Skip to content

Latest commit

 

History

History
191 lines (138 loc) · 6.9 KB

world-api.md

File metadata and controls

191 lines (138 loc) · 6.9 KB

World

World~World

State and stateful utilities can be shared between steps using an instance of "World"

Kind: inner class of World

world.baseUrl

Getter for the baseUrl used for all requests

Kind: instance property of World

world.baseGraphQLUrl

Getter for the baseGraphQLUrl used for all requests

Kind: instance property of World

world.req

Getter for the currently active Superagent request object

Kind: instance property of World

world.req

Setter for the active request

Kind: instance property of World

world.apiSpec

Getter for the full Open API spec

Kind: instance property of World

world.currentAgent

Getter for the current Superagent agent. Reuse this agent in step definitions to preserve client sessions

Kind: instance property of World

world.currentAgent

Setter for the current Superagent agent. Reuse this agent in step definitions to preserve client sessions

Kind: instance property of World

world.newAgent()

Creates and returns a new SuperAgent agent

Kind: instance method of World

world.getAgentByRole(role)

Get a Superagent agent for a specific authorization role

Kind: instance method of World

Param Type Description
role string The role, such as 'admin'

world.setAgentByRole(role, agent)

Save a Superagent agent for a given authorization role

Kind: instance method of World

Param Type
role string
agent *

world.getEndpointSpec()

Get part of the Open API spec for just a single endpoint (resource + method)

Kind: instance method of World

world.getOAuthAccessToken(url, credentials)

Get an Oauth2 access token, by sending the credentials to the endpoint url

Kind: instance method of World

Param Type Description
url * The full token url ()
credentials *

world.replaceVars(val)

Replace placeholders in a value with variables currently stored from environemtn config and previous responses.

Kind: instance method of World

Param Type
val *

world.replaceVariablesInitiator()

Returns Super Agent middleware that replaces placeholders with variables

Kind: instance method of World

world.getResponse(res)

Gets the body from a response. Includes logic to parse JSON from JSON responses that have an incorrect 'text/html' content type.

Kind: instance method of World

Param Description
res A Superagent response object

world.saveCurrentResponse()

Save the current response so its values can be used for future requests

Kind: instance method of World

world.retrieveResponse(resource, method, status)

Retrieve a response cached by saveCurrentResponse

Kind: instance method of World

Param Type Default Description
resource An HTTP resource
method * An HTTP method
status * 200 The response status, defaults to 200