Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/screenShotTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
matrix:
scheme: [ Light ]
color: [ blue ]
api-level: [ 28 ]
api-level: [ 29 ]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

Expand Down
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ dependencies {
implementation(libs.compose.activity)
implementation(libs.compose.ui.tooling.preview)
implementation(libs.foundation)
implementation(libs.espresso.accessibility)
debugImplementation(libs.compose.ui.tooling)
// endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/
package com.nextcloud.client

import android.Manifest
import androidx.test.core.app.launchActivity
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches
Expand All @@ -17,25 +16,23 @@ import androidx.test.espresso.contrib.NavigationViewActions
import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.isRoot
import androidx.test.rule.GrantPermissionRule
import com.owncloud.android.AbstractIT
import com.owncloud.android.R
import com.owncloud.android.lib.common.utils.Log_OC
import com.owncloud.android.ui.activity.FileDisplayActivity
import com.owncloud.android.ui.fragment.EmptyListState
import com.owncloud.android.utils.ScreenshotTest
import org.junit.Assert
import org.junit.Rule
import org.junit.Test

class FileDisplayActivityScreenshotIT : AbstractIT() {
private val testClassName = "com.nextcloud.client.FileDisplayActivityScreenshotIT"

@get:Rule
val permissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.POST_NOTIFICATIONS
)
// @get:Rule
// val permissionRule: GrantPermissionRule = GrantPermissionRule.grant(
// Manifest.permission.WRITE_EXTERNAL_STORAGE,
// Manifest.permission.POST_NOTIFICATIONS
// )

companion object {
private const val TAG = "FileDisplayActivityScreenshotIT"
Expand Down Expand Up @@ -69,8 +66,8 @@ class FileDisplayActivityScreenshotIT : AbstractIT() {
}
}

// @ScreenshotTest disabled for now
@Test
@ScreenshotTest
fun showMediaThenAllFiles() {
try {
launchActivity<FileDisplayActivity>().use { scenario ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ class SyncedFoldersActivityIT : AbstractIT() {
scenario.onActivity { sut ->
val fragment = newInstance(item, 0)
fragment!!.show(sut.supportFragmentManager, "")
screenshot(fragment.requireDialog().window?.decorView, screenShotName)
}
scenario.onActivity { sut ->
screenshotViaName(sut, screenShotName)
}
}
}
Expand All @@ -96,9 +98,12 @@ class SyncedFoldersActivityIT : AbstractIT() {
sut.showPowerCheckDialog()
}

val screenShotName = createName(testClassName + "_" + "showPowerCheckDialog", "")
onView(isRoot()).check(matches(isDisplayed()))
screenshot(dialog!!.window?.decorView, screenShotName)

scenario.onActivity { sut ->
val screenShotName = createName(testClassName + "_" + "showPowerCheckDialog", "")
screenshotViaName(sut, screenShotName)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,21 @@
*/
package com.nextcloud.ui

import android.Manifest
import androidx.test.core.app.launchActivity
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.isRoot
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.rule.GrantPermissionRule
import com.owncloud.android.AbstractIT
import com.owncloud.android.R
import com.owncloud.android.lib.resources.users.Status
import com.owncloud.android.lib.resources.users.StatusType
import com.owncloud.android.ui.activity.FileDisplayActivity
import org.junit.Rule
import org.junit.Test

class SetOnlineStatusBottomSheetIT : AbstractIT() {

@get:Rule
val permissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.POST_NOTIFICATIONS
)

@Test
fun open() {
launchActivity<FileDisplayActivity>().use { scenario ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,20 @@
*/
package com.nextcloud.ui

import android.Manifest
import androidx.test.core.app.launchActivity
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.isRoot
import androidx.test.rule.GrantPermissionRule
import com.owncloud.android.AbstractIT
import com.owncloud.android.lib.resources.users.ClearAt
import com.owncloud.android.lib.resources.users.PredefinedStatus
import com.owncloud.android.lib.resources.users.Status
import com.owncloud.android.lib.resources.users.StatusType
import com.owncloud.android.ui.activity.FileDisplayActivity
import org.junit.Rule
import org.junit.Test

class SetStatusMessageBottomSheetIT : AbstractIT() {
@get:Rule
val permissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.POST_NOTIFICATIONS
)

@Test
fun open() {
launchActivity<FileDisplayActivity>().use { scenario ->
Expand Down
7 changes: 3 additions & 4 deletions app/src/androidTest/java/com/owncloud/android/AbstractIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
package com.owncloud.android;

import android.Manifest;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AuthenticatorException;
Expand Down Expand Up @@ -79,7 +78,6 @@
import androidx.test.espresso.contrib.DrawerActions;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.rule.GrantPermissionRule;
import androidx.test.runner.lifecycle.ActivityLifecycleMonitorRegistry;
import androidx.test.runner.lifecycle.Stage;

Expand All @@ -97,8 +95,9 @@ public abstract class AbstractIT {
@Rule
public final TestRule storagePermissionRule = GrantStoragePermissionRule.grant();

@Rule
public GrantPermissionRule notificationsPermissionRule = GrantPermissionRule.grant(Manifest.permission.POST_NOTIFICATIONS);
// Not needed for API29, might needed for newer API
// @Rule
// public GrantPermissionRule notificationsPermissionRule = GrantPermissionRule.grant(Manifest.permission.POST_NOTIFICATIONS);

protected static OwnCloudClient client;
protected static NextcloudClient nextcloudClient;
Expand Down
14 changes: 2 additions & 12 deletions app/src/androidTest/java/com/owncloud/android/ScreenshotsIT.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/
package com.owncloud.android

import android.Manifest
import androidx.test.core.app.launchActivity
import androidx.test.espresso.Espresso
import androidx.test.espresso.Espresso.onView
Expand All @@ -18,7 +17,6 @@ import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.isRoot
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.rule.GrantPermissionRule
import com.owncloud.android.datamodel.OCFile
import com.owncloud.android.ui.activity.FileDisplayActivity
import com.owncloud.android.ui.activity.SettingsActivity
Expand All @@ -27,20 +25,12 @@ import com.owncloud.android.utils.ScreenshotTest
import org.junit.Assert.assertTrue
import org.junit.BeforeClass
import org.junit.ClassRule
import org.junit.Rule
import org.junit.Test
import tools.fastlane.screengrab.Screengrab
import tools.fastlane.screengrab.UiAutomatorScreenshotStrategy
import tools.fastlane.screengrab.locale.LocaleTestRule

class ScreenshotsIT : AbstractIT() {

@get:Rule
val permissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.POST_NOTIFICATIONS
)

@Test
@ScreenshotTest
fun gridViewScreenshot() {
Expand All @@ -65,7 +55,7 @@ class ScreenshotsIT : AbstractIT() {
OCFile(path).apply {
storageManager.saveFile(this)
}
onView(withId(R.id.list_root)).perform(click())
// onView(withId(R.id.list_root)).perform(click())

onView(isRoot()).check(matches(isDisplayed()))
Screengrab.screenshot("02_listView")
Expand Down Expand Up @@ -111,8 +101,8 @@ class ScreenshotsIT : AbstractIT() {
}
}

// @ScreenshotTest disabled for now
@Test
@ScreenshotTest
fun davdroidScreenshot() {
launchActivity<SettingsActivity>().use {
onView(withText(R.string.prefs_category_more)).perform(scrollTo())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/
package com.owncloud.android.ui.activity

import android.Manifest
import android.accounts.Account
import android.accounts.AccountManager
import android.net.Uri
Expand All @@ -17,7 +16,6 @@ import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions
import androidx.test.espresso.matcher.ViewMatchers
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.rule.GrantPermissionRule
import com.nextcloud.client.account.User
import com.nextcloud.client.account.UserAccountManager
import com.nextcloud.client.account.UserAccountManagerImpl
Expand All @@ -38,12 +36,6 @@ class DrawerActivityIT : AbstractIT() {
@JvmField
val retryTestRule = RetryTestRule()

@get:Rule
val permissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.POST_NOTIFICATIONS
)

@Test
fun switchAccountViaAccountList() {
launchActivity<FileDisplayActivity>().use { scenario ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ class ManageAccountsActivityIT : AbstractIT() {
sut.showUser(user, userInfo)
}

val screenShotName = createName(testClassName + "_" + "open", "")
val screenShotName = createName(testClassName + "_" + "userInfoDetail", "")
onView(isRoot()).check(matches(isDisplayed()))

val a = getCurrentActivity()

scenario.onActivity {
screenshotViaName(getCurrentActivity(), screenShotName)
screenshotViaName(a, screenShotName)
}
}
}
Expand Down
Loading
Loading