Skip to content

Commit 8cbe126

Browse files
MAGETWO-71675: Customer can't see available Payment Method for specific country
1 parent 84c7cd8 commit 8cbe126

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,28 @@
104104
<seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/>
105105
</actionGroup>
106106

107+
<!-- Logged in user checkout filling shipping section -->
108+
<actionGroup name="LoggedInUserCheckoutAddNewShippingSectionWithoutRegionActionGroup">
109+
<arguments>
110+
<argument name="customerVar"/>
111+
<argument name="customerAddressVar"/>
112+
</arguments>
113+
<fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{customerVar.firstname}}" stepKey="enterFirstName"/>
114+
<fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{customerVar.lastname}}" stepKey="enterLastName"/>
115+
<fillField selector="{{CheckoutShippingSection.street}}" userInput="{{customerAddressVar.street[0]}}" stepKey="enterStreet"/>
116+
<fillField selector="{{CheckoutShippingSection.city}}" userInput="{{customerAddressVar.city}}" stepKey="enterCity"/>
117+
<fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{customerAddressVar.postcode}}" stepKey="enterPostcode"/>
118+
<selectOption selector="{{CheckoutShippingSection.country}}" userInput="{{customerAddressVar.country_id}}" stepKey="enterCountry"/>
119+
<fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{customerAddressVar.telephone}}" stepKey="enterTelephone"/>
120+
<click selector="{{CheckoutShippingSection.saveAddress}}" stepKey="clickSaveAddress"/>
121+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
122+
<click selector="{{CheckoutShippingSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
123+
<waitForElement selector="{{CheckoutShippingSection.next}}" time="30" stepKey="waitForNextButton"/>
124+
<click selector="{{CheckoutShippingSection.next}}" stepKey="clickNext"/>
125+
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" time="30" stepKey="waitForPaymentSectionLoaded"/>
126+
<seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/>
127+
</actionGroup>
128+
107129
<!-- Check product in checkout cart items -->
108130
<actionGroup name="CheckProductInCheckoutCartItemsActionGroup">
109131
<arguments>

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,4 +193,69 @@
193193
<waitForPageLoad stepKey="waitForOrderSuccessPage2"/>
194194
<see stepKey="seeSuccessMessage2" selector="{{CheckoutSuccessMainSection.success}}" userInput="Your order number is:" />
195195
</test>
196+
<test name="StorefrontCustomerCheckoutTestWithRestrictedCountriesForPayment">
197+
<annotations>
198+
<features value="Checkout"/>
199+
<stories value="Checkout flow if payment solutions are not available"/>
200+
<title value="Checkout via Customer Checkout with restricted countries for payment"/>
201+
<description value="Should be able to place an order as a Customer with restricted countries for payment."/>
202+
<severity value="CRITICAL"/>
203+
<testCaseId value="MAGETWO-42653"/>
204+
<group value="checkout"/>
205+
</annotations>
206+
<before>
207+
<createData entity="_defaultCategory" stepKey="createCategory"/>
208+
<createData entity="ApiSimpleProduct" stepKey="createProduct">
209+
<requiredEntity createDataKey="createCategory"/>
210+
</createData>
211+
<magentoCLI stepKey="allowSpecificValue" command="config:set payment/checkmo/allowspecific 1" />
212+
<magentoCLI stepKey="specificCountryValue" command="config:set payment/checkmo/specificcountry GB" />
213+
<createData entity="Simple_US_Customer" stepKey="simpleuscustomer"/>
214+
</before>
215+
<after>
216+
<amOnPage url="admin/admin/auth/logout/" stepKey="amOnLogoutPage"/>
217+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
218+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
219+
<magentoCLI stepKey="allowSpecificValue" command="config:set payment/checkmo/allowspecific 0" />
220+
<magentoCLI stepKey="specificCountryValue" command="config:set payment/checkmo/specificcountry ''" />
221+
</after>
222+
<!-- Login as Customer -->
223+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin">
224+
<argument name="Customer" value="$$simpleuscustomer$$" />
225+
</actionGroup>
226+
227+
<!-- Add product to cart -->
228+
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/>
229+
<waitForPageLoad stepKey="waitForPageLoad1"/>
230+
<moveMouseOver selector="{{StorefrontCategoryMainSection.ProductItemInfo}}" stepKey="hoverProduct"/>
231+
<click selector="{{StorefrontCategoryMainSection.AddToCartBtn}}" stepKey="addToCart"/>
232+
<waitForElementVisible selector="{{StorefrontCategoryMainSection.SuccessMsg}}" time="30" stepKey="waitForProductAdded"/>
233+
<see selector="{{StorefrontCategoryMainSection.SuccessMsg}}" userInput="You added $$createProduct.name$$ to your shopping cart." stepKey="seeAddedToCartMessage"/>
234+
<see selector="{{StorefrontMinicartSection.quantity}}" userInput="1" stepKey="seeCartQuantity"/>
235+
236+
<!-- Go to checkout page -->
237+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="customerGoToCheckoutFromMinicart" />
238+
239+
<!-- Select address -->
240+
<click stepKey="selectAddress" selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}"/>
241+
<waitForElement stepKey="waitNextButton" selector="{{CheckoutShippingMethodsSection.next}}" time="30"/>
242+
<click stepKey="clickNextButton" selector="{{CheckoutShippingMethodsSection.next}}" />
243+
<waitForPageLoad stepKey="waitBillingForm"/>
244+
<seeInCurrentUrl url="{{CheckoutPage.url}}/#payment" stepKey="assertCheckoutPaymentUrl"/>
245+
<waitForElementVisible selector="{{CheckoutPaymentSection.noQuotes}}" stepKey="waitMessage"/>
246+
<see userInput="No Payment method available." stepKey="checkMessage"/>
247+
248+
<!-- Fill UK Address and verify that payment available and checkout successful -->
249+
<click selector="{{CheckoutHeaderSection.shippingMethodStep}}" stepKey="goToShipping" />
250+
<click selector="{{CheckoutShippingSection.newAddressButton}}" stepKey="fillNewAddress" />
251+
<actionGroup ref="LoggedInUserCheckoutAddNewShippingSectionWithoutRegionActionGroup" stepKey="customerCheckoutFillingShippingSectionUK">
252+
<argument name="customerVar" value="CustomerEntityOne" />
253+
<argument name="customerAddressVar" value="UK_Not_Default_Address" />
254+
</actionGroup>
255+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="customerSelectCheckMoneyOrderPayment" />
256+
<actionGroup ref="CheckoutPlaceOrderActionGroup" stepKey="customerPlaceorder">
257+
<argument name="orderNumberMessage" value="CONST.successCheckoutOrderNumberMessage" />
258+
<argument name="emailYouMessage" value="CONST.successCheckoutEmailYouMessage" />
259+
</actionGroup>
260+
</test>
196261
</tests>

0 commit comments

Comments
 (0)