1
0
Fork 0

fixing reviewers comments

improve writing email and password in file
master
isabelrios 2019-10-02 14:57:14 +02:00
parent cdefb0d099
commit 2fc6eaf5d4
6 changed files with 27 additions and 39 deletions

View File

@ -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())

View File

@ -58,10 +58,11 @@ def tps_addon(pytestconfig, tmpdir_factory):
def tps_config(fxa_account, monkeypatch): def tps_config(fxa_account, monkeypatch):
monkeypatch.setenv('FXA_EMAIL', fxa_account.email) monkeypatch.setenv('FXA_EMAIL', fxa_account.email)
monkeypatch.setenv('FXA_PASSWORD', fxa_account.password) monkeypatch.setenv('FXA_PASSWORD', fxa_account.password)
f= open("/Users/synctesting/.jenkins/workspace/fenix@2/app/src/androidTest/resources/email.txt","w+") with open ("/Users/synctesting/.jenkins/workspace/fenix/app/src/androidTest/resources/email.txt", "w") as f:
f.write(fxa_account.email) f.write(fxa_account.email)
f= open("/Users/synctesting/.jenkins/workspace/fenix@2/app/src/androidTest/resources/password.txt","w+")
f.write(fxa_account.password) with open ("/Users/synctesting/.jenkins/workspace/fenix/app/src/androidTest/resources/password.txt", "w") as f:
f.write(fxa_account.password)
yield {'fx_account': { yield {'fx_account': {
'username': fxa_account.email, 'username': fxa_account.email,

View File

@ -18,16 +18,9 @@ class GradlewBuild(object):
def test(self, identifier): def test(self, identifier):
self.adbrun.launch() self.adbrun.launch()
#self.xcrun.launch()
# Change path accordingly to go to root folder to run gradlew # Change path accordingly to go to root folder to run gradlew
os.chdir('../../../../../../../..') os.chdir('../../../../../../../..')
args = './gradlew ' + 'app:connectedGeckoNightlyDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=org.mozilla.fenix.syncintegration.SyncIntegrationTest#{}'.format(identifier) args = './gradlew ' + 'app:connectedGeckoNightlyDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=org.mozilla.fenix.syncintegration.SyncIntegrationTest#{}'.format(identifier)
# os.system(args)
# Whit this the logs are shown when there is a failure
# they are saved in ~/fenix/app/build/reports/androidTests/connected/flavors/X86/index.html
# output = subprocess.check_output(args, shell=True)
# This part below does not work yet...
self.logger.info('Running: {}'.format(' '.join(args))) self.logger.info('Running: {}'.format(' '.join(args)))
try: try:

View File

@ -2,7 +2,7 @@
set -e set -e
echo "Waiting emulator is ready..." echo "Waiting emulator is ready..."
~/Library/Android/sdk/emulator/emulator -avd Pixel_API_28 -wipe-data -no-boot-anim -screen no-touch & ~/Library/Android/sdk/emulator/emulator -avd Pixel_3_API_28 -wipe-data -no-boot-anim -screen no-touch &
bootanim="" bootanim=""
failcounter=0 failcounter=0

View File

@ -1 +0,0 @@
pytest-28f90ad8b4@restmail.net

View File

@ -1 +0,0 @@
yArgpjhB