@@ -107,7 +107,8 @@ class UserLoginTest < E2E::Minitest::TestCase
107107 fill_in "Password", with: "password"
108108 click_button "Sign In"
109109
110- assert_includes page.body, "Welcome, User!"
110+ assert_text "Welcome, User!"
111+ assert_current_path "/dashboard"
111112 end
112113end
113114` ` `
@@ -122,6 +123,8 @@ Set the `HEADLESS` environment variable to `false`:
122123
123124` ` ` bash
124125HEADLESS=false bundle exec rspec spec/e2e
126+ # or for minitest
127+ HEADLESS=false ruby test/e2e/login_test.rb
125128` ` `
126129
127130# ## Pausing for Debugging
@@ -142,7 +145,7 @@ Alternatively, you can just use `sleep(10)` if you want the browser to stay open
142145
143146# ## Automatic Screenshots
144147
145- If a test fails in RSpec , a screenshot is automatically saved to `tmp/screenshots/` for quick investigation.
148+ If a test fails, a screenshot is automatically saved to `tmp/screenshots/` for quick investigation.
146149
147150# ## API Reference
148151
@@ -175,7 +178,7 @@ all("li") # Returns Array<E2E::Element>
175178find("button", text: "Save") # Filter by text
176179` ` `
177180
178- # ### Assertions & Matchers
181+ # ### RSpec Matchers
179182
180183All text and path matchers **automatically wait** for the expected condition to be met (up to `wait_timeout` seconds), making your tests resilient to page transitions and async rendering.
181184
@@ -207,6 +210,26 @@ expect(find("button")).to be_disabled
207210expect(find("input")).to be_enabled
208211` ` `
209212
213+ # ### Minitest Assertions
214+
215+ These assertions mimic the behavior of RSpec matchers, including **auto-waiting**.
216+
217+ ` ` ` ruby
218+ # Check for content (auto-waiting)
219+ assert_text "Welcome"
220+ refute_text "Error"
221+ assert_text /welcome/i
222+
223+ # Check for specific elements (auto-waiting)
224+ assert_selector ".user-profile"
225+ refute_selector "#loading-spinner"
226+
227+ # Check current path (auto-waiting)
228+ assert_current_path "/dashboard"
229+ assert_current_path /\/ users\/ \d +/
230+ refute_current_path "/login"
231+ ` ` `
232+
210233# ### Assertions & Data
211234
212235` ` ` ruby
0 commit comments