Generic image validation method

Asked by Rares Pasca on 2018-12-03

Hello,

I've managed to configure a project where I'm using Intelij+java, gradle, testng and sikuli. I want to define a generic method that will check if the given image is found on the screen or not and assert true if found and false if not. So i'm doing so steps and I want to check my steps with my method. The method should have one parameter that is the image that i;m expecting to be present on the screen after my step is executed. My question is, what's the best way to this? Checking if an image is on the screen? how should i declare/store my images inside the java code and then verify them?

Thank you.

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2018-12-03
Last reply:
2018-12-03
RaiMan (raimund-hocke) said : #2

sorry, update for comment #1

-- image store
Put your images with a naming convention into one or more folders (which might be inside your project or somewhere outside)
Use the ImagePath feature, to tell SikuliX where an image named "someImage" is stored.
Please read the docs.

--- check existence (with 1.1.4)
there is no "generic" function needed, simply

assert scr.has("someImage"), "possible message in case of fail"

or

assert scr.has("someImage", waitTime), "possible message in case of fail"

Can you help with this problem?

Provide an answer of your own, or ask Rares Pasca for more information if necessary.

To post a message you must log in.