From c883f02161ca4530e37eaafa7f0272b7f3f04c7a Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sun, 29 Dec 2024 03:25:44 +0300 Subject: [PATCH] Add within_content_body system test helper --- test/application_system_test_case.rb | 4 ++++ test/system/user_signup_test.rb | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index d2c3d5196..0ddb8a87a 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -41,4 +41,8 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase def within_sidebar(&) within("#sidebar_content", &) end + + def within_content_body(&) + within("#content > .content-body", &) + end end diff --git a/test/system/user_signup_test.rb b/test/system/user_signup_test.rb index 0e02b904f..38690d3d9 100644 --- a/test/system/user_signup_test.rb +++ b/test/system/user_signup_test.rb @@ -6,18 +6,22 @@ class UserSignupTest < ApplicationSystemTestCase click_on "Sign up" - assert_content "Confirm Password" + within_content_body do + assert_content "Confirm Password" + end end test "Show OpenID form when OpenID provider button is clicked" do visit login_path - assert_no_field "OpenID URL" - assert_no_button "Continue" + within_content_body do + assert_no_field "OpenID URL" + assert_no_button "Continue" - click_on "Log in with OpenID" + click_on "Log in with OpenID" - assert_field "OpenID URL" - assert_button "Continue" + assert_field "OpenID URL" + assert_button "Continue" + end end end -- 2.39.5