Skip to content

Commit

Permalink
Merge pull request #384 from KasperskyLab/fix_exploit_test
Browse files Browse the repository at this point in the history
fix the exploit test
  • Loading branch information
AzamatCherchesov authored Sep 25, 2022
2 parents 21a9b04 + a66bcc4 commit 5717e61
Showing 1 changed file with 24 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}
}
Expand Down

0 comments on commit 5717e61

Please sign in to comment.