Skip to content

Commit fe0bcdd

Browse files
author
OlgaVasyltsun
committed
Merge remote-tracking branch 'origin/MC-16371' into 2.3-develop-pr53
2 parents 7120c6e + 8353229 commit fe0bcdd

File tree

1 file changed

+12
-2
lines changed
  • dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart

1 file changed

+12
-2
lines changed

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Sidebar extends Block
3434
*
3535
* @var string
3636
*/
37-
protected $braintreePaypalCheckoutButton = './/button[contains(@id, "braintree-paypal-mini-cart")]';
37+
protected $braintreePaypalCheckoutButton = 'button[id^="braintree-paypal-mini-cart"]';
3838

3939
/**
4040
* Locator value for "Proceed to Checkout" button.
@@ -124,8 +124,18 @@ public function openMiniCart()
124124
*/
125125
public function clickBraintreePaypalButton()
126126
{
127-
$this->_rootElement->find($this->braintreePaypalCheckoutButton, Locator::SELECTOR_XPATH)
127+
// Button can be enabled/disabled few times.
128+
sleep(3);
129+
130+
$windowsCount = count($this->browser->getWindowHandles());
131+
$this->_rootElement->find($this->braintreePaypalCheckoutButton)
128132
->click();
133+
$browser = $this->browser;
134+
$this->browser->waitUntil(
135+
function () use ($browser, $windowsCount) {
136+
return count($browser->getWindowHandles()) === ($windowsCount + 1) ? true: null;
137+
}
138+
);
129139
}
130140

131141
/**

0 commit comments

Comments
 (0)