Sha256: 2de2b76a5661dff08c3788d30a31ac94bd7bdf60ae09444fcba623ed86008c74

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

require 'watirspec_helper'

describe 'Element' do
  context '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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
watir-7.1.0 spec/watirspec/drag_and_drop_spec.rb