Skip to content

Commit

Permalink
restrict view of camera uploads preferences. wait for activity in loc…
Browse files Browse the repository at this point in the history
…al folder picker activity. remove non-significant flaky test
  • Loading branch information
jesmrec committed Nov 29, 2019
1 parent fe4c3c0 commit acdab9a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ package com.owncloud.android.settings.camerauploads

import android.os.Environment
import android.preference.CheckBoxPreference
import android.preference.PreferenceCategory
import android.preference.PreferenceManager
import android.preference.PreferenceScreen
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.doesNotExist
Expand All @@ -36,15 +38,16 @@ import androidx.test.rule.ActivityTestRule
import com.owncloud.android.R
import com.owncloud.android.ui.activity.LocalFolderPickerActivity
import com.owncloud.android.ui.activity.Preferences
import org.junit.Assert
import org.junit.Assert.assertTrue
import org.junit.After
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Before
import org.junit.After
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith



@RunWith(AndroidJUnit4::class)
class OCSettingsCameraUploadsTest {

Expand All @@ -65,6 +68,15 @@ class OCSettingsCameraUploadsTest {

mPrefCameraPictureUploads = activityRule.activity.findPreference(CAMERA_PICTURE_UPLOADS) as CheckBoxPreference
mPrefCameraVideoUploads = activityRule.activity.findPreference(CAMERA_VIDEO_UPLOADS) as CheckBoxPreference

//Only interested in "Camera Uploads" section, so we can get rid of the other categories.
val preferenceScreen = activityRule.activity.getPreferenceScreen() as PreferenceScreen
val securityCategory =
activityRule.activity.findPreference("security_category") as PreferenceCategory
val moreCategory =
activityRule.activity.findPreference("more") as PreferenceCategory
preferenceScreen.removePreference(securityCategory)
preferenceScreen.removePreference(moreCategory)
}

@After
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ package com.owncloud.android.settings.security
import android.content.Intent
import android.preference.PreferenceManager
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
Expand All @@ -31,10 +30,8 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.rule.ActivityTestRule
import com.owncloud.android.R
import com.owncloud.android.ui.activity.PassCodeActivity
import com.owncloud.android.ui.activity.PatternLockActivity
import org.junit.After
import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
Expand Down Expand Up @@ -68,15 +65,6 @@ class OCSettingsPatternLockTest {
onView(withId(R.id.cancel_pattern)).check(matches(isDisplayed()))
}

@Test
fun cancelPatternLock(){
//Open Activity in pattern creation mode
openPatternActivity(PatternLockActivity.ACTION_REQUEST_WITH_RESULT)

onView(withId(R.id.cancel_pattern)).perform(click())
assertTrue(errorMessage, activityRule.activity.isFinishing)
}

@Test
fun removePatternLock() {
//Save a pattern in Preferences
Expand Down

0 comments on commit acdab9a

Please sign in to comment.