You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.5 KiB
Kotlin
40 lines
1.5 KiB
Kotlin
package org.mozilla.fenix.ui.robots
|
|
|
|
import androidx.test.espresso.Espresso.onView
|
|
import androidx.test.espresso.assertion.ViewAssertions.matches
|
|
import androidx.test.espresso.matcher.ViewMatchers
|
|
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
|
|
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
|
import androidx.test.espresso.matcher.ViewMatchers.withId
|
|
import org.hamcrest.CoreMatchers.allOf
|
|
import org.mozilla.fenix.R
|
|
import org.mozilla.fenix.helpers.click
|
|
|
|
/**
|
|
* Implementation of Robot Pattern for a single Addon inside of the Addons Management Settings.
|
|
*/
|
|
|
|
class SettingsSubMenuAddonsManagerAddonDetailedMenuRobot {
|
|
|
|
class Transition {
|
|
fun goBack(interact: SettingsSubMenuAddonsManagerRobot.() -> Unit): SettingsSubMenuAddonsManagerRobot.Transition {
|
|
fun goBackButton() = onView(allOf(withContentDescription("Navigate up")))
|
|
goBackButton().click()
|
|
|
|
SettingsSubMenuAddonsManagerRobot().interact()
|
|
return SettingsSubMenuAddonsManagerRobot.Transition()
|
|
}
|
|
|
|
fun removeAddon(interact: SettingsSubMenuAddonsManagerRobot.() -> Unit): SettingsSubMenuAddonsManagerRobot.Transition {
|
|
removeAddonButton().check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
removeAddonButton().click()
|
|
|
|
SettingsSubMenuAddonsManagerRobot().interact()
|
|
return SettingsSubMenuAddonsManagerRobot.Transition()
|
|
}
|
|
}
|
|
}
|
|
|
|
private fun removeAddonButton() =
|
|
onView(withId(R.id.remove_add_on))
|