I'm starting with cucumber and i'm trying to make a test that create a new movie in my rails. So in my teste1.feature
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"
and in my teste1.step i have
#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
but i'm still getting this error
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"'
So, i go to the project runing and click on my article_title to inspect on html page what's the name to put on cucumber, and the id name is "article_text", the label is "article_Titulo", and cucumber cannot find the field. Can someone help me?