Skip to content

Commit 5ce5f82

Browse files
committed
MAGETWO-67106: Unstable Automated test Magento\Paypal\Test\TestCase\InContextExpressCheckoutFromShoppingCartTest failed on variation InContextExpressCheckoutFromShoppingCartTestVariation1
1 parent 9cc1162 commit 5ce5f82

File tree

8 files changed

+14
-37
lines changed

8 files changed

+14
-37
lines changed

app/code/Magento/Paypal/Block/Express/InContext/Minicart/Button.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Button extends Template implements ShortcutInterface
2626

2727
const BUTTON_ELEMENT_INDEX = 'button_id';
2828

29-
const BUTTON_ELEMENT_CLASS_NAME = 'button_class';
29+
const LINK_DATA_ACTION = 'link_data_action';
3030

3131
const CART_BUTTON_ELEMENT_INDEX = 'add_to_cart_selector';
3232

@@ -137,9 +137,9 @@ public function getContainerId()
137137
/**
138138
* @return string
139139
*/
140-
public function getButtonClassName()
140+
public function getLinkAction()
141141
{
142-
return $this->getData(self::BUTTON_ELEMENT_CLASS_NAME);
142+
return $this->getData(self::LINK_DATA_ACTION);
143143
}
144144

145145
/**

app/code/Magento/Paypal/etc/frontend/di.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
<item name="template" xsi:type="string">Magento_Paypal::express/in-context/shortcut/button.phtml</item>
9393
<item name="alias" xsi:type="string">paypal.express-in-context.mini-cart</item>
9494
<item name="button_id" xsi:type="string">paypal-express-in-context-mini-cart</item>
95-
<item name="button_class" xsi:type="string">paypal-express-in-context-checkout</item>
95+
<item name="link_data_action" xsi:type="string">paypal-in-context-checkout</item>
9696
</argument>
9797
<argument name="payment" xsi:type="object">Magento\Paypal\Model\Express</argument>
9898
</arguments>

app/code/Magento/Paypal/view/frontend/templates/express/in-context/shortcut/button.phtml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ use Magento\Paypal\Block\Express\InContext\Minicart\Button;
1111
*/
1212
$config = [
1313
'Magento_Paypal/js/in-context/button' => [
14-
'id' => $block->getContainerId(),
15-
'paypalButtonClass' => $block->getButtonClassName(),
16-
'paypalButton' => Button::PAYPAL_BUTTON_ID,
17-
'addToCartSelector' => $block->getAddToCartSelector()
14+
'id' => $block->escapeHtml($block->getContainerId()),
15+
'linkDataAction' => $block->escapeHtml($block->getLinkAction()),
16+
'paypalButton' => $block->escapeHtml(Button::PAYPAL_BUTTON_ID),
17+
'addToCartSelector' => $block->escapeHtml($block->getAddToCartSelector())
1818
]
1919
];
2020

2121
?>
2222
<div data-mage-init='<?php /* @noEscape */ echo json_encode($config); ?>'
23-
class="paypal checkout paypal-logo <?php /* @noEscape */ echo $block->getContainerId(); ?>-container">
24-
<a class="<?php /* @noEscape */ echo $block->getButtonClassName(); ?>" href="#">
23+
class="paypal checkout paypal-logo <?php echo $block->escapeHtml($block->getContainerId()); ?>-container">
24+
<a data-action="<?php echo $block->escapeHtml($block->getLinkAction()); ?>" href="#">
2525
<img class="paypal-button-hidden"
26-
src="<?php /* @noEscape */ echo $block->getImageUrl() ?>"
26+
src="<?php echo $block->escapeHtml($block->getImageUrl()); ?>"
2727
alt="Check out with PayPal" />
2828
</a>
2929
</div>

app/code/Magento/Paypal/view/frontend/web/js/in-context/button.js

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
define(
66
[
77
'uiComponent',
8-
'Magento_Checkout/js/model/quote',
98
'jquery',
109
'domReady!'
1110
],
1211
function (
1312
Component,
14-
quote,
1513
$
1614
) {
1715
return Component.extend({
@@ -31,25 +29,12 @@ define(
3129
* @returns {Object}
3230
*/
3331
initEvents: function () {
34-
35-
$('.' + this.paypalButtonClass).off('click.' + this.id)
32+
$('a[data-action="' + this.linkDataAction + '"]').off('click.' + this.id)
3633
.on('click.' + this.id, this.click.bind(this));
3734

38-
quote.totals.subscribe(function (newValue) {
39-
// TODO: check for value
40-
this.showLink();
41-
}, this);
42-
4335
return this;
4436
},
4537

46-
/**
47-
* Display PayPal in-context checkout link
48-
*/
49-
showLink: function() {
50-
$('.' + this.paypalButtonClass).show();
51-
},
52-
5338
/**
5439
* @param {Object} event
5540
* @returns void

app/design/frontend/Magento/blank/Magento_Paypal/web/css/source/module/_paypal-button.less

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,4 @@
5353
&:extend(.abs-action-button-as-link all);
5454
}
5555
}
56-
57-
.paypal-express-in-context-checkout {
58-
display: none;
59-
}
6056
}

app/design/frontend/Magento/luma/Magento_Paypal/web/css/source/module/_paypal-button.less

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,4 @@
4949
&:extend(.abs-action-button-as-link all);
5050
}
5151
}
52-
53-
.paypal-express-in-context-checkout {
54-
display: none;
55-
}
5652
}

dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Product/View.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class View extends AbstractConfigureBlock
6868
*
6969
* @var string
7070
*/
71-
protected $inContextPaypalCheckout = '#paypal-express-in-context-mini-cart';
71+
protected $inContextPaypalCheckout = 'ul.checkout-methods-items a[data-action="paypal-in-context-checkout"]';
7272

7373
/**
7474
* Product name element.

dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class Cart extends Block
6262
*
6363
* @var string
6464
*/
65-
protected $inContextPaypalCheckoutButton = 'ul.checkout-methods-items a.paypal-express-in-context-checkout';
65+
protected $inContextPaypalCheckoutButton = 'ul.checkout-methods-items a[data-action="paypal-express-in-context-checkout"]';
6666

6767
/**
6868
* Locator value for "Check out with Braintree PayPal" button.

0 commit comments

Comments
 (0)