Skip to content

Commit c483819

Browse files
committed
Merge remote-tracking branch 'origin/MC-3483' into 2.3-develop-mftf-pr19
2 parents e2d4f02 + 1198e31 commit c483819

4 files changed

+135
-0
lines changed

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,14 @@
392392
<waitForPageLoad stepKey="waitForSave"/>
393393
</actionGroup>
394394

395+
<!-- Action group assign to one website and unassign from another -->
396+
<actionGroup name="AdminProcessProductWebsitesActionGroup" extends="CreatedProductConnectToWebsite">
397+
<arguments>
398+
<argument name="websiteToUnassign"/>
399+
</arguments>
400+
<uncheckOption selector="{{ProductInWebsitesSection.website(websiteToUnassign.name)}}" after="SelectWebsite" stepKey="uncheckWebsite"/>
401+
</actionGroup>
402+
395403
<!--Check tier price with a discount percentage on product-->
396404
<actionGroup name="AssertDiscountsPercentageOfProducts">
397405
<arguments>
@@ -542,4 +550,11 @@
542550
<remove keyForRemoval="seeCheckboxForWebsite"/>
543551
<seeCheckboxIsChecked selector="{{ProductInWebsitesSection.website(website)}}" after="expandProductWebsitesSection" stepKey="seeCustomWebsiteIsChecked"/>
544552
</actionGroup>
553+
554+
<!-- You are on product Edit Page -->
555+
<!-- Assert checkbox is not checked for website in Product In Websites -->
556+
<actionGroup name="AssertProductIsNotAssignedToWebsite" extends="AssertWebsiteIsAvailableInProductWebsites">
557+
<remove keyForRemoval="seeCheckboxForWebsite"/>
558+
<dontSeeCheckboxIsChecked selector="{{ProductInWebsitesSection.website(website)}}" after="expandProductWebsitesSection" stepKey="seeCustomWebsiteIsNotChecked"/>
559+
</actionGroup>
545560
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<!-- Assert 404 Page Not Found on product detail page -->
11+
<actionGroup name="StorefrontAssertPageNotFoundErrorOnProductDetailPageActionGroup">
12+
<arguments>
13+
<argument name="product"/>
14+
</arguments>
15+
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Whoops, our bad..." stepKey="assert404Page"/>
16+
<dontSee selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{product.name}}" stepKey="dontSeeProductName"/>
17+
<seeInCurrentUrl url="/{{product.custom_attributes[url_key]}}.html" stepKey="checkProductUrl"/>
18+
</actionGroup>
19+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
-->
7+
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
9+
<!-- Action group opens product detail page from second website using Store code in URL option -->
10+
<actionGroup name="StorefrontOpenProductPageUsingStoreCodeInUrlActionGroup">
11+
<arguments>
12+
<argument name="product"/>
13+
<argument name="storeView"/>
14+
</arguments>
15+
<amOnPage url="/{{storeView.code}}/{{product.custom_attributes[url_key]}}.html" stepKey="openProductPageUsingStoreCodeInUrl"/>
16+
<see selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{product.name}}" stepKey="assertProductName"/>
17+
</actionGroup>
18+
</actionGroups>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminShouldBeAbleToAssociateSimpleProductToWebsitesTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<stories value="Edit products"/>
15+
<title value="Admin should be able to associate simple product to websites"/>
16+
<description value="Admin should be able to associate simple product to websites"/>
17+
<testCaseId value="MC-3483"/>
18+
<group value="catalog"/>
19+
<severity value="AVERAGE"/>
20+
</annotations>
21+
22+
<before>
23+
<magentoCLI command="config:set {{StorefrontEnableAddStoreCodeToUrls.path}} {{StorefrontEnableAddStoreCodeToUrls.value}}" stepKey="setAddStoreCodeToUrlsToYes"/>
24+
<createData entity="secondCustomWebsite" stepKey="createCustomWebsite"/>
25+
<createData entity="SimpleProduct2" stepKey="createSimpleProduct"/>
26+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
27+
<actionGroup ref="AdminStoreGroupCreateActionGroup" stepKey="createNewStore">
28+
<argument name="Website" value="secondCustomWebsite"/>
29+
<argument name="storeGroup" value="customStoreGroup"/>
30+
</actionGroup>
31+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView">
32+
<argument name="StoreGroup" value="customStoreGroup"/>
33+
<argument name="customStore" value="customStoreEN"/>
34+
</actionGroup>
35+
</before>
36+
37+
<after>
38+
<magentoCLI command="config:set {{StorefrontDisableAddStoreCodeToUrls.path}} {{StorefrontDisableAddStoreCodeToUrls.value}}" stepKey="setAddStoreCodeToUrlsToNo"/>
39+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
40+
<!-- Delete second website -->
41+
<actionGroup ref="DeleteCustomWebsiteActionGroup" stepKey="deleteCustomWeWebsite">
42+
<argument name="websiteName" value="$createCustomWebsite.website[name]$"/>
43+
</actionGroup>
44+
<actionGroup ref="AdminGridFilterResetActionGroup" stepKey="resetFiltersOnStoresIndexPage"/>
45+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPageToResetFilters"/>
46+
<actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFiltersOnProductIndexPage"/>
47+
<actionGroup ref="logout" stepKey="logout"/>
48+
</after>
49+
50+
<!-- 1. Go to product page in admin panel to edit -->
51+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPageToAssociateToSecondWebsite"/>
52+
<actionGroup ref="filterProductGridByName2" stepKey="filterProductInGrid">
53+
<argument name="name" value="$$createSimpleProduct.name$$"/>
54+
</actionGroup>
55+
56+
<!-- 2. Go to Product in Websites tab, unassign product from Main website and assign it to Second website -->
57+
<actionGroup ref="AdminProcessProductWebsitesActionGroup" stepKey="processProductWebsites">
58+
<argument name="website" value="secondCustomWebsite"/>
59+
<argument name="websiteToUnassign" value="_defaultWebsite"/>
60+
<argument name="product" value="$$createSimpleProduct$$"/>
61+
</actionGroup>
62+
<actionGroup ref="AssertProductIsAssignedToWebsite" stepKey="seeCustomWebsiteIsChecked">
63+
<argument name="website" value="$createCustomWebsite.website[name]$"/>
64+
</actionGroup>
65+
<actionGroup ref="AssertProductIsNotAssignedToWebsite" stepKey="seeMainWebsiteIsNotChecked">
66+
<argument name="website" value="{{_defaultWebsite.name}}"/>
67+
</actionGroup>
68+
69+
<!-- 3. Go to frontend and open Simple product on Main website and assert 404 page-->
70+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
71+
<argument name="productUrl" value="$createSimpleProduct.custom_attributes[url_key]$"/>
72+
</actionGroup>
73+
<actionGroup ref="StorefrontAssertPageNotFoundErrorOnProductDetailPageActionGroup" stepKey="assertPageNotFoundErrorOnProductDetailPage">
74+
<argument name="product" value="$$createSimpleProduct$$"/>
75+
</actionGroup>
76+
77+
<!-- 4. Open Simple product on Second website and assert its name -->
78+
<actionGroup ref="StorefrontOpenProductPageUsingStoreCodeInUrlActionGroup" stepKey="openProductPageUsingStoreCodeInUrl">
79+
<argument name="product" value="$$createSimpleProduct$$"/>
80+
<argument name="storeView" value="customStoreEN"/>
81+
</actionGroup>
82+
</test>
83+
</tests>

0 commit comments

Comments
 (0)