capybara-playwright-driver 0.1.4 → 0.1.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: 17075d587d4657d2c2f70b68256bbaeac10e011d553b092cbbed35cb33de6f05
4
- data.tar.gz: c42763d910584f0687985887ab07180f1fde752c9b7543b1613d481757fd3898
3
+ metadata.gz: 0f88314708baa0e7547488ccf9ad93c70f4ab5b4bb9408c5452d013091688034
4
+ data.tar.gz: 578733ad152ef6065cb9c351e48d43ccabd5a0a9dca644c4ad791b2e7e4e5c5f
5
5
  SHA512:
6
- metadata.gz: 94bf8ef42f8d6a8e59b1f160eeb10f142432015beb9c219bab1c0dac31fbbf7dfcea1c2a63349aaf32dac58e87b33add9a690471eef90d96a5d228a9bc9f456e
7
- data.tar.gz: 894cc32d6ef13f2611d81b240a56f75b4ea445667ad7b8215a8955c96e742118dcb08ddf2f15df02fe375674665f45ead8ae892869421e99b01b2ec4bb687082
6
+ metadata.gz: f77aa0e32476d52e6c3aa875a52b24c2693e7129b22a72ca416f30749b167f14b8846889ce39d2db203ce25e890ff74eac1d13f42f630131e64aaab63a578764
7
+ data.tar.gz: 9c22919f25f1a0012a98dc1186724553fbdbecc0df10f95b5f80592e8489a3ed20218b19d8dcf3d2df0e467b8ed457606e039d288d28236c42e72c640a121b89
@@ -328,7 +328,24 @@ module Capybara
328
328
  when ::Playwright::ElementHandle
329
329
  Node.new(@driver, @playwright_page, arg)
330
330
  when ::Playwright::JSHandle
331
- arg.json_value
331
+ obj_type, is_array = arg.evaluate('obj => [typeof obj, Array.isArray(obj)]')
332
+ if obj_type == 'object'
333
+ if is_array
334
+ # Firefox often include 'toJSON' into properties.
335
+ # https://github.com/microsoft/playwright/issues/7015
336
+ #
337
+ # Get rid of non-numeric entries.
338
+ arg.properties.select { |key, _| key.to_i.to_s == key.to_s }.map do |_, value|
339
+ wrap_node(value)
340
+ end
341
+ else
342
+ arg.properties.map do |key, value|
343
+ [key, wrap_node(value)]
344
+ end.to_h
345
+ end
346
+ else
347
+ arg.json_value
348
+ end
332
349
  else
333
350
  arg
334
351
  end
@@ -20,7 +20,7 @@ module Capybara
20
20
  def wait?; true; end
21
21
  def needs_server?; true; end
22
22
 
23
- def browser
23
+ private def browser
24
24
  @browser ||= ::Capybara::Playwright::Browser.new(
25
25
  driver: self,
26
26
  playwright_browser: playwright_browser,
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Capybara
4
4
  module Playwright
5
- VERSION = '0.1.4'
5
+ VERSION = '0.1.5'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capybara-playwright-driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.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-06-19 00:00:00.000000000 Z
11
+ date: 2021-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara