matcherForEnabledElement is treating nil elements as enabled
- Dominant language
- Objective-C
- Stars
- 5.7k
- Forks
- 737
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 5
Description
When using grey_enabled in a test I noticed that any text I used did not assert
```
EarlGrey.select(elementWithMatcher:
allOf(withText("bar"),
withAncestor(allOf(withClass(MyClass.self), isVisible())))).assert(grey_enabled())
```
This is a case where "bar" did not exist at all and I was expecting an assertion thrown.
The answer is here:
https://github.com/google/EarlGrey/blob/b0ed5e03fb2b5a5ba00843811c9e87baa547bf6b/EarlGrey/Matcher/GREYMatchers.m#L476
The default value of BOOL matched should be NO instead of YES.
Contributor guide
Research direction
Inspect EarlGrey/Matcher/GREYMatchers.m around line 476, as linked in the issue, and trace how matcherForEnabledElement handles an element that is not found. Verify the behavior with the grey_enabled example: a missing element should cause the assertion to fail rather than pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- objective-c
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100