Skip to content

Commit

Permalink
Merge pull request #4784 from magento-tsg/2.3-develop-pr74
Browse files Browse the repository at this point in the history
[TSG] Fixes for 2.3 (pr74) (2.3-develop)
  • Loading branch information
zakdma authored Sep 16, 2019
2 parents d354290 + f449c16 commit de0fc3b
Show file tree
Hide file tree
Showing 16 changed files with 588 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?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="AdminAssociateBundleProductToWebsitesTest">
<annotations>
<features value="Bundle"/>
<stories value="Create/Edit bundle product in Admin"/>
<title value="Admin should be able to associate bundle product to websites"/>
<description value="Admin should be able to associate bundle product to websites"/>
<testCaseId value="MC-3344"/>
<severity value="CRITICAL"/>
<group value="bundle"/>
<group value="catalog"/>
</annotations>
<before>
<!-- Configure Store URLs -->
<magentoCLI command="config:set {{StorefrontEnableAddStoreCodeToUrls.path}} {{StorefrontEnableAddStoreCodeToUrls.value}}" stepKey="setAddStoreCodeToUrlsToYes"/>

<!-- Create category -->
<createData entity="SimpleSubCategory" stepKey="createCategory"/>

<!-- Create Simple product -->
<createData entity="SimpleProduct2" stepKey="createSimpleProduct"/>

<!-- Create Bundle product -->
<createData entity="ApiBundleProductPriceViewRange" stepKey="createBundleProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>
<createData entity="DropDownBundleOption" stepKey="bundleOption">
<requiredEntity createDataKey="createBundleProduct"/>
</createData>
<createData entity="ApiBundleLink" stepKey="createNewBundleLink">
<requiredEntity createDataKey="createBundleProduct"/>
<requiredEntity createDataKey="bundleOption"/>
<requiredEntity createDataKey="createSimpleProduct"/>
</createData>

<!-- Reindex -->
<magentoCLI command="indexer:reindex" stepKey="reindex"/>

<!-- Login as admin -->
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>

<!--Create 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>
</before>
<after>
<!-- Disabled Store URLs -->
<magentoCLI command="config:set {{StorefrontDisableAddStoreCodeToUrls.path}} {{StorefrontDisableAddStoreCodeToUrls.value}}" stepKey="setAddStoreCodeToUrlsToNo"/>

<!-- Delete simple product -->
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
<!-- Delete bundle product -->
<deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/>

<!-- Delete second website -->
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
<argument name="websiteName" value="{{secondCustomWebsite.name}}"/>
</actionGroup>

<actionGroup ref="NavigateToAndResetProductGridToDefaultView" 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">
<argument name="productSku" value="$$createBundleProduct.sku$$"/>
</actionGroup>
<actionGroup ref="AdminAssignProductInWebsiteActionGroup" stepKey="assignProductToSecondWebsite">
<argument name="website" value="{{secondCustomWebsite.name}}"/>
</actionGroup>
<actionGroup ref="AdminUnassignProductInWebsiteActionGroup" stepKey="unassignProductFromDefaultWebsite">
<argument name="website" value="{{_defaultWebsite.name}}"/>
</actionGroup>
<actionGroup ref="saveProductForm" stepKey="saveGroupedProduct"/>

<!-- Assert product is assigned to Second website -->
<actionGroup ref="AssertProductIsAssignedToWebsite" stepKey="seeCustomWebsiteIsChecked">
<argument name="website" value="{{secondCustomWebsite.name}}"/>
</actionGroup>

<!-- Assert product is not assigned to Main website -->
<actionGroup ref="AssertProductIsNotAssignedToWebsite" stepKey="seeMainWebsiteIsNotChecked">
<argument name="website" value="{{_defaultWebsite.name}}"/>
</actionGroup>

<!-- Go to frontend and open product on Main website -->
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
<argument name="productUrl" value="$$createBundleProduct.custom_attributes[url_key]$$"/>
</actionGroup>

<!-- Assert 404 page -->
<actionGroup ref="StorefrontAssertPageNotFoundErrorOnProductDetailPageActionGroup" stepKey="assertPageNotFoundError">
<argument name="product" value="$$createBundleProduct$$"/>
</actionGroup>

<!-- Assert product is present at Second website -->
<actionGroup ref="StorefrontOpenProductPageUsingStoreCodeInUrlActionGroup" stepKey="openProductPageUsingStoreCodeInUrl">
<argument name="product" value="$$createBundleProduct$$"/>
<argument name="storeView" value="SecondStoreUnique"/>
</actionGroup>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -396,4 +396,19 @@
<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>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
<element name="productTableColumnName" type="input" selector="#catalog_category_products_filter_name"/>
<element name="productTableRow" type="button" selector="#catalog_category_products_table tbody tr"/>
<element name="productSearch" type="button" selector="//button[@data-action='grid-filter-apply']" timeout="30"/>
<element name="productTableColumnSku" type="input" selector="#catalog_category_products_filter_sku"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?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="AdminProductCustomURLKeyPreservedWhenAssignedToCategoryWithoutCustomURLKey">
<annotations>
<stories value="Product"/>
<features value="Catalog"/>
<title value="Product custom URL Key is preserved when assigned to a Category (without custom URL Key) alongside with another Product without custom URL Key"/>
<description value="The test verifies that product custom URL Key is preserved when assigned to a Category (without custom URL Key) alongside with another Product without custom URL Key."/>
<severity value="MAJOR"/>
<testCaseId value="MC-6443"/>
<useCaseId value="MAGETWO-90331"/>
<group value="catalog"/>
</annotations>
<before>
<!-- Create category -->
<createData entity="SimpleSubCategory" stepKey="createCategory"/>

<!-- Create Simple Products -->
<createData entity="SimpleProduct2" stepKey="createSimpleProductFirst"/>
<createData entity="SimpleProduct2" stepKey="createSimpleProductSecond"/>

<!--Login as admin -->
<actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/>

<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView">
<argument name="customStore" value="storeViewData"/>
</actionGroup>

<!--Run full reindex and clear caches -->
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
<magentoCLI command="cache:flush" arguments="full_page" stepKey="flushCache"/>
</before>
<after>
<deleteData createDataKey="createSimpleProductFirst" stepKey="deleteFirstSimpleProduct"/>
<deleteData createDataKey="createSimpleProductSecond" stepKey="deleteSecondSimpleProduct"/>
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>

<actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView">
<argument name="customStore" value="storeViewData"/>
</actionGroup>

<actionGroup ref="logout" stepKey="logout"/>
</after>

<!-- Open product -->
<amOnPage url="{{AdminProductEditPage.url($createSimpleProductSecond.id$)}}" stepKey="openProductSecondEditPage"/>
<!-- switch store view -->
<actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="switchToStoreView">
<argument name="storeView" value="storeViewData.name"/>
</actionGroup>

<!-- set url key -->
<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="goToAdminCategoryPageById" stepKey="openCategory">
<argument name="id" value="$createCategory.id$"/>
</actionGroup>

<actionGroup ref="AdminCategoryAssignProduct" stepKey="assignSimpleProductFirst">
<argument name="productSku" value="$createSimpleProductFirst.sku$"/>
</actionGroup>
<actionGroup ref="AdminCategoryAssignProduct" stepKey="assignSimpleProductSecond">
<argument name="productSku" value="$createSimpleProductSecond.sku$"/>
</actionGroup>

<actionGroup ref="saveCategoryForm" stepKey="saveCategory"/>

<executeJS function="return '$createCategory.name$'.toLowerCase();" stepKey="categoryNameLower" />
<executeJS function="return '$createSimpleProductFirst.name$'.toLowerCase();" stepKey="simpleProductFirstNameLower" />
<executeJS function="return '$createSimpleProductSecond.name$'.toLowerCase();" stepKey="simpleProductSecondNameLower" />

<!-- Make assertions on frontend -->
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToStorefrontPage"/>
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName($createCategory.name$)}}" stepKey="onCategoryPage"/>
<seeInCurrentUrl url="{$categoryNameLower}.html" stepKey="checkCategryUrlKey"/>

<!-- Open first product -->
<click selector="{{StorefrontCategoryProductSection.ProductTitleByName($createSimpleProductFirst.name$)}}" stepKey="openFirstProduct"/>
<waitForPageLoad time="30" stepKey="waitForFirstProduct"/>
<seeInCurrentUrl url="{$simpleProductFirstNameLower}.html" stepKey="checkFirstSimpleProductUrlKey"/>

<amOnPage url="{{StorefrontCategoryPage.url($createCategory.custom_attributes[url_key]$)}}" stepKey="onCategoryView"/>
<!-- Open second product -->
<click selector="{{StorefrontCategoryProductSection.ProductTitleByName($createSimpleProductSecond.name$)}}" stepKey="openSecondProduct"/>
<waitForPageLoad time="30" stepKey="waitForSecondProduct"/>
<seeInCurrentUrl url="{$simpleProductSecondNameLower}.html" stepKey="checkSecondSimpleProductUrlKey"/>

<actionGroup ref="StorefrontSwitchStoreViewActionGroup" stepKey="switchToCustomStoreView">
<argument name="storeView" value="storeViewData"/>
</actionGroup>

<click selector="{{StorefrontHeaderSection.NavigationCategoryByName($createCategory.name$)}}" stepKey="openCategoryPage"/>
<seeInCurrentUrl url="{$categoryNameLower}.html" stepKey="seeCategoryUrlKey"/>

<!-- Open product first -->
<click selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSimpleProductFirst.name$$)}}" stepKey="openFirstSimpleProduct"/>
<waitForPageLoad time="30" stepKey="waitForFirstSimpleProduct"/>
<seeInCurrentUrl url="{$simpleProductFirstNameLower}.html" stepKey="assertFirstSimpleProductUrlKey"/>

<click selector="{{StorefrontHeaderSection.NavigationCategoryByName($createCategory.name$)}}" stepKey="openCategoryView"/>
<!-- Open product2 -->
<click selector="{{StorefrontCategoryProductSection.ProductTitleByName($createSimpleProductSecond.name$)}}" stepKey="openSecondSimpleProduct"/>
<waitForPageLoad time="30" stepKey="waitForSecondSimpleProduct"/>
<seeInCurrentUrl url="u2.html" stepKey="assertSecondSimpleProductUrlKey"/>
</test>
</tests>
Loading

0 comments on commit de0fc3b

Please sign in to comment.