-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to match on entire html #85
Comments
Yeah, I'm not opposed to the library adding something like that. I think I would name it |
I think |
That's an interesting thought. I think we read it from different angles (which is always interesting!) This is where my head's at 👇 As a user of the library, I would expect assert_html(session, "<div>Could not find user</div>") But my guess is that people want to use it as an "assert this text is on the page": assert_text(session, "Could not find user") I think that's also evidenced by the implementation you suggested -- where you have And if instead we wanted people to assert on HTML structure, I'm not sure I would recommend that. I typically recommend the opposite because asserting on HTML structure tends to make the tests brittle. For example, what if I add a class or id to my HTML in the first example? I've broken my test for no reason. If we want to assert on certain aspects of HTML, we should use Finally, I think |
To retain the ability to match on html instead of a selector, you can use a helper function like this:
I think this should probably just be added in as it's own function in the Assertions module.
The text was updated successfully, but these errors were encountered: