зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1907854 - Close any sharing overlays and apps after they are done r=aaronmt
Differential Revision: https://phabricator.services.mozilla.com/D216543
This commit is contained in:
Родитель
aa144f349b
Коммит
07cf86bbe4
|
@ -356,6 +356,11 @@ object AppAndSystemHelper {
|
|||
forceCloseApp(YOUTUBE_APP)
|
||||
}
|
||||
|
||||
/**
|
||||
* Force stops the app from running in the background.
|
||||
*
|
||||
* @param appPackageName The package name of the app to be stopped.
|
||||
*/
|
||||
fun forceCloseApp(appPackageName: String) {
|
||||
Log.i(TAG, "forceCloseApp: Trying to stop the $appPackageName app from running in the background.")
|
||||
mDevice.executeShellCommand("am force-stop $appPackageName")
|
||||
|
|
|
@ -138,6 +138,7 @@ class ContextMenusTest : TestSetup() {
|
|||
clickContextMenuItem("Share link")
|
||||
shareOverlay {
|
||||
verifyShareLinkIntent(genericURL.url)
|
||||
mDevice.pressBack()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.hamcrest.CoreMatchers
|
|||
import org.hamcrest.CoreMatchers.endsWith
|
||||
import org.hamcrest.Matchers.allOf
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.helpers.AppAndSystemHelper.forceCloseApp
|
||||
import org.mozilla.fenix.helpers.AppAndSystemHelper.isPackageInstalled
|
||||
import org.mozilla.fenix.helpers.Constants.LISTS_MAXSWIPES
|
||||
import org.mozilla.fenix.helpers.Constants.PackageName.GOOGLE_PLAY_SERVICES
|
||||
|
@ -480,6 +481,8 @@ class SettingsRobot {
|
|||
} catch (e: AssertionFailedError) {
|
||||
Log.i(TAG, "verifyGooglePlayRedirect: AssertionFailedError caught, executing fallback methods")
|
||||
BrowserRobot().verifyRateOnGooglePlayURL()
|
||||
} finally {
|
||||
forceCloseApp(GOOGLE_PLAY_SERVICES)
|
||||
}
|
||||
} else {
|
||||
BrowserRobot().verifyRateOnGooglePlayURL()
|
||||
|
|
|
@ -21,6 +21,7 @@ import androidx.test.uiautomator.UiSelector
|
|||
import androidx.test.uiautomator.Until
|
||||
import org.hamcrest.Matchers.allOf
|
||||
import org.mozilla.fenix.R
|
||||
import org.mozilla.fenix.helpers.AppAndSystemHelper.forceCloseApp
|
||||
import org.mozilla.fenix.helpers.Constants.TAG
|
||||
import org.mozilla.fenix.helpers.DataGenerationHelper.getStringResource
|
||||
import org.mozilla.fenix.helpers.MatcherHelper.assertUIObjectExists
|
||||
|
@ -101,10 +102,14 @@ class ShareOverlayRobot {
|
|||
sharingApp.clickAndWaitForNewWindow()
|
||||
Log.i(TAG, "verifySharingWithSelectedApp: Clicked sharing app: $appName and waited for a new window")
|
||||
verifySharedTabsIntent(content, subject)
|
||||
// Close the app after successful verification
|
||||
forceCloseApp(appName)
|
||||
} else {
|
||||
Log.i(TAG, "verifySharingWithSelectedApp: Sharing app: $appName not found.")
|
||||
}
|
||||
}
|
||||
|
||||
fun verifySharedTabsIntent(text: String, subject: String) {
|
||||
private fun verifySharedTabsIntent(text: String, subject: String) {
|
||||
Log.i(TAG, "verifySharedTabsIntent: Trying to verify the intent of the shared tab with text: $text, and subject: $subject")
|
||||
Intents.intended(
|
||||
allOf(
|
||||
|
|
Загрузка…
Ссылка в новой задаче