SetStatusDialogFragmentIT.kt 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Nextcloud - Android Client
  3. *
  4. * SPDX-FileCopyrightText: 2020 Tobias Kaminsky <tobias@kaminsky.me>
  5. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH
  6. * SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
  7. */
  8. package com.nextcloud.ui
  9. import androidx.test.espresso.intent.rule.IntentsTestRule
  10. import com.owncloud.android.AbstractIT
  11. import com.owncloud.android.lib.resources.users.ClearAt
  12. import com.owncloud.android.lib.resources.users.PredefinedStatus
  13. import com.owncloud.android.lib.resources.users.Status
  14. import com.owncloud.android.lib.resources.users.StatusType
  15. import com.owncloud.android.ui.activity.FileDisplayActivity
  16. import org.junit.Rule
  17. import org.junit.Test
  18. class SetStatusDialogFragmentIT : AbstractIT() {
  19. @get:Rule
  20. var activityRule = IntentsTestRule(FileDisplayActivity::class.java, true, false)
  21. @Test
  22. fun open() {
  23. val sut = SetStatusDialogFragment.newInstance(user, Status(StatusType.DND, "Working hard…", "🤖", -1))
  24. val activity = activityRule.launchActivity(null)
  25. sut.show(activity.supportFragmentManager, "")
  26. val predefinedStatus: ArrayList<PredefinedStatus> = arrayListOf(
  27. PredefinedStatus("meeting", "📅", "In a meeting", ClearAt("period", "3600")),
  28. PredefinedStatus("commuting", "🚌", "Commuting", ClearAt("period", "1800")),
  29. PredefinedStatus("remote-work", "🏡", "Working remotely", ClearAt("end-of", "day")),
  30. PredefinedStatus("sick-leave", "🤒", "Out sick", ClearAt("end-of", "day")),
  31. PredefinedStatus("vacationing", "🌴", "Vacationing", null)
  32. )
  33. shortSleep()
  34. activity.runOnUiThread { sut.setPredefinedStatus(predefinedStatus) }
  35. longSleep()
  36. }
  37. }