capybara-playwright-driver 0.3.2 → 0.4.0

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: 56e2d2acc8b4d6a6d29738d3975365d0862d6c160ce638e51c7a0e769ac0036f
4
- data.tar.gz: 4e03613985cac14593ab704fadafb314f10fb217c72d0efc3c2d2e3016b0e81e
3
+ metadata.gz: ff1545e5e7830f5c9c3a3880894c6c4b89cbe3104a18ee388870e16b6d31cd9c
4
+ data.tar.gz: 3add9f1a8aa12f459f2efe3b61d8c0200716201b02effacd666bd97f3220d479
5
5
  SHA512:
6
- metadata.gz: a34891f5ac1177ac7c8a7a0502fca4b6c8148291263de22f8d26b32af116fed576f1b718218ce347bd47be1717b59b87f5de5a1ceac3544a69fe79face267dda
7
- data.tar.gz: 1512b23ee56efdc085f303815f44ef5fd7844ec027f3fe83eb8e59de3a4095059462d5f4584f8889692e2e3e9218c8e48e2724be7c713e7afea8ef33c8714b14
6
+ metadata.gz: 5a88d7c10d9002bf81c0c5d10760623e69d8b02ee86ef238d3a2138e333d936d3c3fc2c6954b483b93dec856653f99a84bbec59b61106fd5a6df3f374e1616d2
7
+ data.tar.gz: aa54328b1a239b1d2800052775a9620180a26cf90ac2cc3fe48334f0b4b4c3d983da29fbc1f3d9aad1b75101319d00e85cd597dcf6ad9d579bda7bee5d236340
@@ -14,18 +14,20 @@ module Capybara
14
14
 
15
15
  class NoSuchWindowError < StandardError ; end
16
16
 
17
- def initialize(driver:, playwright_browser:, page_options:, record_video: false)
17
+ def initialize(driver:, playwright_browser:, page_options:, record_video: false, default_navigation_timeout: nil)
18
18
  @driver = driver
19
19
  @playwright_browser = playwright_browser
20
20
  @page_options = page_options
21
21
  if record_video
22
22
  @page_options[:record_video_dir] ||= tmpdir
23
23
  end
24
+ @default_navigation_timeout = default_navigation_timeout
24
25
  @playwright_page = create_page(create_browser_context)
25
26
  end
26
27
 
27
28
  private def create_browser_context
28
29
  @playwright_browser.new_context(**@page_options).tap do |browser_context|
30
+ browser_context.default_navigation_timeout = @default_navigation_timeout if @default_navigation_timeout
29
31
  browser_context.on('page', ->(page) {
30
32
  unless @playwright_page
31
33
  @playwright_page = page
@@ -21,7 +21,8 @@ module Capybara
21
21
  ignoreDefaultArgs: nil,
22
22
  proxy: nil,
23
23
  slowMo: nil,
24
- timeout: nil,
24
+ # timeout: nil,
25
+ tracesDir: nil,
25
26
  }.keys
26
27
 
27
28
  def value
@@ -9,6 +9,9 @@ module Capybara
9
9
  def initialize(app, **options)
10
10
  @browser_runner = BrowserRunner.new(options)
11
11
  @page_options = PageOptions.new(options)
12
+ if options[:timeout].is_a?(Numeric)
13
+ @default_navigation_timeout = options[:timeout] * 1000
14
+ end
12
15
  end
13
16
 
14
17
  def wait?; true; end
@@ -20,6 +23,7 @@ module Capybara
20
23
  playwright_browser: playwright_browser,
21
24
  page_options: @page_options.value,
22
25
  record_video: callback_on_save_screenrecord?,
26
+ default_navigation_timeout: @default_navigation_timeout,
23
27
  )
24
28
  end
25
29
 
@@ -239,7 +239,13 @@ module Capybara
239
239
 
240
240
  class TextInput < Settable
241
241
  def set(value, **options)
242
- @element.fill(value.to_s, timeout: @timeout)
242
+ text = value.to_s
243
+ if text.end_with?("\n")
244
+ @element.fill(text[0...-1], timeout: @timeout)
245
+ @element.press('Enter', timeout: @timeout)
246
+ else
247
+ @element.fill(text, timeout: @timeout)
248
+ end
243
249
  rescue ::Playwright::TimeoutError
244
250
  raise if @element.editable?
245
251
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Capybara
4
4
  module Playwright
5
- VERSION = '0.3.2'
5
+ VERSION = '0.4.0'
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.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - YusukeIwaki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-28 00:00:00.000000000 Z
11
+ date: 2023-04-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capybara