Skip to content

Commit

Permalink
Merge pull request #4372 from magento-pangolin/2.3-tests-mainline-pr
Browse files Browse the repository at this point in the history
[AutomationTeam][Sprint#2] Deliver automated tests
  • Loading branch information
okolesnyk authored Jun 18, 2019
2 parents 42e7576 + 3b37e78 commit cde6dba
Show file tree
Hide file tree
Showing 62 changed files with 1,385 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,7 @@
<element name="adminUserAccountText" type="text" selector=".page-header .admin-user-account-text" />
<!-- Legacy heading section. Mostly used for admin 404 and 403 pages -->
<element name="pageHeading" type="text" selector=".page-content .page-heading"/>
<!-- Used for page not found error -->
<element name="pageNotFoundTitle" type="text" selector=".page-title span"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
<deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/>
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndexPage"/>
<actionGroup ref="deleteProductsIfTheyExist" stepKey="deleteAllProducts"/>
<actionGroup ref="logout" stepKey="logout"/>
</after>
<!-- go to bundle product creation page-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
<deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/>
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndexPage"/>
<actionGroup ref="deleteProductsIfTheyExist" stepKey="deleteAllProducts"/>
<actionGroup ref="logout" stepKey="logout"/>
</after>
<!-- go to bundle product creation page-->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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="AdminFillProductAttributePropertiesActionGroup">
<arguments>
<argument name="attributeName" type="string"/>
<argument name="attributeType" type="string"/>
</arguments>
<fillField selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{attributeName}}" stepKey="fillDefaultLabel"/>
<selectOption selector="{{AttributePropertiesSection.InputType}}" userInput="{{attributeType}}" stepKey="selectInputType"/>
</actionGroup>
</actionGroups>
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.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminOpenAttributeSetByNameActionGroup">
<arguments>
<argument name="attributeSetName" type="string" defaultValue="Default"/>
</arguments>
<click selector="{{AdminProductAttributeSetGridSection.AttributeSetName(attributeSetName)}}" stepKey="chooseAttributeSet"/>
<waitForPageLoad stepKey="waitForAttributeSetPageLoad"/>
</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="AdminOpenAttributeSetGridPageActionGroup">
<amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSetPage"/>
<waitForPageLoad stepKey="waitForAttributeSetPageLoad"/>
</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="AdminOpenProductAttributePageActionGroup">
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="goToAttributePage"/>
<waitForPageLoad stepKey="waitForAttributePageLoad"/>
</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="AdminOpenProductIndexPageActionGroup">
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndexPage"/>
<waitForPageLoad stepKey="waitForProductIndexPageLoad"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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="AssertStorefrontCustomProductAttributeActionGroup">
<arguments>
<argument name="attributeLabel" type="string"/>
<argument name="attributeValue" type="string"/>
</arguments>
<see userInput="{{attributeLabel}}" selector="{{StorefrontProductMoreInformationSection.customAttributeLabel(attributeLabel)}}" stepKey="seeAttributeLabel" />
<see userInput="{{attributeValue}}" selector="{{StorefrontProductMoreInformationSection.customAttributeValue(attributeLabel)}}" stepKey="seeAttributeValue" />
</actionGroup>
</actionGroups>
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.
*/
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="OpenStorefrontProductPageByProductNameActionGroup">
<arguments>
<argument name="productName" type="string" defaultValue="{{_defaultProduct.name}}"/>
</arguments>
<amOnPage url="{{productName}}.html" stepKey="amOnProductPage"/>
<waitForPageLoad stepKey="waitForProductPageLoad"/>
</actionGroup>
</actionGroups>
7 changes: 7 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/CategoryData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,11 @@
<data key="is_active">false</data>
<data key="include_in_menu">false</data>
</entity>
<!-- Category from file "prepared-for-sample-data.csv"-->
<entity name="Gear" type="category">
<data key="name">Gear</data>
<data key="name_lwr">gear</data>
<data key="is_active">true</data>
<data key="include_in_menu">true</data>
</entity>
</entities>
23 changes: 23 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml
Original file line number Diff line number Diff line change
Expand Up @@ -320,4 +320,27 @@
<data key="option1_admin" unique="suffix">opt1'Admin</data>
<data key="option1_frontend" unique="suffix">opt1'Front</data>
</entity>
<entity name="productTextEditorAttribute" type="ProductAttribute">
<data key="attribute_code" unique="suffix">attribute</data>
<data key="frontend_input">texteditor</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="backend_type">text</data>
<data key="is_wysiwyg_enabled">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>
23 changes: 23 additions & 0 deletions app/code/Magento/Catalog/Test/Mftf/Data/WYSIWYGConfigData.xml
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.
*/
-->

<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
<entity name="EnableWYSIWYG">
<data key="path">cms/wysiwyg/enabled</data>
<data key="scope_id">0</data>
<data key="label">Yes</data>
<data key="value">enabled</data>
</entity>
<entity name="EnableTinyMCE4">
<data key="path">cms/wysiwyg/editor</data>
<data key="scope_id">0</data>
<data key="label">Yes</data>
<data key="value">mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<element name="EnableWYSIWYG" type="select" selector="#enabled"/>
<element name="useForPromoRuleConditions" type="select" selector="#is_used_for_promo_rules"/>
<element name="StorefrontPropertiesSectionToggle" type="button" selector="#front_fieldset-wrapper"/>
<element name="visibleOnCatalogPagesOnStorefront" type="select" selector="#is_visible_on_front"/>
</section>
<section name="WYSIWYGProductAttributeSection">
<element name="ShowHideBtn" type="button" selector="#toggledefault_value_texteditor"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
</section>
<section name="ProductDescriptionWysiwygSection">
<element name="EditArea" type="text" selector="#editorproduct_form_description .mce-edit-area"/>
<element name="attributeEditArea" type="textarea" selector="#product_form_{{attributeCode}}" parameterized="true" timeout="30"/>
</section>
<section name="ProductShortDescriptionWysiwygSection">
<element name="EditArea" type="text" selector="#editorproduct_form_short_description .mce-edit-area"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<section name="StorefrontProductMoreInformationSection">
<element name="moreInformation" type="button" selector="#tab-label-additional-title" timeout="30"/>
<element name="moreInformationTextArea" type="textarea" selector="#additional"/>
<element name="moreInformationSpecs" type="text" selector="#product-attribute-specs-table"/>
<element name="customAttributeLabel" type="text" selector="//th[./following-sibling::td[@data-th='{{attributeCode}}']]" parameterized="true" />
<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"/>
</section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
</before>
<after>
<!-- Delete product attribute -->
<deleteData createDataKey="attribute" stepKey="deleteProductAttribute"/>

<!-- Delete product attribute set -->
<deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/>

<actionGroup ref="logout" stepKey="logout"/>
</after>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<?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="AdminCreateTextEditorProductAttributeTest">
<annotations>
<features value="Catalog"/>
<stories value="Create product Attribute"/>
<title value="Admin create text editor product attribute test"/>
<description value="Create text editor product attribute with TinyMCE4 enabled"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-6338"/>
<group value="catalog"/>
</annotations>
<before>
<!-- Enable WYSIWYG editor -->
<magentoCLI command="config:set {{EnableWYSIWYG.path}} {{EnableWYSIWYG.value}}" stepKey="enableWYSIWYG"/>

<!-- Enable TinyMCE 4 -->
<magentoCLI command="config:set {{EnableTinyMCE4.path}} {{EnableTinyMCE4.value}}" stepKey="enableTinyMCE4"/>

<!-- Login as admin -->
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
</before>
<after>
<!-- Delete attribute -->
<actionGroup ref="deleteProductAttribute" stepKey="deleteAttribute">
<argument name="ProductAttribute" value="productTextEditorAttribute"/>
</actionGroup>

<!-- Delete product -->
<actionGroup ref="deleteProductUsingProductGrid" stepKey="deleteProduct">
<argument name="product" value="_defaultProduct"/>
</actionGroup>

<!-- Log out -->
<actionGroup ref="logout" stepKey="logout"/>
</after>

<!-- Go to Stores > Product, click "Add New Attribute" -->
<actionGroup ref="AdminOpenProductAttributePageActionGroup" stepKey="openProductAttributePage"/>
<click selector="{{AdminProductAttributeGridSection.createNewAttributeBtn}}" stepKey="createNewAttribute"/>

<!-- Input value for Default Label. Verify dropdown of "Catalog Input Type for Store Owner" -->
<actionGroup ref="AdminFillProductAttributePropertiesActionGroup" stepKey="fillAttributeProperties">
<argument name="attributeName" value="{{productTextEditorAttribute.attribute_code}}"/>
<argument name="attributeType" value="{{productTextEditorAttribute.frontend_input}}"/>
</actionGroup>

<!-- Input value for "Catalog Input Type for Store Owner" -->
<selectOption selector="{{AttributePropertiesSection.InputType}}" userInput="{{productAttributeWysiwyg.frontend_input}}" stepKey="updateInputType"/>

<!-- Click on "Storefront Properties" tab on left menu -->
<click selector="{{StorefrontPropertiesSection.StoreFrontPropertiesTab}}" stepKey="clickStorefrontPropertiesTab"/>
<dontSeeElement selector="{{StorefrontPropertiesSection.EnableWYSIWYG}}" stepKey="dontSeeWYSIWYGEnableField"/>

<!-- Selection for "Visible on Catalog Pages on Storefront" -->
<selectOption selector="{{StorefrontPropertiesSection.visibleOnCatalogPagesOnStorefront}}" userInput="Yes" stepKey="enableVisibleOnStorefront"/>
<scrollToTopOfPage stepKey="scrollToPageTop"/>

<!-- Go back to "Properties" tab on left menu -->
<click selector="{{AttributePropertiesSection.propertiesTab}}" stepKey="clickPropertiesTab"/>

<!-- Updated value for "Catalog Input Type for Store Owner" -->
<selectOption selector="{{AttributePropertiesSection.InputType}}" userInput="{{productTextEditorAttribute.frontend_input}}" stepKey="returnInputType"/>

<!-- Save Product Attribute -->
<actionGroup ref="saveProductAttribute" stepKey="saveAttribute"/>

<!-- Go to Store > Attribute Set -->
<actionGroup ref="AdminOpenAttributeSetGridPageActionGroup" stepKey="openAttributeSetPage"/>

<!-- From grid, click on attribute set Default -->
<actionGroup ref="AdminOpenAttributeSetByNameActionGroup" stepKey="openDefaultAttributeSet"/>

<!-- Add Product Attribute to Default attribute by dragging and dropping this to the 'Project Details' folder. Then Save. -->
<actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup">
<argument name="group" value="Product Details"/>
<argument name="attribute" value="{{productTextEditorAttribute.attribute_code}}"/>
</actionGroup>
<actionGroup ref="SaveAttributeSet" stepKey="saveAttributeSet"/>

<!-- Go Catalog > Product to create new product page -->
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="goToProductIndexPage"/>
<actionGroup ref="goToCreateProductPage" stepKey="goToCreateProduct">
<argument name="product" value="_defaultProduct"/>
</actionGroup>

<!-- On product page, select Attribute Set: "Default" -->
<actionGroup ref="AdminProductPageSelectAttributeSet" stepKey="selectAttributeSet">
<argument name="attributeSetName" value="Default"/>
</actionGroup>

<!-- Created product attribute appear on product form -->
<seeElement selector="{{AdminProductFormSection.attributeLabelByText(productTextEditorAttribute.attribute_code)}}" stepKey="seeAttributeLabelInProductForm"/>

<!-- TinyMCE 4 is displayed in WYSIWYG content area -->
<seeElement selector="{{TinyMCESection.TinyMCE4}}" stepKey="seeTinyMCE4"/>

<!-- Verify toolbar menu -->
<actionGroup ref="VerifyTinyMCEActionGroup" stepKey="verifyToolbarMenu"/>

<!-- Click Show/Hide button and see Insert Image button -->
<scrollToTopOfPage stepKey="scrollToTop"/>
<click selector="{{ProductAttributeWYSIWYGSection.showHideBtn(productTextEditorAttribute.attribute_code)}}" stepKey="clickShowHideBtn"/>
<waitForElementVisible selector="{{TinyMCESection.InsertImageBtn}}" stepKey="waitForInsertImageBtn"/>

<!-- Add content into attribute -->
<fillField selector="{{ProductDescriptionWysiwygSection.attributeEditArea(productTextEditorAttribute.attribute_code)}}" userInput="This content from product page" stepKey="setContent"/>

<!-- Fill up all required fields for product form -->
<actionGroup ref="fillMainProductForm" stepKey="fillProductForm"/>
<actionGroup ref="saveProductForm" stepKey="saveProductForm"/>

<!-- Assert product attribute on Storefront -->
<actionGroup ref="OpenStorefrontProductPageByProductNameActionGroup" stepKey="openProductPage"/>
<scrollTo stepKey="scrollToMoreInformation" selector="{{StorefrontProductMoreInformationSection.moreInformationSpecs}}" />
<actionGroup ref="AssertStorefrontCustomProductAttributeActionGroup" stepKey="checkAttributeInMoreInformationTab">
<argument name="attributeLabel" value="{{productTextEditorAttribute.attribute_code}}"/>
<argument name="attributeValue" value="This content from product page"/>
</actionGroup>
</test>
</tests>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?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">
<!-- Assert shipping method name and price are present in cart -->
<actionGroup name="StorefrontAssertShippingMethodOptionPresentInCartActionGroup">
<arguments>
<argument name="methodName" type="string"/>
<argument name="price" type="string"/>
</arguments>
<see selector="{{CheckoutCartSummarySection.methodName}}" userInput="{{methodName}}" stepKey="seeShippingName"/>
<see selector="{{CheckoutCartSummarySection.shippingPrice}}" userInput="{{price}}" stepKey="seeShippingPrice"/>
</actionGroup>
</actionGroups>
Loading

0 comments on commit cde6dba

Please sign in to comment.