playwright-ruby-client 1.59.0 → 1.59.1.alpha1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 959a33f7494fd33763cd54ddcf1e1c17fa0d9d37c89643aef2198f0dd452bbc9
4
- data.tar.gz: ce343d14b0541fdf0ba0892b2e79456eea0ea5340b9f651f77b50c4e9a835cf6
3
+ metadata.gz: d05870691fcb41af53e76d223efc97eff10801482d4f1a0874b75206b6778147
4
+ data.tar.gz: 7200aa440f7ba117f2cb740d12fecb7a379b9ba20d54559d158673c489499d64
5
5
  SHA512:
6
- metadata.gz: bab8717bee2ff89d4735682f4e4b68b545a9812b01143fe082028aded03dcac856e63db430de66ac87cbcbfd397c16ddd1f5a774d6c33e951272e8c701b0149c
7
- data.tar.gz: bba6fa2ebc246f538ccd074630c59f57c206d2942e299514c3d42b4717ae859943e42e4e2c4bc9b8a84e3680b2559f94ec1d7a0c34e7c56c7740468483ebf93e
6
+ metadata.gz: 71f8737925b2560fcb25d4ac4d7263ec6275aa225e0327431a287d9bae03423ebdea0b62a5d2f887aed17b296bb9781ac3fd057b3ecc0880469cb12b5f2ab9e2
7
+ data.tar.gz: f7e8258516e8ae50916f9139dfe668a049d2ab0ae44563361a749a245235e5ca5d90c0566331e6a28c364d5b8cc078ebd9215f92922d583e4b656e5c8cd9ff5a
@@ -951,6 +951,10 @@ module Playwright
951
951
  aria_snapshot(mode: 'ai', timeout: timeout, depth: depth, _track: _track)
952
952
  end
953
953
 
954
+ def _assertions(timeout, is_not, message)
955
+ PageAssertionsImpl.new(self, timeout, is_not, message)
956
+ end
957
+
954
958
  def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
955
959
  params = {
956
960
  resetOnNavigation: resetOnNavigation,
@@ -553,6 +553,10 @@ module Playwright
553
553
  @frame.highlight(@selector)
554
554
  end
555
555
 
556
+ def _assertions(timeout, is_not, message)
557
+ LocatorAssertionsImpl.new(self, timeout, is_not, message)
558
+ end
559
+
556
560
  def expect(expression, options, title)
557
561
  @frame.expect(@selector, expression, options, title)
558
562
  end
@@ -21,37 +21,6 @@ module Playwright
21
21
  end
22
22
 
23
23
  # ref: https://github.com/microsoft/playwright-python/blob/main/playwright/sync_api/__init__.py#L90
24
- class Expect
25
- def initialize
26
- @default_expect_timeout = ::Playwright::Test.expect_timeout
27
- end
28
-
29
- def call(actual, is_not)
30
- case actual
31
- when Page
32
- PageAssertions.new(
33
- PageAssertionsImpl.new(
34
- actual,
35
- @default_expect_timeout,
36
- is_not,
37
- nil,
38
- )
39
- )
40
- when Locator
41
- LocatorAssertions.new(
42
- LocatorAssertionsImpl.new(
43
- actual,
44
- @default_expect_timeout,
45
- is_not,
46
- nil,
47
- )
48
- )
49
- else
50
- raise NotImplementedError.new("Only locator assertions are currently implemented")
51
- end
52
- end
53
- end
54
-
55
24
  module Matchers
56
25
  class PlaywrightMatcher
57
26
  def initialize(expectation_method, *args, **kwargs)
@@ -61,7 +30,7 @@ module Playwright
61
30
  end
62
31
 
63
32
  def matches?(actual)
64
- Expect.new.call(actual, false).send(@method, *@args, **@kwargs)
33
+ assertions_for(actual, false).send(@method, *@args, **@kwargs)
65
34
  true
66
35
  rescue AssertionError => e
67
36
  @failure_message = e.full_message
@@ -69,7 +38,7 @@ module Playwright
69
38
  end
70
39
 
71
40
  def does_not_match?(actual)
72
- Expect.new.call(actual, true).send(@method, *@args, **@kwargs)
41
+ assertions_for(actual, true).send(@method, *@args, **@kwargs)
73
42
  true
74
43
  rescue AssertionError => e
75
44
  @failure_message = e.full_message
@@ -83,6 +52,16 @@ module Playwright
83
52
  def failure_message_when_negated
84
53
  @failure_message
85
54
  end
55
+
56
+ private
57
+
58
+ def assertions_for(actual, is_not)
59
+ if actual.respond_to?(:_assertions)
60
+ actual._assertions(::Playwright::Test.expect_timeout, is_not, nil)
61
+ else
62
+ raise NotImplementedError.new("Only page and locator assertions are currently implemented")
63
+ end
64
+ end
86
65
  end
87
66
  end
88
67
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playwright
4
- VERSION = '1.59.0'
4
+ VERSION = '1.59.1.alpha1'
5
5
  COMPATIBLE_PLAYWRIGHT_VERSION = '1.59.0'
6
6
  end
@@ -1306,6 +1306,11 @@ module Playwright
1306
1306
  wrap_impl(@impl.expect(unwrap_impl(expression), unwrap_impl(options), unwrap_impl(title)))
1307
1307
  end
1308
1308
 
1309
+ # @nodoc
1310
+ def _assertions(timeout, is_not, message)
1311
+ wrap_impl(@impl._assertions(unwrap_impl(timeout), unwrap_impl(is_not), unwrap_impl(message)))
1312
+ end
1313
+
1309
1314
  # @nodoc
1310
1315
  def to_s
1311
1316
  wrap_impl(@impl.to_s)
@@ -1872,13 +1872,13 @@ module Playwright
1872
1872
  end
1873
1873
 
1874
1874
  # @nodoc
1875
- def stop_js_coverage
1876
- wrap_impl(@impl.stop_js_coverage)
1875
+ def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1876
+ wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1877
1877
  end
1878
1878
 
1879
1879
  # @nodoc
1880
- def start_css_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1881
- wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1880
+ def stop_js_coverage
1881
+ wrap_impl(@impl.stop_js_coverage)
1882
1882
  end
1883
1883
 
1884
1884
  # @nodoc
@@ -1892,8 +1892,13 @@ module Playwright
1892
1892
  end
1893
1893
 
1894
1894
  # @nodoc
1895
- def start_js_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1896
- wrap_impl(@impl.start_js_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1895
+ def _assertions(timeout, is_not, message)
1896
+ wrap_impl(@impl._assertions(unwrap_impl(timeout), unwrap_impl(is_not), unwrap_impl(message)))
1897
+ end
1898
+
1899
+ # @nodoc
1900
+ def start_css_coverage(resetOnNavigation: nil, reportAnonymousScripts: nil)
1901
+ wrap_impl(@impl.start_css_coverage(resetOnNavigation: unwrap_impl(resetOnNavigation), reportAnonymousScripts: unwrap_impl(reportAnonymousScripts)))
1897
1902
  end
1898
1903
 
1899
1904
  # -- inherited from EventEmitter --
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playwright-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.59.0
4
+ version: 1.59.1.alpha1
5
5
  platform: ruby
6
6
  authors:
7
7
  - YusukeIwaki