2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-15 18:12:54 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/25808: Handle PackageManager methods deprecation in UI tests.

This commit is contained in:
mcarare 2022-11-16 14:32:51 +02:00 committed by mergify[bot]
parent 0b6c41567f
commit 0b50f9b8cb

View File

@ -23,6 +23,7 @@ import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiScrollable
import androidx.test.uiautomator.UiSelector
import mozilla.components.support.utils.ext.getPackageInfoCompat
import org.hamcrest.CoreMatchers.allOf
import org.hamcrest.CoreMatchers.containsString
import org.junit.Assert.assertTrue
@ -97,7 +98,7 @@ private fun assertAboutToolbar() =
private fun assertVersionNumber() {
val context = InstrumentationRegistry.getInstrumentation().targetContext
val packageInfo = context.packageManager.getPackageInfo(context.packageName, 0)
val packageInfo = context.packageManager.getPackageInfoCompat(context.packageName, 0)
val versionCode = PackageInfoCompat.getLongVersionCode(packageInfo).toString()
val buildNVersion = "${packageInfo.versionName} (Build #$versionCode)\n"