Skip to content

Expect

Namespace: E2E

public static class Expect

Polling assertions for a Locator, expect.soft, and expect.poll. A passing locator assertion verifies the previous agent.act. Plain value matchers are not ported: use NUnit Assert.That, and Assert.EnterMultipleScope for soft value checks.

Inheritance: object

View source

Poll<T>(Func<CancellationToken, Task<T>>, PollOptions?)

Section titled “Poll<T>(Func<CancellationToken, Task<T>>, PollOptions?)”
public static PollExpectation<T> Poll<T>(Func<CancellationToken, Task<T>> read, PollOptions? options = null)

Re-reads <code class=“paramref”>read</code> until the chosen matcher holds or the timeout passes.

Type parameters

Name Description
T

Parameters

Name Type Description
read Func<CancellationToken, Task<T>>
options PollOptions

Returns: PollExpectation&lt;T&gt;

View source

public static PollExpectation<T> Poll<T>(Func<Task<T>> read, PollOptions? options = null)

Re-reads <code class=“paramref”>read</code> until the chosen matcher holds or the timeout passes.

Type parameters

Name Description
T

Parameters

Name Type Description
read Func<Task<T>>
options PollOptions

Returns: PollExpectation&lt;T&gt;

View source

public static PollExpectation<T> Poll<T>(Func<T> read, PollOptions? options = null)

Re-reads <code class=“paramref”>read</code> until the chosen matcher holds or the timeout passes.

Type parameters

Name Description
T

Parameters

Name Type Description
read Func<T>
options PollOptions

Returns: PollExpectation&lt;T&gt;

View source

public static SoftBrowserExpect Soft(Browser browser)

The browser matchers, but a failure is kept as Soft(Locator) keeps one.

Parameters

Name Type Description
browser Browser

Returns: SoftBrowserExpect

View source

public static SoftLocatorExpect Soft(Locator locator)

The locator matchers, but a failure is kept on the session instead of thrown and the body runs on. The test fails at the end with every kept failure. E2ETest records each one as an NUnit assertion failure.

Parameters

Name Type Description
locator Locator

Returns: SoftLocatorExpect

View source

public static BrowserExpect That(Browser browser)

Waits for the browser’s URL or title with BrowserExpect. A passing matcher verifies the previous act.

Parameters

Name Type Description
browser Browser

Returns: BrowserExpect

View source

public static LocatorExpect That(Locator locator)

Parameters

Name Type Description
locator Locator

Returns: LocatorExpect

View source

public static ScreenExpect That(Screen screen)

Compares the whole screen against a stored screenshot with String).

Parameters

Name Type Description
screen Screen

Returns: ScreenExpect

View source