lundi 27 avril 2020

Botium Card Button Click

Would like to know if there is anyway to perform a card button click use the Botium framework - https://github.com/codeforequity-at/botium-core.

For example i have a bot that returns a carousel of cards, each card has a load of buttons attached to it, i want to be able to trigger a click of that button within the conversation spec.

Here is example processed response being given back to Botium framework:

  "cards":[
  {
     "text":"Card 1",
     "buttons":[
        {
           "text":"Learn more",
           "payload":"a custom payload"
        },
        {
           "text":"Other button",
           "payload":"a custom other payload"
        }
     ]
  },
  {
     "text":"Card 2",
     "buttons":[
        {
           "text":"More Stuff,
           "payload":"a custom payload for card 2"
        }
     ]
  }
 ]

And below is example of the spec test file.

#me
Hello

#bot
CARDS Card 1 | Card 2
BUTTONS Learn More | Other button | More Stuff

#me
BUTTON Learn More

My expectation from this test above is that when the #me user send BUTTON click for 'Learn More' it will take the payload from the button attached to 'Card 1' with the title 'Learn More' and send that to the bot over api.

So in this case it would send: {"text":"Learn more", "payload":"a custom payload"}

Is this possible ?

Also i understand that i could just specify the payload like so within the spec file

#me
BUTTON Learn More|a custom payload

But i don't want to do this as it's not fully testing the bot, i want to be sure that my bot payloads are configured correctly and not supply the payloads as that would defeat the purpose of the test entirely.

Aucun commentaire:

Enregistrer un commentaire