featurist / browser-monkey

Reliable DOM testing
https://browsermonkey.org
53 stars 6 forks source link

shouldNotExist passes when it should fail #20

Open dereke opened 8 years ago

dereke commented 8 years ago

when you are checking that something does not exist:

browser.find('.irrelevant-option').shouldNotExist()

but it is dependent on a previous action making it display in the first place:

browser.find('.show').click().then(function(){
  return browser.find('.irrelevant-option').shouldNotExist();
})

The assertion will often pass as the browser has not had a chance to render the previous action (which erroneously displays the irrelevant option). Therefore I think shouldNotExist should be run inside a setTimeout 0. This seems to fix the issue in my testing.

refractalize commented 8 years ago

perhaps shouldDisappear() ? So we first check that it exists, then ensure that it disappears.

dereke commented 8 years ago

yeah that might be a good option actually!