diff options
author | Winnie Hellmann <winnie@gitlab.com> | 2019-08-23 11:40:56 +0000 |
---|---|---|
committer | Kushal Pandya <kushalspandya@gmail.com> | 2019-08-23 11:40:56 +0000 |
commit | 8d5fac4f56bb6c0d6625ea5f6364796a80196933 (patch) | |
tree | ea0caf0e67f8fe5b676ab83b1d4203b5040e0f3f /spec/support/helpers/drag_to_helper.rb | |
parent | 40295b25ab382f87f84e27a16f46be2345fe94c0 (diff) | |
download | gitlab-ce-8d5fac4f56bb6c0d6625ea5f6364796a80196933.tar.gz |
Hide duplicate board list while dragging
Diffstat (limited to 'spec/support/helpers/drag_to_helper.rb')
-rw-r--r-- | spec/support/helpers/drag_to_helper.rb | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/spec/support/helpers/drag_to_helper.rb b/spec/support/helpers/drag_to_helper.rb index 6099f87323f..2e9932f2e8a 100644 --- a/spec/support/helpers/drag_to_helper.rb +++ b/spec/support/helpers/drag_to_helper.rb @@ -1,8 +1,23 @@ # frozen_string_literal: true module DragTo - def drag_to(list_from_index: 0, from_index: 0, to_index: 0, list_to_index: 0, selector: '', scrollable: 'body', duration: 1000) - evaluate_script("simulateDrag({scrollable: $('#{scrollable}').get(0), duration: #{duration}, from: {el: $('#{selector}').eq(#{list_from_index}).get(0), index: #{from_index}}, to: {el: $('#{selector}').eq(#{list_to_index}).get(0), index: #{to_index}}});") + def drag_to(list_from_index: 0, from_index: 0, to_index: 0, list_to_index: 0, selector: '', scrollable: 'body', duration: 1000, perform_drop: true) + js = <<~JS + simulateDrag({ + scrollable: document.querySelector('#{scrollable}'), + duration: #{duration}, + from: { + el: document.querySelectorAll('#{selector}')[#{list_from_index}], + index: #{from_index} + }, + to: { + el: document.querySelectorAll('#{selector}')[#{list_to_index}], + index: #{to_index} + }, + performDrop: #{perform_drop} + }); + JS + evaluate_script(js) Timeout.timeout(Capybara.default_max_wait_time) do loop while drag_active? |