Skip to content

Commit

Permalink
TECH: try to fix tests on Api30
Browse files Browse the repository at this point in the history
  • Loading branch information
Areyana committed Jul 26, 2023
1 parent cdc6042 commit 21560bb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SystemDialogsActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
binding = ActivitySystemDialogsBinding.inflate(layoutInflater)
setContentView(binding.root)
}
Expand All @@ -30,4 +30,9 @@ class SystemDialogsActivity : AppCompatActivity() {
RESULT_CODE)
}
}

override fun onDestroy() {
super.onDestroy()
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,21 @@ class SystemDialogSafetyObjectDisabledSanityTest : TestCase(
step("Click first button") {
SystemDialogsScreen {
btn1 {
click()
flakySafely(3000) {
click()
}
}
}
}

step("Click second button") {
SystemDialogsScreen {
btn2 {
Assert.assertThrows(null, StaleObjectException::class.java) {
isDisplayed()
click()
flakySafely(3000) {
Assert.assertThrows(null, StaleObjectException::class.java) {
isDisplayed()
click()
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.kaspersky.kaspresso.kautomatorsample.systemdialogs

import android.Manifest
import android.os.Bundle
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import com.kaspersky.kaspresso.kautomatorsample.databinding.ActivitySystemDialogsBinding
Expand All @@ -16,6 +17,7 @@ class SystemDialogsActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
binding = ActivitySystemDialogsBinding.inflate(layoutInflater)
setContentView(binding.root)
}
Expand All @@ -28,4 +30,9 @@ class SystemDialogsActivity : AppCompatActivity() {
RESULT_CODE)
}
}

override fun onDestroy() {
super.onDestroy()
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
}
}

0 comments on commit 21560bb

Please sign in to comment.