@@ -157,22 +157,6 @@ private function outputVersions() {
157
157
}
158
158
159
159
160
- /**
161
- * @throws NoSuchElementException
162
- * @throws TimeOutException
163
- */
164
- public function changeDecimal () {
165
- $ this ->goToPage ( 'wp-admin/admin.php?page=wc-settings ' , '#select2-prestashop_currency-container ' );
166
- $ this ->type ( '#prestashop_price_decimal_sep ' , '. ' );
167
- }
168
-
169
- /**
170
- *
171
- */
172
- public function submitAdmin () {
173
- $ this ->click ( '#module_form_submit_btn ' );
174
- }
175
-
176
160
/**
177
161
* @throws NoSuchElementException
178
162
* @throws TimeOutException
@@ -189,25 +173,13 @@ private function directPayment() {
189
173
$ this ->finalPaylike ();
190
174
$ this ->selectOrder ();
191
175
if ( $ this ->capture_mode == 'delayed ' ) {
192
- $ this ->checkNoCaptureWarning ();
193
176
$ this ->capture ();
194
177
} else {
195
178
$ this ->refund ();
196
179
}
197
180
198
181
}
199
182
200
- /**
201
- * @throws NoSuchElementException
202
- * @throws TimeOutException
203
- * @throws UnexpectedTagNameException
204
- */
205
- public function checkNoCaptureWarning () {
206
- $ this ->moveOrderToStatus ( 'Payment accepted ' );
207
- $ text = $ this ->pluckElement ( '.history-status tr td ' , 1 )->getText ();
208
- $ messages = explode ( "\n" , $ text );
209
- $ this ->main_test ->assertEquals ( 'Remote payment accepted ' , $ messages [0 ], "Not captured warning " );
210
- }
211
183
212
184
/**
213
185
* @param $status
@@ -216,10 +188,8 @@ public function checkNoCaptureWarning() {
216
188
* @throws UnexpectedTagNameException
217
189
*/
218
190
public function moveOrderToStatus ( $ status ) {
219
- $ this ->click ( '#id_order_state_chosen ' );
220
- $ this ->type ( ".chosen-search input " , $ status );
221
- $ this ->pressEnter ();
222
- $ this ->click ( 'submitState ' );
191
+ $ this ->selectValueByLabel ('#update_order_status_action_input ' ,$ status );
192
+ $ this ->click ( '#update_order_status_action_btn ' );
223
193
}
224
194
225
195
/**
@@ -228,17 +198,9 @@ public function moveOrderToStatus( $status ) {
228
198
* @throws UnexpectedTagNameException
229
199
*/
230
200
public function capture () {
231
- $ this ->selectValue ( "#paylike_action " , "capture " );
232
- $ this ->click ( '#submit_paylike_action ' );
233
- $ this ->waitElementDisappear ( ".margin-form #submit_paylike_action.disabled " );
234
- $ this ->waitForPageReload ( function () {
235
- }, 5000 );
236
- $ text = $ this ->pluckElement ( '.history-status tr td ' , 1 )->getText ();
237
- if ( $ text == 'Delivered ' || $ text == 'Delivered ' ) {
238
- $ text = $ this ->pluckElement ( '.history-status tr td ' , 1 )->getText ();
239
- }
240
- $ messages = explode ( "\n" , $ text );
241
- $ this ->main_test ->assertEquals ( 'Delivered ' , $ messages [0 ], "Delivered " );
201
+ $ this ->moveOrderToStatus ( 'Delivered ' );
202
+ $ text = $ this ->pluckElement ( '.tab-content #historyTabContent tr td ' , 0 )->getText ();
203
+ $ this ->main_test ->assertEquals ( 'Delivered ' , $ text , "Payment captured " );
242
204
}
243
205
244
206
/**
@@ -364,10 +326,9 @@ public function popupPaylike() {
364
326
* @throws TimeOutException
365
327
*/
366
328
public function selectOrder () {
367
- $ this ->goToPage ( "/index.php?controller=AdminOrders " , '.btn-continue ' , true );
368
- $ this ->click ( ".btn-continue " );
369
- $ this ->waitForElement ( '.text-right .btn-group .icon-search-plus ' );
370
- $ this ->click ( '.text-right .btn-group .icon-search-plus ' );
329
+ $ this ->goToPage ( "/index.php?controller=AdminOrders " , '#page-header-desc-configuration-add ' , true );
330
+ $ this ->waitForElement ( '.text-right .btn[data-original-title="View"] ' );
331
+ $ this ->click ( '.text-right .btn[data-original-title="View"] ' );
371
332
}
372
333
373
334
/**
@@ -376,25 +337,14 @@ public function selectOrder() {
376
337
* @throws UnexpectedTagNameException
377
338
*/
378
339
public function refund () {
379
- $ this ->waitForElement ( '#paylike_action ' );
380
- $ this ->selectValue ( "#paylike_action " , "refund " );
381
- $ refund = preg_match_all ( '!\d+! ' , $ this ->getText ( '.amount strong ' ), $ refund_value );
382
- $ refund_value = $ refund_value [0 ];
383
- $ this ->type ( 'paylike_amount_to_refund ' , $ refund_value [0 ] );
384
- $ this ->click ( '#submit_paylike_action ' );
385
- try {
386
- $ this ->waitElementDisappear ( ".margin-form #submit_paylike_action.disabled " );
387
- } catch ( NoSuchElementException $ e ) {
388
- // the element may have already dissapeared
389
- }
390
- $ this ->waitForPageReload ( function () {
391
- }, 5000 );
392
- $ text = $ this ->pluckElement ( '.history-status tr td ' , 1 )->getText ();
393
- if ( $ text == 'Refunded ' || $ text == 'Refunded ' ) {
394
- $ text = $ this ->pluckElement ( '.history-status tr td ' , 1 )->getText ();
395
- }
396
- $ messages = explode ( "\n" , $ text );
397
- $ this ->main_test ->assertEquals ( 'Refunded ' , $ messages [0 ], "Refunded " );
340
+ $ this ->waitForElement ( '.partial-refund-display ' );
341
+ $ this ->click ('.partial-refund-display ' );
342
+ $ this ->type ( '.refund-quantity ' , 1 );
343
+ $ this ->click ( '#cancel_product_save ' );
344
+
345
+ $ this ->waitForElement ( '.alert.alert-success ' );
346
+ $ text = $ this ->pluckElement ( '.alert.alert-success ' , 0 )->getText ();
347
+ $ this ->main_test ->assertEquals ( 'Paylike: Transaction successfully Refunded. ' , $ text , "Refunded " );
398
348
}
399
349
400
350
/**
0 commit comments