View Source Playwright.APIRequestContext (playwright v1.44.0-alpha.4)
This API is used for the Web API testing. You can use it to trigger API endpoints, configure micro-services, prepare environment or the server to your e2e test.
Use this at caution as has not been tested.
Summary
Functions
Optional callback implementation for Playwright.SDK.ChannelOwner.init/2
.
Types
@type fetch_options() :: %{ optional(:params) => any(), optional(:method) => binary(), optional(:headers) => any(), optional(:postData) => any(), optional(:jsonData) => any(), optional(:formData) => any(), optional(:multipartData) => any(), optional(:timeout) => non_neg_integer(), optional(:failOnStatusCode) => boolean(), optional(:ignoreHTTPSErrors) => boolean() }
@type t() :: %Playwright.APIRequestContext{ guid: term(), initializer: term(), listeners: term(), parent: term(), session: term(), type: term() }
%Playwright.APIRequestContext{}
Functions
Optional callback implementation for Playwright.SDK.ChannelOwner.init/2
.
If implemented, the callback will receive:
- The newly created "channel owner" struct.
- The
:initializer
received from the Playwright browser server.
The implementation has the option of "patching" the struct as stored in the catalog, and/or binding event handlers.
Example
def init(%{session: session} = owner, _initializer) do
Channel.bind(session, {:guid, owner.guid}, :close, fn event ->
Logger.warning("Closing #{inspect(event.target)}")
end)
{:ok, %{owner | version: "1.2.3"}}
end
Returns
{:ok, struct()}
Arguments
key/name | type | description | |
---|---|---|---|
owner | param | struct() | The newly created channel owner (resource). |
initializer | param | struct() | The initializer received from with the channel owner instance was derived. |
@spec post(t(), binary(), fetch_options()) :: Playwright.APIResponse.t()