diff --git a/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/device_tests/DeviceExploitSampleTest.kt b/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/device_tests/DeviceExploitSampleTest.kt index c61f1a65f..9b9ede8de 100644 --- a/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/device_tests/DeviceExploitSampleTest.kt +++ b/samples/kaspresso-sample/src/androidTest/kotlin/com/kaspersky/kaspressample/device_tests/DeviceExploitSampleTest.kt @@ -35,47 +35,51 @@ class DeviceExploitSampleTest : TestCase() { device.exploit.setAutoRotationEnabled(true) }.run { - activityRule.scenario.onActivity { activity -> - step("Change orientation manually") { - device.exploit.setOrientation(Exploit.DeviceOrientation.Landscape) + step("Change orientation manually") { + device.exploit.setOrientation(Exploit.DeviceOrientation.Landscape) + activityRule.scenario.onActivity { activity -> assertTrueSafely { Configuration.ORIENTATION_LANDSCAPE == activity.resources.configuration.orientation } + } - device.exploit.setOrientation(Exploit.DeviceOrientation.Portrait) + device.exploit.setOrientation(Exploit.DeviceOrientation.Portrait) + activityRule.scenario.onActivity { activity -> assertTrueSafely { Configuration.ORIENTATION_PORTRAIT == activity.resources.configuration.orientation } } + } - step("Rotate device") { - device.exploit.rotate() + step("Rotate device") { + device.exploit.rotate() + activityRule.scenario.onActivity { activity -> assertTrueSafely { Configuration.ORIENTATION_LANDSCAPE == activity.resources.configuration.orientation } } + } - step("Open web view and press back button") { - MainScreen { - flakySafely { - webViewButton { - click() - } - device.activities.isCurrent(WebViewActivity::class.java) + step("Open web view and press back button") { + MainScreen { + flakySafely { + webViewButton { + click() } + device.activities.isCurrent(WebViewActivity::class.java) } - - device.exploit.pressBack(true) - device.activities.isCurrent(MainActivity::class.java) // Asserts that MainActivity is resumed } - step("Press home button") { - device.exploit.pressHome() - assertNull(device.activities.getResumed()) - } + device.exploit.pressBack(true) + device.activities.isCurrent(MainActivity::class.java) // Asserts that MainActivity is resumed + } + + step("Press home button") { + device.exploit.pressHome() + assertNull(device.activities.getResumed()) } } }