playwright-ruby-client 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 548d69d7e9ada4dcbd8b760c5c993ad48809bc952d889aa96b440e8d2f2e4cc3
4
- data.tar.gz: d1c634791be5a553240895824b5cd99d17d41d52c0cdfc81993992a8175b4897
3
+ metadata.gz: cd2cd0b1ca23f5807c139c717c91341d2279c98cf6a8b513560221f9da9701cf
4
+ data.tar.gz: 8a059997574ce31fb065b1dbc3dae5c94c3660ada06fc0eaaff5cb29cc6efa6b
5
5
  SHA512:
6
- metadata.gz: d61d45ba95f21049bf4e14001c874d659e3a825f1f531ecd91c4ab107dae3d6eee90ee02f1f7dcce4a7fc8d1041da5bf0b09f4cf562baeb5dd0d2d676ee6eec7
7
- data.tar.gz: 134a10c14a14b716d8be3eff79fffb44fc3f254078a63ac3f00070e5e937ef7523f4b4272b2e838a36357b88862cc643a2d3a5ca9b72295535bdfd1c71cce8f1
6
+ metadata.gz: 6eb023ebb94129a006dcdacb383b43221dbcae61b1d1f474e382f84c2dd4d2b39d6c9cc878673e193f71c2409860bd69d0a8c865508a5930188aeb607325ed00
7
+ data.tar.gz: a3bd488faa4ef02f7afe9e50bd9e001429440b0bfd3a96a00ddf074aac809db828d06562985083b8573c31be966e64394253d6d5d26593cf4ad8434bc5660c50
@@ -149,10 +149,8 @@ module Playwright
149
149
  value: value,
150
150
  label: label,
151
151
  ).as_params
152
- params = base_params + { noWaitAfter: noWaitAfter, timeout: timeout }.compact
152
+ params = base_params.merge({ noWaitAfter: noWaitAfter, timeout: timeout }.compact)
153
153
  @channel.send_message_to_server('selectOption', params)
154
-
155
- nil
156
154
  end
157
155
 
158
156
  def tap_point(
@@ -421,10 +421,8 @@ module Playwright
421
421
  value: value,
422
422
  label: label,
423
423
  ).as_params
424
- params = base_params + { selector: selector, noWaitAfter: noWaitAfter, timeout: timeout }.compact
424
+ params = base_params.merge({ selector: selector, noWaitAfter: noWaitAfter, timeout: timeout }.compact)
425
425
  @channel.send_message_to_server('selectOption', params)
426
-
427
- nil
428
426
  end
429
427
 
430
428
  def set_input_files(selector, files, noWaitAfter: nil, timeout: nil)
@@ -1,18 +1,30 @@
1
1
  module Playwright
2
2
  class SelectOptionValues
3
3
  def initialize(element: nil, index: nil, value: nil, label: nil)
4
- @params =
5
- if element
6
- convert(elmeent)
7
- elsif index
8
- convert(index)
9
- elsif value
10
- convert(value)
11
- elsif label
12
- convert(label)
13
- else
14
- {}
15
- end
4
+ params = {}
5
+
6
+ options = []
7
+ if value
8
+ options.concat(convert(:value, value))
9
+ end
10
+
11
+ if index
12
+ options.concat(convert(:index, index))
13
+ end
14
+
15
+ if label
16
+ options.concat(convert(:label, label))
17
+ end
18
+
19
+ unless options.empty?
20
+ params[:options] = options
21
+ end
22
+
23
+ if element
24
+ params[:elements] = convert(:element, element)
25
+ end
26
+
27
+ @params = params
16
28
  end
17
29
 
18
30
  # @return [Hash]
@@ -20,22 +32,19 @@ module Playwright
20
32
  @params
21
33
  end
22
34
 
23
- private def convert(values)
24
- return convert([values]) unless values.is_a?(Enumerable)
25
- return {} if values.empty?
35
+ private def convert(key, values)
36
+ return convert(key, [values]) unless values.is_a?(Enumerable)
37
+ return [] if values.empty?
26
38
  values.each_with_index do |value, index|
27
- unless values
39
+ unless value
28
40
  raise ArgumentError.new("options[#{index}]: expected object, got null")
29
41
  end
30
42
  end
31
43
 
32
- case values.first
33
- when ElementHandle
34
- { elements: values.map(&:channel) }
35
- when String
36
- { options: values.map { |value| { value: value } } }
44
+ if key == :element
45
+ values.map(&:channel)
37
46
  else
38
- { options: values }
47
+ values.map { |value| { key => value } }
39
48
  end
40
49
  end
41
50
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playwright
4
- VERSION = '0.5.4'
4
+ VERSION = '0.5.5'
5
5
  end
@@ -730,23 +730,23 @@ module Playwright
730
730
  end
731
731
 
732
732
  # @nodoc
733
- def options=(req)
734
- wrap_impl(@impl.options=(unwrap_impl(req)))
733
+ def browser=(req)
734
+ wrap_impl(@impl.browser=(unwrap_impl(req)))
735
735
  end
736
736
 
737
737
  # @nodoc
738
- def browser=(req)
739
- wrap_impl(@impl.browser=(unwrap_impl(req)))
738
+ def owner_page=(req)
739
+ wrap_impl(@impl.owner_page=(unwrap_impl(req)))
740
740
  end
741
741
 
742
742
  # @nodoc
743
- def pause
744
- wrap_impl(@impl.pause)
743
+ def options=(req)
744
+ wrap_impl(@impl.options=(unwrap_impl(req)))
745
745
  end
746
746
 
747
747
  # @nodoc
748
- def owner_page=(req)
749
- wrap_impl(@impl.owner_page=(unwrap_impl(req)))
748
+ def pause
749
+ wrap_impl(@impl.pause)
750
750
  end
751
751
 
752
752
  # -- inherited from EventEmitter --
@@ -2268,6 +2268,11 @@ module Playwright
2268
2268
  raise NotImplementedError.new('wait_for_event is not implemented yet.')
2269
2269
  end
2270
2270
 
2271
+ # @nodoc
2272
+ def owned_context=(req)
2273
+ wrap_impl(@impl.owned_context=(unwrap_impl(req)))
2274
+ end
2275
+
2271
2276
  # @nodoc
2272
2277
  def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
2273
2278
  wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
@@ -2288,11 +2293,6 @@ module Playwright
2288
2293
  wrap_impl(@impl.stop_css_coverage)
2289
2294
  end
2290
2295
 
2291
- # @nodoc
2292
- def owned_context=(req)
2293
- wrap_impl(@impl.owned_context=(unwrap_impl(req)))
2294
- end
2295
-
2296
2296
  # -- inherited from EventEmitter --
2297
2297
  # @nodoc
2298
2298
  def once(event, callback)
@@ -60,13 +60,13 @@ module Playwright
60
60
  end
61
61
 
62
62
  # @nodoc
63
- def after_initialize
64
- wrap_impl(@impl.after_initialize)
63
+ def ok?
64
+ wrap_impl(@impl.ok?)
65
65
  end
66
66
 
67
67
  # @nodoc
68
- def ok?
69
- wrap_impl(@impl.ok?)
68
+ def after_initialize
69
+ wrap_impl(@impl.after_initialize)
70
70
  end
71
71
 
72
72
  # -- inherited from EventEmitter --
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playwright-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - YusukeIwaki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-03 00:00:00.000000000 Z
11
+ date: 2021-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby