Skip to content

Commit fe0e686

Browse files
Chhandak.BaruaChhandak.Barua
authored andcommitted
ACP2E-1007 Compare list redirect to old store
1 parent 7f72ea9 commit fe0e686

File tree

3 files changed

+84
-1
lines changed

3 files changed

+84
-1
lines changed

app/code/Magento/Catalog/Helper/Product/Compare.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ public function getItemCollection()
297297
$this->_itemCollection->addAttributeToSelect('name')->addUrlRewrite()->load();
298298

299299
/* update compare items count */
300-
$this->_catalogSession->setCatalogCompareWebsiteId($this->_storeManager->getWebsite()->getId());
301300
$count = count($this->_itemCollection);
302301
$counts = $this->_catalogSession->getCatalogCompareItemsCountPerWebsite() ?: [];
303302
$counts[$this->_storeManager->getWebsite()->getId()] = $count;

app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductCompareMainSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
<element name="ProductAttributeByCodeAndProductName" type="text" selector="//*[@id='product-comparison']//tr[.//th[./span[contains(text(), '{{var1}}')]]]//td[count(//*[@id='product-comparison']//tr//td[.//strong[@class='product-item-name']/a[contains(text(), '{{var2}}')]]/preceding-sibling::td)+1]/div" parameterized="true"/>
1717
<element name="ProductAddToCartButton" type="button" selector=".product-item-photo[title='{{productName}}'] ~ .product-item-actions button[type='submit']" parameterized="true" timeout="30"/>
1818
<element name="removeFirstItem" type="button" selector="table.table-comparison a.delete"/>
19+
<element name="compareProducts" type="button" selector="//ul[contains(@class, 'compare wrapper')]//a[contains(@class, 'action compare')]"/>
1920
</section>
2021
</sections>
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="StorefrontVerifyCompareListVisibilityForMultiWebsiteTest">
12+
<annotations>
13+
<stories value="Compare list behave incorrectly in multi-website setup."/>
14+
<title value="Customer add product to compare list and verify visibility in other store"/>
15+
<description value="Test compare products link visibility for other store view"/>
16+
<testCaseId value="AC-6406"/>
17+
<useCaseId value="ACP2E-1007"/>
18+
<severity value="MAJOR"/>
19+
<group value="Catalog"/>
20+
</annotations>
21+
<before>
22+
<!-- Create simple products -->
23+
<createData entity="SimpleProduct2" stepKey="createFirstSimpleProduct">
24+
<field key="price">560</field>
25+
</createData>
26+
<createData entity="SimpleProduct2" stepKey="createSecondSimpleProduct">
27+
<field key="price">560</field>
28+
</createData>
29+
30+
<!-- Login as Admin -->
31+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
32+
<actionGroup ref="EnableWebUrlOptionsActionGroup" stepKey="addStoreCodeToUrls"/>
33+
<!-- Create website, store group, store to assign to new product -->
34+
<actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createAdditionalWebsite">
35+
<argument name="newWebsiteName" value="{{customWebsite.name}}"/>
36+
<argument name="websiteCode" value="{{customWebsite.code}}"/>
37+
</actionGroup>
38+
<actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createNewStore">
39+
<argument name="website" value="{{customWebsite.name}}"/>
40+
<argument name="storeGroupName" value="{{customStoreGroup.name}}"/>
41+
<argument name="storeGroupCode" value="{{customStoreGroup.code}}"/>
42+
</actionGroup>
43+
<actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createNewStoreView">
44+
<argument name="StoreGroup" value="customStoreGroup"/>
45+
<argument name="customStore" value="customStore"/>
46+
</actionGroup>
47+
48+
</before>
49+
<after>
50+
<!-- Reset web url option-->
51+
<actionGroup ref="ResetWebUrlOptionsActionGroup" stepKey="resetUrlOption"/>
52+
<!-- Delete website-->
53+
<actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite">
54+
<argument name="websiteName" value="{{NewWebSiteData.name}}"/>
55+
</actionGroup>
56+
<!-- Delete product-->
57+
<deleteData createDataKey="createFirstSimpleProduct" stepKey="deleteFirstSimpleProduct"/>
58+
<deleteData createDataKey="createSecondSimpleProduct" stepKey="deleteSecondSimpleProduct"/>
59+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
60+
</after>
61+
<!-- Add first product to compare list -->
62+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openFirstProductPage">
63+
<argument name="productUrl" value="$$createFirstSimpleProduct.custom_attributes[url_key]$$"/>
64+
</actionGroup>
65+
<scrollTo selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="scrollToCompareProductButton"/>
66+
<actionGroup ref="StorefrontAddProductToCompareActionGroup" stepKey="addFirstProductToCompare">
67+
<argument name="productVar" value="$$createFirstSimpleProduct$$"/>
68+
</actionGroup>
69+
<!--Add second product to compare list -->
70+
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openSecondProductPage">
71+
<argument name="productUrl" value="$$createSecondSimpleProduct.custom_attributes[url_key]$$"/>
72+
</actionGroup>
73+
<scrollTo selector="{{StorefrontProductInfoMainSection.productAddToCompare}}" stepKey="scrollToCompareButton"/>
74+
<actionGroup ref="StorefrontAddProductToCompareActionGroup" stepKey="addSecondProductToCompare">
75+
<argument name="productVar" value="$$createSecondSimpleProduct$$"/>
76+
</actionGroup>
77+
<see userInput="Compare Products" selector="{{StorefrontProductCompareMainSection.compareProducts}}" stepKey="assertCompareProductLinkName"/>
78+
<!-- Open storefront on second store -->
79+
<amOnPage url="{{StorefrontStoreHomePage.url(customStore.code)}}" stepKey="openStorefrontPage"/>
80+
<waitForPageLoad time="30" stepKey="waitStorefrontPage"/>
81+
<dontSee userInput="Compare Products" selector="{{StorefrontProductCompareMainSection.compareProducts}}" stepKey="assertCompareProductLinkNameNotVisible"/>
82+
</test>
83+
</tests>

0 commit comments

Comments
 (0)