加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Capybara :: ElementNotFound:用于jquery ui

发布时间:2020-12-17 02:03:13 所属栏目:百科 来源:网络整理
导读:我将我的登录表单放入 Jquery UI对话框弹出框中.当我开始做RSpec测试时,我得到了一个错误 Failure/Error: fill_in "Username",with: "user@example.com"Capybara::ElementNotFoundcannot fill in,no text field,text area or password field with id,name,or
我将我的登录表单放入 Jquery UI对话框弹出框中.当我开始做RSpec测试时,我得到了一个错误

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

这是我的规格/请求页面:

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

我正在将我的新页面编辑为Form partial. New和edit按钮都有:remote =>打开JqueryUI对话框的true方法.谢谢..

解决方法

试试这个

describe "with valid information" do
    before do
      fill_in "username text-input-field-id",:with => "user@example.com"
      ...
      ...
    end

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读