Skip to content

Commit e44d621

Browse files
authored
Merge pull request #4286 from magento-pangolin/mtf-eol-pr
[Pangolin] Converted MTF tests
2 parents 885c739 + 61a6789 commit e44d621

File tree

130 files changed

+4739
-26
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+4739
-26
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AssertOrderGraphImageOnDashboardActionGroup">
12+
<click selector="{{AdminDashboardSection.ordersTab}}" stepKey="clickOrdersBtn"/>
13+
<seeElement selector="{{AdminDashboardSection.ordersChart}}" stepKey="seeGraphImage"/>
14+
</actionGroup>
15+
</actionGroups>

app/code/Magento/Backend/Test/Mftf/Page/AdminDashboardPage.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
1111
<page name="AdminDashboardPage" url="admin/dashboard/" area="admin" module="Magento_Backend">
1212
<section name="AdminMenuSection"/>
13+
<section name="AdminDashboardSection"/>
1314
</page>
1415
</pages>

app/code/Magento/Backend/Test/Mftf/Section/AdminDashboardSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminDashboardSection">
12+
<element name="ordersTab" type="button" selector="#diagram_tab_orders"/>
13+
<element name="ordersChart" type="button" selector="#diagram_tab_orders_content .dashboard-diagram-image img"/>
1214
<element name="dashboardDiagramContent" type="button" selector="#diagram_tab_content"/>
1315
<element name="dashboardDiagramOrderContentTab" type="block" selector="#diagram_tab_orders_content"/>
1416
<element name="dashboardDiagramAmounts" type="button" selector="#diagram_tab_amounts"/>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddProductToCartActionGroup.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<argument name="product" defaultValue="product"/>
1313
</arguments>
1414
<amOnPage url="{{StorefrontProductPage.url(product.custom_attributes[url_key])}}" stepKey="goToProductPage"/>
15+
<waitForPageLoad stepKey="waitForProductPage"/>
1516
<click selector="{{StorefrontProductPageSection.addToCartBtn}}" stepKey="addToCart"/>
1617
<waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdding}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdding"/>
1718
<waitForElementNotVisible selector="{{StorefrontProductActionSection.addToCartButtonTitleIsAdded}}" stepKey="waitForElementNotVisibleAddToCartButtonTitleIsAdded"/>
@@ -20,4 +21,10 @@
2021
<waitForElementVisible selector="{{StorefrontMessagesSection.success}}" time="30" stepKey="waitForProductAddedMessage"/>
2122
<see selector="{{StorefrontMessagesSection.success}}" userInput="You added {{product.name}} to your shopping cart." stepKey="seeAddToCartSuccessMessage"/>
2223
</actionGroup>
24+
<actionGroup name="StorefrontAddSimpleProductWithQtyActionGroup" extends="AddSimpleProductToCart">
25+
<arguments>
26+
<argument name="quantity" type="string" defaultValue="1"/>
27+
</arguments>
28+
<fillField userInput="{{quantity}}" selector="{{StorefrontProductPageSection.qtyInput}}" stepKey="fillProductQty" after="goToProductPage"/>
29+
</actionGroup>
2330
</actionGroups>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="CatalogInventoryOptionsShowOutOfStockEnable">
12+
<data key="path">cataloginventory/options/show_out_of_stock</data>
13+
<data key="label">Yes</data>
14+
<data key="value">1</data>
15+
</entity>
16+
<entity name="CatalogInventoryOptionsShowOutOfStockDisable">
17+
<!-- Magento default value -->
18+
<data key="path">cataloginventory/options/show_out_of_stock</data>
19+
<data key="label">No</data>
20+
<data key="value">0</data>
21+
</entity>
22+
<entity name="CatalogInventoryItemOptionsBackordersEnable">
23+
<data key="path">cataloginventory/item_options/backorders</data>
24+
<data key="label">Yes</data>
25+
<data key="value">1</data>
26+
</entity>
27+
<entity name="CatalogInventoryItemOptionsBackordersDisable">
28+
<!-- Magento default value -->
29+
<data key="path">cataloginventory/item_options/backorders</data>
30+
<data key="label">No</data>
31+
<data key="value">0</data>
32+
</entity>
33+
</entities>

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,18 @@
153153
<data key="status">1</data>
154154
<data key="quantity">0</data>
155155
</entity>
156+
<entity name="SimpleProductInStockQuantityZero" type="product">
157+
<data key="sku" unique="suffix">testSku</data>
158+
<data key="type_id">simple</data>
159+
<data key="attribute_set_id">4</data>
160+
<data key="visibility">4</data>
161+
<data key="name" unique="suffix">SimpleProductInStockQuantityZero</data>
162+
<data key="price">123.00</data>
163+
<data key="urlKey" unique="suffix">SimpleProductInStockQuantityZero</data>
164+
<data key="status">1</data>
165+
<data key="quantity">0</data>
166+
<requiredEntity type="product_extension_attribute">EavStock0</requiredEntity>
167+
</entity>
156168
<!-- Simple Product Disabled -->
157169
<entity name="SimpleProductOffline" type="product2">
158170
<data key="sku" unique="suffix">testSku</data>

app/code/Magento/Catalog/Test/Mftf/Data/ProductExtensionAttributeData.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
<entity name="EavStock1" type="product_extension_attribute">
2121
<requiredEntity type="stock_item">Qty_1</requiredEntity>
2222
</entity>
23+
<entity name="EavStock0" type="product_extension_attribute">
24+
<requiredEntity type="stock_item">Qty_0</requiredEntity>
25+
</entity>
2326
<entity name="EavStock777" type="product_extension_attribute">
2427
<requiredEntity type="stock_item">Qty_777</requiredEntity>
2528
</entity>

app/code/Magento/Catalog/Test/Mftf/Data/StockItemData.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
<data key="qty">1</data>
3333
<data key="is_in_stock">true</data>
3434
</entity>
35+
<entity name="Qty_0" type="stock_item">
36+
<data key="qty">0</data>
37+
<data key="is_in_stock">true</data>
38+
</entity>
3539
<entity name="Qty_777" type="stock_item">
3640
<data key="qty">777</data>
3741
<data key="is_in_stock">true</data>

app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryProductSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
<element name="ProductTitleByName" type="button" selector="//main//li//a[contains(text(), '{{var1}}')]" parameterized="true"/>
2323
<element name="ProductPriceByName" type="text" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//span[@class='price']" parameterized="true"/>
24+
<element name="ProductCatalogRuleSpecialPriceTitleByName" type="text" selector="//div[descendant::*[contains(text(), '{{var1}}')]]//*[contains(@class, 'special-price')]" parameterized="true"/>
25+
<element name="ProductCatalogRulePriceTitleByName" type="text" selector="//div[descendant::*[contains(text(), '{{var1}}')]]//*[contains(@class, 'price-label')]" parameterized="true"/>
2426
<element name="ProductImageByName" type="text" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//img[@class='product-image-photo']" parameterized="true"/>
2527
<element name="ProductImageBySrc" type="text" selector=".products-grid img[src*='{{pattern}}']" parameterized="true"/>
2628
<element name="ProductInfoByName" type="text" selector="//main//li[.//a[contains(text(), '{{var1}}')]]//div[@class='product-item-info']" parameterized="true"/>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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="AdminBackorderAllowedAddProductToCartTest">
12+
<annotations>
13+
<stories value="Manage products"/>
14+
<title value="Add Product to Cart, Backorder Allowed"/>
15+
<description value="Customer should be able to add products to cart when that products quantity is zero"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="MC-11063"/>
18+
<group value="mtf_migrated"/>
19+
</annotations>
20+
21+
<before>
22+
<!-- Create a product that is "In Stock" but has quantity zero -->
23+
<createData entity="SimpleProductInStockQuantityZero" stepKey="createProduct"/>
24+
25+
<!-- Configure Magento to show out of stock products and to allow backorders -->
26+
<magentoCLI command="config:set {{CatalogInventoryOptionsShowOutOfStockEnable.path}} {{CatalogInventoryOptionsShowOutOfStockEnable.value}}" stepKey="setConfigShowOutOfStockTrue"/>
27+
<magentoCLI command="config:set {{CatalogInventoryItemOptionsBackordersEnable.path}} {{CatalogInventoryItemOptionsBackordersEnable.value}}" stepKey="setConfigAllowBackordersTrue"/>
28+
</before>
29+
30+
<after>
31+
<!-- Set Magento back to default configuration -->
32+
<magentoCLI command="config:set {{CatalogInventoryOptionsShowOutOfStockDisable.path}} {{CatalogInventoryOptionsShowOutOfStockDisable.value}}" stepKey="setConfigShowOutOfStockFalse"/>
33+
<magentoCLI command="config:set {{CatalogInventoryItemOptionsBackordersDisable.path}} {{CatalogInventoryItemOptionsBackordersDisable.value}}" stepKey="setConfigAllowBackordersFalse"/>
34+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
35+
</after>
36+
37+
<!-- Go to the storefront and add the product to the cart -->
38+
<actionGroup ref="AddSimpleProductToCart" stepKey="gotoAndAddProductToCart">
39+
<argument name="product" value="$$createProduct$$"/>
40+
</actionGroup>
41+
42+
<!-- Go to the cart page and verify we see the product -->
43+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="gotoCart"/>
44+
<waitForPageLoad stepKey="waitForCartLoad"/>
45+
<actionGroup ref="AssertStorefrontCheckoutCartItemsActionGroup" stepKey="assertProductItemInCheckOutCart">
46+
<argument name="productName" value="$$createProduct.name$$"/>
47+
<argument name="productSku" value="$$createProduct.sku$$"/>
48+
<argument name="productPrice" value="$$createProduct.price$$"/>
49+
<argument name="subtotal" value="$$createProduct.price$$" />
50+
<argument name="qty" value="1"/>
51+
</actionGroup>
52+
</test>
53+
</tests>

0 commit comments

Comments
 (0)