Class: Playwright::Test::Expect

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

Overview

Instance Method Summary collapse

Constructor Details

#initializeExpect

Returns a new instance of Expect.



25
26
27
# File 'lib/playwright/test.rb', line 25

def initialize
  @default_expect_timeout = ::Playwright::Test.expect_timeout
end

Instance Method Details

#call(actual, is_not) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/playwright/test.rb', line 29

def call(actual, is_not)
  case actual
  when Page
    PageAssertions.new(
      PageAssertionsImpl.new(
        actual,
        @default_expect_timeout,
        is_not,
        nil,
      )
    )
  when Locator
    LocatorAssertions.new(
      LocatorAssertionsImpl.new(
        actual,
        @default_expect_timeout,
        is_not,
        nil,
      )
    )
  else
    raise NotImplementedError.new("Only locator assertions are currently implemented")
  end
end