Add best practice for assertion style in Playwright Python instructions
This commit is contained in:
parent
b633330a97
commit
5aa6f2db0f
@ -27,6 +27,8 @@ applyTo: '**'
|
||||
- **Element Counts**: Use expect(locator).to_have_count() to assert the number of elements found by a locator.
|
||||
- **Text Content**: Use expect(locator).to_have_text() for exact text matches and expect(locator).to_contain_text() for partial matches.
|
||||
- **Navigation**: Use expect(page).to_have_url() to verify the page URL.
|
||||
- **Assertion Style**: Prefer `expect` over `assert` for more reliable UI tests.
|
||||
|
||||
|
||||
## Example
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user