From 66034108ce47fb98c0177dc514b5ceb40ad5825d Mon Sep 17 00:00:00 2001 From: Oana Horvath Date: Wed, 5 Aug 2020 12:36:58 +0300 Subject: [PATCH] run context menu tests --- .../java/org/mozilla/fenix/ui/BookmarksTest.kt | 13 +++++++++++++ .../java/org/mozilla/fenix/ui/ContextMenusTest.kt | 11 +++++++++++ .../java/org/mozilla/fenix/ui/HistoryTest.kt | 13 +++++++++++++ .../org/mozilla/fenix/ui/MediaNotificationTest.kt | 13 +++++++++++++ .../java/org/mozilla/fenix/ui/SettingsAboutTest.kt | 14 +++++++++++++- .../org/mozilla/fenix/ui/SettingsBasicsTest.kt | 11 +++++++++++ .../org/mozilla/fenix/ui/SettingsPrivacyTest.kt | 11 +++++++++++ .../java/org/mozilla/fenix/ui/SmokeTest.kt | 11 +++++++++++ .../java/org/mozilla/fenix/ui/TopSitesTest.kt | 11 +++++++++++ automation/taskcluster/androidTest/flank-x86.yml | 4 ++-- 10 files changed, 109 insertions(+), 3 deletions(-) diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/BookmarksTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/BookmarksTest.kt index 3bb2f5348..014b143dc 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/BookmarksTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/BookmarksTest.kt @@ -6,12 +6,15 @@ package org.mozilla.fenix.ui import androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu import androidx.test.espresso.IdlingRegistry +import androidx.test.platform.app.InstrumentationRegistry import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation +import androidx.test.uiautomator.UiDevice import kotlinx.coroutines.runBlocking import mozilla.appservices.places.BookmarkRoot import okhttp3.mockwebserver.MockWebServer import org.junit.After import org.junit.Before +import org.junit.BeforeClass import org.junit.Ignore import org.junit.Rule import org.junit.Test @@ -54,6 +57,16 @@ class BookmarksTest { } } + // changing the device preference for Touch and Hold delay, to avoid long-clicks instead of a single-click + companion object { + @BeforeClass + @JvmStatic + fun setDevicePreference() { + val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) + mDevice.executeShellCommand("settings put secure long_press_timeout 3000") + } + } + @After fun tearDown() { mockWebServer.shutdown() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/ContextMenusTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/ContextMenusTest.kt index 67125a717..631429db5 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/ContextMenusTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/ContextMenusTest.kt @@ -9,6 +9,7 @@ import androidx.test.uiautomator.UiDevice import okhttp3.mockwebserver.MockWebServer import org.junit.After import org.junit.Before +import org.junit.BeforeClass import org.junit.Ignore import org.junit.Rule import org.junit.Test @@ -47,6 +48,16 @@ class ContextMenusTest { } } + // changing the device preference for Touch and Hold delay, to avoid long-clicks instead of a single-click + companion object { + @BeforeClass + @JvmStatic + fun setDevicePreference() { + val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) + mDevice.executeShellCommand("settings put secure long_press_timeout 3000") + } + } + @After fun tearDown() { mockWebServer.shutdown() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/HistoryTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/HistoryTest.kt index c1b65d5f2..54a3cfcb6 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/HistoryTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/HistoryTest.kt @@ -6,11 +6,14 @@ package org.mozilla.fenix.ui import android.content.Context import androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.uiautomator.UiDevice import kotlinx.coroutines.runBlocking import mozilla.components.browser.storage.sync.PlacesHistoryStorage import okhttp3.mockwebserver.MockWebServer import org.junit.After import org.junit.Before +import org.junit.BeforeClass import org.junit.Rule import org.junit.Test import org.mozilla.fenix.helpers.AndroidAssetDispatcher @@ -42,6 +45,16 @@ class HistoryTest { } } + // changing the device preference for Touch and Hold delay, to avoid long-clicks instead of a single-click + companion object { + @BeforeClass + @JvmStatic + fun setDevicePreference() { + val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) + mDevice.executeShellCommand("settings put secure long_press_timeout 3000") + } + } + @After fun tearDown() { mockWebServer.shutdown() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/MediaNotificationTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/MediaNotificationTest.kt index 14d463209..0f7cc2d42 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/MediaNotificationTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/MediaNotificationTest.kt @@ -4,10 +4,13 @@ package org.mozilla.fenix.ui +import androidx.test.platform.app.InstrumentationRegistry +import androidx.test.uiautomator.UiDevice import androidx.test.uiautomator.UiSelector import okhttp3.mockwebserver.MockWebServer import org.junit.After import org.junit.Before +import org.junit.BeforeClass import org.junit.Ignore import org.junit.Rule import org.junit.Test @@ -42,6 +45,16 @@ class MediaNotificationTest { } } + // changing the device preference for Touch and Hold delay, to avoid long-clicks instead of a single-click + companion object { + @BeforeClass + @JvmStatic + fun setDevicePreference() { + val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) + mDevice.executeShellCommand("settings put secure long_press_timeout 3000") + } + } + @After fun tearDown() { mockWebServer.shutdown() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAboutTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAboutTest.kt index b9963cb98..dafa3d220 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAboutTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAboutTest.kt @@ -10,6 +10,7 @@ import okhttp3.mockwebserver.MockWebServer import org.junit.Rule import org.junit.Before import org.junit.After +import org.junit.BeforeClass import org.junit.Ignore import org.junit.Test import org.mozilla.fenix.helpers.AndroidAssetDispatcher @@ -39,6 +40,16 @@ class SettingsAboutTest { } } + // changing the device preference for Touch and Hold delay, to avoid long-clicks instead of a single-click + companion object { + @BeforeClass + @JvmStatic + fun setDevicePreference() { + val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) + mDevice.executeShellCommand("settings put secure long_press_timeout 3000") + } + } + @After fun tearDown() { mockWebServer.shutdown() @@ -69,7 +80,8 @@ class SettingsAboutTest { } } - @Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/13219") + + // @Ignore("Failing, see: https://github.com/mozilla-mobile/fenix/issues/13219") @Test fun verifyAboutFirefoxPreview() { homeScreen { diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsBasicsTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsBasicsTest.kt index ee20a2c55..3106e222b 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsBasicsTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsBasicsTest.kt @@ -10,6 +10,7 @@ import androidx.test.uiautomator.UiDevice import okhttp3.mockwebserver.MockWebServer import org.junit.After import org.junit.Before +import org.junit.BeforeClass import org.junit.Rule import org.junit.Test import org.junit.Ignore @@ -44,6 +45,16 @@ class SettingsBasicsTest { } } + // changing the device preference for Touch and Hold delay, to avoid long-clicks instead of a single-click + companion object { + @BeforeClass + @JvmStatic + fun setDevicePreference() { + val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) + mDevice.executeShellCommand("settings put secure long_press_timeout 3000") + } + } + @After fun tearDown() { mockWebServer.shutdown() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsPrivacyTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsPrivacyTest.kt index c146a5213..da9a0cb35 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsPrivacyTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SettingsPrivacyTest.kt @@ -9,6 +9,7 @@ import androidx.test.uiautomator.UiDevice import okhttp3.mockwebserver.MockWebServer import org.junit.After import org.junit.Before +import org.junit.BeforeClass import org.junit.Ignore import org.junit.Rule import org.junit.Test @@ -46,6 +47,16 @@ class SettingsPrivacyTest { } } + // changing the device preference for Touch and Hold delay, to avoid long-clicks instead of a single-click + companion object { + @BeforeClass + @JvmStatic + fun setDevicePreference() { + val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) + mDevice.executeShellCommand("settings put secure long_press_timeout 3000") + } + } + @After fun tearDown() { mockWebServer.shutdown() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt index 802a3a22b..ec90db70e 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/SmokeTest.kt @@ -10,6 +10,7 @@ import androidx.test.uiautomator.UiDevice import okhttp3.mockwebserver.MockWebServer import org.junit.After import org.junit.Before +import org.junit.BeforeClass import org.junit.Ignore import org.junit.Rule import org.junit.Test @@ -39,6 +40,16 @@ class SmokeTest { } } + // changing the device preference for Touch and Hold delay, to avoid long-clicks instead of a single-click + companion object { + @BeforeClass + @JvmStatic + fun setDevicePreference() { + val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) + mDevice.executeShellCommand("settings put secure long_press_timeout 3000") + } + } + @After fun tearDown() { mockWebServer.shutdown() diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/TopSitesTest.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/TopSitesTest.kt index 697e25ca6..a5eea2e2b 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/TopSitesTest.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/TopSitesTest.kt @@ -9,6 +9,7 @@ import androidx.test.uiautomator.UiDevice import okhttp3.mockwebserver.MockWebServer import org.junit.After import org.junit.Before +import org.junit.BeforeClass import org.junit.Rule import org.junit.Test import org.mozilla.fenix.helpers.AndroidAssetDispatcher @@ -41,6 +42,16 @@ class TopSitesTest { } } + // changing the device preference for Touch and Hold delay, to avoid long-clicks instead of a single-click + companion object { + @BeforeClass + @JvmStatic + fun setDevicePreference() { + val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) + mDevice.executeShellCommand("settings put secure long_press_timeout 3000") + } + } + @After fun tearDown() { mockWebServer.shutdown() diff --git a/automation/taskcluster/androidTest/flank-x86.yml b/automation/taskcluster/androidTest/flank-x86.yml index 15e72ac14..8abde040c 100644 --- a/automation/taskcluster/androidTest/flank-x86.yml +++ b/automation/taskcluster/androidTest/flank-x86.yml @@ -38,8 +38,8 @@ gcloud: performance-metrics: true test-targets: - - package org.mozilla.fenix.ui - - package org.mozilla.fenix.glean + - class org.mozilla.fenix.ui.ContextMenusTest + # - package org.mozilla.fenix.glean device: - model: Pixel2