Classes

Tester
ResponseAssert
AnyResponseAssert
ConversationTester

Automated Conversation tests runner

Typedefs

TestSource : object
TestCase : object
TextCase : object
TextTest : object
TestCaseStep : object
TestsGroup : object
List : object
TestsDefinition : object
testerFactoryTester

Callback for getting a tester

TestsOutput : object
Logger : object
 

Tester

Kind: global class

 

new Tester()

Utility for testing requests

 

tester.processor : Processor

Kind: instance property of Tester

 

tester.testData

Kind: instance property of Tester
Properties

NameTypeDescription
predefinedobjecttest data to use
 

tester.allowEmptyResponse

Kind: instance property of Tester
Properties

NameTypeDescription
allowbooleantester to process empty responses
 

tester.senderLogger

Kind: instance property of Tester
Properties

NameTypeDescription
useconsoleown loggger
 

tester.features

Kind: instance property of Tester
Properties

Type
Array.<string>
 

tester.ATTACHMENT_MOCK_URL

Kind: instance property of Tester
Properties

Type
string
 

tester.setExpandRandomTexts([fixedIndex])

Enable tester to expand random texts It joins them into a single sting

Kind: instance method of Tester

ParamType
[fixedIndex]boolean
 

tester.cleanup()

Clear acquired responses and data

Kind: instance method of Tester

 

tester.setFeatures([features])

Set features for all messages

Kind: instance method of Tester

ParamType
[features]Array.<string>
 

tester.processMessage(message, senderId, pageId, [data]) ⇒ Promise.<any>

Use tester as a connector :)

Kind: instance method of Tester

ParamTypeDescription
messageobjectwingbot chat event
senderIdstringchat event sender identifier
pageIdstringchannel/page identifier
[data]objectadditional data
 

tester.res([index]) ⇒ ResponseAssert

Returns single response asserter

Kind: instance method of Tester

ParamTypeDefaultDescription
[index]number0response index
 

tester.any() ⇒ AnyResponseAssert

Returns any response asserter

Kind: instance method of Tester

 

tester.lastRes() ⇒ ResponseAssert

Returns last response asserter

Kind: instance method of Tester

 

tester.passedAction(path, [matchRequestActions]) ⇒ this

Checks, that request passed an interaction

Kind: instance method of Tester

ParamTypeDefault
pathstring
[matchRequestActions]booleanfalse
 

tester.respondedWithBlock(blockName) ⇒ this

Checks, that a plugin used a block as a response

Kind: instance method of Tester

ParamType
blockNamestring
 

tester.getState() ⇒ object

Returns state

Kind: instance method of Tester

 

tester.setState([state])

Sets state with Object.assign()

Kind: instance method of Tester

ParamTypeDefault
[state]object{}
 

tester.stateContains(object, [deep])

Assert, that state contains a subset of provided value

Kind: instance method of Tester

ParamTypeDefault
objectobject
[deep]booleanfalse

Example

t.stateContains({ value: true });
 

tester.text(text) ⇒ Promise

Makes text request

Kind: instance method of Tester

ParamType
textstring
 

tester.attachment(type, [url]) ⇒ Promise

Sends attachment

Kind: instance method of Tester

ParamTypeDefault
type'image' | 'audio' | 'video' | 'file'file
[url]string
 

tester.intent(intent, [text], [score]) ⇒ Promise

Makes recognised AI intent request

Kind: instance method of Tester

ParamTypeDefault
intentstring | Array.<string>
[text]stringnull
[score]number
 

tester.intentWithEntity(intent, entity, [value], [text], [score], [entityScore]) ⇒ Promise

Makes recognised AI intent request with entity

Kind: instance method of Tester

ParamTypeDefault
intentstring
entitystring
[value]string
[text]string
[score]number1
[entityScore]number
 

tester.entity(entity, [value], [text], [score]) ⇒ Promise

Makes recognised AI request with entity

Kind: instance method of Tester

ParamTypeDefault
entitystring
[value]string
[text]string
[score]number1
 

tester.optin(action, [data], [userRef]) ⇒ Promise

Make optin call

Kind: instance method of Tester

ParamTypeDefaultDescription
actionstring
[data]object{}
[userRef]stringnullspecific ref string
 

tester.quickReply(action, [data]) ⇒ Promise

Send quick reply

Kind: instance method of Tester

ParamTypeDefault
actionstring
[data]object{}
 

tester.quickReplyText(text) ⇒ Promise.<boolean>

Send quick reply if text exactly matches, otherwise throws exception

Kind: instance method of Tester

ParamType
textstring
 

tester.postBack(action, [data], [refAction], [refData]) ⇒ Promise

Sends postback, optionally with referrer action

Kind: instance method of Tester

ParamTypeDefaultDescription
actionstring
[data]object{}
[refAction]stringnullreferred action
[refData]object{}referred action data
 

tester.debug([showPrivateKeys])

Prints last conversation turnaround

Kind: instance method of Tester

ParamTypeDefault
[showPrivateKeys]booleanfalse
 

Tester.Tester

Kind: static class of Tester

 

new Tester(reducer, [senderId], [pageId], [processorOptions], [storage])

Creates an instance of Tester.

ParamTypeDefaultDescription
reducerRouter | ReducerWrapper
[senderId]stringnull
[pageId]stringnull
[processorOptions]ProcessorOptions{}options for Processor
[storage]MemoryStateStorageplace to override the storage
 

ResponseAssert

Kind: global class

 

new ResponseAssert()

Utility for asserting single response

 

responseAssert.contains(search) ⇒ this

Checks, that response contains text

Kind: instance method of ResponseAssert

ParamType
searchstring | object
 

responseAssert.quickReplyAction(action) ⇒ this

Checks quick response action

Kind: instance method of ResponseAssert

ParamType
actionstring
 

responseAssert.templateType(type) ⇒ this

Checks template type

Kind: instance method of ResponseAssert

ParamType
typestring
 

responseAssert.passThread([appId]) ⇒ this

Checks pass thread control

Kind: instance method of ResponseAssert

ParamTypeDefault
[appId]stringnull
 

responseAssert.attachmentType(type) ⇒ this

Checks attachment type

Kind: instance method of ResponseAssert

ParamType
typestring
 

ResponseAssert.AnyResponseAssert#contains(search) ⇒ this

Checks, that response contains a text

Kind: static method of ResponseAssert

ParamType
searchstring | object
 

ResponseAssert.AnyResponseAssert#notContains(search) ⇒ this

Checks, that response does NOT contain a text

Kind: static method of ResponseAssert

ParamType
searchstring
 

ResponseAssert.AnyResponseAssert#quickReplyAction(action) ⇒ this

Checks quick response action

Kind: static method of ResponseAssert

ParamType
actionstring
 

ResponseAssert.AnyResponseAssert#quickReplyTextContains(search) ⇒ this

Checks quick response text

Kind: static method of ResponseAssert

ParamType
searchstring
 

ResponseAssert.AnyResponseAssert#quickReplyTextNotContains(search) ⇒ this

Checks for missing quick response text

Kind: static method of ResponseAssert

ParamType
searchstring
 

ResponseAssert.AnyResponseAssert#templateType(type) ⇒ this

Checks template type

Kind: static method of ResponseAssert

ParamType
typestring
 

ResponseAssert.AnyResponseAssert#genericTemplate(itemCount)

Checks for generic template

Kind: static method of ResponseAssert

ParamTypeDefaultDescription
itemCountnumberspecified item count
 

ResponseAssert.AnyResponseAssert#buttonTemplate(search, buttonCount)

Checks for button template

Kind: static method of ResponseAssert

ParamTypeDefaultDescription
searchstring
buttonCountnumberspecified button count
 

ResponseAssert.AnyResponseAssert#passThread([appId]) ⇒ this

Checks pass thread control

Kind: static method of ResponseAssert

ParamTypeDefault
[appId]stringnull
 

ResponseAssert.AnyResponseAssert#attachmentType(type) ⇒ this

Checks attachment type

Kind: static method of ResponseAssert

ParamType
typestring
 

AnyResponseAssert

Kind: global class

 

new AnyResponseAssert()

Utility for searching among responses

 

ConversationTester

Automated Conversation tests runner

Kind: global class

 

new ConversationTester(testsSource, botFactory, [options])

ParamTypeDescription
testsSourceTestSource | Object.<string, TestSource>single source or localized list
botFactoryfunction
[options]object
[options.disableAssertActions]boolean
[options.disableAssertTexts]boolean
[options.disableAssertQuickReplies]boolean
[options.useConversationForTextTestCases]boolean
[options.textThreshold]number
[options.stepCasesPerStep]number
[options.textCasesPerStep]number
[options.textCaseParallel]number
[options.allowEmptyResponse]boolean
[options.log]Logger
[options.testerFactory]testerFactory
 

conversationTester._getTestCases(lang) ⇒ Promise.<TestsDefinition>

Kind: instance method of ConversationTester

ParamType
langstring
 

conversationTester.test(validationRequestBody, [step], [lang], [snapshot]) ⇒ Promise.<TestsOutput>

Runs the conversation test

Kind: instance method of ConversationTester

ParamTypeDefault
validationRequestBodyobject
[step]number
[lang]stringnull
[snapshot]stringnull
 

conversationTester._getLists(testCases) ⇒ Array.<List>

Kind: instance method of ConversationTester

 

conversationTester._getListCases(testCases) ⇒ Map.<string, (Array.<TestCase>|Array.<TextCase>)>

Kind: instance method of ConversationTester

 

conversationTester._getPagingForStepCases(testCases, lim)

Kind: instance method of ConversationTester

ParamType
testCasesArray.<TestCase>
limnumber
 

conversationTester._getGroups(testCases) ⇒ Array.<TestsGroup>

Kind: instance method of ConversationTester

ParamType
testCases*
 

conversationTester._getTestsGroups(testsGroups, step)

Kind: instance method of ConversationTester

ParamType
testsGroupsArray.<TestsGroup>
stepnumber
 

conversationTester._createTester(testsGroup, [botconfig], [lang], [snapshot]) ⇒ Promise.<Tester>

Kind: instance method of ConversationTester

ParamTypeDefault
testsGroupTestsGroup
[botconfig]object
[lang]stringnull
[snapshot]stringnull
 

conversationTester._runTextCaseTests(testsGroup, botconfig, [lang], [snapshot])

Kind: instance method of ConversationTester

ParamTypeDefault
testsGroupTestsGroup
botconfigobject
[lang]stringnull
[snapshot]stringnull
 

conversationTester._runStepCaseTests(testsGroup, botconfig, [lang], [snapshot])

Kind: instance method of ConversationTester

ParamTypeDefault
testsGroupTestsGroup
botconfigobject
[lang]stringnull
[snapshot]stringnull
 

conversationTester.executeTextCase(testsGroup, t, textCase, botconfig, longestText, [lang], [snapshot])

Kind: instance method of ConversationTester

ParamTypeDefault
testsGroupTestsGroup
tTester
textCaseTextTest
botconfig*
longestTextnumber
[lang]stringnull
[snapshot]stringnull
 

conversationTester.executeStep(t, step)

Kind: instance method of ConversationTester

ParamType
tTester
stepTestCaseStep
 

TestSource : object

Kind: global typedef
Properties

NameType
getTestCasesfunction
 

TestCase : object

Kind: global typedef
Properties

NameType
liststring
namestring
stepsArray.<TestCaseStep>
 

TextCase : object

Kind: global typedef
Properties

NameType
liststring
namestring
textsArray.<TextTest>
 

TextTest : object

Kind: global typedef
Properties

NameType
appIdstring
textstring
actionstring
intentstring
[rowNum]number
 

TestCaseStep : object

Kind: global typedef
Properties

NameType
stepnumber
rowNumnumber
actionstring
passedActionstring
textContainsstring
quickRepliesContainsstring
stepDescriptionstring
 

TestsGroup : object

Kind: global typedef
Properties

NameType
listIdnumber
liststring
typestring
testCasesArray.<TestCase> | Array.<TextTest>
 

List : object

Kind: global typedef
Properties

NameType
idnumber
namestring
typestring
testCasesArray.<TestCase> | Array.<TextTest>
 

TestsDefinition : object

Kind: global typedef
Properties

NameType
listsArray.<List>
 

testerFactory ⇒ Tester

Callback for getting a tester

Kind: global typedef

ParamTypeDescription
botRouter | ReducerWrapper | BuildRouterthe chatbot itself
testTestsGroupthe chatbot itself
 

TestsOutput : object

Kind: global typedef
Properties

NameType
totalnumber
passednumber
failednumber
skippednumber
outputstring
summaryOutputstring
stepnumber
stepCountnumber
 

Logger : object

Kind: global typedef
Properties

NameType
logfunction
errorfunction