|
|
@ -5,8 +5,8 @@
|
|
|
|
package org.mozilla.fenix.syncintegration
|
|
|
|
package org.mozilla.fenix.syncintegration
|
|
|
|
|
|
|
|
|
|
|
|
import android.os.SystemClock.sleep
|
|
|
|
import android.os.SystemClock.sleep
|
|
|
|
import android.widget.Button
|
|
|
|
|
|
|
|
import android.widget.EditText
|
|
|
|
import android.widget.EditText
|
|
|
|
|
|
|
|
|
|
|
|
import androidx.test.espresso.Espresso.onView
|
|
|
|
import androidx.test.espresso.Espresso.onView
|
|
|
|
import androidx.test.espresso.action.ViewActions.click
|
|
|
|
import androidx.test.espresso.action.ViewActions.click
|
|
|
|
import androidx.test.espresso.action.ViewActions.replaceText
|
|
|
|
import androidx.test.espresso.action.ViewActions.replaceText
|
|
|
@ -26,6 +26,7 @@ import androidx.test.uiautomator.By
|
|
|
|
import androidx.test.uiautomator.Until
|
|
|
|
import androidx.test.uiautomator.Until
|
|
|
|
import org.hamcrest.Matchers.allOf
|
|
|
|
import org.hamcrest.Matchers.allOf
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
import org.mozilla.fenix.R
|
|
|
|
|
|
|
|
import org.mozilla.fenix.helpers.TestAssetHelper
|
|
|
|
|
|
|
|
|
|
|
|
@Suppress("RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
|
|
|
|
@Suppress("RECEIVER_NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
|
|
|
|
class SyncIntegrationTest {
|
|
|
|
class SyncIntegrationTest {
|
|
|
@ -40,9 +41,9 @@ class SyncIntegrationTest {
|
|
|
|
signInFxSync()
|
|
|
|
signInFxSync()
|
|
|
|
tapReturnToPreviousApp()
|
|
|
|
tapReturnToPreviousApp()
|
|
|
|
homeScreen {
|
|
|
|
homeScreen {
|
|
|
|
}.openThreeDotMenu {}
|
|
|
|
}.openThreeDotMenu {
|
|
|
|
libraryButton()
|
|
|
|
}.openLibrary {
|
|
|
|
historyButton()
|
|
|
|
}.openHistory { }
|
|
|
|
historyAfterSyncIsShown()
|
|
|
|
historyAfterSyncIsShown()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* These tests will be running in the future
|
|
|
|
/* These tests will be running in the future
|
|
|
@ -54,11 +55,10 @@ class SyncIntegrationTest {
|
|
|
|
fun checkBookmarkFromDesktopTest() {
|
|
|
|
fun checkBookmarkFromDesktopTest() {
|
|
|
|
signInFxSync()
|
|
|
|
signInFxSync()
|
|
|
|
tapReturnToPreviousApp()
|
|
|
|
tapReturnToPreviousApp()
|
|
|
|
sleep(5000)
|
|
|
|
|
|
|
|
homeScreen {
|
|
|
|
homeScreen {
|
|
|
|
}.openThreeDotMenu {}
|
|
|
|
}.openThreeDotMenu {
|
|
|
|
libraryButton()
|
|
|
|
}.openLibrary {
|
|
|
|
bookmarkButton()
|
|
|
|
}.openBookmarks { }
|
|
|
|
bookmarkAfterSyncIsShown()
|
|
|
|
bookmarkAfterSyncIsShown()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -77,7 +77,7 @@ class SyncIntegrationTest {
|
|
|
|
fun checkHistoryFromDeviceTest() {
|
|
|
|
fun checkHistoryFromDeviceTest() {
|
|
|
|
tapInToolBar()
|
|
|
|
tapInToolBar()
|
|
|
|
typeInToolBar()
|
|
|
|
typeInToolBar()
|
|
|
|
sleep(3000)
|
|
|
|
sleep(TestAssetHelper.waitingTime)
|
|
|
|
mDevice.pressBack()
|
|
|
|
mDevice.pressBack()
|
|
|
|
signInFxSync()
|
|
|
|
signInFxSync()
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -88,7 +88,7 @@ class SyncIntegrationTest {
|
|
|
|
val emailInput = mDevice.findObject(UiSelector()
|
|
|
|
val emailInput = mDevice.findObject(UiSelector()
|
|
|
|
.instance(0)
|
|
|
|
.instance(0)
|
|
|
|
.className(EditText::class.java))
|
|
|
|
.className(EditText::class.java))
|
|
|
|
emailInput.waitForExists(1000)
|
|
|
|
emailInput.waitForExists(TestAssetHelper.waitingTime)
|
|
|
|
|
|
|
|
|
|
|
|
val emailAddress = javaClass.classLoader.getResource("email.txt").readText()
|
|
|
|
val emailAddress = javaClass.classLoader.getResource("email.txt").readText()
|
|
|
|
emailInput.setText(emailAddress)
|
|
|
|
emailInput.setText(emailAddress)
|
|
|
@ -96,7 +96,7 @@ class SyncIntegrationTest {
|
|
|
|
|
|
|
|
|
|
|
|
fun tapOnContinueButton() {
|
|
|
|
fun tapOnContinueButton() {
|
|
|
|
val continueButton = mDevice.findObject(By.res("submit-btn"))
|
|
|
|
val continueButton = mDevice.findObject(By.res("submit-btn"))
|
|
|
|
continueButton.clickAndWait(Until.newWindow(), 50000)
|
|
|
|
continueButton.clickAndWait(Until.newWindow(), TestAssetHelper.waitingTime)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun typePassowrd() {
|
|
|
|
fun typePassowrd() {
|
|
|
@ -109,13 +109,10 @@ class SyncIntegrationTest {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun tapOnSygIn() {
|
|
|
|
fun tapOnSygIn() {
|
|
|
|
|
|
|
|
mDevice.wait(Until.findObjects(By.text("Sign in")), TestAssetHelper.waitingTime)
|
|
|
|
|
|
|
|
// Let's tap on enter, sometimes depending on the device the sign in button is
|
|
|
|
|
|
|
|
// hidden by the keyboard
|
|
|
|
mDevice.pressEnter()
|
|
|
|
mDevice.pressEnter()
|
|
|
|
mDevice.wait(Until.findObjects(By.text("Sign in")), 3000)
|
|
|
|
|
|
|
|
val signInButton = mDevice.findObject(UiSelector()
|
|
|
|
|
|
|
|
.instance(0)
|
|
|
|
|
|
|
|
.className(Button::class.java))
|
|
|
|
|
|
|
|
signInButton.waitForExists(10000)
|
|
|
|
|
|
|
|
signInButton.click()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun typeInToolBar() {
|
|
|
|
fun typeInToolBar() {
|
|
|
@ -134,18 +131,20 @@ class SyncIntegrationTest {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun seeBookmark() {
|
|
|
|
fun seeBookmark() {
|
|
|
|
mDevice.wait(Until.findObjects(By.text("Bookmark")), 3000)
|
|
|
|
mDevice.wait(Until.findObjects(By.text("Bookmark")), TestAssetHelper.waitingTime)
|
|
|
|
val bookmarkButton = mDevice.findObject(By.text("Bookmark"))
|
|
|
|
val bookmarkButton = mDevice.findObject(By.text("Bookmark"))
|
|
|
|
bookmarkButton.click()
|
|
|
|
bookmarkButton.click()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun tapReturnToPreviousApp() {
|
|
|
|
fun tapReturnToPreviousApp() {
|
|
|
|
mDevice.wait(Until.findObjects(By.text("Connected")), 2000)
|
|
|
|
mDevice.wait(Until.findObjects(By.text("Connected")), TestAssetHelper.waitingTime)
|
|
|
|
|
|
|
|
|
|
|
|
val settingsLabel = mDevice.wait(Until.findObject(By.text("Settings")), 20000)
|
|
|
|
val settingsLabel = mDevice.wait(Until.findObject(By.text("Settings")), TestAssetHelper.waitingTime)
|
|
|
|
settingsLabel.isClickable()
|
|
|
|
settingsLabel.isClickable()
|
|
|
|
|
|
|
|
|
|
|
|
mDevice.pressBack()
|
|
|
|
mDevice.wait(Until.findObjects(By.desc("Navigate up")), TestAssetHelper.waitingTime)
|
|
|
|
|
|
|
|
val backButton = mDevice.findObject(By.desc("Navigate up"))
|
|
|
|
|
|
|
|
backButton.click()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun signInFxSync() {
|
|
|
|
fun signInFxSync() {
|
|
|
@ -159,7 +158,7 @@ class SyncIntegrationTest {
|
|
|
|
typeEmail()
|
|
|
|
typeEmail()
|
|
|
|
tapOnContinueButton()
|
|
|
|
tapOnContinueButton()
|
|
|
|
typePassowrd()
|
|
|
|
typePassowrd()
|
|
|
|
sleep(3000)
|
|
|
|
sleep(TestAssetHelper.waitingTime)
|
|
|
|
tapOnSygIn()
|
|
|
|
tapOnSygIn()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -167,7 +166,4 @@ class SyncIntegrationTest {
|
|
|
|
fun settingsAccount() = onView(allOf(withText("Turn on Sync"))).perform(click())
|
|
|
|
fun settingsAccount() = onView(allOf(withText("Turn on Sync"))).perform(click())
|
|
|
|
fun tapInToolBar() = onView(withId(org.mozilla.fenix.R.id.toolbar_wrapper))
|
|
|
|
fun tapInToolBar() = onView(withId(org.mozilla.fenix.R.id.toolbar_wrapper))
|
|
|
|
fun awesomeBar() = onView(withId(org.mozilla.fenix.R.id.mozac_browser_toolbar_edit_url_view))
|
|
|
|
fun awesomeBar() = onView(withId(org.mozilla.fenix.R.id.mozac_browser_toolbar_edit_url_view))
|
|
|
|
fun libraryButton() = onView(allOf(withText(R.string.browser_menu_your_library))).perform(click())
|
|
|
|
|
|
|
|
fun historyButton() = onView(allOf(withText("History"))).perform(click())
|
|
|
|
|
|
|
|
fun bookmarkButton() = onView(allOf(withText("Bookmarks"))).perform(click())
|
|
|
|
|
|
|
|
fun useEmailInsteadButton() = onView(withId(R.id.signInEmailButton)).perform(click())
|
|
|
|
fun useEmailInsteadButton() = onView(withId(R.id.signInEmailButton)).perform(click())
|
|
|
|