Skip to content

Commit 1878a64

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-72466' into 2.1-develop-pr33
2 parents 0ad7b15 + 29dda2f commit 1878a64

File tree

7 files changed

+108
-2
lines changed

7 files changed

+108
-2
lines changed

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ define([
296296
getShippingAddress: function () {
297297
var address = quote.shippingAddress();
298298

299-
if (address.postcode === null) {
299+
if (_.isNull(address.postcode) || _.isUndefined(address.postcode)) {
300300

301301
return {};
302302
}

dev/tests/functional/tests/app/Magento/Braintree/Test/TestCase/OnePageCheckoutWithBraintreePaypalTest.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,21 @@
5050
<constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" />
5151
<constraint name="Magento\Sales\Test\Constraint\AssertCaptureInCommentsHistory" />
5252
</variation>
53+
<variation name="OnePageCheckoutWithBraintreePaypalTestVariation3" summary="Guest Checkout virtual quote with Braintree PayPal from Cart" ticketId="MAGETWO-80083">
54+
<data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S2</data>
55+
<data name="products/0" xsi:type="string">catalogProductVirtual::product_50_dollar</data>
56+
<data name="customer/dataset" xsi:type="string">default</data>
57+
<data name="checkoutMethod" xsi:type="string">guest</data>
58+
<data name="prices" xsi:type="array">
59+
<item name="grandTotal" xsi:type="string">50.00</item>
60+
</data>
61+
<data name="payment/method" xsi:type="string">braintree_paypal</data>
62+
<data name="configData" xsi:type="string">braintree, braintree_paypal, braintree_paypal_skip_order_review</data>
63+
<data name="status" xsi:type="string">Processing</data>
64+
<constraint name="Magento\Checkout\Test\Constraint\AssertOrderSuccessPlacedMessage" />
65+
<constraint name="Magento\Sales\Test\Constraint\AssertOrderGrandTotal" />
66+
<constraint name="Magento\Sales\Test\Constraint\AssertOrderStatusIsCorrect" />
67+
<constraint name="Magento\Sales\Test\Constraint\AssertAuthorizationInCommentsHistory" />
68+
</variation>
5369
</testCase>
5470
</config>

dev/tests/functional/tests/app/Magento/Braintree/Test/TestStep/PlaceOrderWithPaypalStep.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Braintree\Test\TestStep;
77

88
use Magento\Checkout\Test\Constraint\AssertGrandTotalOrderReview;
9+
use Magento\Checkout\Test\Constraint\AssertBillingAddressAbsentInPayment;
910
use Magento\Checkout\Test\Page\CheckoutOnepage;
1011
use Magento\Checkout\Test\Page\CheckoutOnepageSuccess;
1112
use Magento\Mtf\Fixture\FixtureFactory;
@@ -26,6 +27,11 @@ class PlaceOrderWithPaypalStep implements TestStepInterface
2627
*/
2728
private $assertGrandTotalOrderReview;
2829

30+
/**
31+
* @var AssertBillingAddressAbsentInPayment
32+
*/
33+
private $assertBillingAddressAbsentInPayment;
34+
2935
/**
3036
* @var CheckoutOnepageSuccess
3137
*/
@@ -49,6 +55,7 @@ class PlaceOrderWithPaypalStep implements TestStepInterface
4955
/**
5056
* @param CheckoutOnepage $checkoutOnepage
5157
* @param AssertGrandTotalOrderReview $assertGrandTotalOrderReview
58+
* @param AssertBillingAddressAbsentInPayment $assertBillingAddressAbsentInPayment
5259
* @param CheckoutOnepageSuccess $checkoutOnepageSuccess
5360
* @param FixtureFactory $fixtureFactory
5461
* @param array $products
@@ -57,13 +64,15 @@ class PlaceOrderWithPaypalStep implements TestStepInterface
5764
public function __construct(
5865
CheckoutOnepage $checkoutOnepage,
5966
AssertGrandTotalOrderReview $assertGrandTotalOrderReview,
67+
AssertBillingAddressAbsentInPayment $assertBillingAddressAbsentInPayment,
6068
CheckoutOnepageSuccess $checkoutOnepageSuccess,
6169
FixtureFactory $fixtureFactory,
6270
array $products,
6371
array $prices = []
6472
) {
6573
$this->checkoutOnepage = $checkoutOnepage;
6674
$this->assertGrandTotalOrderReview = $assertGrandTotalOrderReview;
75+
$this->assertBillingAddressAbsentInPayment = $assertBillingAddressAbsentInPayment;
6776
$this->checkoutOnepageSuccess = $checkoutOnepageSuccess;
6877
$this->fixtureFactory = $fixtureFactory;
6978
$this->products = $products;
@@ -78,6 +87,9 @@ public function run()
7887
if (isset($this->prices['grandTotal'])) {
7988
$this->assertGrandTotalOrderReview->processAssert($this->checkoutOnepage, $this->prices['grandTotal']);
8089
}
90+
91+
$this->assertBillingAddressAbsentInPayment->processAssert($this->checkoutOnepage);
92+
8193
$parentWindow = $this->checkoutOnepage->getPaymentBlock()
8294
->getSelectedPaymentMethodBlock()
8395
->clickPayWithPaypal();

dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Login.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ class Login extends Form
4949
*/
5050
protected $loadingMask = '.loading-mask';
5151

52+
/**
53+
* Selector for checkout email input.
54+
*
55+
* @var string
56+
*/
57+
private $emailSelector = '[name="username"]';
58+
5259
/**
5360
* Select how to perform checkout whether guest or registered customer.
5461
*
@@ -90,6 +97,18 @@ public function loginCustomer(FixtureInterface $customer)
9097
$this->waitForElementNotVisible($this->loadingMask);
9198
}
9299

100+
/**
101+
* Fill required fields for guest checkout.
102+
*
103+
* @param FixtureInterface $customer
104+
* @return void
105+
*/
106+
public function fillGuestFields(FixtureInterface $customer)
107+
{
108+
$this->_rootElement->find($this->emailSelector)
109+
->setValue($customer->getEmail());
110+
}
111+
93112
/**
94113
* Click continue on checkout method block.
95114
*
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Checkout\Test\Constraint;
7+
8+
use Magento\Checkout\Test\Page\CheckoutOnepage;
9+
use Magento\Mtf\Constraint\AbstractConstraint;
10+
11+
/**
12+
* Assert billing address is not present in selected payment method.
13+
*/
14+
class AssertBillingAddressAbsentInPayment extends AbstractConstraint
15+
{
16+
/**
17+
* Assert billing address is not present in selected payment method.
18+
*
19+
* @param CheckoutOnepage $checkoutOnepage
20+
* @return void
21+
*/
22+
public function processAssert(CheckoutOnepage $checkoutOnepage)
23+
{
24+
\PHPUnit_Framework_Assert::assertFalse(
25+
$checkoutOnepage->getPaymentBlock()
26+
->getSelectedPaymentMethodBlock()
27+
->getBillingBlock()
28+
->isVisible(),
29+
'Billing address is present in payment method'
30+
);
31+
}
32+
33+
/**
34+
* Returns string representation of successful assertion.
35+
*
36+
* @return string
37+
*/
38+
public function toString()
39+
{
40+
return 'Billing address is absent in payment method';
41+
}
42+
}

dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,33 @@ class SelectCheckoutMethodStep implements TestStepInterface
4444
*/
4545
protected $logoutCustomerOnFrontend;
4646

47+
/**
48+
* Shipping carrier and method.
49+
*
50+
* @var array
51+
*/
52+
private $shipping;
53+
4754
/**
4855
* @constructor
4956
* @param CheckoutOnepage $checkoutOnepage
5057
* @param Customer $customer
5158
* @param LogoutCustomerOnFrontendStep $logoutCustomerOnFrontend
5259
* @param string $checkoutMethod
60+
* @param array $shipping
5361
*/
5462
public function __construct(
5563
CheckoutOnepage $checkoutOnepage,
5664
Customer $customer,
5765
LogoutCustomerOnFrontendStep $logoutCustomerOnFrontend,
58-
$checkoutMethod
66+
$checkoutMethod,
67+
array $shipping = []
5968
) {
6069
$this->checkoutOnepage = $checkoutOnepage;
6170
$this->customer = $customer;
6271
$this->logoutCustomerOnFrontend = $logoutCustomerOnFrontend;
6372
$this->checkoutMethod = $checkoutMethod;
73+
$this->shipping = $shipping;
6474
}
6575

6676
/**
@@ -72,6 +82,8 @@ public function run()
7282
{
7383
if ($this->checkoutMethod === 'login') {
7484
$this->checkoutOnepage->getLoginBlock()->loginCustomer($this->customer);
85+
} elseif (($this->checkoutMethod === 'guest') && empty($this->shipping)) {
86+
$this->checkoutOnepage->getLoginBlock()->fillGuestFields($this->customer);
7587
}
7688
}
7789

dev/tests/functional/tests/app/Magento/Checkout/Test/etc/di.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,9 @@
1111
<argument name="severity" xsi:type="string">middle</argument>
1212
</arguments>
1313
</type>
14+
<type name="Magento\Checkout\Test\Constraint\AssertBillingAddressAbsentInPayment">
15+
<arguments>
16+
<argument name="severity" xsi:type="string">S2</argument>
17+
</arguments>
18+
</type>
1419
</config>

0 commit comments

Comments
 (0)