Class WebProbeLoop

Namespace
ProtoTest.Web
Assembly
ProtoTest.Web.dll

The web layer's retry loop: it probes until the observation satisfies the predicate or the timeout elapses, polling every interval the session reports. Assertions, the Selenium backend and any hand-written backend share it, so all retry at the same speed and report the same last observation. The interval is resolved per poll from the backend's PollInterval, so a configured interval reaches the session's assertions instead of only the backend's own action retries.

public sealed class WebProbeLoop
Inheritance
WebProbeLoop
Inherited Members
Extension Methods

Constructors

WebProbeLoop(Func<TimeSpan>)

The web layer's retry loop: it probes until the observation satisfies the predicate or the timeout elapses, polling every interval the session reports. Assertions, the Selenium backend and any hand-written backend share it, so all retry at the same speed and report the same last observation. The interval is resolved per poll from the backend's PollInterval, so a configured interval reaches the session's assertions instead of only the backend's own action retries.

public WebProbeLoop(Func<TimeSpan> interval)

Parameters

interval Func<TimeSpan>

Methods

PollAsync<T>(Func<CancellationToken, ValueTask<T>>, Func<T, bool>, TimeSpan, CancellationToken)

Polls any probe until its observation satisfies the predicate.

public ValueTask<ProtoPollResult<T>> PollAsync<T>(Func<CancellationToken, ValueTask<T>> probe, Func<T, bool> isSatisfied, TimeSpan timeout, CancellationToken cancellationToken)

Parameters

probe Func<CancellationToken, ValueTask<T>>
isSatisfied Func<T, bool>
timeout TimeSpan
cancellationToken CancellationToken

Returns

ValueTask<ProtoPollResult<T>>

Type Parameters

T

PollObservationAsync(Func<CancellationToken, ValueTask<WebProbe>>, Func<WebProbe, bool>, TimeSpan, CancellationToken)

Polls a probe that reports whether its condition holds and what it observed. The two documented retryable web failures become observations rather than errors, so a locator that does not resolve yet or an element that is not actionable yet keeps the loop going.

public ValueTask<ProtoPollResult<WebProbe>> PollObservationAsync(Func<CancellationToken, ValueTask<WebProbe>> probe, Func<WebProbe, bool> isSatisfied, TimeSpan timeout, CancellationToken cancellationToken)

Parameters

probe Func<CancellationToken, ValueTask<WebProbe>>
isSatisfied Func<WebProbe, bool>
timeout TimeSpan
cancellationToken CancellationToken

Returns

ValueTask<ProtoPollResult<WebProbe>>