Sha256: 4442abf6f1f370d15cda43ef313b61adc3212f9f035b0816e4ffaecb152a92a5

Contents?: true

Size: 1.29 KB

Versions: 3

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

require 'watirspec_helper'

module Watir
  describe Element do
    describe 'using drag and drop', except: {browser: :ie} do
      before { browser.goto WatirSpec.url_for('drag_and_drop.html') }

      let(:draggable) { browser.div id: 'draggable' }
      let(:droppable) { browser.div id: 'droppable' }

      it 'can drag and drop an element onto another' do
        expect(droppable.text).to include 'Drop here'
        draggable.drag_and_drop_on droppable
        expect(droppable.text).to include 'Dropped!'
      end

      it 'can drag and drop an element onto another with specified scroll position' do
        expect(droppable.text).to include 'Drop here'
        draggable.drag_and_drop_on droppable, scroll_to: :center
        expect(droppable.text).to include 'Dropped!'
      end

      it 'can drag an element by the given offset' do
        expect(droppable.text).to include 'Drop here'
        draggable.drag_and_drop_by 200, 50
        expect(droppable.text).to include 'Dropped!'
      end

      it 'can drag an element by the given offset with specified scroll position' do
        expect(droppable.text).to include 'Drop here'
        draggable.drag_and_drop_by 200, 50, scroll_to: :center
        expect(droppable.text).to include 'Dropped!'
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
watir-7.3.0 spec/watirspec/drag_and_drop_spec.rb
watir-7.2.2 spec/watirspec/drag_and_drop_spec.rb
watir-7.2.1 spec/watirspec/drag_and_drop_spec.rb