This repository has been archived by the owner on Feb 20, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
6059: Add verify items tests for settings menus r=kglazko a=rpappalax Also closes #6006 All UI tests are passing with the exception of 1 which was just uncovered by a new test in this PR. Issue here: #6053 Co-authored-by: Richard Pappalardo <rpappalax@gmail.com>
- Loading branch information
Showing
19 changed files
with
673 additions
and
46 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
app/src/androidTest/java/org/mozilla/fenix/helpers/TestHelper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* 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/. */ | ||
|
||
package org.mozilla.fenix.helpers | ||
|
||
import androidx.test.uiautomator.UiScrollable | ||
import androidx.test.uiautomator.UiSelector | ||
|
||
object TestHelper { | ||
fun scrollToElementByText(text: String): UiScrollable { | ||
val appView = UiScrollable(UiSelector().scrollable(true)) | ||
appView.scrollTextIntoView(text) | ||
return appView | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
app/src/androidTest/java/org/mozilla/fenix/ui/SettingsAboutTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* 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/. */ | ||
|
||
package org.mozilla.fenix.ui | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.uiautomator.UiDevice | ||
import okhttp3.mockwebserver.MockWebServer | ||
import org.junit.Rule | ||
import org.junit.Before | ||
import org.junit.After | ||
import org.junit.Ignore | ||
import org.junit.Test | ||
import org.mozilla.fenix.helpers.AndroidAssetDispatcher | ||
import org.mozilla.fenix.helpers.HomeActivityTestRule | ||
import org.mozilla.fenix.ui.robots.homeScreen | ||
|
||
/** | ||
* Tests for verifying the main three dot menu options | ||
* | ||
*/ | ||
|
||
class SettingsAboutTest { | ||
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping. | ||
|
||
private val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) | ||
private lateinit var mockWebServer: MockWebServer | ||
|
||
@get:Rule | ||
val activityTestRule = HomeActivityTestRule() | ||
|
||
@Before | ||
fun setUp() { | ||
mockWebServer = MockWebServer().apply { | ||
setDispatcher(AndroidAssetDispatcher()) | ||
start() | ||
} | ||
} | ||
|
||
@After | ||
fun tearDown() { | ||
mockWebServer.shutdown() | ||
} | ||
|
||
@Test | ||
// Walks through settings menu and sub-menus to ensure all items are present | ||
fun settingsAboutItemsTest() { | ||
// ABOUT | ||
homeScreen { | ||
}.openThreeDotMenu { | ||
}.openSettings { | ||
// ABOUT | ||
verifyAboutHeading() | ||
verifyHelp() | ||
verifyRateOnGooglePlay() | ||
verifyAboutFirefoxPreview() | ||
} | ||
} | ||
|
||
// ABOUT | ||
@Ignore("This is a stub test, ignore for now") | ||
@Test | ||
fun verifyHelpRedirect() { | ||
// Open 3dot (main) menu | ||
// Select settings | ||
// Click on "Help" | ||
// Verify redirect to: https://support.mozilla.org/ | ||
} | ||
|
||
@Ignore("This is a stub test, ignore for now") | ||
@Test | ||
fun verifyRateOnGooglePlayRedirect() { | ||
// Open 3dot (main) menu | ||
// Select settings | ||
// Click on "Rate on Google Play" | ||
// Verify Android "Open with Google Play Store" sub menu | ||
} | ||
|
||
@Ignore("This is a stub test, ignore for now") | ||
@Test | ||
fun verifyAboutFirefoxPreview() { | ||
// Open 3dot (main) menu | ||
// Select settings | ||
// Click on "Verify About Firefox Preview" | ||
// Verify about page contains.... | ||
// Build # | ||
// Version # | ||
// "Firefox Preview is produced by Mozilla" | ||
// Day, Date, timestamp | ||
// "Open source libraries we use" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
app/src/androidTest/java/org/mozilla/fenix/ui/SettingsDeveloperToolsTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/* 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/. */ | ||
|
||
package org.mozilla.fenix.ui | ||
|
||
import androidx.test.platform.app.InstrumentationRegistry | ||
import androidx.test.uiautomator.UiDevice | ||
import okhttp3.mockwebserver.MockWebServer | ||
import org.junit.Rule | ||
import org.junit.Before | ||
import org.junit.After | ||
import org.junit.Ignore | ||
import org.junit.Test | ||
import org.mozilla.fenix.helpers.AndroidAssetDispatcher | ||
import org.mozilla.fenix.helpers.HomeActivityTestRule | ||
import org.mozilla.fenix.ui.robots.homeScreen | ||
|
||
/** | ||
* Tests for verifying the main three dot menu options | ||
* | ||
*/ | ||
|
||
class SettingsDeveloperToolsTest { | ||
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping. | ||
|
||
private val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) | ||
private lateinit var mockWebServer: MockWebServer | ||
|
||
@get:Rule | ||
val activityTestRule = HomeActivityTestRule() | ||
|
||
@Before | ||
fun setUp() { | ||
mockWebServer = MockWebServer().apply { | ||
setDispatcher(AndroidAssetDispatcher()) | ||
start() | ||
} | ||
} | ||
|
||
@After | ||
fun tearDown() { | ||
mockWebServer.shutdown() | ||
} | ||
|
||
@Test | ||
// Walks through settings developer tools menu and sub-menus to ensure all items are present | ||
fun settingsDeveloperToolsItemsTest() { | ||
homeScreen { | ||
}.openThreeDotMenu { | ||
}.openSettings { | ||
verifyDeveloperToolsHeading() | ||
verifyRemoteDebug() | ||
} | ||
} | ||
|
||
// DEVELOPER TOOLS | ||
@Ignore("This is a stub test, ignore for now") | ||
@Test | ||
fun turnOnRemoteDebuggingViaUsb() { | ||
// Open terminal | ||
// Verify USB debugging is off | ||
// Open 3dot (main) menu | ||
// Select settings | ||
// Toggle Remote debugging via USB to 'on' | ||
// Open terminal | ||
// Verify USB debugging is on | ||
} | ||
|
||
// ABOUT | ||
@Ignore("This is a stub test, ignore for now") | ||
@Test | ||
fun verifyHelpRedirect() { | ||
// Open 3dot (main) menu | ||
// Select settings | ||
// Click on "Help" | ||
// Verify redirect to: https://support.mozilla.org/ | ||
} | ||
|
||
@Ignore("This is a stub test, ignore for now") | ||
@Test | ||
fun verifyRateOnGooglePlayRedirect() { | ||
// Open 3dot (main) menu | ||
// Select settings | ||
// Click on "Rate on Google Play" | ||
// Verify Android "Open with Google Play Store" sub menu | ||
} | ||
|
||
@Ignore("This is a stub test, ignore for now") | ||
@Test | ||
fun verifyAboutFirefoxPreview() { | ||
// Open 3dot (main) menu | ||
// Select settings | ||
// Click on "Verify About Firefox Preview" | ||
// Verify about page contains.... | ||
// Build # | ||
// Version # | ||
// "Firefox Preview is produced by Mozilla" | ||
// Day, Date, timestamp | ||
// "Open source libraries we use" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.