Closed Vacxe closed 1 year ago
Hmm...
I think that the best way forward would be for a KTextSwitcher
to implement TextViewAssertions
and override view
with a dynamic getter function of switcher.currentView
so that whenever switcher is accessed from UI test, for every action and assertion, we provide latest currently displayed text view but at the same time do not duplicate action/assertion code. WDYT?
Overriding view
will create another issue - base checks such as isVisibile
or hasParent
probably will not work as expected.
Logically we may have 2 views Switcher as it is and currentView for content verification.
Sounds reasonable.
So, in the test it would look like:
mySwitcher {
isVisible()
currentTextView {
hasText("abc")
}
}
In that case, KTextSwitcher
should just extend KBaseView
and provide public final property currentTextView
of KTextView
type. That way, no code duplication needed at all.
@Unlimity
Layout inspector from TextSwitcher
Thats a top level component without any nested TextView
and we can't declare matcher for currentTextView
then. That an other problem. I will be happy if you can jump on this branch and take a look. TBH I'm not happy with Copy-Paste impl.
@Unlimity Done
See: #69