@@ -443,7 +443,6 @@ def android_mock_create_session_w3c
443
443
} . to_json
444
444
445
445
stub_request ( :post , 'http://127.0.0.1:4723/wd/hub/session' )
446
- . with ( headers : { 'X-Idempotency-Key' => /.+/ } )
447
446
. to_return ( headers : HEADER , status : 200 , body : response )
448
447
449
448
stub_request ( :post , "#{ SESSION } /timeouts" )
@@ -453,8 +452,34 @@ def android_mock_create_session_w3c
453
452
driver = @core . start_driver
454
453
455
454
assert_equal ( { } , driver . send ( :bridge ) . http . additional_headers )
456
- assert_requested ( :post , 'http://127.0.0.1:4723/wd/hub/session' , times : 1 )
457
- assert_requested ( :post , "#{ SESSION } /timeouts" , body : { implicit : 5_000 } . to_json , times : 1 )
455
+ assert_requested (
456
+ :post ,
457
+ 'http://127.0.0.1:4723/wd/hub/session' ,
458
+ headers : {
459
+ 'X-Idempotency-Key' => /.+/ ,
460
+ 'Content-Type' => 'application/json; charset=UTF-8' ,
461
+ 'User-Agent' => /appium\/ ruby_lib_core\/ .+/
462
+ } ,
463
+ times : 1
464
+ )
465
+
466
+ assert_requested (
467
+ :post ,
468
+ "#{ SESSION } /timeouts" ,
469
+ headers : {
470
+ 'Content-Type' => 'application/json; charset=UTF-8' ,
471
+ 'User-Agent' => /appium\/ ruby_lib_core\/ .+/
472
+ } ,
473
+ body : { implicit : 5_000 } . to_json ,
474
+ times : 1
475
+ )
476
+ assert_not_requested (
477
+ :post ,
478
+ "#{ SESSION } /timeouts" ,
479
+ headers : { 'X-Idempotency-Key' => /.+/ } ,
480
+ body : { implicit : 5_000 } . to_json ,
481
+ times : 1
482
+ )
458
483
driver
459
484
end
460
485
@@ -473,7 +498,6 @@ def android_chrome_mock_create_session_w3c
473
498
} . to_json
474
499
475
500
stub_request ( :post , 'http://127.0.0.1:4723/wd/hub/session' )
476
- . with ( headers : { 'X-Idempotency-Key' => /.+/ } )
477
501
. to_return ( headers : HEADER , status : 200 , body : response )
478
502
479
503
stub_request ( :post , "#{ SESSION } /timeouts" )
@@ -483,8 +507,34 @@ def android_chrome_mock_create_session_w3c
483
507
driver = @core . start_driver
484
508
485
509
assert_equal ( { } , driver . send ( :bridge ) . http . additional_headers )
486
- assert_requested ( :post , 'http://127.0.0.1:4723/wd/hub/session' , times : 1 )
487
- assert_requested ( :post , "#{ SESSION } /timeouts" , body : { implicit : 5_000 } . to_json , times : 1 )
510
+ assert_requested (
511
+ :post ,
512
+ 'http://127.0.0.1:4723/wd/hub/session' ,
513
+ headers : {
514
+ 'X-Idempotency-Key' => /.+/ ,
515
+ 'Content-Type' => 'application/json; charset=UTF-8' ,
516
+ 'User-Agent' => /appium\/ ruby_lib_core\/ .+/
517
+ } ,
518
+ times : 1
519
+ )
520
+
521
+ assert_requested (
522
+ :post ,
523
+ "#{ SESSION } /timeouts" ,
524
+ headers : {
525
+ 'Content-Type' => 'application/json; charset=UTF-8' ,
526
+ 'User-Agent' => /appium\/ ruby_lib_core\/ .+/
527
+ } ,
528
+ body : { implicit : 5_000 } . to_json ,
529
+ times : 1
530
+ )
531
+ assert_not_requested (
532
+ :post ,
533
+ "#{ SESSION } /timeouts" ,
534
+ headers : { 'X-Idempotency-Key' => /.+/ } ,
535
+ body : { implicit : 5_000 } . to_json ,
536
+ times : 1
537
+ )
488
538
driver
489
539
end
490
540
@@ -510,7 +560,16 @@ def ios_mock_create_session_w3c
510
560
511
561
driver = @core . start_driver
512
562
513
- assert_requested ( :post , 'http://127.0.0.1:4723/wd/hub/session' , times : 1 )
563
+ assert_requested (
564
+ :post ,
565
+ 'http://127.0.0.1:4723/wd/hub/session' ,
566
+ headers : {
567
+ 'X-Idempotency-Key' => /.+/ ,
568
+ 'Content-Type' => 'application/json; charset=UTF-8' ,
569
+ 'User-Agent' => /appium\/ ruby_lib_core\/ .+/
570
+ } ,
571
+ times : 1
572
+ )
514
573
driver
515
574
end
516
575
@@ -532,7 +591,16 @@ def windows_mock_create_session
532
591
533
592
driver = @core . start_driver
534
593
535
- assert_requested ( :post , 'http://127.0.0.1:4723/wd/hub/session' , times : 1 )
594
+ assert_requested (
595
+ :post ,
596
+ 'http://127.0.0.1:4723/wd/hub/session' ,
597
+ headers : {
598
+ 'X-Idempotency-Key' => /.+/ ,
599
+ 'Content-Type' => 'application/json; charset=UTF-8' ,
600
+ 'User-Agent' => /appium\/ ruby_lib_core\/ .+/
601
+ } ,
602
+ times : 1
603
+ )
536
604
driver
537
605
end
538
606
@@ -554,7 +622,16 @@ def windows_mock_create_session_w3c
554
622
555
623
driver = @core . start_driver
556
624
557
- assert_requested ( :post , 'http://127.0.0.1:4723/wd/hub/session' , times : 1 )
625
+ assert_requested (
626
+ :post ,
627
+ 'http://127.0.0.1:4723/wd/hub/session' ,
628
+ headers : {
629
+ 'X-Idempotency-Key' => /.+/ ,
630
+ 'Content-Type' => 'application/json; charset=UTF-8' ,
631
+ 'User-Agent' => /appium\/ ruby_lib_core\/ .+/
632
+ } ,
633
+ times : 1
634
+ )
558
635
driver
559
636
end
560
637
@@ -574,7 +651,16 @@ def mac2_mock_create_session_w3c
574
651
575
652
driver = @core . start_driver
576
653
577
- assert_requested ( :post , 'http://127.0.0.1:4723/wd/hub/session' , times : 1 )
654
+ assert_requested (
655
+ :post ,
656
+ 'http://127.0.0.1:4723/wd/hub/session' ,
657
+ headers : {
658
+ 'X-Idempotency-Key' => /.+/ ,
659
+ 'Content-Type' => 'application/json; charset=UTF-8' ,
660
+ 'User-Agent' => /appium\/ ruby_lib_core\/ .+/
661
+ } ,
662
+ times : 1
663
+ )
578
664
driver
579
665
end
580
666
end
0 commit comments