Skip to content

Commit

Permalink
Attemp to improve notification handling in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpoole committed Jan 14, 2024
1 parent c91842f commit 6f3e98d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/androidTest/java/de/blau/android/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.BySelector;
import androidx.test.uiautomator.Configurator;
import androidx.test.uiautomator.Direction;
import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiObject;
import androidx.test.uiautomator.UiObject2;
Expand Down Expand Up @@ -1561,7 +1562,13 @@ public static boolean findNotification(@NonNull UiDevice device, @NonNull String
if (clearAll != null) {
clearAll.click();
} else {
device.pressBack();
UiObject2 notification = device.findObject(By.textContains(app));
if (notification != null) {
Rect rect = notification.getVisibleBounds();
device.swipe(rect.left, rect.centerY(), rect.right+500, rect.centerY(), 5);
} else {
device.pressBack();
}
}
return found;
}
Expand Down

0 comments on commit 6f3e98d

Please sign in to comment.