You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
## [0.4.0] - 2026-02-06
11
+
12
+
### Added
13
+
14
+
-**Auto-waiting matchers:**`have_text`, `have_content`, and `have_current_path` now automatically retry until the expected condition is met or the timeout expires, eliminating flaky tests caused by page transitions and async rendering
15
+
-`have_current_path` matcher for asserting the current URL path with auto-waiting (supports exact strings and regexps)
16
+
-`E2E.wait_until` helper method for custom waiting logic in tests
17
+
-`wait_timeout` configuration option (default: 5 seconds) to control how long matchers wait before failing
18
+
-`text` method on page/session for reading visible text content of the page body
19
+
20
+
### Changed
21
+
22
+
-`fill_in` now matches fields by label, placeholder, id, and name (Capybara-like behavior) instead of only CSS selectors, with fallback to direct CSS selector
@@ -175,11 +177,18 @@ find("button", text: "Save") # Filter by text
175
177
176
178
#### Assertions & Matchers
177
179
180
+
All 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.
181
+
178
182
```ruby
179
-
# Check for content
180
-
expect(page.body).to include("Success")
181
-
expect(find(".alert")).to have_text("Success")
182
-
expect(find(".alert")).to have_content("Success") # Alias
183
+
# Check for content (auto-waiting)
184
+
expect(page).to have_text("Success")
185
+
expect(page).to have_content("Success") # Alias for have_text
186
+
expect(find(".alert")).to have_text("Success") # Works on elements too
187
+
expect(page).to have_text(/welcome/i) # Regexp support
188
+
189
+
# Check current path (auto-waiting)
190
+
expect(page).to have_current_path("/dashboard")
191
+
expect(page).to have_current_path(/\/users\/\d+/) # Regexp support
The `have_text`, `have_content`, and `have_current_path` matchers automatically retry until the condition is met or the configured `wait_timeout` expires (default: 5 seconds). This eliminates flaky tests caused by page navigations, redirects, and async rendering.
221
+
222
+
```ruby
223
+
click_button "Submit"
224
+
# No need for sleep or manual waiting — the matcher will poll until
225
+
# the page transitions and the expected content appears
226
+
expect(page).to have_current_path("/success")
227
+
expect(page).to have_content("Your order has been placed")
228
+
```
229
+
230
+
For custom waiting logic, use `E2E.wait_until`:
231
+
232
+
```ruby
233
+
E2E.wait_until(timeout: 10) do
234
+
page.current_url.include?("/ready")
235
+
end
236
+
```
237
+
209
238
### 🔓 Native Access (The Escape Hatch)
210
239
211
240
We believe you shouldn't be limited by the wrapper. You can access the underlying `Playwright::Page` object at any time using `.native`.
0 commit comments