codeforequity-at / botium-core

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

Problem with structured message( FB) #132

Closed lovecode1001 closed 5 years ago

lovecode1001 commented 5 years ago

I'm using botium-connector-webdriverio to test my bot. I try to catch these buttons from bot response. But get ERROR: Error: Simple Test/Line 7: bot response "[object Object]" missing expected property: sender at _.forOwn . Here is my botium.json: { "botium": { "Capabilities": { "PROJECTNAME": "WebdriverIO Plugin Sample", "CONTAINERMODE": "webdriverio", "CLEANUPTEMPDIR":false, "WEBDRIVERIO_OPTIONS": { "desiredCapabilities": { "__browserName": "phantomjs", "browserName": "chrome", "__browserName": "edge", "__browserName": "firefox", "moz:firefoxOptions": { "binary": "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe" }, "chromeOptions": { "args": [ "--headless", "--disable-gpu" ] } } }, "WEBDRIVERIO_USERNAME": "user", "WEBDRIVERIO_PASSWORD": "password", "WEBDRIVERIO_PROFILE": "messenger_com", "WEBDRIVERIO_VIEWPORT_SIZE": { "width": 1024, "height": 768 } }, "Envs": { "export DEBUG": "botium" } } }

My convo file:

Simple Test

#me
hello

#bot
{
    "sender": "bot",
    "buttons": [],
    "cards": [
      {
        "buttons": [
          {
            "text": "Recruitment"
          },
          {
            "text": "About Us"
          },
          {
            "text": "Sales"
          }
        ]
      }
    ],
    "messageText": "Hi Cường, what can I help you with?\nAbout Us\nRecruitment\nSales",
    "channel": "default"
  }

Debug log: debug log.txt

Anything wrong with my convo file?

codeforequity-at commented 5 years ago

I can see that you are already trying to use the new Botium features making it possible to verify buttons and media attachments :-)

It's currently not documentated (will come in the next days) - in your case, the convo file should look like this:

Simple Test

#me
hello

#bot
Hi Cường, what can I help you with?
BUTTONS Recruitment|About Us|Sales

"BUTTONS" is a special tag inside the convo file to check for buttons in the bot response.

lovecode1001 commented 5 years ago

@codeforequity-at thank you very much. It works nicely. Waiting for the full document.

lovecode1001 commented 5 years ago

@codeforequity-at , Can you give me the other tags? It'll help me a lot.

codeforequity-at commented 5 years ago

there is one more named MEDIA which will check if images are available, another one named LINK will check for hyperlinks and their availability (to make sure no dead links are used), but it is experimental right now.

lovecode1001 commented 5 years ago

Thank you for sharing.