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
NMC-571 -- removed usesCleartextTraffic from Manifest.
  • Loading branch information
surinder-tsys committed Jan 9, 2025
1 parent 0f7aa88 commit 796a341
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 305 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()
}
}
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@
android:supportsRtl="true"
android:enableOnBackInvokedCallback="false"
android:theme="@style/Theme.ownCloud.Toolbar"
android:usesCleartextTraffic="true"
tools:ignore="UnusedAttribute"
tools:replace="android:allowBackup">

Expand Down
Loading

0 comments on commit 796a341

Please sign in to comment.