diff --git a/README.md b/README.md index fa549061a..ebd87f0ae 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,6 @@ See the example below: @Test fun shouldPassOnNoInternetScanTest() = beforeTest { - activityTestRule.launchActivity(null) // some things with the state }.afterTest { // some things with the state diff --git a/docs/kaspresso/com.kaspersky.kaspresso.testcases.api.testcase/-doc-loc-screenshot-test-case/index.md b/docs/kaspresso/com.kaspersky.kaspresso.testcases.api.testcase/-doc-loc-screenshot-test-case/index.md index bdde56803..335609397 100644 --- a/docs/kaspresso/com.kaspersky.kaspresso.testcases.api.testcase/-doc-loc-screenshot-test-case/index.md +++ b/docs/kaspresso/com.kaspersky.kaspresso.testcases.api.testcase/-doc-loc-screenshot-test-case/index.md @@ -13,51 +13,24 @@ The base class for all docloc screenshot tests. Project-wide ScreenshotTestCase should be implemented as following: - open class ProductDocLocScreenshotTestCase(testName: String) : DocLocScreenshotTestCase( - File(testName), "comma-separated string of locales" - ) { + class AdvancedScreenshotSampleTest : DocLocScreenshotTestCase(locales = "en,ru") { + private lateinit var view: ScreenshotSampleView - @get:Rule - val activityTestRule = ActivityTestRule(FragmentTestActivity::class.java, true, false) - - protected lateinit var activity: FragmentTestActivity - - @Before - open fun setUp() { - activity = activityTestRule.launchActivity(null) - } - } - -Screenshoter test extends the project-wide class: - - @ScreenShooterTest - class FeatureScreenshot : ProductDocLocScreenshotTestCase("feature_screenshot") { - - @Test - fun featureScreen() { - val featureView = FeatureFragment.newInstance() - activity.setFragment(featureView) - val view = getUiSafeProxy(featureView) // Explicit type is important and must be interface - - view.showLoading() - captureScreenshot("screenshot_description") - } - } - -As you might have noticed, activity test rule is launched with ``FragmentTestActivity``. It's a special per-project empty activity for test with ``setFragment(Fragment)`` method. E.g: - - class FragmentTestActivity : AppCompatActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_fragment_container) - } - - fun setFragment(fragment: Fragment) { - val fragmentTransaction = supportFragmentManager.beginTransaction() - fragmentTransaction.replace(R.id.content_container, fragment, "") - fragmentTransaction.build() - } + @ScreenShooterTest + @Test + fun test() = before { + val scenario = launchFragmentInContainer() + scenario.onFragment { + view = getUiSafeProxy(it as ScreenshotSampleView) + } + }.after { + }.run { + step("1. Step 1") { + // ... [view] calls + captureScreenshot("Step 1") + } + ... + } } abstract class [DocLocScreenshotTestCase](index.md)(**screenshotsDirectory**: [File](https://docs.oracle.com/javase/8/docs/api/java/io/File.html), **screenshotDirectoryProvider**: [ScreenshotDirectoryProvider](../../com.kaspersky.kaspresso.device.screenshots.screenshotfiles/-screenshot-directory-provider/index.md), **screenshotNameProvider**: [ScreenshotNameProvider](../../com.kaspersky.kaspresso.device.screenshots.screenshotfiles/-screenshot-name-provider/index.md), **changeSystemLocale**: [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html), **locales**: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?, **kaspressoBuilder**: [Kaspresso.Builder](../../com.kaspersky.kaspresso.kaspresso/-kaspresso/-builder/index.md)) : [TestCase](../-test-case/index.md) diff --git a/docs/kaspresso/com.kaspersky.kaspresso.testcases.api.testcase/index.md b/docs/kaspresso/com.kaspersky.kaspresso.testcases.api.testcase/index.md index 8466badf0..fea998021 100644 --- a/docs/kaspresso/com.kaspersky.kaspresso.testcases.api.testcase/index.md +++ b/docs/kaspresso/com.kaspersky.kaspresso.testcases.api.testcase/index.md @@ -10,6 +10,6 @@ | Name| Summary| |---|---| | [BaseTestCase](-base-test-case/index.md)| [androidJvm]
Brief description


The base class for all parametrized test cases. Extend this class with a single base project-wide inheritor of [TestCase](-test-case/index.md) as a parent for all actual project-wide test cases. Nesting test cases are not recommended, use [com.kaspersky.kaspresso.testcases.api.scenario.Scenario](../com.kaspersky.kaspresso.testcases.api.scenario/-scenario/index.md) instead.


Content
abstract class [BaseTestCase](-base-test-case/index.md)<[InitData](-base-test-case/index.md), [Data](-base-test-case/index.md)>(**kaspressoBuilder**: [Kaspresso.Builder](../com.kaspersky.kaspresso.kaspresso/-kaspresso/-builder/index.md), **dataProducer**: ([InitData](-base-test-case/index.md).() -> [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)?) -> [Data](-base-test-case/index.md), **mainSectionEnrichers**: [List](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html)<[MainSectionEnricher](../com.kaspersky.kaspresso.enricher/-main-section-enricher/index.md)<[Data](-base-test-case/index.md)>>) : [TestAssistantsProvider](../com.kaspersky.kaspresso.testcases.core.testassistants/-test-assistants-provider/index.md)


-| [DocLocScreenshotTestCase](-doc-loc-screenshot-test-case/index.md)| [androidJvm]
Brief description




The base class for all docloc screenshot tests.



Project-wide ScreenshotTestCase should be implemented as following:

open class ProductDocLocScreenshotTestCase(testName: String) : DocLocScreenshotTestCase(
File(testName), "comma-separated string of locales"
) {

@get:Rule
val activityTestRule = ActivityTestRule(FragmentTestActivity::class.java, true, false)

protected lateinit var activity: FragmentTestActivity

@Before
open fun setUp() {
activity = activityTestRule.launchActivity(null)
}
}

Screenshoter test extends the project-wide class:

@ScreenShooterTest
class FeatureScreenshot : ProductDocLocScreenshotTestCase("feature_screenshot") {

@Test
fun featureScreen() {
val featureView = FeatureFragment.newInstance()
activity.setFragment(featureView)
val view = getUiSafeProxy(featureView) // Explicit type is important and must be interface

view.showLoading()
captureScreenshot("screenshot_description")
}
}

As you might have noticed, activity test rule is launched with ``FragmentTestActivity``. It's a special per-project empty activity for test with ``setFragment(Fragment)`` method. E.g:

class FragmentTestActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_fragment_container)
}

fun setFragment(fragment: Fragment) {
val fragmentTransaction = supportFragmentManager.beginTransaction()
fragmentTransaction.replace(R.id.content_container, fragment, "")
fragmentTransaction.build()
}
}


Content
abstract class [DocLocScreenshotTestCase](-doc-loc-screenshot-test-case/index.md)(**screenshotsDirectory**: [File](https://docs.oracle.com/javase/8/docs/api/java/io/File.html), **screenshotDirectoryProvider**: [ScreenshotDirectoryProvider](../com.kaspersky.kaspresso.device.screenshots.screenshotfiles/-screenshot-directory-provider/index.md), **screenshotNameProvider**: [ScreenshotNameProvider](../com.kaspersky.kaspresso.device.screenshots.screenshotfiles/-screenshot-name-provider/index.md), **changeSystemLocale**: [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html), **locales**: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?, **kaspressoBuilder**: [Kaspresso.Builder](../com.kaspersky.kaspresso.kaspresso/-kaspresso/-builder/index.md)) : [TestCase](-test-case/index.md)


+| [DocLocScreenshotTestCase](-doc-loc-screenshot-test-case/index.md)| [androidJvm]
Brief description




The base class for all docloc screenshot tests.



Project-wide ScreenshotTestCase should be implemented as following:

class AdvancedScreenshotSampleTest(DocLocScreenshotTestCase(locales = "en,ru"){

protected lateinit var view: ScreenshotSampleView

@ScreenShooterTest
@Test
fun featureScreen() = before {
val scenario = launchFragmentInContainer()
scenario.onFragment {
view = getUiSafeProxy(it as ScreenshotSampleView) // Explicit type is important and must be interface
}
}.after {
}.run {
view.showLoading()
captureScreenshot("screenshot_description")
}
}


Content
abstract class [DocLocScreenshotTestCase](-doc-loc-screenshot-test-case/index.md)(**screenshotsDirectory**: [File](https://docs.oracle.com/javase/8/docs/api/java/io/File.html), **screenshotDirectoryProvider**: [ScreenshotDirectoryProvider](../com.kaspersky.kaspresso.device.screenshots.screenshotfiles/-screenshot-directory-provider/index.md), **screenshotNameProvider**: [ScreenshotNameProvider](../com.kaspersky.kaspresso.device.screenshots.screenshotfiles/-screenshot-name-provider/index.md), **changeSystemLocale**: [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html), **locales**: [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?, **kaspressoBuilder**: [Kaspresso.Builder](../com.kaspersky.kaspresso.kaspresso/-kaspresso/-builder/index.md)) : [TestCase](-test-case/index.md)


| [TestCase](-test-case/index.md)| [androidJvm]
Brief description


The base class for all test cases. Extend this class with a single base project-wide inheritor of [TestCase](-test-case/index.md) as a parent for all actual project-wide test cases. Nesting test cases are not permitted because they may produce an exception caused by re-initialization of the [Kaspresso](../com.kaspersky.kaspresso.kaspresso/-kaspresso/index.md), use [com.kaspersky.kaspresso.testcases.api.scenario.Scenario](../com.kaspersky.kaspresso.testcases.api.scenario/-scenario/index.md) instead.


Content
abstract class [TestCase](-test-case/index.md)(**kaspressoBuilder**: [Kaspresso.Builder](../com.kaspersky.kaspresso.kaspresso/-kaspresso/-builder/index.md)) : [BaseTestCase](-base-test-case/index.md)<[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html), [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)>


diff --git a/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/compose_tests/ComplexComposeTest.kt b/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/compose_tests/ComplexComposeTest.kt index e54d6e287..0e067f913 100644 --- a/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/compose_tests/ComplexComposeTest.kt +++ b/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/compose_tests/ComplexComposeTest.kt @@ -101,4 +101,3 @@ class ComplexComposeTest : TestCase() { } } } - diff --git a/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/continuously_tests/ContinuouslyTest.kt b/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/continuously_tests/ContinuouslyTest.kt index edd0de864..b9ee9d0c1 100644 --- a/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/continuously_tests/ContinuouslyTest.kt +++ b/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/continuously_tests/ContinuouslyTest.kt @@ -61,7 +61,6 @@ class ContinuouslyTest : TestCase() { } } - @Test fun testDialogNotPresentAfterAndroidO() { // Don`t allow to run this test on Android < Oreo diff --git a/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/continuously_tests/UiContinuouslyTest.kt b/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/continuously_tests/UiContinuouslyTest.kt index 63b66cef5..498b65363 100644 --- a/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/continuously_tests/UiContinuouslyTest.kt +++ b/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/continuously_tests/UiContinuouslyTest.kt @@ -58,7 +58,6 @@ class UiContinuouslyTest : TestCase() { } } - @Test fun testDialogNotPresentAfterAndroidO() { // Don`t allow to run this test on Android < Oreo diff --git a/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/docloc_tests/advanced/AdvancedScreenshotSampleTest.kt b/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/docloc_tests/advanced/AdvancedScreenshotSampleTest.kt index ccb2e9524..a2e012eb1 100644 --- a/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/docloc_tests/advanced/AdvancedScreenshotSampleTest.kt +++ b/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/docloc_tests/advanced/AdvancedScreenshotSampleTest.kt @@ -2,9 +2,8 @@ package com.kaspersky.kaspressample.docloc_tests.advanced import android.Manifest import android.graphics.Color -import androidx.test.ext.junit.rules.activityScenarioRule +import androidx.fragment.app.testing.launchFragmentInContainer import androidx.test.rule.GrantPermissionRule -import com.kaspersky.kaspressample.docloc.FragmentTestActivity import com.kaspersky.kaspressample.docloc.ScreenshotSampleFragment import com.kaspersky.kaspressample.docloc.ScreenshotSampleView import com.kaspersky.kaspresso.annotations.ScreenShooterTest @@ -17,8 +16,6 @@ import org.junit.Test * For more information see DocLoc wiki page. */ class AdvancedScreenshotSampleTest : DocLocScreenshotTestCase(locales = "en,ru") { - - private lateinit var fragment: ScreenshotSampleFragment private lateinit var view: ScreenshotSampleView @get:Rule @@ -27,16 +24,12 @@ class AdvancedScreenshotSampleTest : DocLocScreenshotTestCase(locales = "en,ru") Manifest.permission.READ_EXTERNAL_STORAGE ) - @get:Rule - val activityRule = activityScenarioRule() - @ScreenShooterTest @Test fun test() = before { - fragment = ScreenshotSampleFragment() - view = getUiSafeProxy(fragment as ScreenshotSampleView) - activityRule.scenario.onActivity { activity -> - activity.setFragment(fragment) + val scenario = launchFragmentInContainer() + scenario.onFragment { + view = getUiSafeProxy(it as ScreenshotSampleView) } }.after { }.run { diff --git a/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/docloc_tests/advanced/AdvancedScreenshotSampleTestLegacy.kt b/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/docloc_tests/advanced/AdvancedScreenshotSampleTestLegacy.kt index 3a9885ca9..72c236afd 100644 --- a/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/docloc_tests/advanced/AdvancedScreenshotSampleTestLegacy.kt +++ b/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/docloc_tests/advanced/AdvancedScreenshotSampleTestLegacy.kt @@ -2,9 +2,8 @@ package com.kaspersky.kaspressample.docloc_tests.advanced import android.Manifest import android.graphics.Color -import androidx.test.ext.junit.rules.activityScenarioRule +import androidx.fragment.app.testing.launchFragmentInContainer import androidx.test.rule.GrantPermissionRule -import com.kaspersky.kaspressample.docloc.FragmentTestActivity import com.kaspersky.kaspressample.docloc.ScreenshotSampleFragment import com.kaspersky.kaspressample.docloc.ScreenshotSampleView import com.kaspersky.kaspresso.annotations.ScreenShooterTest @@ -21,8 +20,6 @@ class AdvancedScreenshotSampleTestLegacy : DocLocScreenshotTestCase( screenshotsDirectory = File("screenshots"), locales = "en,ru" ) { - - private lateinit var fragment: ScreenshotSampleFragment private lateinit var view: ScreenshotSampleView @get:Rule @@ -31,16 +28,12 @@ class AdvancedScreenshotSampleTestLegacy : DocLocScreenshotTestCase( Manifest.permission.READ_EXTERNAL_STORAGE ) - @get:Rule - val activityRule = activityScenarioRule() - @ScreenShooterTest @Test fun test() = before { - fragment = ScreenshotSampleFragment() - view = getUiSafeProxy(fragment as ScreenshotSampleView) - activityRule.scenario.onActivity { activity -> - activity.setFragment(fragment) + val scenario = launchFragmentInContainer() + scenario.onFragment { + view = getUiSafeProxy(it as ScreenshotSampleView) } }.after { }.run { diff --git a/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/dsl_tests/InitTransformDataTest.kt b/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/dsl_tests/InitTransformDataTest.kt index 3f2655e63..c243ff4f3 100644 --- a/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/dsl_tests/InitTransformDataTest.kt +++ b/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/dsl_tests/InitTransformDataTest.kt @@ -60,4 +60,3 @@ class InitTransformDataTest : BaseParametrizedTest() { } } } - diff --git a/samples/kaspresso-sample/src/main/AndroidManifest.xml b/samples/kaspresso-sample/src/main/AndroidManifest.xml index 55d1440bc..6bbe86836 100644 --- a/samples/kaspresso-sample/src/main/AndroidManifest.xml +++ b/samples/kaspresso-sample/src/main/AndroidManifest.xml @@ -56,10 +56,6 @@ android:name=".continuously.ContinuouslySampleActivity" android:label="@string/main_screen_continuously_sample_button"/> - - diff --git a/samples/kaspresso-sample/src/main/kotlin/com/kaspersky/kaspressample/docloc/FragmentTestActivity.kt b/samples/kaspresso-sample/src/main/kotlin/com/kaspersky/kaspressample/docloc/FragmentTestActivity.kt deleted file mode 100644 index 5c43b81a6..000000000 --- a/samples/kaspresso-sample/src/main/kotlin/com/kaspersky/kaspressample/docloc/FragmentTestActivity.kt +++ /dev/null @@ -1,13 +0,0 @@ -package com.kaspersky.kaspressample.docloc - -import androidx.appcompat.app.AppCompatActivity -import androidx.fragment.app.Fragment - -class FragmentTestActivity : AppCompatActivity() { - - fun setFragment(fragment: Fragment) = - with(supportFragmentManager.beginTransaction()) { - replace(android.R.id.content, fragment) - commit() - } -} diff --git a/wiki/02_Wrapper_over_UiAutomator.md b/wiki/02_Wrapper_over_UiAutomator.md index 02930c5e7..94f95a3f0 100644 --- a/wiki/02_Wrapper_over_UiAutomator.md +++ b/wiki/02_Wrapper_over_UiAutomator.md @@ -229,13 +229,11 @@ class KautomatorMeasureTest : TestCase( ) @get:Rule - val activityTestRule = ActivityTestRule(MainActivity::class.java, true, false) + val activityRule = activityScenarioRule() @Test fun test() = - before { - activityTestRule.launchActivity(null) - }.after { }.run { + before { }.after { }.run { ======> UI Automator: 0 minutes, 1 seconds and 252 millis ======> UI Automator boost: 0 minutes, 0 seconds and 310 millis diff --git a/wiki/04_How_to_write_autotests.md b/wiki/04_How_to_write_autotests.md index c144e8f34..62f0aa7b6 100644 --- a/wiki/04_How_to_write_autotests.md +++ b/wiki/04_How_to_write_autotests.md @@ -134,7 +134,6 @@ All of the above mentioned inspired us to create the test's structure like below @Test fun shouldPassOnNoInternetScanTest() = before { - activityTestRule.launchActivity(null) // some things with the state }.after { // some things with the state diff --git a/wiki/05_Device.md b/wiki/05_Device.md index c6779eb61..370466451 100644 --- a/wiki/05_Device.md +++ b/wiki/05_Device.md @@ -36,8 +36,7 @@ Device instance is available in `BaseTestContext` scope and `BaseTestCase` via ` @Test fun test() = run { - step("Open Simple Screen") { - activityTestRule.launchActivity(null) + step("On Simple Screen opened") { ======> device.screenshots.take("Additional_screenshot") <====== MainScreen { diff --git a/wiki/06_AdbServer.md b/wiki/06_AdbServer.md index 603be07be..68ae100d9 100644 --- a/wiki/06_AdbServer.md +++ b/wiki/06_AdbServer.md @@ -32,8 +32,7 @@ In Kaspresso, we wrap `AdbTerminal` into a special interface `AdbServer`. @Test fun test() = run { - step("Open Simple Screen") { - activityTestRule.launchActivity(null) + step("On Simple Screen opened") { ======> adbServer.performShell("input text 1") <====== MainScreen { diff --git a/wiki/07_DocLoc.md b/wiki/07_DocLoc.md index 4ea0617be..d84dc9194 100644 --- a/wiki/07_DocLoc.md +++ b/wiki/07_DocLoc.md @@ -132,53 +132,22 @@ In most cases, there is no need to launch certain activity, do a lot of steps be Also, when you use Model-View-Presenter architectural pattern, you are able to control UI state directly through the View interface. So, there is no need to interact with the application interface and wait for changes. -First create a base test activity with `setFragment(Fragment)` method in your application: - -```kotlin -class FragmentTestActivity : AppCompatActivity() { - - fun setFragment(fragment: Fragment) = with(supportFragmentManager.beginTransaction()) { - replace(android.R.id.content, fragment) - commit() - } -} -``` - -Then add a base product screenshot test case: - - ```kotlin -open class ProductDocLocScreenshotTestCase : DocLocScreenshotTestCase( - locales = "en,ru" -) { - - @get:Rule - val activityTestRule = ActivityTestRule(FragmentTestActivity::class.java, false, true) - - protected val activity: FragmentTestActivity - get() = activityTestRule.activity - -} -``` - -This test case would run your `FragmentTestActivity` on startup. Now you are able to write your screenshooter tests. -For example, create a new test class which extends `ProductDocLocScreenshotTestCase`: +We can achieve that by using a `FragmentScenario`, like in the example below: ```kotlin @RunWith(AndroidJUnit4::class) -class AdvancedScreenshotSampleTest : ProductDocLocScreenshotTestCase() { - - private lateinit var fragment: FeatureFragment - private lateinit var view: FeatureView +class AdvancedScreenshotSampleTest : DocLocScreenshotTestCase(locales = "en,ru") { + private lateinit var view: ScreenshotSampleView @ScreenShooterTest @Test - fun test() { - before { - fragment = FeatureFragment() - view = getUiSafeProxy(fragment as FeatureView) - activity.setFragment(fragment) - }.after { - }.run { + fun test() = before { + val scenario = launchFragmentInContainer() + scenario.onFragment { + view = getUiSafeProxy(it as ScreenshotSampleView) + } + }.after { + }.run { step("1. Step 1") { // ... [view] calls @@ -201,7 +170,7 @@ class AdvancedScreenshotSampleTest : ProductDocLocScreenshotTestCase() { } ``` -As you might notice, the `getUiSafeProxy` method called to get an instance of `FeatureView`. +As you might notice, the `getUiSafeProxy` method called to get an instance of `ScreenshotSampleView`. This method wraps your View interface and returns a proxy on it. The proxy guarantees that all the methods of the View interface you called, will be invoked on the main thread. There is also `getUiSafeProxyFromImplementation` which wraps an implementation rather than an interface. diff --git a/wiki/08_Kaspresso-Robolectric.md b/wiki/08_Kaspresso-Robolectric.md index c7a9e662d..7492da0e4 100644 --- a/wiki/08_Kaspresso-Robolectric.md +++ b/wiki/08_Kaspresso-Robolectric.md @@ -82,7 +82,7 @@ class FailingSharedTest : TestCase() { ) @get:Rule - val activityTestRule = ActivityTestRule(DeviceSampleActivity::class.java, false, true) + val activityRule = activityScenarioRule() @Test fun exploitSampleTest() =