[Wtr-development] automatic waiting?

Jarmo jarmo.p at gmail.com
Mon Oct 18 13:10:26 EDT 2010


Jari: does that implicit wait in WD mean that 1.5 seconds is waited
everytime before throwing out an Exception? This is not what i'd want.

After giving some more thought about it then i cannot see any perfect
solution to it and i'm starting to believe that there are none :(

To give you a better picture of the current situation then this is
what i have to do currently in my tests for example:
button.click
# some javascript work
wait_until {div.exists?)

button.click
# some javascript work
wait_until {div.visible?}

button.click
# some javascript work
wait_until {div.text == "expected text"}

button.click
# some javascript work
wait_until {not div.exists?}

And i would like to do these examples like this with RSpec:
button.click
# some javascript work
div.should exist

button.click
# some javascript work
div.should be_visible

button.click
# some javascript work
div.text.should == "expected text"

button.click
# some javascript work
div.should_not exist

In other words i wouldn't want to use any wait_until's or similar
methods explicitly. And considering the examples above it seems to be
impossible to achieve without changing something very drastically or
changing Watir AND RSpec together.

If you think about it then manual tester also waits something to
happen, implicitly, but (s)he always (well, almost always) knows what
to wait. (S)He also knows if there should something to disappear
instead and waits for it. So if we could build some mind-reading AI
then Watir would rock.

Ethan: what would you do in #initialize? As you can see from the
examples above then you cannot just wait until element exists - what
if i want to wait until it doesn't exist? That's the problem. Also, i
wouldn't want it to be limited to only "exists?" as written above.

Bret: using Jari's #while_present doesn't help either because it is
just in a matter of different syntax.

In short, unless someone comes up with some fantastic idea, then this
thing will be on hold.

I'd like to see what Ethan (or anyone else) comes up with.

Jarmo

On Mon, Oct 18, 2010 at 4:35 AM, Bret Pettichord <bret at pettichord.com> wrote:
> Yes, it could be dangerous feature. Many of the commercial tools added
> something like this without careful thought and as a result completely
> killed the performance of scripts.
>
> Several years ago we had several people tell us that Watir was 20 times
> faster than their Silk tests. I believe it was because Silk added some
> implicit, ubiquitous waiting without much care.
>
> Bret
>
> On Sun, Oct 17, 2010 at 8:24 PM, Jari Bakken <jari.bakken at gmail.com> wrote:
>>
>> On Sun, Oct 17, 2010 at 2:11 PM, Jarmo <jarmo.p at gmail.com> wrote:
>> >
>> > What do you guys think? Is there any reason why not to implement
>> > something like that?
>> >
>>
>> WebDriver got this feature recently, configurable as:
>>
>>   driver.manage.timeouts.implicit_wait = 1.5 # seconds
>>
>> The default is not to wait at all. Capybara has its own implicit
>> waiting turned on by default (not sure how long).
>> Personally I'm a bigger fan of explicitly waiting where it's needed,
>> but I can see that this is a useful feature.
>> _______________________________________________
>> Wtr-development mailing list
>> Wtr-development at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/wtr-development
>
>
>
> --
> Bret Pettichord
> Lead Developer, Watir, www.watir.com
>
> Blog, www.io.com/~wazmo/blog
> Twitter, www.twitter.com/bpettichord
>
>
> _______________________________________________
> Wtr-development mailing list
> Wtr-development at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-development
>


More information about the Wtr-development mailing list