Skip to content

Conversation

@TDL-EdgarsEglitis
Copy link
Collaborator

This fixes a fairly specific issue with click actions (where multiple timestamps are generated while finding the element):

If the timeout for finding the element (Time) is specified to be longer than the timeout for clicking the element (CheckTime or the default timeout), there may be a situation where the element search does end up taking a long time - longer than the timeout for clicking the element. This would mean that the condition while (Time.now - start) < wait_time would immediately fail, the click action would not even be attempted, and the test would continue.

This PR fixes the issue by adjusting the above condition.

@alvarolaserna
Copy link
Contributor

This fixes a fairly specific issue with click actions (where multiple timestamps are generated while finding the element):

If the timeout for finding the element (Time) is specified to be longer than the timeout for clicking the element (CheckTime or the default timeout), there may be a situation where the element search does end up taking a long time - longer than the timeout for clicking the element. This would mean that the condition while (Time.now - start) < wait_time would immediately fail, the click action would not even be attempted, and the test would continue.

This PR fixes the issue by adjusting the above condition.

Im not sure if the solution is the right way to do it. Right now you have writen that if the wait_for takes the full timeout, then the clicking can also take the full timeout, which means that its double the time what the user put as expected. I think that if:

while (Time.now - after_find) < wait_time

Is alreaty false from the begining of the loop, we should make it so that it tries to click on it only once.

@TDL-EdgarsEglitis
Copy link
Collaborator Author

we should make it so that it tries to click on it only once

Changed the loop to evaluate its condition at the end of each iteration - this ensures that the click is always attempted at least once (provided the element is found)

@TDL-EdgarsEglitis TDL-EdgarsEglitis merged commit 36c6565 into master Jul 11, 2024
@TDL-EdgarsEglitis TDL-EdgarsEglitis deleted the handle-long-finds branch July 11, 2024 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants