Skip to content

LocatorExpect

Namespace: E2E

public sealed class LocatorExpect

Matchers that retry until they pass or the assertion timeout elapses. Each takes an optional timeout that replaces the assertion timeout for that call.

Inheritance: object

View source

public LocatorExpect Not { get; }

Inverts the matcher. A negated matcher passes after its condition has been false for 1000 ms in a row.

Value: LocatorExpect

View source

ToBeAttachedAsync(bool, TimeSpan?, CancellationToken)

Section titled “ToBeAttachedAsync(bool, TimeSpan?, CancellationToken)”
public Task ToBeAttachedAsync(bool attached = true, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Waits for one match to exist, visible or not. <code class=“paramref”>attached</code> false waits for none.

Parameters

Name Type Description
attached bool
timeout TimeSpan?
cancellationToken CancellationToken

Returns: Task

View source

ToBeCheckedAsync(bool, TimeSpan?, CancellationToken)

Section titled “ToBeCheckedAsync(bool, TimeSpan?, CancellationToken)”
public Task ToBeCheckedAsync(bool isChecked = true, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Waits for checked state. <code class=“paramref”>isChecked</code> false waits for unchecked state.

Parameters

Name Type Description
isChecked bool
timeout TimeSpan?
cancellationToken CancellationToken

Returns: Task

View source

ToBeDisabledAsync(TimeSpan?, CancellationToken)

Section titled “ToBeDisabledAsync(TimeSpan?, CancellationToken)”
public Task ToBeDisabledAsync(TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Waits for disabled state.

Parameters

Name Type Description
timeout TimeSpan?
cancellationToken CancellationToken

Returns: Task

View source

ToBeEnabledAsync(bool, TimeSpan?, CancellationToken)

Section titled “ToBeEnabledAsync(bool, TimeSpan?, CancellationToken)”
public Task ToBeEnabledAsync(bool enabled = true, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Waits for enabled state. <code class=“paramref”>enabled</code> false waits for disabled state.

Parameters

Name Type Description
enabled bool
timeout TimeSpan?
cancellationToken CancellationToken

Returns: Task

View source

ToBeExpandedAsync(TimeSpan?, CancellationToken)

Section titled “ToBeExpandedAsync(TimeSpan?, CancellationToken)”
public Task ToBeExpandedAsync(TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Waits for expanded state.

Parameters

Name Type Description
timeout TimeSpan?
cancellationToken CancellationToken

Returns: Task

View source

ToBeFocusedAsync(TimeSpan?, CancellationToken)

Section titled “ToBeFocusedAsync(TimeSpan?, CancellationToken)”
public Task ToBeFocusedAsync(TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Waits for focused state.

Parameters

Name Type Description
timeout TimeSpan?
cancellationToken CancellationToken

Returns: Task

View source

ToBeHiddenAsync(TimeSpan?, CancellationToken)

Section titled “ToBeHiddenAsync(TimeSpan?, CancellationToken)”
public Task ToBeHiddenAsync(TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Waits for hidden or absent state.

Parameters

Name Type Description
timeout TimeSpan?
cancellationToken CancellationToken

Returns: Task

View source

ToBeSelectedAsync(TimeSpan?, CancellationToken)

Section titled “ToBeSelectedAsync(TimeSpan?, CancellationToken)”
public Task ToBeSelectedAsync(TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Waits for selected state.

Parameters

Name Type Description
timeout TimeSpan?
cancellationToken CancellationToken

Returns: Task

View source

ToBeVisibleAsync(bool, TimeSpan?, CancellationToken)

Section titled “ToBeVisibleAsync(bool, TimeSpan?, CancellationToken)”
public Task ToBeVisibleAsync(bool visible = true, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Waits for one visible match. <code class=“paramref”>visible</code> false waits for hidden or absent, as CancellationToken).

Parameters

Name Type Description
visible bool
timeout TimeSpan?
cancellationToken CancellationToken

Returns: Task

View source

ToContainTextAsync(TextMatch, bool?, TimeSpan?, CancellationToken)

Section titled “ToContainTextAsync(TextMatch, bool?, TimeSpan?, CancellationToken)”
public Task ToContainTextAsync(TextMatch expected, bool? ignoreCase = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Waits for contained normalized text.

Parameters

Name Type Description
expected TextMatch
ignoreCase bool?
timeout TimeSpan?
cancellationToken CancellationToken

Returns: Task

View source

ToContainTextAsync(IReadOnlyList<TextMatch>, bool?, TimeSpan?, CancellationToken)

Section titled “ToContainTextAsync(IReadOnlyList<TextMatch>, bool?, TimeSpan?, CancellationToken)”
public Task ToContainTextAsync(IReadOnlyList<TextMatch> expected, bool? ignoreCase = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Waits for each entry to be contained by a distinct match, in order. Extra matches are allowed.

Parameters

Name Type Description
expected IReadOnlyList<TextMatch>
ignoreCase bool?
timeout TimeSpan?
cancellationToken CancellationToken

Returns: Task

View source

ToHaveAccessibleNameAsync(TextMatch, bool?, TimeSpan?, CancellationToken)

Section titled “ToHaveAccessibleNameAsync(TextMatch, bool?, TimeSpan?, CancellationToken)”
public Task ToHaveAccessibleNameAsync(TextMatch expected, bool? ignoreCase = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Waits for an accessible name.

Parameters

Name Type Description
expected TextMatch
ignoreCase bool?
timeout TimeSpan?
cancellationToken CancellationToken

Returns: Task

View source

ToHaveAttributeAsync(string, TextMatch, bool?, TimeSpan?, CancellationToken)

Section titled “ToHaveAttributeAsync(string, TextMatch, bool?, TimeSpan?, CancellationToken)”
public Task ToHaveAttributeAsync(string name, TextMatch value, bool? ignoreCase = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Waits for the attribute to be present and its normalized value to match.

Parameters

Name Type Description
name string
value TextMatch
ignoreCase bool?
timeout TimeSpan?
cancellationToken CancellationToken

Returns: Task

View source

ToHaveAttributeAsync(string, TimeSpan?, CancellationToken)

Section titled “ToHaveAttributeAsync(string, TimeSpan?, CancellationToken)”
public Task ToHaveAttributeAsync(string name, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Waits for the attribute to be present.

Parameters

Name Type Description
name string
timeout TimeSpan?
cancellationToken CancellationToken

Returns: Task

View source

ToHaveCountAsync(int, TimeSpan?, CancellationToken)

Section titled “ToHaveCountAsync(int, TimeSpan?, CancellationToken)”
public Task ToHaveCountAsync(int count, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Waits for an exact match count.

Parameters

Name Type Description
count int
timeout TimeSpan?
cancellationToken CancellationToken

Returns: Task

View source

ToHaveScreenshotAsync(ScreenshotOptions, string?)

Section titled “ToHaveScreenshotAsync(ScreenshotOptions, string?)”
public Task ToHaveScreenshotAsync(ScreenshotOptions options, string? callerFile = null)

Waits for the one match to look like its stored screenshot, the box of the node cut from the screen. See String).

Parameters

Name Type Description
options ScreenshotOptions
callerFile string

Returns: Task

View source

ToHaveScreenshotAsync(string?, ScreenshotOptions?, string?)

Section titled “ToHaveScreenshotAsync(string?, ScreenshotOptions?, string?)”
public Task ToHaveScreenshotAsync(string? name = null, ScreenshotOptions? options = null, string? callerFile = null)

Waits for the one match to look like its stored screenshot, the box of the node cut from the screen. See String).

Parameters

Name Type Description
name string
options ScreenshotOptions
callerFile string

Returns: Task

View source

ToHaveTextAsync(TextMatch, bool?, TimeSpan?, CancellationToken)

Section titled “ToHaveTextAsync(TextMatch, bool?, TimeSpan?, CancellationToken)”
public Task ToHaveTextAsync(TextMatch expected, bool? ignoreCase = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Waits for exact normalized text: the node’s rendered text (innerText on the web), not its label. <code class=“paramref”>ignoreCase</code> folds a string’s case, and adds or removes a pattern’s.

Parameters

Name Type Description
expected TextMatch
ignoreCase bool?
timeout TimeSpan?
cancellationToken CancellationToken

Returns: Task

View source

ToHaveTextAsync(IReadOnlyList<TextMatch>, bool?, TimeSpan?, CancellationToken)

Section titled “ToHaveTextAsync(IReadOnlyList<TextMatch>, bool?, TimeSpan?, CancellationToken)”
public Task ToHaveTextAsync(IReadOnlyList<TextMatch> expected, bool? ignoreCase = null, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Waits for exactly as many matches as entries, each with its entry’s text, in order.

Parameters

Name Type Description
expected IReadOnlyList<TextMatch>
ignoreCase bool?
timeout TimeSpan?
cancellationToken CancellationToken

Returns: Task

View source

ToHaveValueAsync(TextMatch, TimeSpan?, CancellationToken)

Section titled “ToHaveValueAsync(TextMatch, TimeSpan?, CancellationToken)”
public Task ToHaveValueAsync(TextMatch expected, TimeSpan? timeout = null, CancellationToken cancellationToken = default)

Waits for a form control’s value, compared as it is. Fails on a node that is not a form control, negated too.

Parameters

Name Type Description
expected TextMatch
timeout TimeSpan?
cancellationToken CancellationToken

Returns: Task

View source