Class: Playwright::Test::Matchers::PlaywrightMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/playwright/test.rb

Instance Method Summary collapse

Constructor Details

#initialize(expectation_method, *args, **kwargs) ⇒ PlaywrightMatcher

Returns a new instance of PlaywrightMatcher.



57
58
59
60
61
# File 'lib/playwright/test.rb', line 57

def initialize(expectation_method, *args, **kwargs)
  @method = expectation_method
  @args = args
  @kwargs = kwargs
end

Instance Method Details

#does_not_match?(actual) ⇒ Boolean

Returns:

  • (Boolean)


71
72
73
74
75
76
77
# File 'lib/playwright/test.rb', line 71

def does_not_match?(actual)
  Expect.new.call(actual, true).send(@method, *@args, **@kwargs)
  true
rescue AssertionError => e
  @failure_message = e.full_message
  false
end

#failure_messageObject



79
80
81
# File 'lib/playwright/test.rb', line 79

def failure_message
  @failure_message
end

#failure_message_when_negatedObject



83
84
85
# File 'lib/playwright/test.rb', line 83

def failure_message_when_negated
  @failure_message
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


63
64
65
66
67
68
69
# File 'lib/playwright/test.rb', line 63

def matches?(actual)
  Expect.new.call(actual, false).send(@method, *@args, **@kwargs)
  true
rescue AssertionError => e
  @failure_message = e.full_message
  false
end