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.



7
8
9
# File 'lib/playwright/test.rb', line 7

def initialize
  @timeout_settings = TimeoutSettings.new
end

Instance Method Details

#call(actual, is_not) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/playwright/test.rb', line 11

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