Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 178db2a

Browse files
committed
MAGETWO-87709: add related products test.
1 parent 7b94f57 commit 178db2a

19 files changed

+399
-42
lines changed

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/AdminProductActionGroup.xml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,40 @@
6060
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="{{image.file}}" stepKey="uploadFile"/>
6161
<waitForAjaxLoad stepKey="waitForAjaxUpload"/>
6262
</actionGroup>
63+
64+
<!--Fill fields for simple product in a category in Admin-->
65+
<actionGroup name="FillAdminSimpleProductForm">
66+
<arguments>
67+
<argument name="category"/>
68+
<argument name="simpleProduct"/>
69+
</arguments>
70+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
71+
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/>
72+
<click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickAddSimpleProduct"/>
73+
<fillField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/>
74+
<fillField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/>
75+
<fillField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/>
76+
<fillField userInput="{{simpleProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/>
77+
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{category.name}}]" stepKey="searchAndSelectCategory"/>
78+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/>
79+
<fillField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/>
80+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/>
81+
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertSaveMessageSuccess"/>
82+
<seeInField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="assertFieldName"/>
83+
<seeInField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="assertFieldSku"/>
84+
<seeInField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="assertFieldPrice"/>
85+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSectionAssert"/>
86+
<seeInField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="assertFieldUrlKey"/>
87+
</actionGroup>
88+
89+
<!--Assert text in Related, Up-Sell or Cross-Sell section in Admin Product page-->
90+
<actionGroup name="AssertTextInAdminProductRelatedUpSellCrossSellSection">
91+
<arguments>
92+
<argument name="element" defaultValue="AdminProductRelatedUpSellCrossSellSection.relatedProductSectionText"/>
93+
<argument name="expectedText"/>
94+
</arguments>
95+
<conditionalClick selector="{{AdminProductFormSection.productFormTab('Related Products')}}" dependentSelector="{{AdminProductFormSection.productFormTabState('Related Products', 'closed')}}" visible="true" stepKey="openTab"/>
96+
<waitForPageLoad time="30" stepKey="waitForPageLoad"/>
97+
<see selector="{{element}}" userInput="{{expectedText}}" stepKey="AssertText"/>
98+
</actionGroup>
6399
</actionGroups>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/ActionGroup/FillAdminSimpleProductFormActionGroup.xml

Lines changed: 0 additions & 34 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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"
9+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
10+
<!--Click Add to Cart button in storefront product page-->
11+
<actionGroup name="addToCartFromStorefrontProductPage">
12+
<arguments>
13+
<argument name="productName"/>
14+
</arguments>
15+
<click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart"/>
16+
<waitForElementVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementVisibleAddToCartButtonTitleIsAdding"/>
17+
<waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdding"/>
18+
<waitForElementVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementVisibleAddToCartButtonTitleIsAdded"/>
19+
<waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdded"/>
20+
<waitForElementVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAddToCart}}" stepKey="waitForElementVisibleAddToCartButtonTitleIsAddToCart"/>
21+
<waitForPageLoad stepKey="waitForPageLoad"/>
22+
<see selector="{{StorefrontMessagesSection.messageText}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/>
23+
</actionGroup>
24+
</actionGroups>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/CustomAttributeData.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,5 @@
2323
<entity name="CustomAttributeProductAttribute" type="custom_attribute">
2424
<var key="attribute_code" entityKey="attribute_code" entityType="ProductAttribute"/>
2525
<var key="value" entityKey="value" entityType="ProductAttributeOption"/>
26-
<data key="value">test product attribute</data>
27-
<data key="attribute_code">test_product_attribute</data>
2826
</entity>
2927
</entities>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductAttributeData.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,25 @@
3131
<data key="used_for_sort_by">true</data>
3232
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
3333
</entity>
34+
<entity name="productDropDownAttribute" type="ProductAttribute">
35+
<data key="attribute_code" unique="suffix">attribute</data>
36+
<data key="frontend_input">select</data>
37+
<data key="scope">global</data>
38+
<data key="is_required">false</data>
39+
<data key="is_unique">false</data>
40+
<data key="is_searchable">true</data>
41+
<data key="is_visible">true</data>
42+
<data key="is_visible_in_advanced_search">true</data>
43+
<data key="is_visible_on_front">true</data>
44+
<data key="is_filterable">true</data>
45+
<data key="is_filterable_in_search">true</data>
46+
<data key="used_in_product_listing">true</data>
47+
<data key="is_used_for_promo_rules">true</data>
48+
<data key="is_comparable">true</data>
49+
<data key="is_used_in_grid">true</data>
50+
<data key="is_visible_in_grid">true</data>
51+
<data key="is_filterable_in_grid">true</data>
52+
<data key="used_for_sort_by">true</data>
53+
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
54+
</entity>
3455
</entities>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductFormSection.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
<element name="contentTab" type="button" selector="//strong[@class='admin__collapsible-title']/span[text()='Content']"/>
2020
<element name="fieldError" type="text" selector="//input[@name='product[{{fieldName}}]']/following-sibling::label[@class='admin__field-error']" parameterized="true"/>
2121
<element name="priceFieldError" type="text" selector="//input[@name='product[price]']/parent::div/parent::div/label[@class='admin__field-error']"/>
22+
<element name="productFormTab" type="button" selector="//strong[@class='admin__collapsible-title']/span[contains(text(), '{{tabName}}')]" parameterized="true"/>
23+
<element name="productFormTabState" type="text" selector="//strong[@class='admin__collapsible-title']/span[contains(text(), '{{tabName}}')]/parent::*/parent::*[@data-state-collapsible='{{state}}']" parameterized="true"/>
24+
</section>
25+
<section name="AdminProductFormRelatedUpSellCrossSellSection">
26+
<element name="AddRelatedProductsButton" type="button" selector="button[data-index='button_related']"/>
27+
</section>
28+
<section name="AdminAddRelatedProductsModalSection">
29+
<element name="AddSelectedProductsButton" type="button" selector="//aside[contains(@class, 'product_form_product_form_related_related_modal')]//button/span[contains(text(), 'Add Selected Products')]" timeout="30"/>
2230
</section>
2331
<section name="ProductWYSIWYGSection">
2432
<element name="Switcher" type="button" selector="//select[@id='dropdown-switcher']"/>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/AdminProductGridSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@
2222
<element name="multicheckOption" type="button" selector="//div[@data-role='grid-wrapper']//th[contains(@class, data-grid-multicheck-cell)]//li//span[text() = '{{label}}']" parameterized="true"/>
2323
<element name="bulkActionDropdown" type="button" selector="div.admin__data-grid-header-row.row div.action-select-wrap button.action-select"/>
2424
<element name="bulkActionOption" type="button" selector="//div[contains(@class,'admin__data-grid-header-row') and contains(@class, 'row')]//div[contains(@class, 'action-select-wrap')]//ul/li/span[text() = '{{label}}']" parameterized="true"/>
25+
<element name="productGridXRowYColumnButton" type="input" selector="table.data-grid tr.data-row:nth-child({{row}}) td:nth-child({{column}})" parameterized="true"/>
2526
</section>
2627
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="AdminProductModalSlideGridSection">
12+
<element name="productGridXRowYColumnButton" type="input" selector=".modal-slide table.data-grid tr.data-row:nth-child({{row}}) td:nth-child({{column}})" parameterized="true"/>
13+
</section>
14+
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
11+
<section name="AdminProductRelatedUpSellCrossSellSection">
12+
<element name="relatedProductSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='related']"/>
13+
<element name="upSellProductSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='upsell']"/>
14+
<element name="crossSellProductSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='crosssell']"/>
15+
</section>
16+
</sections>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Section/StorefrontMessagesSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
1111
<section name="StorefrontMessagesSection">
12-
<element name="test" type="input" selector=".test"/>
12+
<element name="messageText" type="text" selector=".message-success.success.message"/>
1313
</section>
1414
</sections>

0 commit comments

Comments
 (0)