Skip to content

Commit

Permalink
Switch to assert_text in some more tests (#1057)
Browse files Browse the repository at this point in the history
A few more instances of `assert page.has_content?` have crept in.
Switching them to `assert_text` instead so that we get better error
messages when tests fail.
  • Loading branch information
jagthedrummer authored and newstler committed Oct 9, 2023
1 parent 596936f commit 959c3b4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions test/system/invitation_lists_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def teardown
fill_in "Confirm Password", with: example_password
click_on "Sign Up"

assert page.has_content?("Tell us about you")
assert_text("Tell us about you")
fill_in "First Name", with: "Hanako"
fill_in "Last Name", with: "Tanaka"
fill_in "Your Team Name", with: "The Testing Team"
Expand All @@ -40,7 +40,7 @@ def teardown

# Click on next to show that bulk invitations will raise an error if not filled out properly.
click_on "Next"
assert page.has_content?("Email can't be blank")
assert_text("Email can't be blank")

# Fill in the email addresses.
email_fields = page.all("label", text: "Email Address")
Expand All @@ -61,12 +61,12 @@ def teardown
sleep 2
end

assert page.has_content?("The Testing Team’s Dashboard")
assert_text("The Testing Team’s Dashboard")
within_team_menu_for(display_details) do
click_on "Team Members"
end

assert page.has_content?("[email protected]")
assert_text("[email protected]")
invitation = Invitation.find_by(email: "[email protected]")
assert_equal invitation.membership.role_ids, ["admin", "editor"]
end
Expand Down
4 changes: 2 additions & 2 deletions test/system/super_scaffolding_partial_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ def setup
# Number Field Partial
fill_in "Number Field Test", with: 47

assert page.has_content? "State / Province / Region"
assert_text "State / Province / Region"
select "United States", from: "Country"
assert page.has_content? "State"
assert_text "State"

fill_in "Address", with: "123 Main St."
fill_in "City", with: "New York"
Expand Down
6 changes: 3 additions & 3 deletions test/system/tangible_thing_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ class TangibleThingTest < ApplicationSystemTestCase
fill_in "Password Field Value", with: "secure-password"
fill_in "Phone Field Value", with: "(201) 551-8321"

assert page.has_content? "State / Province"
assert_text "State / Province"
select "Japan", from: "Country"
assert page.has_content? "Prefecture"
assert_text "Prefecture"
select "United States", from: "Country"
assert page.has_content? "State"
assert_text "State"

fill_in "Address", with: "123 Main St."
fill_in "City", with: "New York"
Expand Down

0 comments on commit 959c3b4

Please sign in to comment.