broken after upgrade

28 views
Skip to first unread message

Perry Smith

unread,
Jan 14, 2013, 6:40:29 PM1/14/13
to capybar...@googlegroups.com
Mostly I'm looking for help on how to debug this... I suppose this could be a bug capybara-webkit but I'd be surprised.  I'm not doing anything really odd.

I have one test that I run via cucumber.  I can add @webkit to the feature and run it with capybara-webkit or remove it and it runs it via selenium.

Before the upgrade, it worked both ways.

After the upgrade, I had to dork with the authentication part to make it work with selenium but that should not affect the path using webkit.

The part I changed is this step:

Given /^I am on the welcome page$/ do
  case page.mode.to_s
  when 'selenium'
    # r = page.driver.rack_server

  when 'rack_test'
    encoded_login = ["ped...@us.ibm.com:lostgr8t"].pack("m*")
    page.driver.header 'Authorization', "Basic #{encoded_login}"
    visit(welcome_path)

  when 'webkit'
    encoded_login = ["ped...@us.ibm.com:lostgr8t"].pack("m*")
    page.driver.header 'Authorization', "Basic #{encoded_login}"
    visit(welcome_path)
  end
end

The test itself is pretty simple:


And /^I enter a defect into the swinfo form$/ do
  within('#swinfo_form') do
    fill_in('item', with: @current_adv.defect.name)
  end
end

When /^I hit the submit button$/ do
  within('#swinfo_form') do
    click_button('Submit')
  end
end

Then /^I should see the results$/ do
  within('table.upd_apar_defs tbody') do
    tr1 = find('tr:first-child')
    tds = tr1.all('td')
    tds[0].text.should == '1'
    tds[1].text.should == @current_adv.defect.name
    tds[2].text.should == "IV22222"
  end
end

If I save the page in after the fill_in, the text is not filled in.  If I save the page after the click button, the app is complaining about no route which I think is because the item is not filled in.

I know capybara 2 is more restrictive than before but it works with selenium.

Any ideas of what is going wrong or how to track it down?

Thank you,
Perry

Matt Horan

unread,
Jan 14, 2013, 9:02:26 PM1/14/13
to capybar...@googlegroups.com
On Mon, Jan 14, 2013 at 05:40:29PM -0600, Perry Smith wrote:
> The part I changed is this step:
> >
> > Given /^I am on the welcome page$/ do
> > case page.mode.to_s
> > when 'selenium'
> > # r = page.driver.rack_server
> > # visit("http://username:password@#{r.host}:#{r.port}#{welcome_path}")
> > visit("http://username:password@localhost#{welcome_path}")
> >
> > when 'rack_test'
> > encoded_login = ["ped...@us.ibm.com:lostgr8t"].pack("m*")
> > page.driver.header 'Authorization', "Basic #{encoded_login}"
> > visit(welcome_path)
> >
> > when 'webkit'
> > encoded_login = ["ped...@us.ibm.com:lostgr8t"].pack("m*")
> > page.driver.header 'Authorization', "Basic #{encoded_login}"

Instead, try

page.driver.browser.authenticate('ped...@us.ibm.com', 'lostgr8t')

There was a change rolled into the 0.14.0 release which may be causing
an issue with the Authorization header, though I'm surprised it ever
actually worked that way.

--
Matt Horan ma...@matthoran.com http://matthoran.com/

Perry Smith

unread,
Jan 14, 2013, 10:07:01 PM1/14/13
to capybar...@googlegroups.com

On Jan 14, 2013, at 8:02 PM, Matt Horan wrote:

> On Mon, Jan 14, 2013 at 05:40:29PM -0600, Perry Smith wrote:
>> The part I changed is this step:
>>>
>>> when 'webkit'
>>> encoded_login = ["ped...@us.ibm.com:lostgr8t"].pack("m*")
>>> page.driver.header 'Authorization', "Basic #{encoded_login}"
>
> Instead, try
>
> page.driver.browser.authenticate('ped...@us.ibm.com', 'lostgr8t')
>
> There was a change rolled into the 0.14.0 release which may be causing
> an issue with the Authorization header, though I'm surprised it ever
> actually worked that way.

That worked. Thanks.

FYI: I came from 0.13.0 to 0.14.1

Reply all
Reply to author
Forward
0 new messages