[QA] Browser testing components that disappear quickly e.g. ajax

Jon Robson jrobson at wikimedia.org
Tue Mar 4 19:19:09 UTC 2014


It doesn't seem to work for my use case...

When I try:
Then(/^I see an upload progress bar$/) do
  on(ArticlePage) do |page|
    page.progress_header_element.when_present
    page.progress_header_element.when_not_present(20)
  end
end

I see:
    Then I see an upload progress bar                  #
features/step_definitions/uploads_steps.rb:60
      timed out after 5 seconds, waiting for {:class=>"uploading",
:tag_name=>"h2"} to become present (Watir::Wait::TimeoutError)
      ./features/step_definitions/uploads_steps.rb:62:in `block (2
levels) in <top (required)>'
      ./features/step_definitions/uploads_steps.rb:61:in `/^I see an
upload progress bar$/'
      features/uploads_page.feature:10:in `Then I see an upload progress bar'

It really is a case of blink and you miss it...

On Tue, Mar 4, 2014 at 6:33 AM, Chris McMahon <cmcmahon at wikimedia.org> wrote:
>
> See if this would do what you want:
> https://gerrit.wikimedia.org/r/#/c/115659/
>
> It works pretty well, there are a couple of other similar checks in the
> repos.
>
>
> On Mon, Mar 3, 2014 at 7:34 PM, Jon Robson <jrobson at wikimedia.org> wrote:
>>
>> Anyone?
>>
>> On Fri, Feb 28, 2014 at 2:15 PM, Jon Robson <jrobson at wikimedia.org> wrote:
>> > I have two things I want to write tests for.
>> > 1) When a user clicks on a link in alpha on mobile the page loads via
>> > JavaScript and an ajax loader appears.
>> >
>> > 2) When a user uploads an image, after hitting submit they see a
>> > progress bar.
>> >
>> > Both of these elements typically appear for a short period of time
>> > before disappearing.
>> >
>> > Using the following rule:
>> >
>> > Then(/^I see an upload progress bar$/) do
>> >   on(ArticlePage).progress_header_element.when_present.should be_visible
>> > end
>> >
>> > When I watch the test run I see that the progress_header is in fact
>> > visible, but Watir does not find it. If I update the JavaScript so the
>> > progress header never disappears, then the test passes.
>> >
>> > Is there some kind of time interval for checking this sort of thing?
>> >
>> > For reference here is the patch...
>> > https://gerrit.wikimedia.org/r/#/c/116167/
>> >
>> > Any ideas how to deal with this sort of browser test?
>>
>> _______________________________________________
>> QA mailing list
>> QA at lists.wikimedia.org
>> https://lists.wikimedia.org/mailman/listinfo/qa
>
>
>
> _______________________________________________
> QA mailing list
> QA at lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/qa
>



More information about the QA mailing list