Skip to content

Commit

Permalink
Merge pull request #2397 from owncloud/espresso/fix_auth_tests_after_…
Browse files Browse the repository at this point in the history
…PR2302

Fix espresso tests after merging PR 2302
  • Loading branch information
jesmrec authored Dec 13, 2018
2 parents a0ae34a + a7ece64 commit ef2ccbe
Showing 1 changed file with 14 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,24 +160,24 @@ public void test1_check_certif_not_secure_no_accept()
if (servertype == ServerType.HTTPS_NON_SECURE ||
servertype == ServerType.REDIRECTED_NON_SECURE ) {

// Check that login button is disabled
// Check that login button is not displayed
onView(withId(R.id.loginButton))
.check(matches(not(isEnabled())));
.check(matches(not(isDisplayed())));

// Type server url
onView(withId(R.id.hostUrlInput))
.perform(replaceText(testServerURL), closeSoftKeyboard());
onView(withId(R.id.scroll)).perform(click());
onView(withId(R.id.embeddedCheckServerButton)).perform(click());
SystemClock.sleep(WAIT_CONNECTION_MS);

//certif not accepted
onView(withId(R.id.cancel)).perform(click());

SystemClock.sleep(WAIT_CONNECTION_MS);

// Check that login button keeps on being disabled
// Check that login button keeps on not being displayed
onView(withId(R.id.loginButton))
.check(matches(not(isEnabled())));
.check(matches(not(isDisplayed())));

// Check that SSL server is not trusted
onView(withId(R.id.server_status_text))
Expand All @@ -204,14 +204,14 @@ public void test2_check_certif_not_secure()
if (servertype == ServerType.HTTPS_NON_SECURE ||
servertype == ServerType.REDIRECTED_NON_SECURE) {

// Check that login button is disabled
// Check that login button is not displayed
onView(withId(R.id.loginButton))
.check(matches(not(isEnabled())));
.check(matches(not(isDisplayed())));

// Type server url
onView(withId(R.id.hostUrlInput))
.perform(replaceText(testServerURL), closeSoftKeyboard());
onView(withId(R.id.scroll)).perform(click());
onView(withId(R.id.embeddedCheckServerButton)).perform(click());
SystemClock.sleep(WAIT_CONNECTION_MS);

//Check untrusted certificate, opening the details
Expand Down Expand Up @@ -309,10 +309,8 @@ public void test4_login_orientation_changes()
onView(withId(R.id.scroll)).perform(click());
SystemClock.sleep(WAIT_CONNECTION_MS);

onView(withId(R.id.account_username)).perform(click(),
replaceText(testUser), closeSoftKeyboard());
onView(withId(R.id.account_password)).perform(click(),
replaceText(testPassword), closeSoftKeyboard());
onView(withId(R.id.account_username)).perform(replaceText(testUser), closeSoftKeyboard());
onView(withId(R.id.account_password)).perform(replaceText(testPassword), closeSoftKeyboard());

//Set portrait
mActivityRule.getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Expand Down Expand Up @@ -414,32 +412,11 @@ public void test7_check_existing_account()

}

/**
* Login without credentials (Negative test)
*/
@Test
public void test8_check_login_blanks()
throws IllegalArgumentException {

Log_OC.i(LOG_TAG, "Test Check Blanks Login Start");

// Check that login button is hidden
onView(withId(R.id.loginButton)).check(matches(not(isDisplayed())));

setFields(testServerURL, "", "");

//check that the credentials are not correct
onView(withId(R.id.auth_status_text)).check(matches(withText(R.string.auth_unauthorized)));

Log_OC.i(LOG_TAG, "Test Check Blanks Login Passed");

}

/**
* Login with an username that contains blanks before and after.
*/
@Test
public void test9_check_login_trimmed_blanks()
public void test8_check_login_trimmed_blanks()
throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException {

Log_OC.i(LOG_TAG, "Test Check Trimmed Blanks Start");
Expand Down Expand Up @@ -470,7 +447,7 @@ public void test9_check_login_trimmed_blanks()
* Login with server URL copied and pasted from web browser
*/
@Test
public void test_10_check_url_from_browser()
public void test9_check_url_from_browser()
throws NoSuchFieldException, IllegalArgumentException, IllegalAccessException {

Log_OC.i(LOG_TAG, "Test Check URL Browser Start");
Expand Down Expand Up @@ -501,14 +478,14 @@ public void test_10_check_url_from_browser()
* Login with server URL in uppercase
*/
@Test
public void test_11_check_url_uppercase()
public void test_10_check_url_uppercase()
throws IllegalArgumentException {

Log_OC.i(LOG_TAG, "Test Check URL Uppercase Start");

onView(withId(R.id.hostUrlInput))
.perform(replaceText(testServerURL.toUpperCase()), closeSoftKeyboard());
onView(withId(R.id.scroll)).perform(click());
onView(withId(R.id.embeddedCheckServerButton)).perform(click());
SystemClock.sleep(WAIT_CONNECTION_MS);

checkStatusMessage();
Expand Down

0 comments on commit ef2ccbe

Please sign in to comment.