theextremeprogrammer / Succinct

UI tests at the speed of unit tests. Proper encapsulation. Architecture agnostic. Freedom to refactor.
MIT License
42 stars 7 forks source link

Searching for labels should exclude searching UISegmentedControls #56

Closed theextremeprogrammer closed 4 years ago

theextremeprogrammer commented 4 years ago

For example: findLabel(withExactText: "Issues") returns true if there is a UISegmentedControl with a title of "Issues".

UISegmentedControls should be excluded when searching for UILabel to ensure that searching for UILabels is exclusive to UILabel. If the developer wants to search for a UISegmentedControl, then the developer should call those methods explicitly.

theextremeprogrammer commented 4 years ago

The reason for this is because @XuqiuyeLi and I encountered an issue while working on https://github.com/WWCodeTokyo/wwcode-tokyo-iOS-app where Succinct is finding UILabels inside of UISegmentedControls as a UISegmentLabel object.

My current though process is that findInSubviews could maybe specify an optional list of classes to exclude when searching, but I'll play around with this a bit to see how it comes together.

theextremeprogrammer commented 4 years ago

Figured out a nice way to manage this just for UILabels. If it turns out that this kind of functionality is needed in other places, then at that time we can look at creating an abstraction.

Closed by the following commits: