Skip to content

Commit 2f31299

Browse files
committed
MAGETWO-52478: CreateOnlineCreditMemoBraintreePaypalTest is failing on closing popup window
1 parent 04795a6 commit 2f31299

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
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/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/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)