Skip to content

Commit b689199

Browse files
authored
ENGCOM-9131: MFTF: Disallow Guests Users To Write Product Reviews #33325
2 parents cff58b1 + 06b6be5 commit b689199

File tree

5 files changed

+93
-1
lines changed

5 files changed

+93
-1
lines changed

app/code/Magento/Catalog/Test/Mftf/Data/ConfigData.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,13 @@
1616
<data key="path">catalog/layered_navigation/display_category</data>
1717
<data key="value">0</data>
1818
</entity>
19-
</entities>
19+
<entity name="AllowGuestsToWriteReviewsConfigData">
20+
<!-- Magento Default Value -->
21+
<data key="path">catalog/review/allow_guest</data>
22+
<data key="value">1</data>
23+
</entity>
24+
<entity name="DisAllowGuestsToWriteReviewsConfigData">
25+
<data key="path">catalog/review/allow_guest</data>
26+
<data key="value">0</data>
27+
</entity>
28+
</entities>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@
2020
<element name="reviewAuthor" type="text" selector=".item.review-item:nth-of-type({{row}}) .review-author .review-details-value" parameterized="true"/>
2121
<!-- The tab transform to an accordion when window resize -->
2222
<element name="reviewsSectionToggleState" type="button" selector="//*[@id='tab-label-reviews-title']/ancestor::div[@aria-selected='{{boolean}}'][@aria-expanded='{{boolean}}']" parameterized="true"/>
23+
<element name="infoForNotLoggedIn" type="block" selector=".block-content .message.info.notlogged"/>
2324
</section>
2425
</sections>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontAssertReviewFieldsAreAbsentActionGroup">
12+
<dontSeeElement selector="{{StorefrontProductReviewsSection.nicknameField}}" stepKey="doNotSeeNicknameField"/>
13+
<dontSeeElement selector="{{StorefrontProductReviewsSection.summaryField}}" stepKey="doNotSeeSummaryField"/>
14+
<dontSeeElement selector="{{StorefrontProductReviewsSection.reviewField}}" stepKey="doNotSeeReviewField"/>
15+
<dontSeeElement selector="{{StorefrontProductReviewsSection.submitReview}}" stepKey="doNotSeeSubmitButton"/>
16+
</actionGroup>
17+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontAssertReviewNotificationForNotLoggedInUsersActionGroup">
12+
<arguments>
13+
<argument name="message" type="string"/>
14+
</arguments>
15+
<see userInput="{{message}}" selector="{{StorefrontProductReviewsSection.infoForNotLoggedIn}}" stepKey="verifyMessage"/>
16+
</actionGroup>
17+
</actionGroups>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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="StorefrontReviewDisallowGuestsToWriteReviewsTest">
12+
<annotations>
13+
<features value="Review"/>
14+
<stories value="Disallow guests to write reviews"/>
15+
<title value="Guests are not allowed to write reviews if the option disabled in admin"/>
16+
<description value="Guests should be not able write product reviews if the option disabled in configurations"/>
17+
<severity value="MINOR"/>
18+
<group value="catalog"/>
19+
</annotations>
20+
<before>
21+
<magentoCLI command="config:set {{DisAllowGuestsToWriteReviewsConfigData.path}} {{DisAllowGuestsToWriteReviewsConfigData.value}}" stepKey="disAllowGuestsWriteReviews"/>
22+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
23+
<createData entity="_defaultProduct" stepKey="createProduct">
24+
<requiredEntity createDataKey="createCategory"/>
25+
</createData>
26+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanInvalidatedCaches">
27+
<argument name="tags" value="config full_page"/>
28+
</actionGroup>
29+
</before>
30+
<after>
31+
<magentoCLI command="config:set {{AllowGuestsToWriteReviewsConfigData.path}} {{AllowGuestsToWriteReviewsConfigData.value}}" stepKey="returnDefaultValue"/>
32+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
33+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
34+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanInvalidatedCaches">
35+
<argument name="tags" value="config full_page"/>
36+
</actionGroup>
37+
</after>
38+
39+
<actionGroup ref="OpenProductFromCategoryPageActionGroup" stepKey="openProductFromCategory">
40+
<argument name="category" value="$createCategory$"/>
41+
<argument name="product" value="$createProduct$"/>
42+
</actionGroup>
43+
<actionGroup ref="StorefrontAssertReviewNotificationForNotLoggedInUsersActionGroup" stepKey="assertMessage">
44+
<argument name="message" value="Only registered users can write reviews. Please Sign in or create an account"/>
45+
</actionGroup>
46+
<actionGroup ref="StorefrontAssertReviewFieldsAreAbsentActionGroup" stepKey="assertReviewElementsNotVisible"/>
47+
</test>
48+
</tests>

0 commit comments

Comments
 (0)