|
| 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="StoreFrontReviewRatingByCustomerTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Review"/> |
| 14 | + <stories value="Review By Customers"/> |
| 15 | + <title value="StoreFront Review Rating By Customers"/> |
| 16 | + <description value="Check if product rating is the same at list, table view on PLP and customers account."/> |
| 17 | + <severity value="AVERAGE"/> |
| 18 | + <testCaseId value=""/> |
| 19 | + </annotations> |
| 20 | + <before> |
| 21 | + <!-- Enable singe store view to view ratings--> |
| 22 | + <magentoCLI command="config:set general/single_store_mode/enabled 1" stepKey="enabledSingleStoreMode"/> |
| 23 | + <!--Login--> |
| 24 | + <actionGroup ref="AdminLoginActionGroup" stepKey="LoginAsAdmin"/> |
| 25 | + <!--Create product and Category--> |
| 26 | + <createData stepKey="category" entity="SimpleSubCategory"/> |
| 27 | + <createData stepKey="createProduct1" entity="SimpleProduct"> |
| 28 | + <requiredEntity createDataKey="category"/> |
| 29 | + </createData> |
| 30 | + <createData stepKey="createProduct2" entity="SimpleProduct"> |
| 31 | + <requiredEntity createDataKey="category"/> |
| 32 | + </createData> |
| 33 | + </before> |
| 34 | + <after> |
| 35 | + <!-- Delete reviews --> |
| 36 | + <actionGroup ref="AdminOpenReviewsPageActionGroup" stepKey="openAllReviewsPage"/> |
| 37 | + <actionGroup ref="AdminDeleteReviewsByUserNicknameActionGroup" stepKey="deleteCustomerReview"/> |
| 38 | + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearNickNameReviewFilters"/> |
| 39 | + <!-- Delete customer --> |
| 40 | + <actionGroup ref="AdminDeleteCustomerActionGroup" stepKey="deleteCustomer"> |
| 41 | + <argument name="customerEmail" value="CustomerEntityOne.email"/> |
| 42 | + </actionGroup> |
| 43 | + <!--delete Category and Products --> |
| 44 | + <deleteData createDataKey="createProduct1" stepKey="deleteProduct1"/> |
| 45 | + <deleteData createDataKey="createProduct2" stepKey="deleteProduct2"/> |
| 46 | + <deleteData createDataKey="category" stepKey="deleteCategory"/> |
| 47 | + <!--Logout--> |
| 48 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 49 | + <!-- Disable single store view back--> |
| 50 | + <magentoCLI command="config:set general/single_store_mode/enabled 0" stepKey="enabledSingleStoreMode"/> |
| 51 | + </after> |
| 52 | + <!-- Go to frontend and make a user account and login with it --> |
| 53 | + <actionGroup ref="SignUpNewUserFromStorefrontActionGroup" stepKey="signUpNewUser"> |
| 54 | + <argument name="Customer" value="CustomerEntityOne"/> |
| 55 | + </actionGroup> |
| 56 | + <!-- Go to the product view page --> |
| 57 | + <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openStorefrontProductPage"> |
| 58 | + <argument name="productUrl" value="$$createProduct1.custom_attributes[url_key]$$"/> |
| 59 | + </actionGroup> |
| 60 | + <!-- Click on reviews and add reviews with current user --> |
| 61 | + <click selector="{{StorefrontProductReviewsSection.reviewsTab}}" stepKey="openReviewTab"/> |
| 62 | + <!-- set product rating stars --> |
| 63 | + <actionGroup ref="StorefrontSetProductRatingStarsActionGroup" stepKey="setQualityStars"> |
| 64 | + <argument name="ratingName" value="Quality"/> |
| 65 | + <argument name="stars" value="3"/> |
| 66 | + </actionGroup> |
| 67 | + <actionGroup ref="StorefrontSetProductRatingStarsActionGroup" stepKey="setValueStars"> |
| 68 | + <argument name="ratingName" value="Value"/> |
| 69 | + <argument name="stars" value="4"/> |
| 70 | + </actionGroup> |
| 71 | + <actionGroup ref="StorefrontSetProductRatingStarsActionGroup" stepKey="setPriceStars"> |
| 72 | + <argument name="ratingName" value="Price"/> |
| 73 | + <argument name="stars" value="5"/> |
| 74 | + </actionGroup> |
| 75 | + <!-- Click on reviews and add reviews with current user --> |
| 76 | + <actionGroup ref="StorefrontAddProductReviewActionGroup" stepKey="addReview"/> |
| 77 | + <!-- Go to Pending reviews page and clear filters --> |
| 78 | + <actionGroup ref="AdminOpenPendingReviewsPageActionGroup" stepKey="openReviewsPage"/> |
| 79 | + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilters"/> |
| 80 | + <!-- Moderate first product reviews: change review status from pending to approved, save --> |
| 81 | + <actionGroup ref="AdminOpenReviewByUserNicknameActionGroup" stepKey="openFirstCustomerReviews"/> |
| 82 | + <actionGroup ref="AdminChangeReviewStatusActionGroup" stepKey="changeFirstReviewStatus"/> |
| 83 | + <actionGroup ref="AdminSaveReviewActionGroup" stepKey="saveModeratedFirstReview"/> |
| 84 | + <!-- Navigate to PLP and check product rating for list and table views --> |
| 85 | + <actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="amOnStoreViewHomePage"/> |
| 86 | + <actionGroup ref="StoreFrontQuickSearchActionGroup" stepKey="searchBySku"> |
| 87 | + <argument name="query" value="$$createProduct1.sku$$"/> |
| 88 | + </actionGroup> |
| 89 | + <!-- Check stars at list view --> |
| 90 | + <click selector="{{StorefrontCategoryTopToolbarSection.listMode}}" stepKey="switchCategoryViewToListMode"/> |
| 91 | + <grabAttributeFrom selector="#rating-result_$$createProduct1.id$$ span" userInput="style" stepKey="getProductStarsAtListView"/> |
| 92 | + <assertEquals stepKey="checkProductStarsAtListView"> |
| 93 | + <actualResult type="string">$getProductStarsAtListView</actualResult> |
| 94 | + <expectedResult type="string">width: 80%;</expectedResult> |
| 95 | + </assertEquals> |
| 96 | + <!-- Check stars at grid view --> |
| 97 | + <click selector="{{StorefrontCategoryTopToolbarSection.gridMode}}" stepKey="switchCategoryViewToGridMode"/> |
| 98 | + <grabAttributeFrom selector="#rating-result_$$createProduct1.id$$ span" userInput="style" stepKey="getProductStarsAtGridView"/> |
| 99 | + <assertEquals stepKey="checkProductStarsAtGridView"> |
| 100 | + <actualResult type="string">$getProductStarsAtGridView</actualResult> |
| 101 | + <expectedResult type="string">width: 80%;</expectedResult> |
| 102 | + </assertEquals> |
| 103 | + <!-- Navigate to user account and check product ratings--> |
| 104 | + <amOnPage url="review/customer/" stepKey="amOnCustomerReviewPage"/> |
| 105 | + <click selector=".action.more" stepKey="amOnProductReviewDetailsPage"/> |
| 106 | + <!-- Check stars at rating result under the product name --> |
| 107 | + <grabAttributeFrom selector="#rating-result_$$createProduct1.id$$ span" userInput="style" stepKey="getProductResultStarsUnderProductName"/> |
| 108 | + <assertEquals stepKey="checkProductResultStarsUnderProductName"> |
| 109 | + <actualResult type="string">$getProductResultStarsUnderProductName</actualResult> |
| 110 | + <expectedResult type="string">width: 80%;</expectedResult> |
| 111 | + </assertEquals> |
| 112 | + <!-- Check that the rating are accurate--> |
| 113 | + <grabAttributeFrom selector=".rating-result.Quality span" userInput="style" stepKey="getProductQualityStarsAtUserAccount"/> |
| 114 | + <assertEquals stepKey="checkProductQualityStarsAtUserAccount"> |
| 115 | + <actualResult type="string">$getProductQualityStarsAtUserAccount</actualResult> |
| 116 | + <expectedResult type="string">width: 60%;</expectedResult> |
| 117 | + </assertEquals> |
| 118 | + <grabAttributeFrom selector=".rating-result.Value span" userInput="style" stepKey="getProductValueStarsAtUserAccount"/> |
| 119 | + <assertEquals stepKey="checkProductValueStarsAtUserAccount"> |
| 120 | + <actualResult type="string">$getProductValueStarsAtUserAccount</actualResult> |
| 121 | + <expectedResult type="string">width: 80%;</expectedResult> |
| 122 | + </assertEquals> |
| 123 | + <grabAttributeFrom selector=".rating-result.Price span" userInput="style" stepKey="getProductPriceStarsAtUserAccount"/> |
| 124 | + <assertEquals stepKey="checkProductPriceStarsAtUserAccount"> |
| 125 | + <actualResult type="string">$getProductPriceStarsAtUserAccount</actualResult> |
| 126 | + <expectedResult type="string">width: 100%;</expectedResult> |
| 127 | + </assertEquals> |
| 128 | + </test> |
| 129 | +</tests> |
0 commit comments