agoda-com / Kakao

This repo is no longer supported. Please visit a https://github.com/KakaoCup/Kakao
Apache License 2.0
1.11k stars 102 forks source link

Support ActionBar #191

Closed Vacxe closed 4 years ago

Vacxe commented 4 years ago

See #188

Screen Shot 2019-11-27 at 2 13 45 am

Issue:

Unlimity commented 4 years ago

So, how do you plan to match ActionBar's children if they don't have id? The button at least is not a text view, so you can start with that

Vacxe commented 4 years ago

@Unlimity for both texts we can generalize solution F.E. hasText(<Str/Res>) or match specific based on text sizes 👢 🔫 . Also, I think that the navigation button should be a single button on this layout. Maybe first() ?

Yea. Menu buttons can be matched clearly.

psh commented 4 years ago

Some code from one of my personal projects - in the base screen class I have a couple of methods

fun onToolbar(function: KActionbar.() -> Unit) =
    KActionbar().apply(function)

fun onToolbar(id: Int, function: KToolbar.() -> Unit) =
    KToolbar { withId(id) }.apply(function)

Allowing me to find either the normal action bar, or a toolbar in the layout with a particular ID. The definition for the action bar might be pertinent to your current issue -

class KActionbar : KBaseView<KActionbar>(
    { withResourceName("action_bar") }
), KToolbarAssertions

interface KToolbarAssertions : BaseAssertions {
    fun hasTitle(title: String) {
        view.check(matches(hasDescendant(withText(title))))
    }

    fun hasTitle(title: Int) {
        view.check(matches(hasDescendant(withText(title))))
    }
}

I was also unable to find the action bar by ID, but it does have a related resource name (action_bar). And, for completeness, my KToolbar that doesn't do a whole lot but I referenced in this comment

class KToolbar : KBaseView<KActionbar>, KToolbarAssertions {
    constructor(function: ViewBuilder.() -> Unit) : super(function)
    constructor(parent: Matcher<View>, function: ViewBuilder.() -> Unit) : super(parent, function)
    constructor(parent: DataInteraction, function: ViewBuilder.() -> Unit) : super(parent, function)
}

Does that help at all?

Vacxe commented 4 years ago

@psh I don't think that base Screen should content this method. And yea, in your suggestion we still have the issue with title matching.

In any case thanks for the assistance!

Vacxe commented 4 years ago

@Unlimity smth interesting mate. IDK why this changes actually affected on AlertDialogTest In any case, I'll double-check it but it's really odd