Response header and flickering test

131 views
Skip to first unread message

beagile

unread,
Jan 4, 2013, 4:42:08 AM1/4/13
to capybar...@googlegroups.com
Hello Guys,

I've got the following cucumber step (which uses capybara and capybara-webkit under the hood) that sometimes works and sometimes not:

Then /^I can download a file$/ do
    page.response_headers['Content-Disposition'].should include('attachement') unless @selenium
end

It seems as if page.response_headers is sometimes present and sometimes not. If not I get the following error:
undefined method `include?' for nil:NilClass (NoMethodError

Does anybody know how to fix this?

Cheers,

Govinda

Perry Smith

unread,
Jan 4, 2013, 9:21:56 AM1/4/13
to capybar...@googlegroups.com
See if page.response_headers is nil with an explicit test and then see if that particular header is present or not.

I'm guessing sometimes that particular header is not present (as oppose to all of the headers).

That might give you a clue which way to debug this.

beagile

unread,
Jan 9, 2013, 5:37:39 AM1/9/13
to capybar...@googlegroups.com
OK. In the end I fixed by changing my step like this

Then /^I can download a file$/ do 
Timeout.timeout(20) do 
                sleep 0.1 if page.response_headers['Content-Disposition'].nil?
              end
              page.response_headers['Content-Disposition'].should include('attachement') unless @selenium
            end

Reply all
Reply to author
Forward
0 new messages