-
Notifications
You must be signed in to change notification settings - Fork 668
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Adding get method to Wrapper #1304
Adding get method to Wrapper #1304
Conversation
To have it fail with a clear error message when selector does not match an existing element.
Code looks fine, but is this additional API necessary? I don't fully understand the use case. If you cannot |
Yes, and it will not be helpful. I dont want a generic error like:
Instead I want something like:
I often find myself doing |
I agree it's useful to have better debugging messages - but adding an entire API doesn't seem like the correct solution. Rather, can we improve One idea could be for |
Changing find like that would break the API. Lots of people upgrading would get failing test cases because of that. How would you assert that an element does, or does not, exist? My point is that there is a difference between searching and getting. If you search with find, you may not find it, and that is totally ok. |
Good point, I forgot the I think the code is fine, will need to wait on a maintainer (@eddyerburgh , I guess?) to approve and merge. Also, do you have a use case for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job using the existing functionality of find
.
@tomasbjerre I'll be coming on board as a maintainer in the near future, and would like to get this one merged up I have the repo access to do so. I just realized since this does add a new API, we will need to add docs for it. Is this something you are able to do (if not, I can take a look at doing it). |
Ok! I can make an attempt =) |
I added some docs now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small grammar improvement! Also, some tests seem to be failing.
The failing test seems to be toggling, looks like a timeout. I dont think that is introduced in this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes made
LGTM, will merge when I get merge rights in the next week or two. Nice job! |
I had another idea inspired by this repo in response to your earlier question, "How would you assert that an element does, or does not, exist?" Could this make sense as a custom matcher? |
I often test a condition where I assume existens. And that is when the get method is useful I don't want to spend my time and write code to test existens. I simply want to assume it exists and if it does not, i want a clear error. I'd like my test cases to be clear about other conditions and those conditions implicitly assumes the element actually exists. Like asserting the
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the status on this? Generally this looks OK to me, hope ppl dont get confused when to use what.
You have added docs, so thats good.
Should |
@afontcu I think that it's fine not to throw an error for 1+ elements. If that is a use case, we should include a Although |
Fixed merge conflicts, let's merge on CI passing. I wish GH had the feature GitLab has (auto merge on pass). We can dream! |
To have it fail with a clear error message when selector does not match an existing element.
Closes #1298