capybara-playwright-driver 0.5.2 → 0.5.4

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: ff2e156c0f77ca328e9f95266e2b3ec6bf5a8250dbdbdb4d8c5e58b6590c042b
4
- data.tar.gz: 252a5c70de1364cde5fd3996466d166deb3d17639476731c63e24c362a3f46bd
3
+ metadata.gz: a279b6e3fb53216312d0acfb25cab1b393a122f777c65729df720b77f6bd0a17
4
+ data.tar.gz: 21f8543b574eeebe80fe02261020aa6430a4aa4a280718d1deb2fcd7cde24f1e
5
5
  SHA512:
6
- metadata.gz: fcfa998db2aa8701ba465be17b67df0164e9fdb4cb9c7c087342256143dde984573f7627d20297f6dc1b9680d9b6bfa5b3e2227f4bbc91eea3bfd878c76ad01a
7
- data.tar.gz: f792c1dd299fc9d257c6a38311a270979da849f4617d5827bbcfe7b186ccbca80cb92f27b1f4b6e6684a9443f8751af18501d4857f22031754ded783b6519219
6
+ metadata.gz: c0107a7bc12828a7022a4dbe12d371c8a38a58a98a136bb819cbff329b9c949ea785fdafdd8ed45ff2eb9aa176df7c962737aa1139cebe921e1458c3d56817da
7
+ data.tar.gz: cbe1c778c7996168db5e0d67e9869afc267ffff30c7c686f9ccc03c87ff1afa98eb21d4b77e5fcc3098c762b1fad255f9cd066b9b9e59b7e456838c4be97ef76
@@ -46,7 +46,7 @@ module Capybara
46
46
  def with_playwright_page(&block)
47
47
  raise ArgumentError.new('block must be given') unless block
48
48
 
49
- @browser&.with_playwright_page(&block)
49
+ browser.with_playwright_page(&block)
50
50
  end
51
51
 
52
52
  # Start Playwright tracing (doc: https://playwright.dev/docs/api/class-tracing#tracing-start)
@@ -8,7 +8,10 @@ module Capybara
8
8
 
9
9
  # Playwright has own auto-waiting feature.
10
10
  # So disable Capybara's retry logic.
11
- options[:wait] = 0
11
+ if driver.is_a?(Capybara::Playwright::Driver)
12
+ options[:wait] = 0
13
+ end
14
+
12
15
  super
13
16
  end
14
17
  end
@@ -21,7 +24,7 @@ module Capybara
21
24
  if native.is_a?(::Playwright::ElementHandle)
22
25
  block.call(native)
23
26
  else
24
- raise "#{native.inspect} is not a Playwirght::ElementHandle"
27
+ raise "#{native.inspect} is not a Playwright::ElementHandle"
25
28
  end
26
29
  end
27
30
  end
@@ -131,7 +134,7 @@ module Capybara
131
134
  }
132
135
  }
133
136
  JAVASCRIPT
134
- text.to_s.gsub(/\A[[:space:]&&[^\u00a0]]+/, '')
137
+ text.to_s.scrub.gsub(/\A[[:space:]&&[^\u00a0]]+/, '')
135
138
  .gsub(/[[:space:]&&[^\u00a0]]+\z/, '')
136
139
  .gsub(/\n+/, "\n")
137
140
  .tr("\u00a0", ' ')
@@ -548,7 +551,7 @@ module Capybara
548
551
  _key = key.last
549
552
  code =
550
553
  if _key.is_a?(String) && _key.length == 1
551
- _key.upcase
554
+ _key
552
555
  elsif _key.is_a?(Symbol)
553
556
  key_for(_key)
554
557
  else
@@ -567,7 +570,7 @@ module Capybara
567
570
  when String
568
571
  key.each_char do |char|
569
572
  executables << PressKey.new(
570
- key: char.upcase,
573
+ key: char,
571
574
  modifiers: modifiers,
572
575
  )
573
576
  end
@@ -600,6 +603,10 @@ module Capybara
600
603
 
601
604
  class PressKey
602
605
  def initialize(key:, modifiers:)
606
+ # Shift requires an explicitly uppercase a-z key to produce the correct output
607
+ # See https://playwright.dev/docs/input#keys-and-shortcuts
608
+ key = key.upcase if modifiers == [MODIFIERS[:shift]] && key.match?(/^[a-z]$/)
609
+
603
610
  # puts "PressKey: key=#{key} modifiers: #{modifiers}"
604
611
  if modifiers.empty?
605
612
  @key = key
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Capybara
4
4
  module Playwright
5
- VERSION = '0.5.2'
5
+ VERSION = '0.5.4'
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.5.2
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - YusukeIwaki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-25 00:00:00.000000000 Z
11
+ date: 2024-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -241,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
241
241
  - !ruby/object:Gem::Version
242
242
  version: '0'
243
243
  requirements: []
244
- rubygems_version: 3.5.11
244
+ rubygems_version: 3.5.22
245
245
  signing_key:
246
246
  specification_version: 4
247
247
  summary: Playwright driver for Capybara