Skip to content

Commit

Permalink
Merge pull request magento#180 from magento-pangolin/MC-6484
Browse files Browse the repository at this point in the history
MC-6484
  • Loading branch information
kabothu authored Jul 23, 2019
2 parents dd85619 + 5ccd0f6 commit 9929790
Show file tree
Hide file tree
Showing 17 changed files with 429 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="StorefrontAddProductReviewActionGroup">
<arguments>
<argument name="review" type="entity" defaultValue="simpleProductReview"/>
</arguments>
<click selector="{{StorefrontProductReviewsSection.reviewsTab}}" stepKey="openReviewTab"/>
<fillField selector="{{StorefrontProductReviewsSection.nicknameField}}" userInput="{{review.nickname}}" stepKey="fillNicknameField"/>
<fillField selector="{{StorefrontProductReviewsSection.summaryField}}" userInput="{{review.title}}" stepKey="fillSummaryField"/>
<fillField selector="{{StorefrontProductReviewsSection.reviewField}}" userInput="{{review.detail}}" stepKey="fillReviewField"/>
<click selector="{{StorefrontProductReviewsSection.submitReview}}" stepKey="clickSubmitReview"/>
<waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" stepKey="waitForSuccessMessage"/>
<see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You submitted your review for moderation." stepKey="seeSuccessMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
<section name="StorefrontProductInfoDetailsSection">
<element name="productNameForReview" type="text" selector=".legend.review-legend>strong" />
<element name="detailsTab" type="button" selector="#tab-label-description-title" />
<!-- The tab transform to an accordion when window resize -->
<element name="detailsSectionToggleState" type="button" selector="//*[@id='tab-label-description-title']/ancestor::div[@aria-selected='{{boolean}}'][@aria-expanded='{{boolean}}']" parameterized="true"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@
<element name="customAttributeValue" type="text" selector="//td[@data-th='{{attributeCode}}']" parameterized="true" />
<element name="attributeLabel" type="text" selector=".col.label"/>
<element name="attributeValue" type="text" selector=".col.data"/>
<!-- The tab transform to an accordion when window resize -->
<element name="moreInformationSectionToggleState" type="button" selector="//*[@id='tab-label-additional-title']/ancestor::div[@aria-selected='{{boolean}}'][@aria-expanded='{{boolean}}']" parameterized="true"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
<section name="StorefrontProductReviewsSection">
<element name="reviewsTab" type="button" selector="#tab-label-reviews-title"/>
<element name="nicknameField" type="text" selector="#nickname_field"/>
<element name="summaryField" type="text" selector="#summary_field"/>
<element name="reviewField" type="textarea" selector="#review_field"/>
<element name="submitReview" type="button" selector=".submit"/>
<element name="reviewsBlock" type="block" selector="#customer-reviews"/>
<element name="reviewTitle" type="text" selector=".item.review-item:nth-of-type({{row}}) .review-title" parameterized="true"/>
<element name="reviewContent" type="text" selector=".item.review-item:nth-of-type({{row}}) .review-content" parameterized="true"/>
<element name="reviewAuthor" type="text" selector=".item.review-item:nth-of-type({{row}}) .review-author .review-details-value" parameterized="true"/>
<!-- The tab transform to an accordion when window resize -->
<element name="reviewsSectionToggleState" type="button" selector="//*[@id='tab-label-reviews-title']/ancestor::div[@aria-selected='{{boolean}}'][@aria-expanded='{{boolean}}']" parameterized="true"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
<?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="StorefrontEnsureThatAccordionAnchorIsVisibleOnViewportOnceClickedTest">
<annotations>
<features value="Catalog"/>
<stories value="Ensure that accordion anchor is visible on viewport once clicked"/>
<title value="Ensure that accordion anchor is visible on viewport once clicked"/>
<description value="Ensure that accordion anchor is visible on viewport once clicked"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-6484"/>
<group value="Catalog"/>
</annotations>
<before>
<!-- Create product with description -->
<createData entity="SimpleProductWithDescription" stepKey="createProduct"/>

<!-- Create 4 product attributes visible on front end -->
<createData entity="productDropDownAttribute" stepKey="createFirstAttribute"/>
<createData entity="productAttributeOption1" stepKey="createOption">
<requiredEntity createDataKey="createFirstAttribute"/>
</createData>
<createData entity="productAttributeText" stepKey="createSecondAttribute"/>
<createData entity="newProductAttribute" stepKey="createThirdAttribute"/>
<createData entity="productAttributeWithTwoOptions" stepKey="createFourthAttribute"/>
<createData entity="productAttributeOption1" stepKey="createFirstOption">
<requiredEntity createDataKey="createFourthAttribute"/>
</createData>
<createData entity="productAttributeOption2" stepKey="createSecondOption">
<requiredEntity createDataKey="createFourthAttribute"/>
</createData>

<!-- Add all created attributes to Default Attribute Set -->
<createData entity="AddToDefaultSet" stepKey="addFirstAttributeToAttributeSet">
<requiredEntity createDataKey="createFirstAttribute"/>
</createData>
<createData entity="AddToDefaultSet" stepKey="addSecondAttributeToAttributeSet">
<requiredEntity createDataKey="createSecondAttribute"/>
</createData>
<createData entity="AddToDefaultSet" stepKey="addThirdAttributeToAttributeSet">
<requiredEntity createDataKey="createThirdAttribute"/>
</createData>
<createData entity="AddToDefaultSet" stepKey="addFourthAttributeToAttributeSet">
<requiredEntity createDataKey="createFourthAttribute"/>
</createData>

<!-- Login as admin -->
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
</before>
<after>
<!-- Delete reviews -->
<actionGroup ref="AdminOpenReviewsPageActionGroup" stepKey="openAllReviewsPage"/>
<actionGroup ref="AdminDeleteReviewsByUserNicknameActionGroup" stepKey="deleteCustomerReview"/>

<!-- Delete customer -->
<actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteCustomer">
<argument name="email" value="{{CustomerEntityOne.email}}"/>
</actionGroup>

<deleteData createDataKey="createFirstAttribute" stepKey="deleteFirstAttribute"/>
<deleteData createDataKey="createSecondAttribute" stepKey="deleteSecondAttribute"/>
<deleteData createDataKey="createThirdAttribute" stepKey="deleteThirdAttribute"/>
<deleteData createDataKey="createFourthAttribute" stepKey="deleteFourthAttribute"/>
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
</after>

<!-- Edit the product and set those attributes values -->
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="findCreatedProductInGrid">
<argument name="product" value="$$createProduct$$"/>
</actionGroup>
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="goToEditProductPage">
<argument name="product" value="$$createProduct$$"/>
</actionGroup>
<selectOption selector="{{AdminProductFormSection.customSelectField($$createFirstAttribute.attribute[attribute_code]$$)}}" userInput="$$createOption.option[store_labels][0][label]$$" stepKey="setFirstAttributeValue"/>
<fillField selector="{{AdminProductAttributeSection.textAttributeByCode($$createSecondAttribute.attribute[attribute_code]$$)}}" userInput="{{ProductAttributeOption8.value}}" stepKey="setSecondAttributeValue"/>
<fillField selector="{{AdminProductAttributeSection.textAttributeByCode($$createThirdAttribute.attribute[attribute_code]$$)}}" userInput="{{ProductAttributeOption8.value}}" stepKey="setThirdAttributeValue"/>
<selectOption selector="{{AdminProductFormSection.customSelectField($$createFourthAttribute.attribute[attribute_code]$$)}}" userInput="$$createSecondOption.option[store_labels][0][label]$$" stepKey="setFourthAttributeValue"/>

<!-- Save product form -->
<actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/>

<!-- Go to frontend and make a user account and login with it -->
<actionGroup ref="SignUpNewUserFromStorefrontActionGroup" stepKey="signUpNewUser">
<argument name="Customer" value="CustomerEntityOne"/>
</actionGroup>

<!-- Go to the product view page -->
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openCreatedProductPage">
<argument name="productUrl" value="$$createProduct.custom_attributes[url_key]$$"/>
</actionGroup>

<!-- Click on reviews and add 2 reviews with current user -->
<actionGroup ref="StorefrontAddProductReviewActionGroup" stepKey="addFirstReview"/>
<actionGroup ref="StorefrontAddProductReviewActionGroup" stepKey="addSecondReview"/>

<!-- Go to Pending reviews page and clear filters -->
<actionGroup ref="AdminOpenPendingReviewsPageActionGroup" stepKey="openReviewsPage"/>
<actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilters"/>

<!-- Moderate first product reviews: change review status from pending to approved, save -->
<actionGroup ref="AdminOpenReviewByUserNicknameActionGroup" stepKey="openFirstCustomerReviews"/>
<actionGroup ref="AdminChangeReviewStatusActionGroup" stepKey="changeFirstReviewStatus"/>
<actionGroup ref="AdminSaveReviewActionGroup" stepKey="saveModeratedFirstReview"/>

<!-- Moderate second product reviews: change review status from pending to approved, save -->
<actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearFilter"/>
<actionGroup ref="AdminOpenReviewByUserNicknameActionGroup" stepKey="openSecondCustomerReviews"/>
<actionGroup ref="AdminChangeReviewStatusActionGroup" stepKey="changeSecondReviewStatus"/>
<actionGroup ref="AdminSaveReviewActionGroup" stepKey="saveModeratedSecondReview"/>

<!-- Assert that product page has the description -->
<actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage">
<argument name="productUrl" value="$$createProduct.custom_attributes[url_key]$$"/>
</actionGroup>
<click selector="{{StorefrontProductInfoDetailsSection.detailsTab}}" stepKey="clickDetailsTab"/>
<see selector="{{StorefrontProductInfoMainSection.productDescription}}" userInput="$$createProduct.custom_attributes[description]$$" stepKey="assertProductDescription"/>

<!-- Assert that product page has added reviews -->
<click selector="{{StorefrontProductReviewsSection.reviewsTab}}" stepKey="clickReviewTab"/>
<waitForElementVisible selector="{{StorefrontProductReviewsSection.reviewsBlock}}" stepKey="seeAllReviews"/>
<actionGroup ref="StorefrontAssertReviewAtProductPageActionGroup" stepKey="assertFirstReview">
<argument name="rowIndex" value="1"/>
</actionGroup>
<actionGroup ref="StorefrontAssertReviewAtProductPageActionGroup" stepKey="assertSecondReview">
<argument name="rowIndex" value="2"/>
</actionGroup>

<!-- Assert that product page has all product attributes in More Info tab -->
<actionGroup ref="checkAttributeInMoreInformationTab" stepKey="checkFirstAttributeInMoreInformationTab">
<argument name="attributeLabel" value="$$createFirstAttribute.attribute[frontend_labels][0][label]$$"/>
<argument name="attributeValue" value="$$createOption.option[store_labels][0][label]$$"/>
</actionGroup>
<actionGroup ref="checkAttributeInMoreInformationTab" stepKey="checkSecondAttributeInMoreInformationTab">
<argument name="attributeLabel" value="$$createSecondAttribute.attribute[frontend_labels][0][label]$$"/>
<argument name="attributeValue" value="{{ProductAttributeOption8.value}}"/>
</actionGroup>
<actionGroup ref="checkAttributeInMoreInformationTab" stepKey="checkThirdAttributeInMoreInformationTab">
<argument name="attributeLabel" value="$$createThirdAttribute.attribute[frontend_labels][0][label]$$"/>
<argument name="attributeValue" value="{{ProductAttributeOption8.value}}"/>
</actionGroup>
<actionGroup ref="checkAttributeInMoreInformationTab" stepKey="checkFourthAttributeInMoreInformationTab">
<argument name="attributeLabel" value="$$createFourthAttribute.attribute[frontend_labels][0][label]$$"/>
<argument name="attributeValue" value="$$createSecondOption.option[store_labels][0][label]$$"/>
</actionGroup>

<!-- Collapse the view of the page to minimum width so that mobile view becomes visible -->
<resizeWindow width="400" height="590" stepKey="resizeWindowToMobileView"/>

<!-- Assert that Details tab on product page become accordion -->
<click selector="{{StorefrontProductInfoDetailsSection.detailsTab}}" stepKey="clickDetails"/>
<seeElement selector="{{StorefrontProductInfoDetailsSection.detailsSectionToggleState('true')}}" stepKey="seeOpenDetailsTab"/>
<seeElement selector="{{StorefrontProductMoreInformationSection.moreInformationSectionToggleState('false')}}" stepKey="seeClosedMoreInformationTab"/>
<seeElement selector="{{StorefrontProductReviewsSection.reviewsSectionToggleState('false')}}" stepKey="seeClosedReviewTab"/>

<!-- Assert that More Information tab on product page become accordion -->
<click selector="{{StorefrontProductMoreInformationSection.moreInformation}}" stepKey="clickMoreInformation"/>
<seeElement selector="{{StorefrontProductInfoDetailsSection.detailsSectionToggleState('false')}}" stepKey="seeClosedDetails"/>
<seeElement selector="{{StorefrontProductMoreInformationSection.moreInformationSectionToggleState('true')}}" stepKey="seeOpenMoreInformationTab"/>
<seeElement selector="{{StorefrontProductReviewsSection.reviewsSectionToggleState('false')}}" stepKey="seeClosedReview"/>

<!-- Assert that Reviews tab on product page become accordion -->
<click selector="{{StorefrontProductReviewsSection.reviewsTab}}" stepKey="clickReview"/>
<seeElement selector="{{StorefrontProductInfoDetailsSection.detailsSectionToggleState('false')}}" stepKey="seeClosedDetailsTab"/>
<seeElement selector="{{StorefrontProductMoreInformationSection.moreInformationSectionToggleState('false')}}" stepKey="seeClosedMoreInformation"/>
<seeElement selector="{{StorefrontProductReviewsSection.reviewsSectionToggleState('true')}}" stepKey="seeOpenReviewTab"/>

<!-- Scroll so that the description is visible and More info tab is on the upper middle of the page -->
<scrollTo selector="{{StorefrontProductInfoDetailsSection.detailsTab}}" stepKey="scrollToMoreInfoTab"/>
<resizeWindow width="1280" height="1024" stepKey="resizeWindowToDesktop"/>
</test>
</tests>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminChangeReviewStatusActionGroup">
<arguments>
<argument name="status" type="string" defaultValue="1"/>
</arguments>
<selectOption selector="{{AdminEditReviewSection.status}}" userInput="{{status}}" stepKey="changeReviewStatus"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminDeleteReviewsByUserNicknameActionGroup">
<arguments>
<argument name="nickname" type="string" defaultValue="{{simpleProductReview.nickname}}"/>
</arguments>
<fillField selector="{{AdminReviewGridSection.nickname}}" userInput="{{nickname}}" stepKey="fillNickname"/>
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFilters"/>
<selectOption selector="{{AdminReviewGridSection.massActions}}" userInput="selectAll" stepKey="selectAll"/>
<selectOption selector="{{AdminReviewGridSection.massActionsSelect}}" userInput="delete" stepKey="clickDeleteActionDropdown"/>
<click selector="{{AdminReviewGridSection.submit}}" stepKey="clickSubmit"/>
<waitForElementVisible selector="{{AdminReviewGridSection.acceptModal}}" stepKey="waitForModalPopUp"/>
<click selector="{{AdminReviewGridSection.acceptModal}}" stepKey="confirmProductDelete"/>
<see selector="{{AdminMessagesSection.success}}" userInput="record(s) have been deleted." stepKey="seeSuccessMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminOpenPendingReviewsPageActionGroup">
<amOnPage url="{{AdminPendingReviewsPage.url}}" stepKey="openReviewsPageActionGroup"/>
<waitForPageLoad stepKey="waitForReviewsPageLoad"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminOpenReviewByUserNicknameActionGroup">
<arguments>
<argument name="nickname" type="string" defaultValue="{{simpleProductReview.nickname}}"/>
</arguments>
<fillField selector="{{AdminReviewGridSection.nickname}}" userInput="{{nickname}}" stepKey="fillNickname"/>
<click selector="{{AdminDataGridHeaderSection.applyFilters}}" stepKey="clickApplyFilters"/>
<click selector="{{AdminReviewGridSection.firstRow}}" stepKey="clickFirstRow"/>
<waitForPageLoad stepKey="waitForEditReviewPageLoad"/>
</actionGroup>
</actionGroups>
Loading

0 comments on commit 9929790

Please sign in to comment.