Skip to content

Commit

Permalink
TECH: extend regex for system dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Areyana committed Dec 21, 2022
1 parent a3efaa8 commit e38f9ed
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,12 @@ class SystemDialogSafetyProviderImpl(

/**
* Checks if error is allowed and android system dialogs/windows are overlaying the app.
* Aware to use By.pkg with String, cause it will cause to use Pattern.quote in internal code
* Aware to use By.pkg with String, cause it will cause to use Pattern.quote in internal code,
* internal use Pattern.match() method, so we need regex that will match full string, not part.
*/
private fun isAndroidSystemDetected(): Boolean {
with(uiDevice) {
if (isVisible(By.pkg(Pattern.compile("\\S*android\\S*")).clazz(FrameLayout::class.java))) {
if (isVisible(By.pkg(Pattern.compile("\\S*google.android\\S*")).clazz(FrameLayout::class.java))) {
logger.i("The android system dialog/window was detected")
return true
}
Expand Down

0 comments on commit e38f9ed

Please sign in to comment.