@@ -349,10 +349,15 @@ public function testSubmitForm(callable $clientFactory): void
349
349
]);
350
350
351
351
$ crawler = $ client ->submit ($ form );
352
- $ this ->assertInstanceOf (DomCrawlerCrawler::class, $ crawler );
353
352
if ($ client instanceof Client) {
353
+ try {
354
+ $ crawler = $ client ->waitFor ('#result ' );
355
+ } catch (TimeoutException ) {
356
+ $ this ->markTestSkipped ('Test skipped if no result after 30 seconds to prevent inconsistent fail on CI ' );
357
+ }
354
358
$ this ->assertInstanceOf (Crawler::class, $ crawler );
355
359
}
360
+ $ this ->assertInstanceOf (DomCrawlerCrawler::class, $ crawler );
356
361
$ this ->assertSame (self ::$ baseUri .'/form-handle.php ' , $ crawler ->getUri ());
357
362
$ this ->assertSame ('I1: Reclus ' , $ crawler ->filter ('#result ' )->text (null , true ));
358
363
@@ -362,6 +367,13 @@ public function testSubmitForm(callable $clientFactory): void
362
367
]);
363
368
364
369
$ crawler = $ client ->submit ($ form );
370
+ if ($ client instanceof Client) {
371
+ try {
372
+ $ crawler = $ client ->waitFor ('#result ' );
373
+ } catch (TimeoutException ) {
374
+ $ this ->markTestSkipped ('Test skipped if no result after 30 seconds to prevent inconsistent fail on CI ' );
375
+ }
376
+ }
365
377
$ this ->assertSame (self ::$ baseUri .'/form-handle.php?i1=Michel&i2=&i3=&i4=i4a ' , $ crawler ->getUri ());
366
378
367
379
try {
@@ -382,7 +394,7 @@ public function testSubmitForm(callable $clientFactory): void
382
394
/**
383
395
* @dataProvider clientFactoryProvider
384
396
*/
385
- public function testSubmitFormWithValues (callable $ clientFactory, string $ type ): void
397
+ public function testSubmitFormWithValues (callable $ clientFactory ): void
386
398
{
387
399
/** @var AbstractBrowser $client */
388
400
$ client = $ clientFactory ();
@@ -392,10 +404,15 @@ public function testSubmitFormWithValues(callable $clientFactory, string $type):
392
404
$ crawler = $ client ->submit ($ form , [
393
405
'i1 ' => 'Reclus ' ,
394
406
]);
395
- $ this ->assertInstanceOf (DomCrawlerCrawler::class, $ crawler );
396
- if (Client::class === $ type ) {
407
+ if ($ client instanceof Client) {
408
+ try {
409
+ $ crawler = $ client ->waitFor ('#result ' );
410
+ } catch (TimeoutException ) {
411
+ $ this ->markTestSkipped ('Test skipped if no result after 30 seconds to prevent inconsistent fail on CI ' );
412
+ }
397
413
$ this ->assertInstanceOf (Crawler::class, $ crawler );
398
414
}
415
+ $ this ->assertInstanceOf (DomCrawlerCrawler::class, $ crawler );
399
416
$ this ->assertSame (self ::$ baseUri .'/form-handle.php ' , $ crawler ->getUri ());
400
417
$ this ->assertSame ('I1: Reclus ' , $ crawler ->filter ('#result ' )->text (null , true ));
401
418
}
0 commit comments