0
我開始與黃瓜,我試圖做一個測試,在我的軌道中創建一個新電影。所以在我的teste1.feature無法找到字段(水豚:: ElementNotFound)在軌道上
Feature: É possivel acessar a pagina de Novo Filme
Scenario: É possivel visitar paginas
Given I visit "/articles"
And I press the "Novo Filme" button
Then I should see the "/articles/new" page
Scenario: Add a movie
Given I visit "/articles"
And I press the "Novo Filme" button
Then I should see the "/articles/new" page
Given I am on a new movies page
When I fill in "article_title" with "Sta Uors"
And I fill in "f.number_field" with "10.5"
And I press "Salvar Novo Filme"
Then I should see "/articles"
Then I should see the "Sta Uors" at "tabelafilme"
,並在我的teste1.step我有
#Given(/^I visit "([^"]*)"$/) do
# visit article_path # Write code here that turns the phrase above into concrete actions
#end
Given (/^I visit "(.*)"/) do |place|
visit place
end
And(/^I press the "([^"]*)" button$/) do |arg|
click_on(arg) # Write code here that turns the phrase above into concrete actions
end
Then(/^I should see the "([^"]*)" page$/) do |place|
visit "/articles/new"
end
Given (/^I am on a new movies page/) do
visit "/articles/new"
end
When (/^I fill in "(.*)" with "(.*)"/) do |field , content|
fill_in (field), :with => (content), visible: false
end
And(/^I press "([^\"]*)"/) do |button|
click_button(button)
end
Then (/^I should see "([^\"]*)"/) do |arg|
page.find_by_id('notice').text == arg
end
Then (/^I should see the "([^\"]*)" at "([^\"]*)"/) do |film, table|
expect(page).to have_css("#tebelafilme", :text => table)
find('td', text: film)
end
但我仍然收到此錯誤
When I fill in "article_Titulo" with "Sta Uors" # features/step_definitions/teste1.rb:24
Unable to find field "article_Titulo" (Capybara::ElementNotFound)
./features/step_definitions/teste1.rb:25:in `/^I fill in "(.*)" with "(.*)"/'
features/teste1.feature:18:in `When I fill in "article_Titulo" with "Sta Uors"'
所以,我去項目運行並點擊我的article_title來查看html頁面上的黃瓜名稱,id名稱爲「article_text」,標籤爲「article_Titulo」,黃瓜找不到該字段。 有人可以幫我嗎?