CarlaTestHelper

Description

This repo contains a testing library used in Carla end-to-end tests. It provides a library to describe and test conversations.

Requirements

Installation

If available in Hex, the package can be installed by adding carla_test_helper to your list of dependencies in mix.exs:

def deps do
  [
    {:carla_test_helper, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/carla_test_helper.

Example Test Case

If we want to write a test case for the "Request Detail - request details for optima" scenario, our file would look like this:

defmodule BotTestsTest do
  use CarlaTestHelper.Case, async: true
  import CarlaTestHelper

  describe "request.detail" do

    carlatest "should provide details on optima", do: [
      # write conversation tests here 
      # message("optima", "request.details.optima")
    ]
    
  end

end

Helper Functions

message

Parameters:

Sends message for the asserts the response is the expected_action.

message("optima", "request.details.optima")

quick_reply

Parameters:

Uses quick reply button using label and asserts the response is the expected_action.

quick_reply("Build & Price", "build:_optima")

button_action

Parameters:

Similar to quick reply, uses gallery card item button using label and asserts the response is expected_action.

button_action("Ok", "hello_2")

button_linkout

Parameters:

Similar to quick reply, uses gallery card item button using label and asserts the button payload is value.

button_linkout("Features & Specs", "https://kia.com/us/en/vehicle/optima/2018/features")

debug_last_response

Prints out JSON of last response in the console

debug_last_response()