KakaoCup / Kakao

Nice and simple DSL for Espresso in Kotlin
https://kakaocup.github.io/Kakao/
Apache License 2.0
325 stars 28 forks source link

Support TextSwitcher #73

Closed Vacxe closed 1 year ago

Vacxe commented 1 year ago

@Unlimity Done

See: #69

Unlimity commented 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?

Vacxe commented 1 year ago

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.

Unlimity commented 1 year ago

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.

Vacxe commented 1 year ago

@Unlimity Layout inspector from TextSwitcher image 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.