Skip to content

Commit f51164a

Browse files
committed
MC-16371: [FT] CheckoutWithBraintreePaypalMinicartTest fails on Bamboo
1 parent 353322d commit f51164a

File tree

1 file changed

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

1 file changed

+10
-2
lines changed

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

Lines changed: 10 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,16 @@ 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(function () use ($browser, $windowsCount) {
135+
return count($browser->getWindowHandles()) === ($windowsCount + 1) ? true: null;
136+
});
129137
}
130138

131139
/**

0 commit comments

Comments
 (0)