Skip to content

Commit ca38be2

Browse files
committed
MC-24244: [MFTF Test] Instant purchase negative scenarios
1 parent 1a77b70 commit ca38be2

File tree

2 files changed

+250
-0
lines changed

2 files changed

+250
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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="Enable3DSecureBraintree">
12+
<data key="path">payment/braintree/verify_3dsecure</data>
13+
<data key="value">1</data>
14+
</entity>
15+
<entity name="Disable3DSecureBraintree">
16+
<data key="path">payment/braintree/verify_3dsecure</data>
17+
<data key="value">0</data>
18+
</entity>
19+
<entity name="DisableVaultBraintree">
20+
<data key="path">payment/braintree_cc_vault/active</data>
21+
<data key="value">0</data>
22+
</entity>
23+
</entities>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="StorefrontInstantPurchaseFunctionalityNegativeScenarioTest">
11+
<annotations>
12+
<features value="InstantPurchase"/>
13+
<stories value="Using Instant Purchase - Negative Scenario"/>
14+
<title value="Checks negative Instant Purchase functionality scenario"/>
15+
<description value="Checks that Instant Purchase button does not appears in a different situation"/>
16+
<useCaseId value="MAGETWO-84214"/>
17+
<testCaseId value="MC-25949"/>
18+
<severity value="CRITICAL"/>
19+
<group value="instant_purchase"/>
20+
<group value="vault"/>
21+
<group value="braintree"/>
22+
</annotations>
23+
<before>
24+
<magentoCLI command="downloadable:domains:add" arguments="example.com static.magento.com" stepKey="addDownloadableDomain"/>
25+
<!-- Configure Braintree payment method -->
26+
<createData entity="BraintreeConfig" stepKey="configureBraintreePayment"/>
27+
<!-- Enable Braintree with Vault -->
28+
<createData entity="CustomBraintreeConfigurationData" stepKey="enableBraintreeAndVault"/>
29+
<!-- Create customers: without address, with address, with saved shipping and billing -->
30+
<createData entity="Simple_Customer_Without_Address" stepKey="customerWithoutAddress"/>
31+
<createData entity="Simple_US_Customer_Multiple_Addresses_No_Default_Address" stepKey="customerWithAddress"/>
32+
<createData entity="Simple_US_Customer_Multiple_Addresses" stepKey="customerWithDefaultAddress"/>
33+
<!-- Create all product variations -->
34+
<createData entity="SimpleProduct2" stepKey="createSimpleProduct"/>
35+
<createData entity="VirtualProduct" stepKey="createVirtualProduct"/>
36+
<actionGroup ref="AdminCreateApiConfigurableProductActionGroup" stepKey="createConfigurableProduct"/>
37+
<!-- Create Bundle Product -->
38+
<createData entity="ApiFixedBundleProduct" stepKey="createBundleProduct"/>
39+
<createData entity="DropDownBundleOption" stepKey="createBundleOption">
40+
<requiredEntity createDataKey="createBundleProduct"/>
41+
</createData>
42+
<createData entity="ApiBundleLink" stepKey="createBundleLink">
43+
<requiredEntity createDataKey="createBundleProduct"/>
44+
<requiredEntity createDataKey="createBundleOption"/>
45+
<requiredEntity createDataKey="createSimpleProduct"/>
46+
</createData>
47+
<!-- Create Downloadable Product -->
48+
<createData entity="ApiDownloadableProduct" stepKey="createDownloadableProduct"/>
49+
<createData entity="downloadableLink1" stepKey="addDownloadableLink">
50+
<requiredEntity createDataKey="createDownloadableProduct"/>
51+
</createData>
52+
<!-- Create Grouped Product -->
53+
<createData entity="ApiGroupedProduct" stepKey="createGroupedProduct"/>
54+
<createData entity="OneSimpleProductLink" stepKey="createLinkForGroupedProduct">
55+
<requiredEntity createDataKey="createGroupedProduct"/>
56+
<requiredEntity createDataKey="createSimpleProduct"/>
57+
</createData>
58+
<!-- Log in as a customer -->
59+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLoginToStorefront">
60+
<argument name="Customer" value="$customerWithDefaultAddress$"/>
61+
</actionGroup>
62+
<!-- Customer placed order from storefront with payment method -->
63+
<actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addProductToCart">
64+
<argument name="product" value="$createSimpleProduct$"/>
65+
</actionGroup>
66+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
67+
<actionGroup ref="StorefrontSetShippingMethodActionGroup" stepKey="setShippingMethodFlatRate"/>
68+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="goToCheckoutPaymentStep"/>
69+
<!-- Fill Braintree card data -->
70+
<click selector="{{BraintreeConfigurationPaymentSection.creditCart}}" stepKey="selectBraintreePaymentMethod"/>
71+
<waitForPageLoad stepKey="waitForBraintreeFormLoad"/>
72+
<scrollTo selector="{{BraintreeConfigurationPaymentSection.creditCart}}" stepKey="scrollToCreditCardSection"/>
73+
<actionGroup ref="StorefrontFillCartDataActionGroup" stepKey="fillCardData">
74+
<argument name="cartData" value="VisaDefaultCard"/>
75+
</actionGroup>
76+
<waitForPageLoad stepKey="waitForFillCardData"/>
77+
<checkOption selector="{{StorefrontOnePageCheckoutPaymentSection.saveForLaterUse}}" stepKey="checkSaveForLaterUse"/>
78+
<actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="clickOnPlaceOrder">
79+
<argument name="orderNumberMessage" value="CONST.successCheckoutOrderNumberMessage"/>
80+
<argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage"/>
81+
</actionGroup>
82+
</before>
83+
<after>
84+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/>
85+
<deleteData createDataKey="customerWithoutAddress" stepKey="deleteCustomerWithoutAddress"/>
86+
<deleteData createDataKey="customerWithAddress" stepKey="deleteCustomerWithAddress"/>
87+
<deleteData createDataKey="customerWithDefaultAddress" stepKey="deleteCustomerWithDefaultAddress"/>
88+
<!-- Set configs to default -->
89+
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="restoreToDefaultFlatRate"/>
90+
<magentoCLI command="config:set {{Disable3DSecureBraintree.path}} {{Disable3DSecureBraintree.value}}" stepKey="restoreToDefault3DSecureVerification"/>
91+
<createData entity="DefaultBraintreeConfig" stepKey="defaultBraintreeConfig"/>
92+
<createData entity="RollBackCustomBraintreeConfigurationData" stepKey="rollBackCustomBraintreeConfigurationData"/>
93+
<!-- Remove created products/attributes -->
94+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
95+
<deleteData createDataKey="createVirtualProduct" stepKey="deleteVirtualProduct"/>
96+
<deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/>
97+
<deleteData createDataKey="createGroupedProduct" stepKey="deleteGroupedProduct"/>
98+
<!-- Remove Downloadable Product -->
99+
<magentoCLI command="downloadable:domains:remove static.magento.com" stepKey="removeDownloadableDomain"/>
100+
<deleteData createDataKey="createDownloadableProduct" stepKey="deleteDownloadableProduct"/>
101+
<!-- Remove Configurable Product -->
102+
<deleteData createDataKey="createConfigProductCreateConfigurableProduct" stepKey="deleteConfigProduct"/>
103+
<deleteData createDataKey="createConfigProductAttributeCreateConfigurableProduct" stepKey="deleteConfigProductAttribute"/>
104+
<deleteData createDataKey="createConfigChildProduct1CreateConfigurableProduct" stepKey="deleteConfigChildProduct1"/>
105+
<deleteData createDataKey="createConfigChildProduct2CreateConfigurableProduct" stepKey="deleteConfigChildProduct2"/>
106+
<!-- Reindex invalidated indices after product attribute has been created/deleted -->
107+
<actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/>
108+
</after>
109+
<!-- 1. Ensure customer is a guest -->
110+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/>
111+
<!-- 2. Browse all product pages and verify that the "Instant Purchase" button does not appear -->
112+
<!-- Simple product -->
113+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductPage">
114+
<argument name="product" value="$createSimpleProduct$"/>
115+
</actionGroup>
116+
<dontSeeElement selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="dontSeeButtonOnSimpleProductPage"/>
117+
<!-- Virtual product -->
118+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openVirtualProductPage">
119+
<argument name="product" value="$createVirtualProduct$"/>
120+
</actionGroup>
121+
<dontSeeElement selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="dontSeeButtonOnVirtualProductPage"/>
122+
<!-- Downloadable Product -->
123+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openDownloadableProductPage">
124+
<argument name="product" value="$createDownloadableProduct$"/>
125+
</actionGroup>
126+
<dontSeeElement selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="dontSeeButtonOnDownloadableProductPage"/>
127+
<!-- Bundle Product -->
128+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openBundleProductPage">
129+
<argument name="product" value="$createBundleProduct$"/>
130+
</actionGroup>
131+
<waitForElementVisible selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="waitForCustomizeAndAddToCartButton"/>
132+
<click selector="{{StorefrontBundleProductActionSection.customizeAndAddToCartButton}}" stepKey="clickCustomizeAndAddToCart"/>
133+
<waitForPageLoad stepKey="waitForBundleProductPageLoad"/>
134+
<dontSeeElement selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="dontSeeButtonOnBundleProductPage"/>
135+
<!-- Grouped product -->
136+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openGroupedProductPage">
137+
<argument name="product" value="$createGroupedProduct$"/>
138+
</actionGroup>
139+
<dontSeeElement selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="dontSeeButtonOnGroupedProductPage"/>
140+
<!-- Configurable Product -->
141+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openConfigurableProductPage">
142+
<argument name="product" value="$createConfigProductCreateConfigurableProduct$"/>
143+
</actionGroup>
144+
<dontSeeElement selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="dontSeeButtonOnConfigurableProductPage"/>
145+
<!-- 3. Log in as a customer without address -->
146+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerWithoutAddressLoginToStorefront">
147+
<argument name="Customer" value="$customerWithoutAddress$"/>
148+
</actionGroup>
149+
<!-- 4. Browse simple product page and check that Instant Purchase button does not show up -->
150+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openSimpleProductPageAgain">
151+
<argument name="product" value="$createSimpleProduct$"/>
152+
</actionGroup>
153+
<dontSeeElement selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="dontSeeButtonOnSimpleProductPageAgain"/>
154+
<!-- 5. Log in as a customer with address -->
155+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomerWithoutAddress"/>
156+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerWithAddressLoginToStorefront">
157+
<argument name="Customer" value="$customerWithAddress$"/>
158+
</actionGroup>
159+
<!-- 6. Browse simple product page and check that Instant Purchase button does not show up -->
160+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openSimpleProductPageOneMoreTime">
161+
<argument name="product" value="$createSimpleProduct$"/>
162+
</actionGroup>
163+
<dontSeeElement selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="dontSeeButtonOnSimpleProductPageOneMoreTime"/>
164+
<!-- 7. Log in as a customer with default address -->
165+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomerWithAddress"/>
166+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerWithDefaultAddressLoginToStorefront">
167+
<argument name="Customer" value="$customerWithDefaultAddress$"/>
168+
</actionGroup>
169+
<!-- 8. Browse simple product page and check that Instant Purchase button show up -->
170+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openSimpleProductPageForFourthTime">
171+
<argument name="product" value="$createSimpleProduct$"/>
172+
</actionGroup>
173+
<waitForElementVisible selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="waitForInstantPurchaseButton"/>
174+
<!-- 9-10. Configure Braintree Payment Method(without Vault). Configure 3d Secure Verification -->
175+
<magentoCLI command="config:set {{DisableVaultBraintree.path}} {{DisableVaultBraintree.value}}" stepKey="disableVault"/>
176+
<magentoCLI command="config:set {{Enable3DSecureBraintree.path}} {{Enable3DSecureBraintree.value}}" stepKey="enable3DSecureVerification"/>
177+
<!-- New session should be started -->
178+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomerWithAddressAgain"/>
179+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerWithDefaultAddressLoginToStorefrontAgain">
180+
<argument name="Customer" value="$customerWithDefaultAddress$"/>
181+
</actionGroup>
182+
<!-- 11. Browse simple product page and check that Instant Purchase button does not show up -->
183+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openSimpleProductPageForFifthTime">
184+
<argument name="product" value="$createSimpleProduct$"/>
185+
</actionGroup>
186+
<dontSeeElement selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="dontSeeButtonOnSimpleProductPageForFifthTime"/>
187+
<!-- 12. Disable all supported payment methods -->
188+
<createData entity="DefaultBraintreeConfig" stepKey="restoreToDefaultBraintreeConfig"/>
189+
<createData entity="RollBackCustomBraintreeConfigurationData" stepKey="restoreToDefaultBraintreeConfigurationData"/>
190+
<!-- New session should be started -->
191+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomerWithAddressOneMoreTime"/>
192+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerWithDefaultAddressLoginToStorefrontOneMoreTime">
193+
<argument name="Customer" value="$customerWithDefaultAddress$"/>
194+
</actionGroup>
195+
<!-- 13. Browse simple product page and check that Instant Purchase button does not show up -->
196+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openSimpleProductPageForSixthTime">
197+
<argument name="product" value="$createSimpleProduct$"/>
198+
</actionGroup>
199+
<dontSeeElement selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="dontSeeButtonOnSimpleProductPageForSixthTime"/>
200+
<!-- 14. Reenable supported payment method (without 3d secure for Braintree) -->
201+
<magentoCLI command="config:set {{Disable3DSecureBraintree.path}} {{Disable3DSecureBraintree.value}}" stepKey="disable3DSecureVerification"/>
202+
<createData entity="BraintreeConfig" stepKey="reenableBraintreePayment"/>
203+
<createData entity="CustomBraintreeConfigurationData" stepKey="reenableBraintreeAndVault"/>
204+
<!-- New session should be started -->
205+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomerWithAddressForFourthTime"/>
206+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerWithDefaultAddressLoginToStorefrontFinalTime">
207+
<argument name="Customer" value="$customerWithDefaultAddress$"/>
208+
</actionGroup>
209+
<!-- 15. Browse simple product page and check that Instant Purchase button show up -->
210+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openSimpleProductPageForSeventhTime">
211+
<argument name="product" value="$createSimpleProduct$"/>
212+
</actionGroup>
213+
<waitForElementVisible selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="waitForInstantPurchaseButtonAgain"/>
214+
<!-- 16. Disable shipping method for customer with default address -->
215+
<magentoCLI command="config:set {{DisableFlatRateConfigData.path}} {{DisableFlatRateConfigData.value}}" stepKey="disableFlatRate"/>
216+
<!-- New session should be started -->
217+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomerWithAddressForFifthTime"/>
218+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerWithDefaultAddressLoginToStorefrontForFifthTime">
219+
<argument name="Customer" value="$customerWithDefaultAddress$"/>
220+
</actionGroup>
221+
<!-- 17. Browse simple product page and check that Instant Purchase button does not show up -->
222+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openSimpleProductPageFinalTime">
223+
<argument name="product" value="$createSimpleProduct$"/>
224+
</actionGroup>
225+
<dontSeeElement selector="{{StorefrontInstantPurchaseSection.instantPurchaseButton}}" stepKey="dontSeeButtonOnSimpleProductPageFinalTime"/>
226+
</test>
227+
</tests>

0 commit comments

Comments
 (0)