File tree Expand file tree Collapse file tree 8 files changed +35
-22
lines changed
dev/tests/functional/tests/app/Magento
Catalog/Test/Block/Product Expand file tree Collapse file tree 8 files changed +35
-22
lines changed Original file line number Diff line number Diff line change @@ -40,22 +40,15 @@ public function waitForFormLoaded()
40
40
/**
41
41
* Process PayPal auth flow
42
42
*
43
- * @return void
43
+ * @param null|string $parentWindow
44
+ *
44
45
*/
45
- public function process ()
46
+ public function process ($ parentWindow = null )
46
47
{
47
48
$ this ->browser ->selectWindow ();
48
49
$ this ->waitForFormLoaded ();
49
50
$ 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 );
59
52
$ this ->waitForElementNotVisible ($ this ->loader );
60
53
}
61
54
}
Original file line number Diff line number Diff line change @@ -37,8 +37,9 @@ public function __construct(CheckoutCart $checkoutCart)
37
37
public function run ()
38
38
{
39
39
$ this ->checkoutCart ->open ();
40
- $ this ->checkoutCart ->getCartBlock ()
40
+ $ this ->checkoutCart ->getTotalsBlock ()->waitForUpdatedTotals ();
41
+ $ currentWindow = $ this ->checkoutCart ->getCartBlock ()
41
42
->braintreePaypalCheckout ();
42
- $ this ->checkoutCart ->getBraintreePaypalBlock ()->process ();
43
+ $ this ->checkoutCart ->getBraintreePaypalBlock ()->process ($ currentWindow );
43
44
}
44
45
}
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ public function run()
61
61
{
62
62
$ product = reset ($ this ->products );
63
63
$ 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 );
66
66
}
67
67
}
Original file line number Diff line number Diff line change @@ -78,8 +78,11 @@ public function run()
78
78
if (isset ($ this ->prices ['grandTotal ' ])) {
79
79
$ this ->assertGrandTotalOrderReview ->processAssert ($ this ->checkoutOnepage , $ this ->prices ['grandTotal ' ]);
80
80
}
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
+
83
86
$ order = $ this ->fixtureFactory ->createByCode (
84
87
'orderInjectable ' ,
85
88
[
Original file line number Diff line number Diff line change @@ -302,11 +302,12 @@ public function inContextPaypalCheckout()
302
302
303
303
/**
304
304
* Press 'Check out with Braintree PayPal' button.
305
- *
306
- * @return void
305
+ *
306
+ * @return string
307
307
*/
308
308
public function braintreePaypalCheckout ()
309
309
{
310
+ $ currentWindow = $ this ->browser ->getCurrentWindow ();
310
311
/** @var \Magento\Checkout\Test\Block\Cart\Sidebar $miniCart */
311
312
$ miniCart = $ this ->blockFactory ->create (
312
313
'\Magento\Checkout\Test\Block\Cart\Sidebar ' ,
@@ -315,6 +316,7 @@ public function braintreePaypalCheckout()
315
316
316
317
$ miniCart ->openMiniCart ();
317
318
$ miniCart ->clickBraintreePaypalButton ();
319
+ return $ currentWindow ;
318
320
}
319
321
320
322
/**
Original file line number Diff line number Diff line change @@ -152,12 +152,14 @@ public function getOnepageLinkBlock()
152
152
/**
153
153
* Click "Check out with Braintree PayPal" button.
154
154
*
155
- * @return void
155
+ * @return string
156
156
*/
157
157
public function braintreePaypalCheckout ()
158
158
{
159
+ $ currentWindow = $ this ->browser ->getCurrentWindow ();
159
160
$ this ->_rootElement ->find ($ this ->braintreePaypalCheckoutButton , Locator::SELECTOR_XPATH )
160
161
->click ();
162
+ return $ currentWindow ;
161
163
}
162
164
163
165
/**
Original file line number Diff line number Diff line change @@ -247,8 +247,7 @@ public function isVisibleShippingPriceBlock()
247
247
*/
248
248
public function waitForUpdatedTotals ()
249
249
{
250
- // Code under may use JavaScript delay at this point as well.
251
- sleep (1 );
250
+ $ this ->waitForElementVisible ($ this ->blockWaitElement );
252
251
$ this ->waitForElementNotVisible ($ this ->blockWaitElement );
253
252
}
254
253
Original file line number Diff line number Diff line change @@ -70,6 +70,19 @@ public function clickPlaceOrder()
70
70
$ this ->waitForElementNotVisible ($ this ->waitElement );
71
71
}
72
72
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
+
73
86
/**
74
87
* Click "Check out with PayPal" button.
75
88
*/
You can’t perform that action at this time.
0 commit comments