|
| 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="AdminVerifyThatCustomersMatchesToASegmentWithConditionsOrderAddressTest"> |
| 12 | + <annotations> |
| 13 | + <features value="CustomerSegment"/> |
| 14 | + <stories value="Customer segment with ordered address based condition"/> |
| 15 | + <title value="Customer segment with order based condition should automatically match customer after order is placed"/> |
| 16 | + <description value="Customer segment with address based condition should automatically match customer after order is placed and also verify the customer for wrong postal code"/> |
| 17 | + <severity value="MAJOR"/> |
| 18 | + <testCaseId value="AC-3857"/> |
| 19 | + </annotations> |
| 20 | + <before> |
| 21 | + <!-- Create product --> |
| 22 | + <createData entity="SimpleProduct" after="createCustomer" stepKey="createSimpleProduct"/> |
| 23 | + <!-- Login to backend --> |
| 24 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 25 | + <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> |
| 26 | + <argument name="indices" value=""/> |
| 27 | + </actionGroup> |
| 28 | + <actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache"> |
| 29 | + <argument name="tags" value="config full_page"/> |
| 30 | + </actionGroup> |
| 31 | + </before> |
| 32 | + <after> |
| 33 | + <!-- Delete product --> |
| 34 | + <deleteData createDataKey="createSimpleProduct" after="deleteCustomer" stepKey="deleteProduct"/> |
| 35 | + <!-- Delete customer segment --> |
| 36 | + <actionGroup ref="FindAndDeleteCustomerSegmentActionGroup" stepKey="deleteSegment"> |
| 37 | + <argument name="segmentName" value="{{CustomerSegmentForRegistered.name}}"/> |
| 38 | + </actionGroup> |
| 39 | + <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> |
| 40 | + <argument name="indices" value=""/> |
| 41 | + </actionGroup> |
| 42 | + <!-- Logout from backend --> |
| 43 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 44 | + </after> |
| 45 | + |
| 46 | + <!-- Login to storefront as customer --> |
| 47 | + <actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin"> |
| 48 | + <argument name="Customer" value="$createCustomer$"/> |
| 49 | + </actionGroup> |
| 50 | + <!-- Open product on storefront --> |
| 51 | + <actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductPage"> |
| 52 | + <argument name="product" value="$createSimpleProduct$"/> |
| 53 | + </actionGroup> |
| 54 | + <!-- Add product to shopping cart --> |
| 55 | + <actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart"> |
| 56 | + <argument name="product" value="$createSimpleProduct$"/> |
| 57 | + <argument name="productCount" value="1"/> |
| 58 | + </actionGroup> |
| 59 | + <!-- Open shopping cart --> |
| 60 | + <actionGroup ref="StorefrontOpenCheckoutPageActionGroup" stepKey="goBackToCheckout"/> |
| 61 | + <actionGroup ref="CheckoutSelectFlatRateShippingMethodActionGroup" stepKey="selectFlatShippingMethod"/> |
| 62 | + <actionGroup ref="StorefrontCheckoutClickNextButtonActionGroup" stepKey="clickNext"/> |
| 63 | + <actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/> |
| 64 | + <actionGroup ref="ClickPlaceOrderActionGroup" stepKey="clickPlaceOrder"/> |
| 65 | + <!-- Create customer segment --> |
| 66 | + <actionGroup ref="CreateCustomerSegmentWithContinueEditActionGroup" stepKey="createCustomerSegment"> |
| 67 | + <argument name="customerSegment" value="CustomerSegmentForRegistered"/> |
| 68 | + </actionGroup> |
| 69 | + <!-- Fill all fields according to dataset --> |
| 70 | + <waitForElementClickable selector="{{AdminCustomerSegmentEditSection.conditionsTab}}" stepKey="waitForConditionTabToBeClicked"/> |
| 71 | + <click selector="{{AdminCustomerSegmentEditSection.conditionsTab}}" stepKey="proceedToConditionsTab"/> |
| 72 | + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/> |
| 73 | + <click selector="{{AdminCustomerSegmentConditionsEditSection.addCondition}}" stepKey="clickToAddCondition"/> |
| 74 | + |
| 75 | + <!-- Add condition {Customer Address|ANY:[City|is|Culver City]} --> |
| 76 | + <selectOption userInput="Customer Address" selector="{{AdminCustomerSegmentConditionsEditSection.conditions}}" stepKey="selectCondition"/> |
| 77 | + <waitForPageLoad stepKey="waitForConditionsToAppear"/> |
| 78 | + <click selector="{{AdminCustomerSegmentConditionsEditSection.conditionValueChooserParam('1','ALL')}}" stepKey="openSelectorAll"/> |
| 79 | + <selectOption userInput="ALL" selector="{{AdminCustomerSegmentConditionsEditSection.conditionTypeValue}}" stepKey="selectANY"/> |
| 80 | + <actionGroup ref="FillAddressConditionWithIsInCustomerSegmentActionGroup" stepKey="1stCondition"> |
| 81 | + <argument name="index" value="1"/> |
| 82 | + <argument name="conditionDegree" value="1--1--1"/> |
| 83 | + <argument name="attribute" value="City"/> |
| 84 | + <argument name="valueCondition" value="Brisbane"/> |
| 85 | + </actionGroup> |
| 86 | + |
| 87 | + <actionGroup ref="SelectAddressConditionWithIsInCustomerSegmentActionGroup" stepKey="6thCondition"> |
| 88 | + <argument name="index" value="2"/> |
| 89 | + <argument name="conditionDegree" value="1--1--2"/> |
| 90 | + <argument name="attribute" value="State/Province"/> |
| 91 | + <argument name="valueCondition" value="{{US_Address_Bris.state}}"/> |
| 92 | + </actionGroup> |
| 93 | + |
| 94 | + <actionGroup ref="SelectAddressConditionWithIsInCustomerSegmentActionGroup" stepKey="3rdCondition"> |
| 95 | + <argument name="index" value="3"/> |
| 96 | + <argument name="conditionDegree" value="1--1--3"/> |
| 97 | + <argument name="attribute" value="Country"/> |
| 98 | + <argument name="valueCondition" value="United States"/> |
| 99 | + </actionGroup> |
| 100 | + |
| 101 | + <actionGroup ref="FillAddressConditionWithIsInCustomerSegmentActionGroup" stepKey="9thCondition"> |
| 102 | + <argument name="index" value="4"/> |
| 103 | + <argument name="conditionDegree" value="1--1--4"/> |
| 104 | + <argument name="attribute" value="Zip/Postal"/> |
| 105 | + <argument name="valueCondition" value="{{US_Address_Bris.postcode}}"/> |
| 106 | + </actionGroup> |
| 107 | + |
| 108 | + <waitForElementClickable selector="{{AdminMainActionsSection.saveAndContinue}}" stepKey="waitForSaveSegmentButtonToBeClicked"/> |
| 109 | + <click selector="{{AdminMainActionsSection.saveAndContinue}}" stepKey="saveSegment"/> |
| 110 | + <waitForText userInput="You saved the segment." selector="{{AdminMessagesSection.success}}" stepKey="checkSuccessMessage"/> |
| 111 | + <!-- Start consumer message queue and refresh the page--> |
| 112 | + <actionGroup ref="CliConsumerStartActionGroup" stepKey="startMessageQueue"> |
| 113 | + <argument name="consumerName" value="{{AdminCustomerSegmentConsumerData.consumerName}}"/> |
| 114 | + <argument name="maxMessages" value="{{AdminCustomerSegmentConsumerData.messageLimit}}"/> |
| 115 | + </actionGroup> |
| 116 | + <reloadPage stepKey="refreshPage"/> |
| 117 | + <waitForPageLoad stepKey="waitForPageLoaded"/> |
| 118 | + <!--Open customer segment and check customer--> |
| 119 | + <actionGroup ref="AdminCheckCustomerInSegmentActionGroup" stepKey="checkCustomerInSegment"> |
| 120 | + <argument name="customer" value="$createCustomer$"/> |
| 121 | + </actionGroup> |
| 122 | + <!--Open condition tab and change pincode and save--> |
| 123 | + <waitForElementClickable selector="{{AdminCustomerSegmentEditSection.conditionsTab}}" stepKey="waitForConditionTabToBeClickedAfterAssertingCustomer"/> |
| 124 | + <click selector="{{AdminCustomerSegmentEditSection.conditionsTab}}" stepKey="clickOnConditionsTabAgainToUpdatePostalCode"/> |
| 125 | + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappearToUpdatePostalCode"/> |
| 126 | + <click selector="{{AdminCustomerSegmentConditionsEditSection.removeConditionValueChooserParam('1--1','94005')}}" stepKey="doubleClickOnQtyInput"/> |
| 127 | + <actionGroup ref="FillAddressConditionWithIsInCustomerSegmentActionGroup" stepKey="updateZipCode"> |
| 128 | + <argument name="index" value="4"/> |
| 129 | + <argument name="conditionDegree" value="1--1--4"/> |
| 130 | + <argument name="attribute" value="Zip/Postal"/> |
| 131 | + <argument name="valueCondition" value="34785"/> |
| 132 | + </actionGroup> |
| 133 | + <waitForElementClickable selector="{{AdminMainActionsSection.saveAndContinue}}" stepKey="waitForSaveSegmentButtonToBeClickedAfterUpdatingZipCode"/> |
| 134 | + <click selector="{{AdminMainActionsSection.saveAndContinue}}" stepKey="saveSegmentAfterChangingZipCode"/> |
| 135 | + <waitForText userInput="You saved the segment." selector="{{AdminMessagesSection.success}}" stepKey="checkSuccessMessageAfterChangingZipCode"/> |
| 136 | + <!-- Start consumer message queue and refresh the page--> |
| 137 | + <actionGroup ref="CliConsumerStartActionGroup" stepKey="startMessageQueueAfterChangingPinCode"> |
| 138 | + <argument name="consumerName" value="{{AdminCustomerSegmentConsumerData.consumerName}}"/> |
| 139 | + <argument name="maxMessages" value="{{AdminCustomerSegmentConsumerData.messageLimit}}"/> |
| 140 | + </actionGroup> |
| 141 | + <reloadPage stepKey="refreshPageAfterChangingZipCode"/> |
| 142 | + <waitForPageLoad stepKey="waitForPageLoadedAfterChangingZipCode"/> |
| 143 | + <!--Assert the customer is not present in segment--> |
| 144 | + <actionGroup ref="AdminCheckCustomerNotMatchedSegmentActionGroup" stepKey="checkCustomerNotInSegment"> |
| 145 | + <argument name="customer" value="$createCustomer$"/> |
| 146 | + </actionGroup> |
| 147 | + </test> |
| 148 | +</tests> |
0 commit comments