无法找到字段“内容”(Capybara :: ElementNotFound)

时间:2016-10-01 21:09:10

标签: ruby-on-rails ruby automation cucumber bdd

这是我的Write_blog.feature文件

Feature: Write blog
As a Blog Owner
I can write new blog post
Scenario: Write Blog
Given I am on the Blog Homepage
When I click on the "New Post" Link
And I fill "My first blog" as Title
And I fill "Test content" as content
And I click on "Post" button 
Then I should see the blog i just posted

这是我的write_blog_steps.feature步骤

Given(/^I am on the Blog Page$/) do
  visit ("/posts")
end

When(/^I click on the "([^"]*)" Link$/) do |arg1|
  click_on "New Post"
end

When(/^I fill "([^"]*)" as title$/) do |title|
  @title = title
  fill_in  "Title", :with => title 
end

When(/^I fill "([^"]*)" as content$/) do |content|
  fill_in "Content", :with => content
end

When(/^I click on "([^"]*)" button$/) do |btn|
  click_button  btn
end

Then(/^I should see the blog i just posted$/) do
  page_should have_content(@title)
end

当我尝试运行它时:#cucumber features / write_steps.feature 这是以下错误

我填写“内容”作为内容功能/ step_definitions / write_post_steps.rb:14       无法找到字段“content”(Capybara :: ElementNotFound)       ./features/step_definitions/write_post_steps.rb:15:in /^I fill "([^"]*)" as content$/' features/write_post.feature:8:in我填写“测试内容”作为内容' 这里有什么错误?

0 个答案:

没有答案