зеркало из https://github.com/nextcloud/android.git
Fix code analytics
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
Родитель
e9ccdd2d19
Коммит
3b4b644b1d
|
@ -8,19 +8,27 @@
|
|||
package com.owncloud.android.ui.activity
|
||||
|
||||
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.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.nextcloud.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.lib.resources.notifications.models.Action
|
||||
import com.owncloud.android.lib.resources.notifications.models.Notification
|
||||
import com.owncloud.android.lib.resources.notifications.models.RichObject
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
import java.util.GregorianCalendar
|
||||
|
||||
class NotificationsActivityIT : AbstractIT() {
|
||||
private val scope = CoroutineScope(Dispatchers.IO)
|
||||
private val testClassName = "com.owncloud.android.ui.activity.NotificationsActivityIT"
|
||||
|
||||
@Before
|
||||
|
@ -41,7 +49,14 @@ class NotificationsActivityIT : AbstractIT() {
|
|||
onIdleSync {
|
||||
sut.runOnUiThread { sut.populateList(ArrayList()) }
|
||||
val screenShotName = createName(testClassName + "_" + "empty", "")
|
||||
screenshotViaName(sut, screenShotName)
|
||||
|
||||
scope.launch {
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
|
||||
launch(Dispatchers.Main) {
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +148,13 @@ class NotificationsActivityIT : AbstractIT() {
|
|||
scenario.onActivity { sut ->
|
||||
sut.runOnUiThread { sut.populateList(notifications) }
|
||||
val screenShotName = createName(testClassName + "_" + "showNotifications", "")
|
||||
screenshotViaName(sut, screenShotName)
|
||||
scope.launch {
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
|
||||
launch(Dispatchers.Main) {
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +166,14 @@ class NotificationsActivityIT : AbstractIT() {
|
|||
scenario.onActivity { sut ->
|
||||
sut.runOnUiThread { sut.setEmptyContent("Error", "Error! Please try again later!") }
|
||||
val screenShotName = createName(testClassName + "_" + "error", "")
|
||||
screenshotViaName(sut, screenShotName)
|
||||
|
||||
scope.launch {
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
|
||||
launch(Dispatchers.Main) {
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,17 +11,25 @@ import android.accounts.Account
|
|||
import android.accounts.AccountManager
|
||||
import android.content.Intent
|
||||
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.isDisplayed
|
||||
import androidx.test.espresso.matcher.ViewMatchers.isRoot
|
||||
import com.nextcloud.utils.EspressoIdlingResource
|
||||
import com.owncloud.android.AbstractIT
|
||||
import com.owncloud.android.MainApp
|
||||
import com.owncloud.android.lib.common.accounts.AccountUtils
|
||||
import com.owncloud.android.utils.ScreenshotTest
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import org.junit.After
|
||||
import org.junit.Before
|
||||
import org.junit.Test
|
||||
|
||||
class TrashbinActivityIT : AbstractIT() {
|
||||
private val scope = CoroutineScope(Dispatchers.IO)
|
||||
private val testClassName = "com.owncloud.android.ui.trashbin.TrashbinActivityIT"
|
||||
|
||||
enum class TestCase {
|
||||
|
@ -48,7 +56,13 @@ class TrashbinActivityIT : AbstractIT() {
|
|||
onIdleSync {
|
||||
sut.runOnUiThread { sut.loadFolder() }
|
||||
val screenShotName = createName(testClassName + "_" + "error", "")
|
||||
screenshotViaName(sut, screenShotName)
|
||||
scope.launch {
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
|
||||
launch(Dispatchers.Main) {
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +94,13 @@ class TrashbinActivityIT : AbstractIT() {
|
|||
onIdleSync {
|
||||
sut.runOnUiThread { sut.loadFolder() }
|
||||
val screenShotName = createName(testClassName + "_" + "empty", "")
|
||||
screenshotViaName(sut, screenShotName)
|
||||
scope.launch {
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
|
||||
launch(Dispatchers.Main) {
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +116,13 @@ class TrashbinActivityIT : AbstractIT() {
|
|||
onIdleSync {
|
||||
sut.runOnUiThread { sut.showInitialLoading() }
|
||||
val screenShotName = createName(testClassName + "_" + "loading", "")
|
||||
screenshotViaName(sut, screenShotName)
|
||||
scope.launch {
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
|
||||
launch(Dispatchers.Main) {
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +138,13 @@ class TrashbinActivityIT : AbstractIT() {
|
|||
onIdleSync {
|
||||
sut.runOnUiThread { sut.showUser() }
|
||||
val screenShotName = createName(testClassName + "_" + "normalUser", "")
|
||||
screenshotViaName(sut, screenShotName)
|
||||
scope.launch {
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
|
||||
launch(Dispatchers.Main) {
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +172,13 @@ class TrashbinActivityIT : AbstractIT() {
|
|||
onIdleSync {
|
||||
sut.runOnUiThread { sut.showUser() }
|
||||
val screenShotName = createName(testClassName + "_" + "differentUser", "")
|
||||
screenshotViaName(sut, screenShotName)
|
||||
scope.launch {
|
||||
onView(isRoot()).check(matches(isDisplayed()))
|
||||
|
||||
launch(Dispatchers.Main) {
|
||||
screenshotViaName(sut, screenShotName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,10 +189,8 @@ class TrashbinActivity :
|
|||
|
||||
trashbinPresenter?.loadFolder(onCompleted = {
|
||||
EspressoIdlingResource.decrement()
|
||||
hideInitialLoading()
|
||||
}, onError = {
|
||||
EspressoIdlingResource.decrement()
|
||||
hideInitialLoading()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -303,17 +301,6 @@ class TrashbinActivity :
|
|||
EspressoIdlingResource.decrement()
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
fun hideInitialLoading() {
|
||||
EspressoIdlingResource.increment()
|
||||
|
||||
binding.emptyList.emptyListView.visibility = View.VISIBLE
|
||||
binding.list.visibility = View.VISIBLE
|
||||
binding.loadingContent.visibility = View.GONE
|
||||
|
||||
EspressoIdlingResource.decrement()
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
fun showUser() {
|
||||
EspressoIdlingResource.increment()
|
||||
|
|
Загрузка…
Ссылка в новой задаче