Skip to content

Commit 18cbf02

Browse files
committed
Merge remote-tracking branch 'mpi/MAGETWO-52478' into MPI-PR-3005
2 parents a10478e + 463e25a commit 18cbf02

File tree

8 files changed

+35
-22
lines changed

8 files changed

+35
-22
lines changed

dev/tests/functional/tests/app/Magento/Braintree/Test/Block/Paypal/PopupWindow.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,15 @@ public function waitForFormLoaded()
4040
/**
4141
* Process PayPal auth flow
4242
*
43-
* @return void
43+
* @param null|string $parentWindow
44+
*
4445
*/
45-
public function process()
46+
public function process($parentWindow = null)
4647
{
4748
$this->browser->selectWindow();
4849
$this->waitForFormLoaded();
4950
$this->browser->find($this->submitButton)->click();
50-
/**
51-
* This try/catch is intended as workaround in case if popup window is closed instantly and #login-preview
52-
* selector cannot be found.
53-
*/
54-
try {
55-
$this->waitForElementNotVisible($this->selector);
56-
} catch (\PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
57-
}
58-
$this->browser->selectWindow();
51+
$this->browser->selectWindow($parentWindow);
5952
$this->waitForElementNotVisible($this->loader);
6053
}
6154
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ public function __construct(CheckoutCart $checkoutCart)
3737
public function run()
3838
{
3939
$this->checkoutCart->open();
40-
$this->checkoutCart->getCartBlock()
40+
$this->checkoutCart->getTotalsBlock()->waitForUpdatedTotals();
41+
$currentWindow = $this->checkoutCart->getCartBlock()
4142
->braintreePaypalCheckout();
42-
$this->checkoutCart->getBraintreePaypalBlock()->process();
43+
$this->checkoutCart->getBraintreePaypalBlock()->process($currentWindow);
4344
}
4445
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function run()
6161
{
6262
$product = reset($this->products);
6363
$this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
64-
$this->catalogProductView->getViewBlock()->braintreePaypalCheckout();
65-
$this->catalogProductView->getBraintreePaypalBlock()->process();
64+
$parentWindow = $this->catalogProductView->getViewBlock()->braintreePaypalCheckout();
65+
$this->catalogProductView->getBraintreePaypalBlock()->process($parentWindow);
6666
}
6767
}

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,11 @@ public function run()
7878
if (isset($this->prices['grandTotal'])) {
7979
$this->assertGrandTotalOrderReview->processAssert($this->checkoutOnepage, $this->prices['grandTotal']);
8080
}
81-
$this->checkoutOnepage->getPaymentBlock()->getSelectedPaymentMethodBlock()->clickPlaceOrder();
82-
$this->checkoutOnepage->getBraintreePaypalBlock()->process();
81+
$parentWindow = $this->checkoutOnepage->getPaymentBlock()
82+
->getSelectedPaymentMethodBlock()
83+
->clickContinueToPaypal();
84+
$this->checkoutOnepage->getBraintreePaypalBlock()->process($parentWindow);
85+
8386
$order = $this->fixtureFactory->createByCode(
8487
'orderInjectable',
8588
[

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,12 @@ public function inContextPaypalCheckout()
302302

303303
/**
304304
* Press 'Check out with Braintree PayPal' button.
305-
*
306-
* @return void
305+
*
306+
* @return string
307307
*/
308308
public function braintreePaypalCheckout()
309309
{
310+
$currentWindow = $this->browser->getCurrentWindow();
310311
/** @var \Magento\Checkout\Test\Block\Cart\Sidebar $miniCart */
311312
$miniCart = $this->blockFactory->create(
312313
'\Magento\Checkout\Test\Block\Cart\Sidebar',
@@ -315,6 +316,7 @@ public function braintreePaypalCheckout()
315316

316317
$miniCart->openMiniCart();
317318
$miniCart->clickBraintreePaypalButton();
319+
return $currentWindow;
318320
}
319321

320322
/**

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,14 @@ public function getOnepageLinkBlock()
152152
/**
153153
* Click "Check out with Braintree PayPal" button.
154154
*
155-
* @return void
155+
* @return string
156156
*/
157157
public function braintreePaypalCheckout()
158158
{
159+
$currentWindow = $this->browser->getCurrentWindow();
159160
$this->_rootElement->find($this->braintreePaypalCheckoutButton, Locator::SELECTOR_XPATH)
160161
->click();
162+
return $currentWindow;
161163
}
162164

163165
/**

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,7 @@ public function isVisibleShippingPriceBlock()
247247
*/
248248
public function waitForUpdatedTotals()
249249
{
250-
// Code under may use JavaScript delay at this point as well.
251-
sleep(1);
250+
$this->waitForElementVisible($this->blockWaitElement);
252251
$this->waitForElementNotVisible($this->blockWaitElement);
253252
}
254253

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,19 @@ public function clickPlaceOrder()
7070
$this->waitForElementNotVisible($this->waitElement);
7171
}
7272

73+
/**
74+
* Click Continue to Paypal button.
75+
*
76+
* @return string
77+
*/
78+
public function clickContinueToPaypal()
79+
{
80+
$currentWindow = $this->browser->getCurrentWindow();
81+
$this->_rootElement->find($this->placeOrderButton)->click();
82+
$this->waitForElementNotVisible($this->waitElement);
83+
return $currentWindow;
84+
}
85+
7386
/**
7487
* Click "Check out with PayPal" button.
7588
*/

0 commit comments

Comments
 (0)