Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "ISSUE-404: Removed storage rules for all tests" #478

Merged
merged 1 commit into from
Jan 12, 2023
Merged
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.kaspersky.kaspresso.alluresupport.sample

import android.Manifest
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.rule.GrantPermissionRule
import com.kaspersky.components.alluresupport.addAllureSupport
import com.kaspersky.components.alluresupport.files.attachViewHierarchyToAllureReport
import com.kaspersky.components.alluresupport.withAllureSupport
Expand Down Expand Up @@ -33,6 +35,11 @@ class AllureSupportCustomizeTest : TestCase(
}
}
) {
@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
)

@get:Rule
val activityRule = activityScenarioRule<MainActivity>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.kaspersky.kaspresso.alluresupport.sample

import android.Manifest
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.rule.GrantPermissionRule
import com.kaspersky.components.alluresupport.withAllureSupport
import com.kaspersky.kaspresso.alluresupport.sample.screen.MainScreen
import com.kaspersky.kaspresso.kaspresso.Kaspresso
import com.kaspersky.kaspresso.testcases.api.testcaserule.TestCaseRule
import com.kaspersky.kaspresso.alluresupport.sample.screen.MainScreen
import com.kaspersky.kaspresso.params.ScreenshotParams
import com.kaspersky.kaspresso.params.VideoParams
import com.kaspersky.kaspresso.testcases.api.testcaserule.TestCaseRule
import org.junit.Rule
import org.junit.Test

Expand All @@ -15,6 +17,12 @@ import org.junit.Test
*/
class AllureSupportTestWithRule {

@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
)

@get:Rule
val testCaseRule = TestCaseRule(
testClassName = javaClass.simpleName,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.kaspersky.kaspressample.compose_tests

import android.Manifest
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.rule.GrantPermissionRule
import com.kaspersky.kaspressample.MainActivity
import com.kaspersky.kaspressample.external_screens.UiComposeDialog1
import com.kaspersky.kaspressample.external_screens.UiComposeDialog2
Expand All @@ -12,6 +14,12 @@ import org.junit.Test

class ComplexComposeTest : TestCase() {

@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
)

@get:Rule
val activityRule = activityScenarioRule<MainActivity>()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.kaspersky.kaspressample.compose_tests

import android.Manifest
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.rule.GrantPermissionRule
import com.kaspersky.kaspressample.MainActivity
import com.kaspersky.kaspressample.R
import com.kaspersky.kaspressample.screen.CommonFlakyScreen
Expand All @@ -11,6 +13,12 @@ import org.junit.Test

class SimpleComposeTest : TestCase() {

@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
)

@get:Rule
val activityRule = activityScenarioRule<MainActivity>()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.kaspersky.kaspressample.compose_tests

import android.Manifest
import androidx.test.espresso.web.webdriver.Locator
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.rule.GrantPermissionRule
import com.kaspersky.kaspressample.MainActivity
import com.kaspersky.kaspressample.screen.MainScreen
import com.kaspersky.kaspressample.screen.WebViewScreen
Expand All @@ -11,6 +13,12 @@ import org.junit.Test

class WebComposeTest : TestCase() {

@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
)

@get:Rule
val activityRule = activityScenarioRule<MainActivity>()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.kaspersky.kaspressample.configurator_tests

import android.Manifest
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.rule.GrantPermissionRule
import com.kaspersky.kaspressample.MainActivity
import com.kaspersky.kaspressample.R
import com.kaspersky.kaspressample.screen.MainScreen
Expand All @@ -15,6 +17,11 @@ class DisabledStepAutoNumberingTest : TestCase(
stepParams.autonumber = false
}
) {
@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
)

@get:Rule
val activityRule = activityScenarioRule<MainActivity>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.kaspersky.kaspressample.configurator_tests.defaultaction_tests

import android.Manifest
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.rule.GrantPermissionRule
import com.kaspersky.kaspressample.MainActivity
import com.kaspersky.kaspressample.R
import com.kaspersky.kaspressample.screen.MainScreen
Expand All @@ -21,6 +23,11 @@ class DefaultActionsTest : ParentTestCase(
}
}
) {
@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
)

@get:Rule
val activityRule = activityScenarioRule<MainActivity>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.kaspersky.kaspressample.configurator_tests.interceptor_tests

import android.Manifest
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.rule.GrantPermissionRule
import com.kaspersky.kaspressample.MainActivity
import com.kaspersky.kaspressample.R
import com.kaspersky.kaspressample.configurator_tests.interceptor_tests.helpers.CheckCustomInterceptorsStorage
Expand All @@ -27,6 +29,12 @@ class KaspressoConfiguringTest : TestCase(
}
) {

@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
)

@get:Rule
val activityRule = activityScenarioRule<MainActivity>()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.kaspersky.kaspressample.continuously_tests

import android.Manifest
import android.os.Build
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.rule.GrantPermissionRule
import com.kaspersky.kaspressample.MainActivity
import com.kaspersky.kaspressample.screen.ContinuouslyDialogScreen
import com.kaspersky.kaspressample.screen.ContinuouslyScreen
Expand All @@ -17,6 +19,12 @@ class ContinuouslyTest : TestCase() {
private const val FAKE_MAX_DELAY_MS: Long = 5_000
}

@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
)

@get:Rule
val activityRule = activityScenarioRule<MainActivity>()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.kaspersky.kaspressample.continuously_tests

import android.Manifest
import android.os.Build
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.rule.GrantPermissionRule
import com.kaspersky.kaspressample.MainActivity
import com.kaspersky.kaspressample.external_screens.UiContinuouslyDialogScreen
import com.kaspersky.kaspressample.external_screens.UiContinuouslyScreen
Expand All @@ -17,6 +19,12 @@ class UiContinuouslyTest : TestCase() {
private const val FAKE_MAX_DELAY_MS: Long = 5_000
}

@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
)

@get:Rule
val activityRule = activityScenarioRule<MainActivity>()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package com.kaspersky.kaspressample.device_tests

import android.Manifest
import android.os.Build
import android.provider.Settings
import android.provider.Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.rule.GrantPermissionRule
import com.kaspersky.kaspressample.device.DeviceSampleAccessibilityService
import com.kaspersky.kaspressample.device.DeviceSampleActivity
import com.kaspersky.kaspressample.utils.SafeAssert.assertFalseSafely
Expand All @@ -26,6 +28,12 @@ class DeviceAccessibilitySampleTest : TestCase() {
private val SERVICE_CLASS_NAME = DeviceSampleAccessibilityService::class.java.canonicalName!!
}

@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
)

@get:Rule
val activityRule = activityScenarioRule<DeviceSampleActivity>()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.kaspersky.kaspressample.device_tests

import android.Manifest
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.rule.GrantPermissionRule
import com.kaspersky.kaspressample.MainActivity
import com.kaspersky.kaspresso.testcases.api.testcase.TestCase
import org.hamcrest.CoreMatchers.instanceOf
Expand All @@ -10,6 +12,12 @@ import org.junit.Test

class DeviceActivitiesSampleTest : TestCase() {

@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
)

@get:Rule
val activityRule = activityScenarioRule<MainActivity>()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.kaspersky.kaspressample.device_tests

import android.Manifest
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.rule.GrantPermissionRule
import com.kaspersky.kaspressample.MainActivity
import com.kaspersky.kaspressample.device_tests.DeviceAppSampleTest.Companion.TEST_APK_FILE_RELATIVE_PATH
import com.kaspersky.kaspresso.device.apps.Apps
import com.kaspersky.kaspresso.device.server.AdbServer
import com.kaspersky.kaspresso.testcases.api.testcase.TestCase
Expand All @@ -26,6 +27,12 @@ class DeviceAppSampleTest : TestCase() {
private const val TEST_APK_PACKAGE_NAME = "com.example.helloworld"
}

@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
)

@get:Rule
val activityRule = activityScenarioRule<MainActivity>()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.kaspersky.kaspressample.device_tests

import android.Manifest
import android.content.res.Configuration
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.rule.GrantPermissionRule
import com.kaspersky.kaspressample.MainActivity
import com.kaspersky.kaspressample.screen.MainScreen
import com.kaspersky.kaspressample.utils.SafeAssert.assertTrueSafely
Expand All @@ -14,6 +16,12 @@ import org.junit.Test

class DeviceExploitSampleTest : TestCase() {

@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
)

@get:Rule
val activityRule = activityScenarioRule<MainActivity>()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
package com.kaspersky.kaspressample.device_tests

import android.Manifest
import android.os.Environment
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.rule.GrantPermissionRule
import com.kaspersky.kaspressample.MainActivity
import com.kaspersky.kaspresso.device.files.Files
import com.kaspersky.kaspresso.testcases.api.testcase.TestCase
import java.io.File
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test
import java.io.File

/**
* Pushes and then removes a file file placed at /artifacts directory.
Expand All @@ -23,6 +25,12 @@ class DeviceFilesSampleTest : TestCase() {
private const val FILE_RELATIVE_PATH = "artifacts/$FILE_NAME"
}

@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
)

@get:Rule
val activityRule = activityScenarioRule<MainActivity>()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.kaspersky.kaspressample.device_tests

import android.Manifest
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.rule.GrantPermissionRule
import com.kaspersky.kaspressample.devicefull.DeviceFullWindowSampleActivity
import com.kaspersky.kaspresso.testcases.api.testcase.TestCase
import org.junit.Assert
Expand All @@ -14,6 +16,12 @@ class DeviceFullScreenshotSampleTest : TestCase() {
private const val SCREENSHOT_TAG = "screenshot_full"
}

@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
)

@get:Rule
val activityRule = activityScenarioRule<DeviceFullWindowSampleActivity>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.Manifest
import android.content.pm.PackageManager
import android.os.Build
import androidx.test.ext.junit.rules.activityScenarioRule
import androidx.test.rule.GrantPermissionRule
import com.kaspersky.kaspressample.device.DeviceSampleActivity
import com.kaspersky.kaspresso.testcases.api.testcase.TestCase
import com.kaspersky.kaspresso.testcases.core.testcontext.BaseTestContext
Expand All @@ -21,6 +22,12 @@ import org.junit.Test
*/
class DeviceHackPermissionsSampleTest : TestCase() {

@get:Rule
val runtimePermissionRule: GrantPermissionRule = GrantPermissionRule.grant(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE
)

@get:Rule
val activityRule = activityScenarioRule<DeviceSampleActivity>()

Expand Down
Loading