|
|
|
@ -1,17 +1,23 @@
|
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
@file:Suppress("DEPRECATION")
|
|
|
|
|
|
|
|
|
|
package org.mozilla.fenix.ui.robots
|
|
|
|
|
|
|
|
|
|
import android.view.View
|
|
|
|
|
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 androidx.test.rule.ActivityTestRule
|
|
|
|
|
import org.hamcrest.CoreMatchers.allOf
|
|
|
|
|
import org.mozilla.fenix.HomeActivity
|
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
|
import org.mozilla.fenix.helpers.TestHelper.registerAndCleanupIdlingResources
|
|
|
|
|
import org.mozilla.fenix.helpers.ViewVisibilityIdlingResource
|
|
|
|
|
import org.mozilla.fenix.helpers.click
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -29,9 +35,16 @@ class SettingsSubMenuAddonsManagerAddonDetailedMenuRobot {
|
|
|
|
|
return SettingsSubMenuAddonsManagerRobot.Transition()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun removeAddon(interact: SettingsSubMenuAddonsManagerRobot.() -> Unit): SettingsSubMenuAddonsManagerRobot.Transition {
|
|
|
|
|
fun removeAddon(activityTestRule: ActivityTestRule<HomeActivity>, interact: SettingsSubMenuAddonsManagerRobot.() -> Unit): SettingsSubMenuAddonsManagerRobot.Transition {
|
|
|
|
|
registerAndCleanupIdlingResources(
|
|
|
|
|
ViewVisibilityIdlingResource(
|
|
|
|
|
activityTestRule.activity.findViewById(R.id.addon_container),
|
|
|
|
|
View.VISIBLE,
|
|
|
|
|
),
|
|
|
|
|
) {
|
|
|
|
|
removeAddonButton().check(matches(withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)))
|
|
|
|
|
removeAddonButton().click()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SettingsSubMenuAddonsManagerRobot().interact()
|
|
|
|
|
return SettingsSubMenuAddonsManagerRobot.Transition()
|
|
|
|
|