Verify Exists steps fails immediately without waiting through timeout

8 posts, 1 answers
  1. Ory
    Ory avatar
    7 posts
    Member since:
    Jul 2012

    Posted 30 Aug 2012 Link to this post

    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
  2. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 30 Aug 2012 Link to this post

    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
  3. Ory
    Ory avatar
    7 posts
    Member since:
    Jul 2012

    Posted 03 Sep 2012 Link to this post

    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
  4. Answer
    Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 04 Sep 2012 Link to this post

    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
  5. Ory
    Ory avatar
    7 posts
    Member since:
    Jul 2012

    Posted 26 Oct 2012 Link to this post

    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
  6. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 26 Oct 2012 Link to this post

    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
  7. Gregory
    Gregory avatar
    15 posts
    Member since:
    Oct 2013

    Posted 08 Mar 2014 in reply to Plamen Link to this post

    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!!
  8. Boyan Boev
    Admin
    Boyan Boev avatar
    1072 posts

    Posted 13 Mar 2014 Link to this post

    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!
Back to Top