class Playwright::Test::Matchers::PlaywrightMatcher

def assertions_for(actual, is_not)

def assertions_for(actual, is_not)
  if actual.respond_to?(:_assertions)
    actual._assertions(::Playwright::Test.expect_timeout, is_not, nil)
  else
    raise NotImplementedError.new("Only page and locator assertions are currently implemented")
  end
end

def does_not_match?(actual)

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

def failure_message

def failure_message
  @failure_message
end

def failure_message_when_negated

def failure_message_when_negated
  @failure_message
end

def initialize(expectation_method, *args, **kwargs)

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

def matches?(actual)

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