Skip to content

Commit 09b16f9

Browse files
committed
Merge branch 'MAGETWO-60572' into MAGETWO-60453
2 parents d3fbc33 + ce7d097 commit 09b16f9

File tree

6 files changed

+128
-2
lines changed

6 files changed

+128
-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-41559">
54+
<data name="products/0" xsi:type="string">catalogProductVirtual::product_50_dollar</data>
55+
<data name="customer/dataset" xsi:type="string">default</data>
56+
<data name="checkoutMethod" xsi:type="string">guest</data>
57+
<data name="prices" xsi:type="array">
58+
<item name="grandTotal" xsi:type="string">50.00</item>
59+
</data>
60+
<data name="payment/method" xsi:type="string">braintree_paypal</data>
61+
<data name="configData" xsi:type="string">braintree, braintree_paypal, braintree_paypal_skip_order_review</data>
62+
<data name="status" xsi:type="string">Processing</data>
63+
<data name="tag" xsi:type="string">test_type:3rd_party_test, severity:S2</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: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
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;
13+
use Magento\Customer\Test\Fixture\Customer;
1214
use Magento\Mtf\TestStep\TestStepInterface;
1315

1416
/**
@@ -26,6 +28,11 @@ class PlaceOrderWithPaypalStep implements TestStepInterface
2628
*/
2729
private $assertGrandTotalOrderReview;
2830

31+
/**
32+
* @var AssertBillingAddressAbsentInPayment
33+
*/
34+
private $assertBillingAddressAbsentInPayment;
35+
2936
/**
3037
* @var CheckoutOnepageSuccess
3138
*/
@@ -46,28 +53,64 @@ class PlaceOrderWithPaypalStep implements TestStepInterface
4653
*/
4754
private $products;
4855

56+
/**
57+
* Customer fixture.
58+
*
59+
* @var Customer
60+
*/
61+
protected $customer;
62+
63+
/**
64+
* Checkout method.
65+
*
66+
* @var string
67+
*/
68+
protected $checkoutMethod;
69+
70+
/**
71+
* Shipping carrier and method.
72+
*
73+
* @var array
74+
*/
75+
protected $shipping;
76+
4977
/**
5078
* @param CheckoutOnepage $checkoutOnepage
5179
* @param AssertGrandTotalOrderReview $assertGrandTotalOrderReview
80+
* @param AssertBillingAddressAbsentInPayment $assertBillingAddressAbsentInPayment
5281
* @param CheckoutOnepageSuccess $checkoutOnepageSuccess
5382
* @param FixtureFactory $fixtureFactory
83+
* @param Customer $customer
84+
* @param string $checkoutMethod
5485
* @param array $products
5586
* @param array $prices
87+
* @param array $shipping
88+
*
5689
*/
5790
public function __construct(
5891
CheckoutOnepage $checkoutOnepage,
5992
AssertGrandTotalOrderReview $assertGrandTotalOrderReview,
93+
AssertBillingAddressAbsentInPayment $assertBillingAddressAbsentInPayment,
6094
CheckoutOnepageSuccess $checkoutOnepageSuccess,
6195
FixtureFactory $fixtureFactory,
96+
Customer $customer = null,
97+
$checkoutMethod,
98+
6299
array $products,
63-
array $prices = []
100+
array $prices = [],
101+
array $shipping = []
102+
64103
) {
65104
$this->checkoutOnepage = $checkoutOnepage;
66105
$this->assertGrandTotalOrderReview = $assertGrandTotalOrderReview;
106+
$this->assertBillingAddressAbsentInPayment = $assertBillingAddressAbsentInPayment;
67107
$this->checkoutOnepageSuccess = $checkoutOnepageSuccess;
68108
$this->fixtureFactory = $fixtureFactory;
109+
$this->customer = $customer;
110+
$this->checkoutMethod = $checkoutMethod;
69111
$this->products = $products;
70112
$this->prices = $prices;
113+
$this->shipping = $shipping;
71114
}
72115

73116
/**
@@ -78,6 +121,13 @@ public function run()
78121
if (isset($this->prices['grandTotal'])) {
79122
$this->assertGrandTotalOrderReview->processAssert($this->checkoutOnepage, $this->prices['grandTotal']);
80123
}
124+
125+
$this->assertBillingAddressAbsentInPayment->processAssert($this->checkoutOnepage);
126+
127+
if ($this->checkoutMethod === 'guest' && empty($this->shipping)) {
128+
$this->checkoutOnepage->getLoginBlock()->fillGuestFields($this->customer);
129+
}
130+
81131
$parentWindow = $this->checkoutOnepage->getPaymentBlock()
82132
->getSelectedPaymentMethodBlock()
83133
->clickPayWithPaypal();

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,18 @@ public function loginCustomer(FixtureInterface $customer)
9090
$this->waitForElementNotVisible($this->loadingMask);
9191
}
9292

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

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)