Skip to content

Commit 308bfba

Browse files
committed
[rb] remove support for deprecated actions class parameters
1 parent 590cfbb commit 308bfba

3 files changed

Lines changed: 14 additions & 92 deletions

File tree

rb/lib/selenium/webdriver/common/action_builder.rb

Lines changed: 11 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -42,30 +42,13 @@ class ActionBuilder
4242
# @return [ActionBuilder] A self reference.
4343
#
4444

45-
def initialize(bridge, deprecated_mouse = nil, deprecated_keyboard = nil, deprecated_async = nil,
46-
devices: [], async: false, duration: 250)
45+
def initialize(bridge, devices: [], async: false, duration: 250)
4746
@bridge = bridge
4847
@duration = duration
49-
50-
@async = if deprecated_async.nil?
51-
async
52-
else
53-
WebDriver.logger.deprecate('initializing ActionBuilder with async parameter',
54-
':async keyword',
55-
id: :action_async)
56-
deprecated_async
57-
end
58-
48+
@async = async
5949
@devices = []
60-
if deprecated_keyboard || deprecated_mouse
61-
WebDriver.logger.deprecate "initializing ActionBuilder with keyboard and mouse parameters",
62-
"devices keyword or, even better, Driver#action",
63-
id: :action_devices
64-
add_input(deprecated_mouse)
65-
add_input(deprecated_keyboard)
66-
else
67-
Array(devices).each { |device| add_input(device) }
68-
end
50+
51+
Array(devices).each { |device| add_input(device) }
6952
end
7053

7154
#
@@ -118,20 +101,6 @@ def add_wheel_input(name)
118101
add_input(Interactions.wheel(name))
119102
end
120103

121-
#
122-
# Retrieves the input device for the given name
123-
#
124-
# @param [String] name name of the input device
125-
# @return [Selenium::WebDriver::Interactions::InputDevice] input device with given name
126-
#
127-
128-
def get_device(name)
129-
WebDriver.logger.deprecate('#get_device with name parameter',
130-
'#device with :name or :type keyword',
131-
id: :get_device)
132-
device(name: name)
133-
end
134-
135104
#
136105
# Retrieves the input device for the given name or type
137106
#
@@ -194,11 +163,9 @@ def wheel_inputs
194163
# @return [ActionBuilder] A self reference.
195164
#
196165

197-
def pause(deprecated_device = nil, deprecated_duration = nil, device: nil, duration: 0)
198-
deprecate_method(deprecated_device, deprecated_duration)
199-
200-
device ||= deprecated_device || pointer_input
201-
device.create_pause(deprecated_duration || duration)
166+
def pause(device: nil, duration: 0)
167+
device ||= pointer_input
168+
device.create_pause(duration)
202169
self
203170
end
204171

@@ -218,13 +185,10 @@ def pause(deprecated_device = nil, deprecated_duration = nil, device: nil, durat
218185
# @return [ActionBuilder] A self reference.
219186
#
220187

221-
def pauses(deprecated_device = nil, deprecated_number = nil, deprecated_duration = nil,
222-
device: nil, number: nil, duration: 0)
223-
deprecate_method(deprecated_device, deprecated_duration, deprecated_number, method: :pauses)
224-
225-
number ||= deprecated_number || 2
226-
device ||= deprecated_device || pointer_input
227-
duration ||= deprecated_duration || 0
188+
def pauses(device: nil, number: nil, duration: 0)
189+
number ||= 2
190+
device ||= pointer_input
191+
duration ||= 0
228192

229193
number.times { device.create_pause(duration) }
230194
self

rb/lib/selenium/webdriver/remote/bridge.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ def delete_all_cookies
367367
# actions
368368
#
369369

370-
def action(deprecated_async = nil, async: false, devices: [], duration: 250)
371-
ActionBuilder.new self, nil, nil, deprecated_async, async: async, devices: devices, duration: duration
370+
def action(async: false, devices: [], duration: 250)
371+
ActionBuilder.new self, async: async, devices: devices, duration: duration
372372
end
373373
alias_method :actions, :action
374374

rb/spec/unit/selenium/webdriver/common/action_builder_spec.rb

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,6 @@ module WebDriver
3434
expect(action_builder.devices).to be_empty
3535
end
3636

37-
it 'deprecates using mouse and keyboard directly' do
38-
expect {
39-
action_builder = ActionBuilder.new(bridge, mouse, keyboard)
40-
expect(action_builder.devices).to eq([mouse, keyboard])
41-
}.to have_deprecated(:action_devices)
42-
end
43-
44-
it 'deprecates using async parameter' do
45-
expect {
46-
ActionBuilder.new(bridge, nil, nil, true)
47-
}.to have_deprecated(:action_async)
48-
end
49-
5037
it 'accepts mouse and keyboard with devices keyword' do
5138
action_builder = ActionBuilder.new(bridge, devices: [mouse, keyboard])
5239
expect(action_builder.devices).to eq([mouse, keyboard])
@@ -65,18 +52,9 @@ module WebDriver
6552
expect(action_builder.default_move_duration).to eq(2.2)
6653
end
6754

68-
it 'does not accept additional devices if deprecated parameters are used' do
69-
none = Interactions.none('none')
70-
touch = Interactions.pointer(:touch, name: 'touch')
71-
expect {
72-
action_builder = ActionBuilder.new(bridge, mouse, keyboard, devices: [none, touch])
73-
expect(action_builder.devices).to eq([mouse, keyboard])
74-
}.to have_deprecated(:action_devices)
75-
end
76-
7755
it 'raises a TypeError if a non InputDevice is passed into devices' do
7856
expect {
79-
ActionBuilder.new(bridge, devices: [mouse, keyboard, "banana"])
57+
ActionBuilder.new(bridge, devices: [mouse, keyboard, 'banana'])
8058
}.to raise_error(TypeError)
8159
end
8260
end
@@ -161,14 +139,6 @@ module WebDriver
161139
end
162140
end
163141

164-
describe '#get_device' do
165-
it 'gets device by name with deprecation' do
166-
expect {
167-
expect(builder.get_device('mouse')).to eq(mouse)
168-
}.to have_deprecated(:get_device)
169-
end
170-
end
171-
172142
describe '#pointer_inputs' do
173143
it 'returns only pointer inputs' do
174144
touch_input = builder.add_pointer_input(:touch, 'touch')
@@ -205,12 +175,6 @@ module WebDriver
205175

206176
expect(mouse).to have_received(:create_pause).with(5)
207177
end
208-
209-
it 'has deprecated ordered parameters' do
210-
expect {
211-
builder.pause(mouse, 3)
212-
}.to have_deprecated(:pause)
213-
end
214178
end
215179

216180
describe '#pauses' do
@@ -229,12 +193,6 @@ module WebDriver
229193

230194
expect(mouse).to have_received(:create_pause).with(0).exactly(3).times
231195
end
232-
233-
it 'has deprecated ordered parameters' do
234-
expect {
235-
builder.pauses(mouse, 3)
236-
}.to have_deprecated(:pauses)
237-
end
238196
end
239197

240198
describe '#perform' do

0 commit comments

Comments
 (0)