dalekjs / dalek-internal-assertions

[unmaintained] DalekJS internal module for assertions
3 stars 1 forks source link

Ability to set the amount of time to wait when using asserts #3

Closed ryanzec closed 11 years ago

ryanzec commented 11 years ago

While my specific use case related to doesntExist, I can't see any reason not to expose this functionality to all assert methods.

Right now when using assert.doesntExist(), it seems to wait a few seconds before it either passes of fails the test but there is no control over what the wait time is. I think the default wait time should be instant 0 milliseconds) but allow the user to be able to override that.

The use case for me is I have this component that will wait X milliseconds after the user has stops typing before performing an ajax request and insert that data from the ajax request. If that time is set to 350 milliseconds, right now I can't test that because doing this:

test.assert.doesntExist('selector')

will wait more that 350 milliseconds. What would be nice is to be able to do something like this:

test
  //should not exists yet, only 200 milliseconds passed
  .assert.wait(200).doesntExist('selector')
  //not it should exists as 400 milliseconds has passed, more than the configured 350 milliseconds)
  .assert.wait(200).exists('selector');
asciidisco commented 11 years ago

When the std. wait(xxxx ms) method is fixed, you can do this with the action method, I think it is more important to highlight the usage in the docs & create a nice example.