codeforequity-at / botium-core

The Selenium for Chatbots - Bots Testing Bots
https://www.botium.ai
MIT License
229 stars 64 forks source link

Using DialogFlow facebook responses, not default responses for testing #118

Closed madtaras closed 6 years ago

madtaras commented 6 years ago

Hi!

I used this article to set up tests https://chatbotsmagazine.com/3-steps-setup-automated-testing-for-google-assistant-and-dialogflow-de42937e57c6

Most of the tests fail because of Botium is waiting for DialogFlow default answers, not facebook answers. How can I configure Botium to use facebook answers?

screen shot 2018-10-02 at 4 31 35 pm screen shot 2018-10-02 at 4 31 42 pm
codeforequity-at commented 6 years ago

The dialogflow connector currently doesn't support this. But I agree that this is more than useful. I am tracking this topic, hopefully we will be able to provide a solution soon.

madtaras commented 6 years ago

@codeforequity-at do you have any ETA for this? Can I implement it on my own and pull request?

codeforequity-at commented 6 years ago

I would be more than happy to see a pull request with this feature. It actually shouldn't be so hard to do - just fork the botium-connector-dialogflow repository and start a pull request when you have something working for you.

madtaras commented 6 years ago

@codeforequity-at cool! I checked out the connector code. Looks like know what to do. Could you please help me? I can't find the place where to choose facebook response in dialogflow API https://github.com/googleapis/nodejs?

codeforequity-at commented 6 years ago

So, the changes should be somewhere in this file: https://github.com/codeforequity-at/botium-connector-dialogflow/blob/master/index.js

Line 100 and following.

The documentation in the Dialogflow API is here: https://dialogflow.com/docs/reference/api-v2/rpc/google.cloud.dialogflow.v2#google.cloud.dialogflow.v2.QueryResult

codeforequity-at commented 6 years ago

The latest build includes this feature. The new capability is named "DIALOGFLOW_OUTPUT_PLATFORM", set it to "FACEBOOK"

madtaras commented 6 years ago

@codeforequity-at thanks! I'm getting undefined on

  .UserSaysText('hi')
  .WaitBotSaysText(console.log)
  .WaitBotSays(console.log)

buy console.log(response.queryResult.fulfillmentMessages) in connector code returns

[ { platform: 'FACEBOOK',
    card: 
     { buttons: [Array],
       title: '',
       subtitle: ',
       imageUri: '' },
    message: 'card' },
  { platform: 'PLATFORM_UNSPECIFIED',
    text: { text: [Array] },
    message: 'text' } ]

(I deleted the values from object). Will try to fix this

madtaras commented 6 years ago

@codeforequity-at any ideas on why this happens?

madtaras commented 6 years ago

My mistake. Forgot to update dependencies. Everything works fine now. Thanks a lot! Can we close this issue? @codeforequity-at

codeforequity-at commented 6 years ago

Hi, we are working hard to not only support text messages, but also the rich messages and custom payload. So the cards you are obviously using can now be asserted in Botium scripts with some simple tags in the convo files.