LauncherActivityIT.kt 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Nextcloud - Android Client
  3. *
  4. * SPDX-FileCopyrightText: 2023 TSI-mc
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. package com.nmc.android.ui
  8. import androidx.test.espresso.Espresso.onView
  9. import androidx.test.espresso.assertion.ViewAssertions.matches
  10. import androidx.test.espresso.matcher.ViewMatchers
  11. import androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed
  12. import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
  13. import androidx.test.espresso.matcher.ViewMatchers.withId
  14. import androidx.test.ext.junit.rules.ActivityScenarioRule
  15. import androidx.test.ext.junit.runners.AndroidJUnit4
  16. import com.owncloud.android.AbstractIT
  17. import com.owncloud.android.R
  18. import org.junit.Rule
  19. import org.junit.Test
  20. import org.junit.runner.RunWith
  21. @RunWith(AndroidJUnit4::class)
  22. class LauncherActivityIT : AbstractIT() {
  23. @get:Rule
  24. val activityRule = ActivityScenarioRule(LauncherActivity::class.java)
  25. @Test
  26. fun testSplashScreenWithEmptyTitlesShouldHideTitles() {
  27. waitForIdleSync()
  28. onView(withId(R.id.ivSplash)).check(matches(isCompletelyDisplayed()))
  29. onView(withId(R.id.splashScreenBold)).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE)))
  30. onView(withId(R.id.splashScreenNormal)).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE)))
  31. }
  32. @Test
  33. fun testSplashScreenWithTitlesShouldShowTitles() {
  34. waitForIdleSync()
  35. onView(withId(R.id.ivSplash)).check(matches(isCompletelyDisplayed()))
  36. activityRule.scenario.onActivity {
  37. it.setSplashTitles("Example", "Cloud")
  38. }
  39. val onePercentArea = ViewMatchers.isDisplayingAtLeast(1)
  40. onView(withId(R.id.splashScreenBold)).check(matches(onePercentArea))
  41. onView(withId(R.id.splashScreenNormal)).check(matches(onePercentArea))
  42. }
  43. }