Watir / Cucumber在场景中间超时

时间:2017-08-13 20:30:15

标签: ruby timeout cucumber watir scenarios

所以我对Watir / Cucumber来说是全新的,我正在做一个教程,包括编写一个脚本去假小狗收养网站,然后收养一只小狗。当我把它写成Watir脚本时,它工作正常,但现在我试图将它作为黄瓜场景运行,我遇到了问题。

它在网站上正确导航,但它来到一个页面,它必须填写多个文本字段。由于某种原因,它总是填充第一个文本字段,然后只是坐在那里,直到它超时。我不知道为什么会发生这种情况 - 我试着直接复制/粘贴教程所说应该工作的代码并且它仍在发生。

这是黄瓜特色:

Feature: Adopting Puppies
  As a pupppy lover
  I want to adopt puppies
  So they can chew my furniture

  Scenario: Adopting one puppy
    Given I am on the puppy adoption site
    When I click the View Details button
    And I click the Adopt Me button
    And I click the Complete the Adoption button
    And I enter "Name" in the name field
    And I enter "123 Main St." in the address field
    And I enter "name@foo.com" in the email field
    And I select "Credit Card" from the pay with dropdown
    And I click the Place Order button
    Then I should see "Thank you for adopting a puppy!"

它在正确的字段中输入“名称”,但从不输入地址。

以下是步骤定义:

Given /^I am on the puppy adoption site$/ do
  @browser.goto "http://puppies.herokuapp.com"
end
When /^I click the View Details button$/ do
  @browser.button(:value => "View Details").click
end
When /^I click the Adopt Me button$/ do
  @browser.button(:value => "Adopt Me!").click
end
When /^I click the Complete the Adoption button$/ do
  @browser.button(:value => "Complete the Adoption").click
end
When /^I enter "([^\"]*)" in the name field$/ do |name|
  @browser.text_field(:id => "order_name").set(name)
end
When /^I enter "([^\"]*)" in the address field$/ do |address|
  @browser.text_field(:id => "order_address").set(address)
end
When /^I enter "([^\"]*)" in the email field$/ do |email|
  @browser.text_field(:id => "order_email").set(email)
end
When /^I select "([^\"]*)" from the pay with dropdown$/ do |pay_type|
  @browser.select_list(:id => "order_pay_type").select(pay_type)
end
When /^I click the Place Order button$/ do
  @browser.button(:value => "Place Order").click
end
Then /^I should see "([^\"]*)"$/ do |expected|
  expect(@browser.text).to include expected
end

不确定要提供的其他细节。我正在使用Firefox作为浏览器。任何人都知道为什么这不起作用?

0 个答案:

没有答案