Skip to content

Commit

Permalink
Merge pull request #2128 from magento-pangolin/MAGETWO-87709
Browse files Browse the repository at this point in the history
[pangolin] MAGETWO-87704: [MFTF] Automate MAGETWO-87504
  • Loading branch information
Joan He authored Mar 8, 2018
2 parents b050660 + af9e488 commit 13d54f9
Show file tree
Hide file tree
Showing 27 changed files with 556 additions and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,40 @@
<attachFile selector="{{AdminProductImagesSection.imageFileUpload}}" userInput="{{image.file}}" stepKey="uploadFile"/>
<waitForAjaxLoad stepKey="waitForAjaxUpload"/>
</actionGroup>

<!--Fill fields for simple product in a category in Admin-->
<actionGroup name="FillAdminSimpleProductForm">
<arguments>
<argument name="category"/>
<argument name="simpleProduct"/>
</arguments>
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
<click selector="{{AdminProductGridActionSection.addProductToggle}}" stepKey="clickAddProductDropdown"/>
<click selector="{{AdminProductGridActionSection.addSimpleProduct}}" stepKey="clickAddSimpleProduct"/>
<fillField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="fillName"/>
<fillField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="fillSKU"/>
<fillField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="fillPrice"/>
<fillField userInput="{{simpleProduct.quantity}}" selector="{{AdminProductFormSection.productQuantity}}" stepKey="fillQuantity"/>
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{category.name}}]" stepKey="searchAndSelectCategory"/>
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/>
<fillField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/>
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="saveProduct"/>
<seeElement selector="{{AdminProductMessagesSection.successMessage}}" stepKey="assertSaveMessageSuccess"/>
<seeInField userInput="{{simpleProduct.name}}" selector="{{AdminProductFormSection.productName}}" stepKey="assertFieldName"/>
<seeInField userInput="{{simpleProduct.sku}}" selector="{{AdminProductFormSection.productSku}}" stepKey="assertFieldSku"/>
<seeInField userInput="{{simpleProduct.price}}" selector="{{AdminProductFormSection.productPrice}}" stepKey="assertFieldPrice"/>
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSectionAssert"/>
<seeInField userInput="{{simpleProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="assertFieldUrlKey"/>
</actionGroup>

<!--Assert text in Related, Up-Sell or Cross-Sell section in Admin Product page-->
<actionGroup name="AssertTextInAdminProductRelatedUpSellCrossSellSection">
<arguments>
<argument name="element" defaultValue="AdminProductFormRelatedUpSellCrossSellSection.relatedProductSectionText"/>
<argument name="expectedText"/>
</arguments>
<conditionalClick selector="{{AdminProductFormSection.productFormTab('Related Products')}}" dependentSelector="{{AdminProductFormSection.productFormTabState('Related Products', 'closed')}}" visible="true" stepKey="openTab"/>
<waitForPageLoad time="30" stepKey="waitForPageLoad"/>
<see selector="{{element}}" userInput="{{expectedText}}" stepKey="AssertText"/>
</actionGroup>
</actionGroups>
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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertProductInStorefrontCategoryPage">
<arguments>
<argument name="category"/>
<argument name="product"/>
</arguments>
<!-- Go to storefront category page, assert product visibility -->
<amOnPage url="{{StorefrontCategoryPage.url(category.name)}}" stepKey="navigateToCategoryPage"/>
<waitForPageLoad stepKey="waitForPageLoad1"/>
<see userInput="{{product.name}}" stepKey="assertProductPresent"/>
<see userInput="{{product.price}}" stepKey="assertProductPricePresent"/>
</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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
<actionGroup name="AssertProductInStorefrontProductPage">
<arguments>
<argument name="product"/>
</arguments>
<!-- Go to storefront product page, assert product visibility -->
<amOnPage url="{{product.urlKey}}.html" stepKey="navigateToProductPage"/>
<waitForPageLoad stepKey="waitForPageLoad2"/>
<seeInTitle userInput="{{product.name}}" stepKey="assertProductNameTitle"/>
<see userInput="{{product.name}}" selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="assertProductName"/>
<see userInput="{{product.price}}" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="assertProductPrice"/>
<see userInput="{{product.sku}}" selector="{{StorefrontProductInfoMainSection.productSku}}" stepKey="assertProductSku"/>
</actionGroup>
</actionGroups>

This file was deleted.

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.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Test/etc/actionGroupSchema.xsd">
<!--Click Add to Cart button in storefront product page-->
<actionGroup name="addToCartFromStorefrontProductPage">
<arguments>
<argument name="productName"/>
</arguments>
<click selector="{{StorefrontProductActionSection.addToCart}}" stepKey="addToCart"/>
<waitForElementVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementVisibleAddToCartButtonTitleIsAdding"/>
<waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdding"/>
<waitForElementVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementVisibleAddToCartButtonTitleIsAdded"/>
<waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdded"/>
<waitForElementVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAddToCart}}" stepKey="waitForElementVisibleAddToCartButtonTitleIsAddToCart"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{productName}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,25 @@
<data key="used_for_sort_by">true</data>
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
</entity>
<entity name="productDropDownAttribute" type="ProductAttribute">
<data key="attribute_code" unique="suffix">attribute</data>
<data key="frontend_input">select</data>
<data key="scope">global</data>
<data key="is_required">false</data>
<data key="is_unique">false</data>
<data key="is_searchable">true</data>
<data key="is_visible">true</data>
<data key="is_visible_in_advanced_search">true</data>
<data key="is_visible_on_front">true</data>
<data key="is_filterable">true</data>
<data key="is_filterable_in_search">true</data>
<data key="used_in_product_listing">true</data>
<data key="is_used_for_promo_rules">true</data>
<data key="is_comparable">true</data>
<data key="is_used_in_grid">true</data>
<data key="is_visible_in_grid">true</data>
<data key="is_filterable_in_grid">true</data>
<data key="used_for_sort_by">true</data>
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,35 @@
<data key="status">1</data>
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
</entity>
<entity name="SimpleTwo" type="product2">
<data key="sku" unique="suffix">SimpleTwo</data>
<data key="type_id">simple</data>
<data key="attribute_set_id">4</data>
<data key="name" unique="suffix">SimpleProduct</data>
<data key="price">1.23</data>
<data key="visibility">4</data>
<data key="status">1</data>
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
<requiredEntity type="custom_attribute">CustomAttributeProductUrlKey</requiredEntity>
</entity>
<entity name="ImageUpload" type="uploadImage">
<data key="title" unique="suffix">Image1</data>
<data key="price">1.00</data>
<data key="file_type">Upload File</data>
<data key="shareable">Yes</data>
<data key="file">magento-logo.png</data>
</entity>
<entity name="ProductWithUnicode" type="product">
<data key="sku" unique="suffix">&#38657;&#20135;&#21697;</data>
<data key="type_id">simple</data>
<data key="attribute_set_id">4</data>
<data key="visibility">4</data>
<data key="name" unique="suffix">&#38657;&#20135;&#21697;</data>
<data key="price">123.00</data>
<data key="urlKey" unique="suffix">testurlkey</data>
<data key="status">1</data>
<data key="quantity">100</data>
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
<requiredEntity type="custom_attribute_array">CustomAttributeCategoryIds</requiredEntity>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
<section name="AdminProductImagesSection"/>
<section name="AdminAddProductsToOptionPanel"/>
<section name="AdminProductMessagesSection"/>
<section name="AdminProductFormRelatedUpSellCrossSellSection"/>
</page>
</pages>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
<page name="StorefrontCategoryPage" url="/{{var1}}.html" area="storefront" module="Category" parameterized="true">
<page name="StorefrontCategoryPage" url="/{{var1}}.html" area="storefront" module="Catalog" parameterized="true">
<section name="StorefrontCategoryMainSection"/>
<section name="WYSIWYGToolbarSection"/>
</page>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@

<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/PageObject.xsd">
<page name="StorefrontProductPage" url="/{{var1}}.html" area="storefront" module="Product" parameterized="true">
<section name="StorefrontProductInfoDetailsSection"/>
<section name="StorefrontProductInfoMainSection"/>
<page name="StorefrontProductPage" url="/{{var1}}.html" area="storefront" module="Catalog" parameterized="true">
<section name="StorefrontProductInfoMainSection" />
<section name="StorefrontProductInfoDetailsSection" />
<section name="WYSIWYGToolbarSection"/>
<section name="StorefrontProductImageSection" />
<section name="StorefrontMessagesSection" />
<section name="StorefrontProductRelatedProductsSection"/>
</page>
</pages>
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
<element name="attributeTab" type="button" selector="//strong[@class='admin__collapsible-title']/span[text()='Attributes']"/>
<element name="attributeLabel" type="input" selector="//input[@name='frontend_label[0]']"/>
<element name="frontendInput" type="select" selector="select[name = 'frontend_input']"/>
<element name="productFormTab" type="button" selector="//strong[@class='admin__collapsible-title']/span[contains(text(), '{{tabName}}')]" parameterized="true"/>
<element name="productFormTabState" type="text" selector="//strong[@class='admin__collapsible-title']/span[contains(text(), '{{tabName}}')]/parent::*/parent::*[@data-state-collapsible='{{state}}']" parameterized="true"/>
</section>
<section name="AdminProductFormRelatedUpSellCrossSellSection">
<element name="AddRelatedProductsButton" type="button" selector="button[data-index='button_related']" timeout="30"/>
</section>
<section name="AdminAddRelatedProductsModalSection">
<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"/>
</section>
<section name="ProductWYSIWYGSection">
<element name="Switcher" type="button" selector="//select[@id='dropdown-switcher']"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@
<element name="multicheckOption" type="button" selector="//div[@data-role='grid-wrapper']//th[contains(@class, data-grid-multicheck-cell)]//li//span[text() = '{{label}}']" parameterized="true"/>
<element name="bulkActionDropdown" type="button" selector="div.admin__data-grid-header-row.row div.action-select-wrap button.action-select"/>
<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"/>
<element name="productGridXRowYColumnButton" type="input" selector="table.data-grid tr.data-row:nth-child({{row}}) td:nth-child({{column}})" parameterized="true" timeout="30"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
<section name="AdminProductMessagesSection">
<element name="successMessage" type="text" selector=".message-success"/>
<element name="errorMessage" type="text" selector=".message.message-error.error"/>
</section>
</sections>
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.
*/
-->

<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
<section name="AdminProductModalSlideGridSection">
<element name="productGridXRowYColumnButton" type="input" selector=".modal-slide table.data-grid tr.data-row:nth-child({{row}}) td:nth-child({{column}})" parameterized="true" timeout="30"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?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="../../../../../../vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
<section name="AdminProductFormRelatedUpSellCrossSellSection">
<element name="AddRelatedProductsButton" type="button" selector="button[data-index='button_related']" timeout="30"/>
<element name="relatedProductSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='related']"/>
<element name="upSellProductSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='upsell']"/>
<element name="crossSellProductSectionText" type="text" selector=".fieldset-wrapper.admin__fieldset-section[data-index='crosssell']"/>
</section>
</sections>
Loading

0 comments on commit 13d54f9

Please sign in to comment.