Constantly Checking for GUI Failure Messages In Test

Asked by Art

The use case I have is:
The GUI that I am writing a test case for, can at any point throw up an error that looks something like "Backend failure, error code xxxxxxx, click here to continue". As the backend takes a while to process input, a few seconds after any point of the test it can go to the error page, at which point I want to click to continue.

The current solution I have been trying is basically checking for the error message after each action I do, like so:

click(...)
if exists(errorMessageScreen, 5):
    click(errorContinueButton)
else:
    wait(actualExpectedGuiChange)
    click(lastMatch())

There are two problems here: if the error screen takes longer than 5 seconds to go up, then the script will fail as it will never find the expected GUI change due to the error screen being up, and that it takes an additional 5 seconds in between every command, which significantly slows down the test.

Is there sikuli specific functionality that I can do to handle this test case, something like making a handler for a particular image appearing that it checks every few seconds? Is there anything to do in this case other than launching parallel python processes that will just do the clicking on error screens as it comes up?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Best RaiMan (raimund-hocke) said :
#1
Revision history for this message
Art (artemigkh) said :
#2

Thanks RaiMan, that solved my question.