File tree Expand file tree Collapse file tree 5 files changed +39
-14
lines changed
dev/tests/functional/tests/app/Magento
Paypal/Test/Block/Onepage/Payment Expand file tree Collapse file tree 5 files changed +39
-14
lines changed Original file line number Diff line number Diff line change 6
6
7
7
namespace Magento \Paypal \Test \Block \Onepage \Payment ;
8
8
9
+ use Magento \Mtf \Client \ElementInterface ;
10
+
9
11
/**
10
12
* Hosted Pro credit card block.
11
13
*/
@@ -17,4 +19,12 @@ class HostedPro extends PaypalIframe
17
19
* @var string
18
20
*/
19
21
protected $ formBlockCc = \Magento \Paypal \Test \Block \Form \HostedPro \Cc::class;
22
+
23
+ /**
24
+ * {@inheritdoc}
25
+ */
26
+ protected function waitSubmitForm (ElementInterface $ iframeRootElement )
27
+ {
28
+ // This method is empty because Selenium is blocking current click operation.
29
+ }
20
30
}
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ class PaypalIframe extends Method
54
54
*
55
55
* @var string
56
56
*/
57
- private $ loader = '#lightBoxDiv ' ;
57
+ protected $ loader = '#lightBoxDiv ' ;
58
58
59
59
/**
60
60
* Fill credit card data in PayPal iframe form.
@@ -72,6 +72,19 @@ public function fillPaymentData(FixtureInterface $creditCard)
72
72
$ formBlock ->fill ($ creditCard , $ iframeRootElement );
73
73
$ iframeRootElement ->find ($ this ->payNowButton )->click ();
74
74
75
+ $ this ->waitSubmitForm ($ iframeRootElement );
76
+
77
+ $ this ->browser ->switchToFrame ();
78
+ }
79
+
80
+ /**
81
+ * Wait form submit for that payment.
82
+ *
83
+ * @param ElementInterface $iframeRootElement
84
+ * @return void
85
+ */
86
+ protected function waitSubmitForm (ElementInterface $ iframeRootElement )
87
+ {
75
88
$ loaderElement = $ iframeRootElement ->find ($ this ->loader );
76
89
77
90
$ loaderElement ->waitUntil (function () use ($ loaderElement ) {
@@ -81,8 +94,6 @@ public function fillPaymentData(FixtureInterface $creditCard)
81
94
$ loaderElement ->waitUntil (function () use ($ loaderElement ) {
82
95
return !$ loaderElement ->isVisible () ? true : null ;
83
96
});
84
-
85
- $ this ->browser ->switchToFrame ();
86
97
}
87
98
88
99
/**
Original file line number Diff line number Diff line change @@ -86,11 +86,13 @@ public function run()
86
86
$ refundsData = $ this ->order ->getRefund () !== null ? $ this ->order ->getRefund () : ['refundData ' => []];
87
87
foreach ($ refundsData as $ refundData ) {
88
88
$ this ->salesOrderView ->getPageActions ()->orderCreditMemo ();
89
- $ this ->orderCreditMemoNew ->getFormBlock ()->fillProductData (
90
- $ refundData ,
91
- $ this ->cart ->getItems ()
92
- );
93
- $ this ->orderCreditMemoNew ->getFormBlock ()->updateQty ();
89
+
90
+ $ items = $ this ->cart ->getItems ();
91
+ $ this ->orderCreditMemoNew ->getFormBlock ()->fillProductData ($ refundData , $ items );
92
+ if (!empty ($ refundData ) && count ($ refundData ) !== count ($ items )) {
93
+ $ this ->orderCreditMemoNew ->getFormBlock ()->updateQty ();
94
+ }
95
+
94
96
$ this ->orderCreditMemoNew ->getFormBlock ()->fillFormData ($ refundData );
95
97
$ this ->orderCreditMemoNew ->getFormBlock ()->submit ();
96
98
}
Original file line number Diff line number Diff line change @@ -121,11 +121,13 @@ public function run()
121
121
$ invoicesData = $ this ->order ->getInvoice () !== null ? $ this ->order ->getInvoice () : ['invoiceData ' => []];
122
122
foreach ($ invoicesData as $ invoiceData ) {
123
123
$ this ->salesOrderView ->getPageActions ()->invoice ();
124
- $ this ->orderInvoiceNew ->getFormBlock ()->fillProductData (
125
- $ invoiceData ,
126
- $ this ->cart ->getItems ()
127
- );
128
- $ this ->orderInvoiceNew ->getFormBlock ()->updateQty ();
124
+
125
+ $ items = $ this ->cart ->getItems ();
126
+ $ this ->orderInvoiceNew ->getFormBlock ()->fillProductData ($ invoiceData , $ items );
127
+ if (!empty ($ invoiceData ) && count ($ invoiceData ) !== count ($ items )) {
128
+ $ this ->orderInvoiceNew ->getFormBlock ()->updateQty ();
129
+ }
130
+
129
131
$ this ->orderInvoiceNew ->getFormBlock ()->fillFormData ($ invoiceData );
130
132
$ this ->orderInvoiceNew ->getFormBlock ()->submit ();
131
133
$ shipmentIds = $ this ->getShipmentIds ();
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ public function run()
104
104
105
105
$ items = $ this ->cart ->getItems ();
106
106
$ this ->orderCreditMemoNew ->getFormBlock ()->fillProductData ($ refundData , $ items );
107
- if (count ($ refundData ) !== count ($ items )) {
107
+ if (! empty ( $ refundData ) && count ($ refundData ) !== count ($ items )) {
108
108
$ this ->orderCreditMemoNew ->getFormBlock ()->updateQty ();
109
109
}
110
110
You can’t perform that action at this time.
0 commit comments