Sha256: c86d6a4499ca3e29b1d26f34fa274a3626c0372ecc260d481985bb1ac085cd5a

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

# frozen_string_literal: true

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.2.0 spec/watirspec/drag_and_drop_spec.rb