Skip to content

Commit

Permalink
NMC-3250 -> opening login flow in internal webview instead of externa…
Browse files Browse the repository at this point in the history
…l browser.

NMC-1885: Splash screen customized
  • Loading branch information
surinder-tsys committed Sep 4, 2024
1 parent 3beab5f commit f10eb0d
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 267 deletions.
65 changes: 13 additions & 52 deletions app/src/androidTest/java/com/nmc/android/ui/LauncherActivityIT.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,72 +6,33 @@
*/
package com.nmc.android.ui

import androidx.annotation.UiThread
import androidx.test.core.app.launchActivity
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.IdlingRegistry
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.owncloud.android.AbstractIT
import com.owncloud.android.R
import com.owncloud.android.utils.EspressoIdlingResource
import org.junit.After
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class LauncherActivityIT : AbstractIT() {

@Before
fun registerIdlingResource() {
IdlingRegistry.getInstance().register(EspressoIdlingResource.countingIdlingResource)
}

@After
fun unregisterIdlingResource() {
IdlingRegistry.getInstance().unregister(EspressoIdlingResource.countingIdlingResource)
}

@Test
@UiThread
fun testSplashScreenWithEmptyTitlesShouldHideTitles() {
launchActivity<LauncherActivity>().use { scenario ->
scenario.onActivity { _ ->
onIdleSync {
onView(withId(R.id.ivSplash)).check(matches(isCompletelyDisplayed()))
onView(
withId(R.id.splashScreenBold)
).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE)))
onView(
withId(R.id.splashScreenNormal)
).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE)))
}
}
}
}
@get:Rule
val activityRule = ActivityScenarioRule(LauncherActivity::class.java)

@Test
@UiThread
fun testSplashScreenWithTitlesShouldShowTitles() {
launchActivity<LauncherActivity>().use { scenario ->
scenario.onActivity {
onIdleSync {
onView(withId(R.id.ivSplash)).check(matches(isCompletelyDisplayed()))

EspressoIdlingResource.increment()
it.setSplashTitles("Example", "Cloud")
EspressoIdlingResource.decrement()

val onePercentArea = ViewMatchers.isDisplayingAtLeast(1)
onView(withId(R.id.splashScreenBold)).check(matches(onePercentArea))
onView(withId(R.id.splashScreenNormal)).check(matches(onePercentArea))
}
}
}
fun verifyUIElements() {
onView(withId(R.id.ivSplash)).check(matches(isCompletelyDisplayed()))
onView(withId(R.id.splashScreenBold)).check(matches(isCompletelyDisplayed()))
onView(withId(R.id.splashScreenNormal)).check(matches(isCompletelyDisplayed()))

onView(withId(R.id.splashScreenBold)).check(matches(withText("Magenta")))
onView(withId(R.id.splashScreenNormal)).check(matches(withText("CLOUD")))
shortSleep()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import com.nextcloud.common.NextcloudClient;
import com.nextcloud.utils.extensions.AccountExtensionsKt;
import com.nmc.android.ui.LauncherActivity;
import com.owncloud.android.MainApp;
import com.owncloud.android.R;
import com.owncloud.android.authentication.AuthenticatorActivity;
Expand Down Expand Up @@ -397,6 +398,10 @@ private String getAccountType() {

@Override
public void startAccountCreation(final Activity activity) {
// NMC-3278 fix
// Splash screen should be shown properly before navigating to Login screen
if(activity instanceof LauncherActivity) return;

Intent intent = new Intent(context, AuthenticatorActivity.class);

intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Expand Down
Loading

0 comments on commit f10eb0d

Please sign in to comment.