Surface 'text' condition in css query error message when specified #714
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request surfaces the
text
condition value when it's specified in CSS queries, and leaves the existing error message as-is when the condition isn't specified.Motivation
I frequently build out css queries using the
text
condition (in combination with the base css selector of the query). Sometimes I would get failures where the element selector was found in the application UI but failed due thetext
condition, but in those cases the error message would only reference the selector, which would lead me to think that the element hadn't been present at all.These cases usually led me to open the screenshots and see the element present in the UI and realize my error—usually a case mismatch or outright typo🤦🏻♂️—and it's happened to me enough that I figured the lib could and should specify this condition in the error.
When the text-condition isn't specified, we leave the existing error message as-is so as to not confuse devs.
Before
After