I have my jQuery UI Dialog popup login form. When I start performing the RSpec test, I got an error with
Failure/Error: fill_in "Username", with: " user@example.com " Capybara::ElementNotFound cannot fill in, no text field, text area or password field with id, name, or label 'Username' found
Here is my spec / request page:
describe "create user", :js => true do before { visit new_enr_rds_dea_path } let(:submit) { "Create Dea" } describe "with invalid information" do it "should not create a user" do expect { click_button submit }.not_to change(Enr::Rds::Dea, :count) end end describe "with valid information" do before do fill_in "Username", with: " user@example.com " fill_in "Password", with: "foobar" fill_in "Confirm password", with: "foobar" fill_in "Organisation", with: "foobar" end it "should create a user" do expect { click_link_or_button submit }.to change(Enr::Rds::Dea, :count).by() end end
Factories.rb
FactoryGirl.define do factory :dea_user do |user| user.dea_user " example@in4systems.com " user.dea_pwd "foobar" user.dea_pwd_confirmation "foobar" user.pro_organisation_id "NHER" end end
I am submitting my new and editing page to the partial part of the form. Both the New and edit buttons have a method :remote => true to open the JqueryUI dialog box. Thanks..
user1761938
source share