LauncherActivityIT.kt 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. *
  3. * Nextcloud Android client application
  4. *
  5. * @author TSI-mc
  6. * Copyright (C) 2023 TSI-mc
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License
  19. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. */
  21. package com.nmc.android.ui
  22. import androidx.test.espresso.Espresso.onView
  23. import androidx.test.espresso.assertion.ViewAssertions.matches
  24. import androidx.test.espresso.matcher.ViewMatchers
  25. import androidx.test.espresso.matcher.ViewMatchers.isCompletelyDisplayed
  26. import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
  27. import androidx.test.espresso.matcher.ViewMatchers.withId
  28. import androidx.test.ext.junit.rules.ActivityScenarioRule
  29. import androidx.test.ext.junit.runners.AndroidJUnit4
  30. import com.owncloud.android.AbstractIT
  31. import com.owncloud.android.R
  32. import org.junit.Rule
  33. import org.junit.Test
  34. import org.junit.runner.RunWith
  35. @RunWith(AndroidJUnit4::class)
  36. class LauncherActivityIT : AbstractIT() {
  37. @get:Rule
  38. val activityRule = ActivityScenarioRule(LauncherActivity::class.java)
  39. @Test
  40. fun testSplashScreenWithEmptyTitlesShouldHideTitles() {
  41. waitForIdleSync()
  42. onView(withId(R.id.ivSplash)).check(matches(isCompletelyDisplayed()))
  43. onView(withId(R.id.splashScreenBold)).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE)))
  44. onView(withId(R.id.splashScreenNormal)).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE)))
  45. }
  46. @Test
  47. fun testSplashScreenWithTitlesShouldShowTitles() {
  48. waitForIdleSync()
  49. onView(withId(R.id.ivSplash)).check(matches(isCompletelyDisplayed()))
  50. activityRule.scenario.onActivity {
  51. it.setSplashTitles("Example", "Cloud")
  52. }
  53. val onePercentArea = ViewMatchers.isDisplayingAtLeast(1)
  54. onView(withId(R.id.splashScreenBold)).check(matches(onePercentArea))
  55. onView(withId(R.id.splashScreenNormal)).check(matches(onePercentArea))
  56. }
  57. }