LauncherActivityIT.kt 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. import org.mockito.AdditionalMatchers.not
  36. @RunWith(AndroidJUnit4::class)
  37. class LauncherActivityIT : AbstractIT() {
  38. @get:Rule
  39. val activityRule = ActivityScenarioRule(LauncherActivity::class.java)
  40. @Test
  41. fun testSplashScreenWithEmptyTitlesShouldHideTitles() {
  42. waitForIdleSync()
  43. onView(withId(R.id.ivSplash)).check(matches(isCompletelyDisplayed()))
  44. onView(withId(R.id.splashScreenBold)).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE)))
  45. onView(withId(R.id.splashScreenNormal)).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE)))
  46. }
  47. @Test
  48. fun testSplashScreenWithTitlesShouldShowTitles() {
  49. waitForIdleSync()
  50. onView(withId(R.id.ivSplash)).check(matches(isCompletelyDisplayed()))
  51. activityRule.scenario.onActivity {
  52. it.setSplashTitles("Example", "Cloud")
  53. }
  54. val onePercentArea = ViewMatchers.isDisplayingAtLeast(1)
  55. onView(withId(R.id.splashScreenBold)).check(matches(onePercentArea))
  56. onView(withId(R.id.splashScreenNormal)).check(matches(onePercentArea))
  57. }
  58. }