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