Forum Discussion

TestQA1's avatar
TestQA1
Frequent Contributor
2 years ago
Solved

Applying wait in BDD steps

Hi All,

 

I have a bdd structure like below:

 

When (....)

some actions like click etc

Then (...)

Assertion script method....

aqUtils.Delay(1000);

 

When (....)

some actions like click etc

And (....)

some other action

Then (...)

Assertion script method....

aqUtils.Delay(1000);

 

Now the problem is that I have to apply Delay after most assertion methods in Then because the scenarios run after one another and the script fail if the second When in the second scenario runs quickly after the first Then in the first scenario.

 

Is this the correct way to apply delay or there is a better alternative to deal with this issue?

Thanks very much.

  • Hi TestQA1 

     

    If the object can't be found it may be linked to the criteria in the name mapping or the values you have defined in the wait property. 

     

    The idea of the wait property is to wait until that property value equals the specified value or until a specified time limit elapses rather than a static wait time every time. 

     

    Typically this is linked to the Auto-wait time out which can be extended. 

     

    Alternatively you can add an explicit time limit just for that wait operation 

     

    For example

     

    Aliases.browser.pageSignUpLoginForm.buttonLogIn.WaitProperty("enabled", "true", 20);

     

    Delays are just a short term way of figuring out whether you need to add in wait times or not.

     

    KR


    Vinnie 

4 Replies

    • TestQA1's avatar
      TestQA1
      Frequent Contributor

      Thank you.

      But, what if the object does not exist (sometime it takes time for the object to exist) and you use object.WaitProperty('Exists',true). The error will be shown on the line 'object.WaitProperty' saying the waitproperty uses object that does not exists?

      I saw this issue in one of my implementation. My knowledge may be very limited. 🙂

      • vinniew's avatar
        vinniew
        Staff

        Hi TestQA1 

         

        If the object can't be found it may be linked to the criteria in the name mapping or the values you have defined in the wait property. 

         

        The idea of the wait property is to wait until that property value equals the specified value or until a specified time limit elapses rather than a static wait time every time. 

         

        Typically this is linked to the Auto-wait time out which can be extended. 

         

        Alternatively you can add an explicit time limit just for that wait operation 

         

        For example

         

        Aliases.browser.pageSignUpLoginForm.buttonLogIn.WaitProperty("enabled", "true", 20);

         

        Delays are just a short term way of figuring out whether you need to add in wait times or not.

         

        KR


        Vinnie