@@ -404,8 +404,7 @@ def test_single_select_form_submission
404
404
405
405
find ( "input[type=submit]" ) . click
406
406
407
- # for some reason the JSON response is wrapped in HTML, I have no idea why
408
- response = JSON . parse ( find ( "pre" ) . text )
407
+ response = JSON . parse ( page . document . text )
409
408
assert_equal "fast_forward" , response [ "value" ]
410
409
end
411
410
@@ -417,8 +416,7 @@ def test_single_select_form_uses_label_if_no_value_provided
417
416
418
417
find ( "input[type=submit]" ) . click
419
418
420
- # for some reason the JSON response is wrapped in HTML, I have no idea why
421
- response = JSON . parse ( find ( "pre" ) . text )
419
+ response = JSON . parse ( page . document . text )
422
420
assert_equal "Resolve" , response [ "value" ]
423
421
end
424
422
@@ -434,8 +432,7 @@ def test_multiple_select_form_submission
434
432
435
433
find ( "input[type=submit]" ) . click
436
434
437
- # for some reason the JSON response is wrapped in HTML, I have no idea why
438
- response = JSON . parse ( find ( "pre" ) . text )
435
+ response = JSON . parse ( page . document . text )
439
436
440
437
# "ours" is pre-selected
441
438
assert_equal %w[ fast_forward recursive ours ] , response [ "value" ]
@@ -453,8 +450,7 @@ def test_multiple_select_form_uses_label_if_no_value_provided
453
450
454
451
find ( "input[type=submit]" ) . click
455
452
456
- # for some reason the JSON response is wrapped in HTML, I have no idea why
457
- response = JSON . parse ( find ( "pre" ) . text )
453
+ response = JSON . parse ( page . document . text )
458
454
459
455
# "ours" is pre-selected
460
456
assert_equal %w[ fast_forward ours Resolve ] , response [ "value" ]
@@ -471,7 +467,7 @@ def test_individual_items_can_submit_post_requests_via_forms
471
467
click_on_invoker_button
472
468
click_on_fourth_item
473
469
474
- response = JSON . parse ( find ( "pre" ) . text )
470
+ response = JSON . parse ( page . document . text )
475
471
assert_equal "bar" , response [ "value" ]
476
472
end
477
473
@@ -481,8 +477,7 @@ def test_single_select_items_can_submit_forms
481
477
click_on_invoker_button
482
478
click_on_first_item
483
479
484
- # for some reason the JSON response is wrapped in HTML, I have no idea why
485
- response = JSON . parse ( find ( "pre" ) . text )
480
+ response = JSON . parse ( page . document . text )
486
481
assert_equal "group-by-repository" , response [ "value" ]
487
482
end
488
483
@@ -494,8 +489,7 @@ def test_single_select_items_can_submit_forms_on_enter
494
489
# "click" first item
495
490
keyboard . type ( :enter )
496
491
497
- # for some reason the JSON response is wrapped in HTML, I have no idea why
498
- response = JSON . parse ( find ( "pre" ) . text )
492
+ response = JSON . parse ( page . document . text )
499
493
assert_equal "group-by-repository" , response [ "value" ]
500
494
end
501
495
@@ -507,8 +501,7 @@ def test_single_select_items_can_submit_forms_on_keydown_space
507
501
# "click" first item
508
502
keyboard . type ( :space )
509
503
510
- # for some reason the JSON response is wrapped in HTML, I have no idea why
511
- response = JSON . parse ( find ( "pre" ) . text )
504
+ response = JSON . parse ( page . document . text )
512
505
assert_equal "group-by-repository" , response [ "value" ]
513
506
end
514
507
@@ -518,8 +511,7 @@ def test_single_select_items_can_submit_forms_with_multiple_fields
518
511
click_on_invoker_button
519
512
click_on_first_item
520
513
521
- # for some reason the JSON response is wrapped in HTML, I have no idea why
522
- response = JSON . parse ( find ( "pre" ) . text )
514
+ response = JSON . parse ( page . document . text )
523
515
assert_equal "query" , response . dig ( "other_params" , "query" )
524
516
end
525
517
0 commit comments