codeforequity-at / botium-core

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

Generic HTTP(S)/JSON Connector: Enable empty string as SIMPLEREST_INIT_TEXT #466

Closed omoravskyi closed 4 years ago

omoravskyi commented 4 years ago

We are using Generic HTTP(S)/JSON Connector to connect to custom endpoint. The problem is that our bot requires an empty message for initialization. This is essential to properly start conversation.

Possible solution This is relatively easy to fix. Additional condition can be added to check if SIMPLEREST_INIT_TEXT is an empty string. Here is the block of code with applied suggestion: if (this.caps[Capabilities.SIMPLEREST_INIT_TEXT] || this.caps[Capabilities.SIMPLEREST_INIT_TEXT] === "") It solved the problem for me. And in case SIMPLEREST_INIT_TEXT property is not present at botium.json configuration file at all - the condition won't evaluate and everything remains the same.

Could you add this modification to SimpleRestContainer.js?

Drawback This would probably require some modification for Botium Box, so that Initial conversation text field could tell the difference between an empty text and null (maybe additional checkBox).

omoravskyi commented 4 years ago

Thanks, the issue does not reproduce after new release of botium-core v.1.8.2.