Carla Test Helper v0.1.6 CarlaTestHelper View Source
Carla test helper
Link to this section Summary
Functions
Similar to quick_reply/4
but instead of quick replies, this
scans text and gallery card item buttons for a button with the
label label
Similar to quick_reply/4
but instead of quick replies, this
scans text and gallery card item buttons for a button with the
label label
Similar to quick_reply/4
but instead of quick replies, this
scans text and gallery card item buttons for a button with the
label label
Similar to button_action/4
The difference is that we don’t decode the payload
Macro to help easily define a set a list of assertions to test against the bot.
carlatest
will accept a name and a list of assertion functions and return a new function
with the given name that accepts 2 parameters
Prints the last response from a request
Retrieves a gallery card from the response and searches for a
button with the label label
sends its payload as the given
user for uuid
. Then asserts that the resulting response is
expected_action
Retrieves a gallery card from the response and searches for a
button with the label label
. Asserts the button linkout url
contains value
Retrieves a gallery card from the response and searches for a
button with the label label
. Asserts the button linkout url
contains value
Sends message
for the given uuid
and asserts the
response is the expected_action
Scans the buttons
portion of the given response
for the first quick reply
button with the label label
and sends its payload as the given user for
uuid
. Then asserts that the resulting response is expected_action
Link to this section Functions
Similar to quick_reply/4
but instead of quick replies, this
scans text and gallery card item buttons for a button with the
label label
.
Parameters:
- response - Response to look for a button with
label
- uuid - The user uuid to send the message as
- label - The label of the button you want to “click”
- expected_action - The resulting response’s action
Returns the response after clicking the button.
Similar to quick_reply/4
but instead of quick replies, this
scans text and gallery card item buttons for a button with the
label label
.
Parameters:
- response - Response to look for a button with
label
- uuid - The user uuid to send the message as
- label - The label of the button you want to “click”
- value - The linkout button payload value
Returns the response after clicking the button.
Similar to quick_reply/4
but instead of quick replies, this
scans text and gallery card item buttons for a button with the
label label
.
Parameters:
- response - Response to look for a button with
label
- uuid - The user uuid to send the message as
- label - The label of the button you want to “click”
- value - The linkout button payload value
- params - The params expected in the value
Returns the response after clicking the button.
Similar to button_action/4
The difference is that we don’t decode the payload.
Parameters:
- response - Response to look for a button with
label
- uuid - The user uuid to send the message as
- label - The label of the button you want to “click”
- expected_action - The resulting response’s action
Returns the response after clicking the button.
Macro to help easily define a set a list of assertions to test against the bot.
carlatest
will accept a name and a list of assertion functions and return a new function
with the given name that accepts 2 parameters.
The resulting function’s parameters:
- uuid - The uuid of the user to use when testing the list of assertions.
- state (defaults to
%{}
) - The state to setup for the user before running tests.
The macro’s assertions
argument is a expected to be a list of assertion functions.
This macro will take the list of functions and iterate through each one and call them.
This allows the user of the macro to define a conversation test case like so:
carlatest "request details optima", do: [
message("optima", "request.details.optima"),
quick_reply("Build & Price", "build:_optima"),
]
Prints the last response from a request.
Parameters:
- response - Response to print
- uuid - Unused, The user uuid passed down
Retrieves a gallery card from the response and searches for a
button with the label label
sends its payload as the given
user for uuid
. Then asserts that the resulting response is
expected_action
.
Parameters:
- response - Response to look for a button with
label
- uuid - The user uuid to send the message as
- index - The index of the gallery card
- label - The label of the button you want to “click”
- expected_action - the resulting response’s action
Returns the response after clicking the button.
Retrieves a gallery card from the response and searches for a
button with the label label
. Asserts the button linkout url
contains value
Parameters:
- response - Response to look for a button with
label
- uuid - The user uuid to send the message as
- index - The index of the gallery card
- label - The label of the button you want to “click”
- value - The linkout button payload value
Returns the response after asserting the button url.
Retrieves a gallery card from the response and searches for a
button with the label label
. Asserts the button linkout url
contains value
Parameters:
- response - Response to look for a button with
label
- uuid - The user uuid to send the message as
- index - The index of the gallery card
- label - The label of the button you want to “click”
- value - The linkout button payload value
- params - The params expected in the value
Returns the response after asserting the button url.
Sends message
for the given uuid
and asserts the
response is the expected_action
.
Parameters:
- _response - Unused, just made it 4 args to be in line w/ quick_reply and button
- uuid - The user to send the message as
- message - The message to send
- expected_action - The action to assert when it comes back
Returns a Response object.
Scans the buttons
portion of the given response
for the first quick reply
button with the label label
and sends its payload as the given user for
uuid
. Then asserts that the resulting response is expected_action
.
Parameters:
- response - Response to look for a button with
label
- uuid - The user uuid to send the message as
- label - The label of the button you want to “click”
- expected_action - the resulting response’s action
Returns the response after clicking the quick_reply.