diff options
author | Clement Ho <clemmakesapps@gmail.com> | 2017-04-04 17:47:16 +0000 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2017-04-04 17:47:16 +0000 |
commit | 0a4b853f2ceb0ad6c7394d1056f9139e53b38688 (patch) | |
tree | caacb3215d7ed5d292abf0af4f12ae1d0718e8fa /spec | |
parent | d8cbe979164192231a85da386337978f6cbfc31d (diff) | |
parent | 4461e7087d6ba76c7b5b089cac2c19db1e4e19f0 (diff) | |
download | gitlab-ce-0a4b853f2ceb0ad6c7394d1056f9139e53b38688.tar.gz |
Merge branch 'refactor_simulate_drag' into 'master'
Refactor test_utils bundle
See merge request !10437
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/milestones/milestones_spec.rb | 6 | ||||
-rw-r--r-- | spec/support/drag_to_helper.rb | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/spec/features/milestones/milestones_spec.rb b/spec/features/milestones/milestones_spec.rb index 8de9942c54e..2fa3e72ab08 100644 --- a/spec/features/milestones/milestones_spec.rb +++ b/spec/features/milestones/milestones_spec.rb @@ -76,6 +76,7 @@ describe 'Milestone draggable', feature: true, js: true do create(:issue, params.merge(title: 'Foo', project: project, milestone: milestone)) visit namespace_project_milestone_path(project.namespace, project, milestone) + scroll_into_view('.milestone-content') drag_to(selector: '.issues-sortable-list', list_to_index: 1) wait_for_ajax @@ -86,8 +87,13 @@ describe 'Milestone draggable', feature: true, js: true do visit namespace_project_milestone_path(project.namespace, project, milestone) page.find("a[href='#tab-merge-requests']").click + scroll_into_view('.milestone-content') drag_to(selector: '.merge_requests-sortable-list', list_to_index: 1) wait_for_ajax end + + def scroll_into_view(selector) + page.evaluate_script("document.querySelector('#{selector}').scrollIntoView();") + end end diff --git a/spec/support/drag_to_helper.rb b/spec/support/drag_to_helper.rb index 0c0659d3ecd..ae149631ed9 100644 --- a/spec/support/drag_to_helper.rb +++ b/spec/support/drag_to_helper.rb @@ -3,11 +3,11 @@ module DragTo evaluate_script("simulateDrag({scrollable: $('#{scrollable}').get(0), from: {el: $('#{selector}').eq(#{list_from_index}).get(0), index: #{from_index}}, to: {el: $('#{selector}').eq(#{list_to_index}).get(0), index: #{to_index}}});") Timeout.timeout(Capybara.default_max_wait_time) do - loop until drag_active? + loop while drag_active? end end def drag_active? - page.evaluate_script('window.SIMULATE_DRAG_ACTIVE').zero? + page.evaluate_script('window.SIMULATE_DRAG_ACTIVE').nonzero? end end |