This is a migrated thread and some comments may be shown as answers.

Verify Exists steps fails immediately without waiting through timeout

7 Answers 350 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ory
Top achievements
Rank 2
Ory asked on 30 Aug 2012, 09:15 AM
Hi,

I have an If using a verify exist validation to handle the case when an error message is displayed after a button is clicked.
I noticed that usually the If does not look like it executes so I added another Verify Exists before the If and sure enough the Verify Exists fails immediately without waiting the 10s timeout configured for the step. Adding a 2s wait will solve the problem (see screenshot) however I do not want to wait a fixed amount of time before checking (and it could also take more than 2 s for that error to appear).

Is this a Test Studio bug?

Regards,
Ory

7 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 30 Aug 2012, 11:02 AM
Hello Ory,

You can easily change the role of that step. You can do that by right-clicking on the step>Change Role>Set As Wait(see screenshot). Test Studio will wait for that condition to be true (up to the time set) until proceeding with the test (instead of checking once and failing if false). See this article for more information.

Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Ory
Top achievements
Rank 2
answered on 03 Sep 2012, 07:22 AM
Hi Plamen,

I am not sure you understood the problem... I have no need to change the role of any steps.

The problem described is that it does not "wait for that condition to be true (up to the time set)" as you say it should. It fails immediately without waiting the set amount of time. Please re-read my post and see the screenshot.

Thanks,
Ory
0
Accepted
Plamen
Telerik team
answered on 04 Sep 2012, 11:44 AM
Hello Ory,

I think I understand exactly what the problem is. You are using a "Verify Exists" step inside of the If/else statement and your test fails on that step, because the element cannot be found. The problem is that the "Verify Exists" step performs the verification only once against the cached copy of the DOM tree(it doesn't wait for the element to exists). 
 
One way to overcome this is to add a fixed execution delay step right before the "Verify Exists" step, but we don't recommend this approach.

Another option is to set the EnsureStateIsCurrent property on that step to True(see screenshot). This will refresh the DOM tree before performing the verification, but this still does not guarantee that the verification will succeed.
 
The best approach in this case is described in this article from our Troubleshooting Guide. If you change the verification from "Verify Exists" to "Wait For Exists", Test Studio will wait up to the time set in the Timeout property(see screenshot), refreshing the DOM tree on every 500 ms, and when the element is found will proceed with the next step.

Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Ory
Top achievements
Rank 2
answered on 26 Oct 2012, 06:32 AM
Hi Plamen,

Sorry for the long reply time, have been busy with other things.

I have done as you suggested and it has solved the problem perfectly.

Thanks,
Ory
0
Plamen
Telerik team
answered on 26 Oct 2012, 07:59 AM
Hello Ory,

Glad to hear it! Thanks for the update.

Kind regards,
Plamen
the Telerik team
Are you enjoying Test Studio? We’d appreciate your vote in the ATI automation awards.
Vote now
0
Gregory
Top achievements
Rank 1
answered on 08 Mar 2014, 08:04 PM
What would be best practice to do this opposite of this?  I want to verify that an element DOES NOT exist depending on a condition.

Example:
A notification button, depending on a DB flag, will show a badge.  I query the DB for the flag value, and based on it's value will either verify that the badge is visible (if flag = true) or that the badge is not present.  I cannot use the .visible option because the element does not exist if the DB = false.  I figured that I could check to make sure the element does not exist if the DB flag = false instead of visible.  What would be the best way to handle this in a coded step?

Thanks!!
0
Boyan Boev
Telerik team
answered on 13 Mar 2014, 08:22 AM
Hello Gregory,

This is a duplicate of ticket number 796285, let's continue the discussion there.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Ory
Top achievements
Rank 2
Answers by
Plamen
Telerik team
Ory
Top achievements
Rank 2
Gregory
Top achievements
Rank 1
Boyan Boev
Telerik team
Share this question
or