ruby Capybara JS使用angular.js和/或turbolinks怪癖

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ruby Capybara JS使用angular.js和/或turbolinks怪癖相关的知识,希望对你有一定的参考价值。

step %{I save a task without the required fields} do
  within_task_form do
    # NOTE filling with '' won't work as it does not trigger keypress events
    # and thus breaks angular bindings
    fill_in 'task_name', with: ' '
  end
  step %{I save the task}
end
step %{the task should be :task_state} do |task_state|
  within '.tag-list .dropdown.task-state' do
    expect(page).to have_css '.dropdown-toggle',       text: task_state.capitalize
    toggle_dropdown # NOTE needed to get next assertion, else finder returns '' for some reason
    expect(page).to have_css '.dropdown-menu .active', text: task_state.capitalize
  end
end
step %{I go to edit task} do
  expect(page).to have_css %{a[rel='edit-task']}, visible: true
  find(%{a[rel='edit-task']}).click
  # NOTE must wait for selector else turbolinks breaks the next step since it 
  # will execute instantly as it is no longer waiting for the traditional page load
  expect(page).to have_css '.editor-pane'
end

以上是关于ruby Capybara JS使用angular.js和/或turbolinks怪癖的主要内容,如果未能解决你的问题,请参考以下文章

ruby capybara.rb(无头铬)

ruby Capybara + Poltergeistの雏形

ruby capybara_screenshots.rb

ruby capybara.rb

ruby Capybara自动保存测试失败的屏幕截图

ruby capybara_wait_until.rb