Last active
December 20, 2015 14:39
-
-
Save nowk/6148337 to your computer and use it in GitHub Desktop.
Capybara JS quirks using angular.js and/or turbolinks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment