|
| 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="AddToCartCrossSellTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Catalog"/> |
| 14 | + <stories value="Promote Products as Cross-Sells"/> |
| 15 | + <title value="Admin should be able to add cross-sell to products."/> |
| 16 | + <description value="Create products, add products to cross sells, and check that they appear in the Shopping Cart page."/> |
| 17 | + <severity value="MAJOR"/> |
| 18 | + <testCaseId value="MC-113"/> |
| 19 | + <group value="Catalog"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <createData entity="SimpleSubCategory" stepKey="category1"/> |
| 23 | + <createData entity="_defaultProduct" stepKey="simpleProduct1"> |
| 24 | + <requiredEntity createDataKey="category1"/> |
| 25 | + </createData> |
| 26 | + <createData entity="_defaultProduct" stepKey="simpleProduct2"> |
| 27 | + <requiredEntity createDataKey="category1"/> |
| 28 | + </createData> |
| 29 | + <createData entity="_defaultProduct" stepKey="simpleProduct3"> |
| 30 | + <requiredEntity createDataKey="category1"/> |
| 31 | + </createData> |
| 32 | + |
| 33 | + <actionGroup ref="LoginAsAdmin" stepKey="logInAsAdmin"/> |
| 34 | + </before> |
| 35 | + <after> |
| 36 | + <actionGroup ref="logout" stepKey="logoutFromAdmin"/> |
| 37 | + |
| 38 | + <deleteData createDataKey="simpleProduct1" stepKey="deleteSimp1"/> |
| 39 | + <deleteData createDataKey="simpleProduct2" stepKey="deleteSimp2"/> |
| 40 | + <deleteData createDataKey="simpleProduct3" stepKey="deleteSimp3"/> |
| 41 | + <deleteData createDataKey="category1" stepKey="deleteCategory"/> |
| 42 | + </after> |
| 43 | + |
| 44 | + <!-- Go to simpleProduct1, add simpleProduct2 and simpleProduct3 as cross-sell--> |
| 45 | + <amOnPage url="{{AdminProductEditPage.url($simpleProduct1.id$)}}" stepKey="goToProduct1"/> |
| 46 | + <click stepKey="openHeader1" selector="{{AdminProductFormRelatedUpSellCrossSellSection.sectionHeader}}"/> |
| 47 | + |
| 48 | + <actionGroup ref="addCrossSellProductBySku" stepKey="addProduct2ToSimp1"> |
| 49 | + <argument name="sku" value="$simpleProduct2.sku$"/> |
| 50 | + </actionGroup> |
| 51 | + <actionGroup ref="addCrossSellProductBySku" stepKey="addProduct3ToSimp1"> |
| 52 | + <argument name="sku" value="$simpleProduct3.sku$"/> |
| 53 | + </actionGroup> |
| 54 | + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSave"/> |
| 55 | + <waitForPageLoad stepKey="waitForPageLoad1"/> |
| 56 | + |
| 57 | + <!-- Go to simpleProduct3, add simpleProduct1 and simpleProduct2 as cross-sell--> |
| 58 | + <amOnPage url="{{AdminProductEditPage.url($simpleProduct3.id$)}}" stepKey="goToProduct3"/> |
| 59 | + <click stepKey="openHeader2" selector="{{AdminProductFormRelatedUpSellCrossSellSection.sectionHeader}}"/> |
| 60 | + |
| 61 | + <actionGroup ref="addCrossSellProductBySku" stepKey="addProduct1ToSimp3"> |
| 62 | + <argument name="sku" value="$simpleProduct1.sku$"/> |
| 63 | + </actionGroup> |
| 64 | + <actionGroup ref="addCrossSellProductBySku" stepKey="addProduct2ToSimp3"> |
| 65 | + <argument name="sku" value="$simpleProduct2.sku$"/> |
| 66 | + </actionGroup> |
| 67 | + <click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickSave2"/> |
| 68 | + <waitForPageLoad stepKey="waitForPageLoad2"/> |
| 69 | + |
| 70 | + <!-- Go to frontend, add simpleProduct1 to cart--> |
| 71 | + <actionGroup ref="AddSimpleProductToCart" stepKey="addSimp1ToCart"> |
| 72 | + <argument name="product" value="$simpleProduct1$"/> |
| 73 | + </actionGroup> |
| 74 | + |
| 75 | + <!-- Check that cart page contains cross-sell to simpleProduct2 and simpleProduct3--> |
| 76 | + <amOnPage url="{{CheckoutCartPage.url}}" stepKey="goToCart1"/> |
| 77 | + <waitForPageLoad stepKey="waitForCartToLoad"/> |
| 78 | + <waitForElementVisible selector="{{CheckoutCartCrossSellSection.products}}" stepKey="waitForCrossSellLoading"/> |
| 79 | + <see stepKey="seeProduct2InCrossSell" selector="{{CheckoutCartCrossSellSection.products}}" userInput="$simpleProduct2.name$"/> |
| 80 | + <see stepKey="seeProduct3InCrossSell" selector="{{CheckoutCartCrossSellSection.products}}" userInput="$simpleProduct3.name$"/> |
| 81 | + |
| 82 | + <!-- Add simpleProduct3 to cart, check cross-sell contains product2 but not product3--> |
| 83 | + <click stepKey="addSimp3ToCart" selector="{{CheckoutCartCrossSellSection.productRowByName($simpleProduct3.name$)}}{{CheckoutCartCrossSellSection.addToCart}}"/> |
| 84 | + <waitForPageLoad stepKey="waitForCartToLoad2"/> |
| 85 | + <see stepKey="seeProduct2StillInCrossSell" selector="{{CheckoutCartCrossSellSection.products}}" userInput="$simpleProduct2.name$"/> |
| 86 | + <dontSee stepKey="dontSeeProduct3InCrossSell" selector="{{CheckoutCartCrossSellSection.products}}" userInput="$simpleProduct3.name$"/> |
| 87 | + |
| 88 | + <!-- Add simpleProduct2 to cart, check cross-sell doesn't contain product 2 anymore.--> |
| 89 | + <click stepKey="addSimp2ToCart" selector="{{CheckoutCartCrossSellSection.productRowByName($simpleProduct2.name$)}}{{CheckoutCartCrossSellSection.addToCart}}"/> |
| 90 | + <waitForPageLoad stepKey="waitForCartToLoad3"/> |
| 91 | + <dontSee stepKey="dontSeeProduct2InCrossSell" selector="{{CheckoutCartCrossSellSection.products}}" userInput="$simpleProduct2.name$"/> |
| 92 | + </test> |
| 93 | +</tests> |
0 commit comments