Skip to content

Commit

Permalink
add timeout after scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
BenedictP committed Sep 13, 2023
1 parent a13aa12 commit 1ac8b55
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

## [Unreleased]

# [1.1.2] - 2023-09-13

Changed:
- Scrolling has a timeout to check if view hierarchy has changed

# [1.1.1] - 2023-09-12

Added:
Expand Down Expand Up @@ -132,7 +137,8 @@ New:

Initial release.

[unreleased]: https://github.com/getyourguide/UiTestGlaze/compare/1.1.1...HEAD
[unreleased]: https://github.com/getyourguide/UiTestGlaze/compare/1.1.2...HEAD
[1.1.2]: https://github.com/getyourguide/UiTestGlaze/releases/tag/1.1.2
[1.1.1]: https://github.com/getyourguide/UiTestGlaze/releases/tag/1.1.1
[1.1.0]: https://github.com/getyourguide/UiTestGlaze/releases/tag/1.1.0
[1.0.2]: https://github.com/getyourguide/UiTestGlaze/releases/tag/1.0.2
Expand Down
2 changes: 1 addition & 1 deletion uiTestGlaze/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {

ext {
PUBLISH_GROUP_ID = 'io.github.getyourguide'
PUBLISH_VERSION = '1.1.1'
PUBLISH_VERSION = '1.1.2'
PUBLISH_ARTIFACT_ID = 'uitestglaze'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,21 @@ internal class ScrollHelper(
while (toFindUiElement == null || toFindUiElement.height == 0) {
val hierarchyBeforeScroll = getHierarchyHelper.getHierarchy(device)
scrollDirection()
hierarchySettleHelper.waitTillHierarchySettles(
emptyList(),
device,
config.waitTillLoadingViewsGoneTimeout,
config.waitTillHierarchySettlesTimeout,
val startTime = System.currentTimeMillis()
var hierarchyAfterScroll: TreeNode?
do {
hierarchySettleHelper.waitTillHierarchySettles(
emptyList(),
device,
config.waitTillLoadingViewsGoneTimeout,
config.waitTillHierarchySettlesTimeout,
)
hierarchyAfterScroll = getHierarchyHelper.getHierarchy(device)

} while (hierarchyBeforeScroll == hierarchyAfterScroll &&
(System.currentTimeMillis() - startTime) < 3.seconds.inWholeMilliseconds
)
val hierarchyAfterScroll = getHierarchyHelper.getHierarchy(device)
if (hierarchyBeforeScroll == hierarchyAfterScroll) {
if (hierarchyBeforeScroll == hierarchyAfterScroll || hierarchyAfterScroll == null) {
throw IllegalStateException("Could not find element to scroll to")
}
toFindUiElement = findUiElementHelper.getUiElement(
Expand Down

0 comments on commit 1ac8b55

Please sign in to comment.