Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into fix-collection-test
Browse files Browse the repository at this point in the history
  • Loading branch information
boek committed Aug 7, 2019
2 parents 938445d + c388bad commit 8c0d33c
Show file tree
Hide file tree
Showing 41 changed files with 1,106 additions and 791 deletions.
3 changes: 2 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply from: "$project.rootDir/automation/gradle/versionCode.gradle"
apply plugin: 'androidx.navigation.safeargs.kotlin'
apply plugin: 'com.google.android.gms.oss-licenses-plugin'

import com.android.build.gradle.internal.tasks.AppPreBuildTask
import org.gradle.internal.logging.text.StyledTextOutput.Style
Expand Down Expand Up @@ -289,8 +290,8 @@ dependencies {
implementation Deps.anko_constraintlayout

implementation Deps.sentry

implementation Deps.leanplum
implementation Deps.osslicenses_library

implementation Deps.mozilla_concept_engine
implementation Deps.mozilla_concept_push
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import org.mozilla.fenix.ui.robots.homeScreen
/**
* Tests for verifying the presence of home screen and first-run homescreen elements
*
* Note: For private browsing, navigation bar and tabs see separate test class
*
*/

class HomeScreenTest {
Expand Down
2 changes: 0 additions & 2 deletions app/src/androidTest/java/org/mozilla/fenix/ui/SearchTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class SearchTest {

homeScreen {
}.openSearch {
clickShortcutsButton()
verifySearchWithText()
clickDuckDuckGoEngineButton()
typeSearch()
Expand All @@ -74,7 +73,6 @@ class SearchTest {

homeScreen {
}.openSearch {
clickShortcutsButton()
scrollToSearchEngineSettings()
clickSearchEngineSettings()
verifySearchEngineSettings()
Expand Down
122 changes: 122 additions & 0 deletions app/src/androidTest/java/org/mozilla/fenix/ui/TabsTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/* 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.Ignore
import org.junit.Rule
import org.junit.Test
import org.junit.Before
import org.junit.After
import org.mozilla.fenix.helpers.AndroidAssetDispatcher
import org.mozilla.fenix.helpers.HomeActivityTestRule
import org.mozilla.fenix.helpers.TestAssetHelper
import org.mozilla.fenix.ui.robots.homeScreen
import org.mozilla.fenix.ui.robots.navigationToolbar

/**
* Tests for verifying basic functionality of tabs
*
*/

class TabsTest {
/* 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()
}

@Ignore("This is a stub test, ignore for now")
@Test
fun tabsItemsTest() {
homeScreen { }.dismissOnboarding()

// Setup browser so that tabs are visible in UI
// Verify all tabs elements are visible:
// "open tabs header, + button, etc.
// Verify tabs 3-dot menu elements
}

@Ignore("This is a stub test, ignore for now")
@Test
fun noTabsInCacheTest() {
// Verify open tabs header and text exists (when no previous browsing)
// Verify + button redirects to navigation bar UI
// Verify "Collections" header exists
// Verify "No collections" text (when no previous browsing)
}

@Ignore("This is a stub test, ignore for now")
@Test
fun browsingWithTabsTest() {
// Setup:
// - Verify + button redirects to navigation bar UI
// - Enter mock website via navigation bar
// Verify "Open tabs" header exits
// Verify Collections header exits
// Verify that tabs counter is augmented by 1 count
// Click on tabs counter
// Verify that new page is listed in "Open tabs"
// Repeat for several sites

}

@Ignore("This is a stub test, ignore for now")
@Test
fun tabsThreeDotMenuTest() {
// short 3-dot menu setup:
// - create multiple tabs (using mock web server) for the following...
// Verify tabs 3-dot menu functions:
// 1. "Close all tabs"
// 2. "Share tabs" - opens share sub-menu
// 3. "Save to collection" - verify saved to collection

// NOTE: extended 3 dot menu test is verified in a separate class
}

@Ignore("This is a stub test, ignore for now")
@Test
fun collectionsTest() {
// Setup:
// - create multiple tabs (using mock web server) for the following...
// Verify collections header exits
// Verify multiple collections can be saved, named
// Verify "Select tabs to save"
// Verify collections dropdown toggle
// Verify send and share button works - opens share menu

// Verify collections 3-dot menu functions:
// 1. Delete collection
// 2. Rename collection
// 3. Open tabs
}

@Ignore("This is a sample test, ignore")
@Test
fun sampleTest() {
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)

navigationToolbar {
}.enterURLAndEnterToBrowser(defaultWebPage.url) {
}
}
}
23 changes: 23 additions & 0 deletions app/src/androidTest/java/org/mozilla/fenix/ui/robots/TabsRobot.kt
Original file line number Diff line number Diff line change
@@ -0,0 +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("TooManyFunctions")

package org.mozilla.fenix.ui.robots

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice

class TabsRobot {

// Tabs functions here

class Transition {
private val mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())

// Transition functions here
}
}

// Locaters here
6 changes: 6 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@
android:enabled="${isRaptorEnabled}"
android:exported="${isRaptorEnabled}" />

<activity android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
android:theme="@style/Theme.AppCompat.DayNight.DarkActionBar"/>

<activity android:name="com.google.android.gms.oss.licenses.OssLicensesActivity"
android:theme="@style/Theme.AppCompat.DayNight.DarkActionBar"/>

<service
android:name=".customtabs.CustomTabsService"
android:exported="true"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/org/mozilla/fenix/HomeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ open class HomeActivity : AppCompatActivity(), ShareFragment.TabsSharedCallback
return
} else if (intent?.extras?.getBoolean(OPEN_TO_SEARCH) == true) {
this.intent.putExtra(OPEN_TO_SEARCH, false)
navHost.navController.nav(null, NavGraphDirections.actionGlobalSearch(null, true))
navHost.navController.nav(null, NavGraphDirections.actionGlobalSearch(null))
return
}

Expand Down

0 comments on commit 8c0d33c

Please sign in to comment.