Unknown
Unknown

Reputation: 2137

Botium with custom payload - DefaultWelcome: bot says undefined

I was trying test my application using botium. I have Generated the convo files by using botium-cli import dialogflow-conversations

I have DefaultWelcome intent which has below payload

{
  "cutomPayload": {
    "card": {
      "description": "Hey there! I’m a bot that can help you troubleshoot issues with UPS. Please enter the model number"
    }
  }
}

and Training phases as below

just going to say hi
heya
hello hi
howdy
hey there
hi there
greetings
hey
long time no see
hello
lovely day isn't it
I greet you
hello again
hi
hello there
a good day

In my convo folder I have DefaultWelcome.convo.txt and DefaultWelcome_input.utterances.txt

DefaultWelcome.convo.txt has

DefaultWelcome

#me
DefaultWelcome_input

#bot
!INCOMPREHENSION

DefaultWelcome_input.utterances.txt has

DefaultWelcome_input
just going to say hi
heya
hello hi
howdy
hey there
hi there
greetings
hey
long time no see
hello
lovely day isn't it
I greet you
hello again
hi
hello there
a good day

I tried to run the

const BotDriver = require('botium-core').BotDriver;

const driver = new BotDriver();

driver.BuildFluent()
  .ReadScripts('convos')
  .Start()
  .RunScripts()
  .Exec().then(() => {
    console.log('READY')
  })
  .catch((err) => {
    console.log('ERROR: ', err)
  });

But unfortunately I got the below output

botium-connector-dialogflow Start called +256ms
  botium-ScriptingProvider Using utterances expansion mode: all +172ms
  botium-Convo DefaultWelcome/Line 6: user says ConvoStep {
  botium-Convo   sender: 'me',
  botium-Convo   channel: null,
  botium-Convo   messageText: 'just going to say hi',
  botium-Convo   sourceData: undefined,
  botium-Convo   stepTag: 'Line 6',
  botium-Convo   not: false } +0ms
  botium-connector-dialogflow UserSays called +175ms
  botium-connector-dialogflow dialogflow request: {
  botium-connector-dialogflow   "session": "projects/joules-test/agent/sessions/defee8a0-4b08-11e9-93e7-fd1394066413",
  botium-connector-dialogflow   "queryInput": {
  botium-connector-dialogflow     "text": {
  botium-connector-dialogflow       "text": "just going to say hi",
  botium-connector-dialogflow       "languageCode": "en-US"
  botium-connector-dialogflow     }
  botium-connector-dialogflow   },
  botium-connector-dialogflow   "queryParams": null
  botium-connector-dialogflow } +0ms
  botium-connector-dialogflow dialogflow response: {
  botium-connector-dialogflow   "responseId": "27545943-441c-487f-9f45-2cd32e833ace",
  botium-connector-dialogflow   "queryResult": {
  botium-connector-dialogflow     "fulfillmentMessages": [
  botium-connector-dialogflow       {
  botium-connector-dialogflow         "platform": "PLATFORM_UNSPECIFIED",
  botium-connector-dialogflow         "payload": {
  botium-connector-dialogflow           "fields": {
  botium-connector-dialogflow             "cutomPayload": {
  botium-connector-dialogflow               "structValue": {
  botium-connector-dialogflow                 "fields": {
  botium-connector-dialogflow                   "card": {
  botium-connector-dialogflow                     "structValue": {
  botium-connector-dialogflow                       "fields": {
  botium-connector-dialogflow                         "description": {
  botium-connector-dialogflow                           "stringValue": "Hey there! I’m a bot that can help you troubleshoot issues with Back-UPS. Please enter your model number",
  botium-connector-dialogflow                           "kind": "stringValue"
  botium-connector-dialogflow                         }
  botium-connector-dialogflow                       }
  botium-connector-dialogflow                     },
  botium-connector-dialogflow                     "kind": "structValue"
  botium-connector-dialogflow                   }
  botium-connector-dialogflow                 }
  botium-connector-dialogflow               },
  botium-connector-dialogflow               "kind": "structValue"
  botium-connector-dialogflow             }
  botium-connector-dialogflow           }
  botium-connector-dialogflow         },
  botium-connector-dialogflow         "message": "payload"
  botium-connector-dialogflow       }

  botium-Convo DefaultWelcome wait for bot null +3s
  botium-BaseContainer WaitBotSays error Error: Queue.pop timeout after 60000
  botium-BaseContainer     at timeoutRequest (/Users/madhavam/joules-botium/node_modules/botium-core/src/helpers/Queue.js:46:18)
  botium-BaseContainer     at Timeout.timeoutCallback [as _onTimeout] (/Users/madhavam/joules-botium/node_modules/async/dist/async.js:4936:13)
  botium-BaseContainer     at ontimeout (timers.js:427:11)
  botium-BaseContainer     at tryOnTimeout (timers.js:289:5)
  botium-BaseContainer     at listOnTimeout (timers.js:252:5)
  botium-BaseContainer     at Timer.processTimers (timers.js:212:10) +0ms
  botium-Convo DefaultWelcome: bot says undefined +1m
ERROR:  Error: DefaultWelcome/Line 8: bot says nothing
    at Object.fail (/Users/mma/joules-botium/node_modules/botium-core/src/scripting/ScriptingProvider.js:50:15)
    at container.WaitBotSays.then (/Users/madhavam/joules-botium/node_modules/botium-core/src/scripting/Convo.js:64:49)

So how to solve this issue? Is there anyway I can able to handle the specific response in the intent?

Upvotes: 1

Views: 388

Answers (1)

Florian Treml
Florian Treml

Reputation: 1315

It is one of the current restrictions of the Botium Dialogflow Connector that custom payload is not supported, see: https://github.com/codeforequity-at/botium-connector-dialogflow#open-issues-and-restrictions

When using Botium CLI, you don't need to write any Botium code - you can run your test cases with the cli:

> botium-cli run --convos ./convos

UPDATE

You can set the capabilitiy _DIALOGFLOW_FORCE_INTENT_RESOLUTION_ to true, to even deliver a response to Botium if the connector didn't recognize any known content. You are one stop further then.

For actually asserting the response, you could use the integrated JSON structure matching, but due to the nature of Dialogflow custom payload structures, your convo files will get pretty cluttered then.

Your convo file should look like this

DefaultWelcome

#me
DefaultWelcome_input

#bot
{  
   "fulfillmentMessages":[  
      {  
         "platform":"PLATFORM_UNSPECIFIED",
         "payload":{  
            "fields":{  
               "cutomPayload":{  
                  "structValue":{  
                     "fields":{  
                        "card":{  
                           "structValue":{  
                              "fields":{  
                                 "description":{  
                                    "stringValue":"Hey there! I’m a bot that can help you troubleshoot issues with Back-UPS. Please enter your model number",
                                 }
                              }
                           },
                        }
                     }
                  },
               }
            }
         },
      }
   ]
}

Upvotes: 1

Related Questions