Class WebSessionAttribute
Declares a named web session for the test during setup, created on demand like any other session. Optionally navigates it to a start URL. Combine with LoginAsAttribute<TStrategy> when the session also needs authentication; use Order to sequence the two if needed.
[AttributeUsage(AttributeTargets.Class|AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public sealed class WebSessionAttribute : ProtoAttribute
- Inheritance
-
WebSessionAttribute
- Inherited Members
- Extension Methods
Examples
[WebSession("Admin", Open = "https://app.test/back-office")]
[WebSession("Customer")]
[LoginAs<BackOfficeLogin>("billing.admin", Session = "Admin")]
public async Task ...() { ... }
Constructors
WebSessionAttribute(string)
public WebSessionAttribute(string name)
Parameters
namestring
Properties
Application
Gets or sets the application this session targets, defaulting to the application selected for the
test and then to the session name. Its address comes from
ProtoTest:Applications:{application}:BaseUrl.
public string? Application { get; init; }
Property Value
DiscoverRoutes
Gets or sets whether Vue Router discovery records this session's routes as page inventory.
public bool DiscoverRoutes { get; init; }
Property Value
Endpoint
Gets or sets the application endpoint this session is rooted at, joined to the application's base
URL through ProtoTest:Applications:{application}:Endpoints:{endpoint}.
public string? Endpoint { get; init; }
Property Value
Name
Gets the session name, matching Proto.Context.Web(name) and LoginAs(Session = ...).
public string Name { get; }
Property Value
Open
Gets or sets an optional absolute or relative URL to navigate this session to during setup.
public string? Open { get; init; }
Property Value
Methods
BeforeTestAsync(ProtoExecutionContext)
Executed asynchronously before the decorated test or class tests execute.
public override Task BeforeTestAsync(ProtoExecutionContext context)
Parameters
contextProtoExecutionContext