Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with SimpleREST ContainerMode #162

Closed
sgolodychenko opened this issue Dec 18, 2018 · 18 comments
Closed

Problem with SimpleREST ContainerMode #162

sgolodychenko opened this issue Dec 18, 2018 · 18 comments
Labels

Comments

@sgolodychenko
Copy link

We are trying to test with botium our custom API to Watson chatbot.
For this we have used SIMPLEREST container mode.
botium.json
` "botium": {
"Capabilities": {
"PROJECTNAME": "Chatbot",
"CONTAINERMODE": "simplerest",

    "SIMPLEREST_INIT_TEXT": "hi",
    "SIMPLEREST_URL": "http://custom_url/ChatbotApi/Ask",
    "SIMPLEREST_METHOD": "POST",
    "SIMPLEREST_HEADERS_TEMPLATE": "{ \"Content-Type\": \"application/json\"}",
    
    "SIMPLEREST_RESPONSE_JSONPATH": "$.answer.*",
    "SIMPLEREST_BODY_TEMPLATE": "{\"question\":\"{{msg.messageText}}\"}",

    "SCRIPTING_FORMAT": "xlsx",
    "SCRIPTING_XLSX_STARTROW": 2,
    "SCRIPTING_XLSX_STARTCOL": 1,
    "SCRIPTING_XLSX_SHEETNAMES": "dialogs",
    "SCRIPTING_XLSX_SHEETNAMES_UTTERANCES": "DATA",
    "SCRIPTING_ENABLE_MEMORY": true
  }
}

}`
Receiving an error:
image

As a solution we add code to SimpleRestContainer.js
Instead of code begin from line # 165

if (body) {
	if (this.caps[Capabilities.SIMPLEREST_CONTEXT_JSONPATH]) {
		const contextNodes = jp.query(body, this.caps[Capabilities.SIMPLEREST_CONTEXT_JSONPATH])

We began to use :

         if (body) {
            if (this.caps[Capabilities.SIMPLEREST_CONTEXT_JSONPATH]) {
               var body_parse = JSON.stringify(eval("(" + body + ")"))
               body = JSON.parse(body_parse);
               const contextNodes = jp.query(body, this.caps[Capabilities.SIMPLEREST_CONTEXT_JSONPATH])

With this fix testing works for us.

Is this is an issue? or Should we use Simplerest in other way?
How we could handle serialization of body?

@codeforequity-at
Copy link
Owner

I think you are doing nothing wrong.
I am surprised that the code you mentioned is reached, because obviously the capability "SIMPLEREST_CONTEXT_JSONPATH" is empty ?
But the root of the problem seems to be, that the response from your HTTP service is not handled as JSON content by Botium - is it possible that the service is not returning a proper content type header ? Usually, the JSON parsing is done automatically.

@sgolodychenko
Copy link
Author

"SIMPLEREST_CONTEXT_JSONPATH": "$.context"
..during debug steps has removed line :)
Response from API is:
image

@codeforequity-at
Copy link
Owner

codeforequity-at commented Dec 18, 2018

OK, everything looks correct, so most likely a bug in Botium.
Can you run in debug mode ("export DEBUG=botium*") and attach the log output here (remove secrets please), I will try to find a generic solution (or just pull in your code changes from above).

@sgolodychenko
Copy link
Author

Where i have to put debug settings? Using to run:
botium-cli run tap -C tests/test --config botium.rest.json

@codeforequity-at
Copy link
Owner

just use "--verbose" command line switch

@sgolodychenko
Copy link
Author

`2018-12-19T09:16:10.225Z botium-cli Using Botium configuration file botium.rest.json
2018-12-19T09:16:10.228Z botium-cli-run command options: { _: [ 'run' ],
help: false,
h: false,
version: false,
V: false,
C: [ 'tests/test' ],
convos: [ 'tests/test' ],
config: 'botium.rest.json',
c: 'botium.rest.json',
verbose: true,
v: true,
output: 'tap',
testsuitename: 'Botium Test-Suite',
n: 'Botium Test-Suite',
expandutterances: false,
timeout: 60,
'$0':
'C:\Users\\AppData\Roaming\npm\node_modules\botium-cli\bin\botium-cli.js',
filter: undefined,
'reporter-options': undefined }
2018-12-19T09:16:10.228Z botium-cli-run Mocha Reporter "tap", options: undefined
2018-12-19T09:16:10.229Z botium-BotDriver Loaded Botium configuration file ./botium.json
2018-12-19T09:16:10.229Z botium-BotDriver Loaded Botium configuration file botium.rest.json
2018-12-19T09:16:10.229Z botium-BotDriver Changed capability : CONFIG to : botium.rest.json using environment variables.
2018-12-19T09:16:10.229Z botium-BotDriver BuildCompiler: Capabilites: { PROJECTNAME: 'Chatbot',
TEMPDIR: 'botiumwork',
CLEANUPTEMPDIR: true,
WAITFORBOTTIMEOUT: 10000,
SIMULATE_WRITING_SPEED: false,
DOCKERCOMPOSEPATH: 'docker-compose',
DOCKERMACHINEPATH: 'docker-machine',
DOCKERMACHINE: false,
DOCKERIMAGE: 'node:boron',
DOCKERUNIQUECONTAINERNAMES: false,
DOCKERSYSLOGPORT_RANGE: '47100-47299',
BOT_HEALTH_STATUS: 200,
SLACK_PUBLISHPORT_RANGE: '46100-46299',
FACEBOOK_PUBLISHPORT_RANGE: '46300-46499',
FACEBOOK_SEND_DELIVERY_CONFIRMATION: true,
BOTFRAMEWORK_PUBLISHPORT_RANGE: '46500-46699',
BOTFRAMEWORK_WEBHOOK_PORT: 3978,
BOTFRAMEWORK_WEBHOOK_PATH: 'api/messages',
BOTFRAMEWORK_CHANNEL_ID: 'facebook',
SIMPLEREST_METHOD: 'POST',
WEBSPEECH_SERVER_PORT: 46050,
WEBSPEECH_LANGUAGE: 'en-US',
WEBSPEECH_CLOSEBROWSER: true,
SCRIPTING_TXT_EOL: '\n',
SCRIPTING_XLSX_STARTROW: 2,
SCRIPTING_XLSX_STARTCOL: 1,
SCRIPTING_NORMALIZE_TEXT: true,
SCRIPTING_ENABLE_MEMORY: true,
SCRIPTING_MATCHING_MODE: 'includeLowerCase',
SCRIPTING_UTTEXPANSION_MODE: 'all',
SCRIPTING_UTTEXPANSION_RANDOM_COUNT: 1,
SCRIPTING_UTTEXPANSION_INCOMPREHENSION: 'INCOMPREHENSION',
ASSERTERS: [],
CONTAINERMODE: 'simplerest',
WATSON_USER: '',
WATSON_PASSWORD: '',
WATSON_WORKSPACE_ID: '',
WATSON_USE_INTENT: true,
SCRIPTING_FORMAT: 'xlsx',
SCRIPTING_XLSX_SHEETNAMES: 'general_flow',
SIMPLEREST_INIT_TEXT: 'hi',
SIMPLEREST_URL: 'http://localhost:58812/api/ChatbotApi/Ask',
SIMPLEREST_HEADERS_TEMPLATE:
'{ "Content-Type": "application/json", "Referer": "http://localhost:58812/en" }',
SIMPLEREST_RESPONSE_JSONPATH: '$.answer.0',
SIMPLEREST_CONTEXT_JSONPATH: '$.context',
SIMPLEREST_BODY_TEMPLATE:
'{ "context": { {{#context.conversation_id}} "conversation_id": "{{context.conversation_id}}", {{/ context.conversation_id}} "system": { "initialized": "{{context.system.initialized}}", "dialog_stack": [ {{#context.system.dialog_stack}} { {{#dialog_node}} "dialog_node": "{{.}}" {{/dialog_node}} {{#state}}, "state": "{{.}}" {{/state}} } {{/context.system.dialog_stack}} ], "dialog_request_counter": "{{context.system.dialog_request_counter}}", "dialog_turn_counter" : "{{context.system.dialog_turn_counter}}" },"counter_repeats": "{{context.counter_repeats}}", "counter_repeats_max": "{{context.counter_repeats_max}}" {{#context.product}}, "product": "{{context.product}}"{{/ context.product}} {{# context.product_type}}, "product_type": "{{context.product_type}}" {{/ context.product_type}} {{#context.code}}, "code": "{{context.code}}" {{/ context.code}}, "next_dialog": "{{context.next_dialog}}" }, "question":"{{msg.messageText}}" }',
SCRIPTING_XLSX_SHEETNAMES_UTTERANCES: 'DATA',
CONFIG: 'botium.rest.json' }
2018-12-19T09:16:10.416Z botium-ScriptingProvider Using matching mode: includeLowerCase
2018-12-19T09:16:10.417Z botium-asserterUtils Loaded Default asserter - { BUTTONS:
ButtonsAsserter {
context:
{ AddConvos: [Function: bound AddConvos],
AddUtterances: [Function: bound AddUtterances],
Match: [Function: bound Match],
IsAsserterValid: [Function: bound IsAsserterValid],
scriptingEvents: [Object] },
caps:
{ PROJECTNAME: 'Chatbot',
TEMPDIR: 'botiumwork',
CLEANUPTEMPDIR: true,
WAITFORBOTTIMEOUT: 10000,
SIMULATE_WRITING_SPEED: false,
DOCKERCOMPOSEPATH: 'docker-compose',
DOCKERMACHINEPATH: 'docker-machine',
DOCKERMACHINE: false,
DOCKERIMAGE: 'node:boron',
DOCKERUNIQUECONTAINERNAMES: false,
DOCKERSYSLOGPORT_RANGE: '47100-47299',
BOT_HEALTH_STATUS: 200,
SLACK_PUBLISHPORT_RANGE: '46100-46299',
FACEBOOK_PUBLISHPORT_RANGE: '46300-46499',
FACEBOOK_SEND_DELIVERY_CONFIRMATION: true,
BOTFRAMEWORK_PUBLISHPORT_RANGE: '46500-46699',
BOTFRAMEWORK_WEBHOOK_PORT: 3978,
BOTFRAMEWORK_WEBHOOK_PATH: 'api/messages',
BOTFRAMEWORK_CHANNEL_ID: 'facebook',
SIMPLEREST_METHOD: 'POST',
WEBSPEECH_SERVER_PORT: 46050,
WEBSPEECH_LANGUAGE: 'en-US',
WEBSPEECH_CLOSEBROWSER: true,
SCRIPTING_TXT_EOL: '\n',
SCRIPTING_XLSX_STARTROW: 2,
SCRIPTING_XLSX_STARTCOL: 1,
SCRIPTING_NORMALIZE_TEXT: true,
SCRIPTING_ENABLE_MEMORY: true,
SCRIPTING_MATCHING_MODE: 'includeLowerCase',
SCRIPTING_UTTEXPANSION_MODE: 'all',
SCRIPTING_UTTEXPANSION_RANDOM_COUNT: 1,
SCRIPTING_UTTEXPANSION_INCOMPREHENSION: 'INCOMPREHENSION',
ASSERTERS: [],
CONTAINERMODE: 'simplerest',
WATSON_USER: '',
WATSON_PASSWORD: '',
WATSON_WORKSPACE_ID: '',
WATSON_USE_INTENT: true,
SCRIPTING_FORMAT: 'xlsx',
SCRIPTING_XLSX_SHEETNAMES: 'general_flow',
SIMPLEREST_INIT_TEXT: 'hi',
SIMPLEREST_URL: 'http://localhost:58812/api/ChatbotApi/Ask',
SIMPLEREST_HEADERS_TEMPLATE:
'{ "Content-Type": "application/json", "Referer": "http://localhost:58812/en" }',
SIMPLEREST_RESPONSE_JSONPATH: '$.answer.0',
SIMPLEREST_CONTEXT_JSONPATH: '$.context',
SIMPLEREST_BODY_TEMPLATE:
'{ "context": { {{#context.conversation_id}} "conversation_id": "{{context.conversation_id}}", {{/ context.conversation_id}} "system": { "initialized": "{{context.system.initialized}}", "dialog_stack": [ {{#context.system.dialog_stack}} { {{#dialog_node}} "dialog_node": "{{.}}" {{/dialog_node}} {{#state}}, "state": "{{.}}" {{/state}} } {{/context.system.dialog_stack}} ], "dialog_request_counter": "{{context.system.dialog_request_counter}}", "dialog_turn_counter" : "{{context.system.dialog_turn_counter}}" },"counter_repeats": "{{context.counter_repeats}}", "counter_repeats_max": "{{context.counter_repeats_max}}" {{#context.product}}, "product": "{{context.product}}"{{/ context.product}} {{# context.product_type}}, "product_type": "{{context.product_type}}" {{/ context.product_type}} {{#context.code}}, "code": "{{context.code}}" {{/ context.code}}, "next_dialog": "{{context.next_dialog}}" }, "question":"{{msg.messageText}}" }',
SCRIPTING_XLSX_SHEETNAMES_UTTERANCES: 'DATA',
CONFIG: 'botium.rest.json' } },
MEDIA:
MediaAsserter {
context:
{ AddConvos: [Function: bound AddConvos],
AddUtterances: [Function: bound AddUtterances],
Match: [Function: bound Match],
IsAsserterValid: [Function: bound IsAsserterValid],
scriptingEvents: [Object] },
caps:
{ PROJECTNAME: 'Chatbot',
TEMPDIR: 'botiumwork',
CLEANUPTEMPDIR: true,
WAITFORBOTTIMEOUT: 10000,
SIMULATE_WRITING_SPEED: false,
DOCKERCOMPOSEPATH: 'docker-compose',
DOCKERMACHINEPATH: 'docker-machine',
DOCKERMACHINE: false,
DOCKERIMAGE: 'node:boron',
DOCKERUNIQUECONTAINERNAMES: false,
DOCKERSYSLOGPORT_RANGE: '47100-47299',
BOT_HEALTH_STATUS: 200,
SLACK_PUBLISHPORT_RANGE: '46100-46299',
FACEBOOK_PUBLISHPORT_RANGE: '46300-46499',
FACEBOOK_SEND_DELIVERY_CONFIRMATION: true,
BOTFRAMEWORK_PUBLISHPORT_RANGE: '46500-46699',
BOTFRAMEWORK_WEBHOOK_PORT: 3978,
BOTFRAMEWORK_WEBHOOK_PATH: 'api/messages',
BOTFRAMEWORK_CHANNEL_ID: 'facebook',
SIMPLEREST_METHOD: 'POST',
WEBSPEECH_SERVER_PORT: 46050,
WEBSPEECH_LANGUAGE: 'en-US',
WEBSPEECH_CLOSEBROWSER: true,
SCRIPTING_TXT_EOL: '\n',
SCRIPTING_XLSX_STARTROW: 2,
SCRIPTING_XLSX_STARTCOL: 1,
SCRIPTING_NORMALIZE_TEXT: true,
SCRIPTING_ENABLE_MEMORY: true,
SCRIPTING_MATCHING_MODE: 'includeLowerCase',
SCRIPTING_UTTEXPANSION_MODE: 'all',
SCRIPTING_UTTEXPANSION_RANDOM_COUNT: 1,
SCRIPTING_UTTEXPANSION_INCOMPREHENSION: 'INCOMPREHENSION',
ASSERTERS: [],
CONTAINERMODE: 'simplerest',
WATSON_USER: '',
WATSON_PASSWORD: '',
WATSON_WORKSPACE_ID: '',
WATSON_USE_INTENT: true,
SCRIPTING_FORMAT: 'xlsx',
SCRIPTING_XLSX_SHEETNAMES: 'general_flow',
SIMPLEREST_INIT_TEXT: 'hi',
SIMPLEREST_URL: 'http://localhost:58812/api/ChatbotApi/Ask',
SIMPLEREST_HEADERS_TEMPLATE:
'{ "Content-Type": "application/json", "Referer": "http://localhost:58812/en" }',
SIMPLEREST_RESPONSE_JSONPATH: '$.answer.0',
SIMPLEREST_CONTEXT_JSONPATH: '$.context',
SIMPLEREST_BODY_TEMPLATE:
'{ "context": { {{#context.conversation_id}} "conversation_id": "{{context.conversation_id}}", {{/ context.conversation_id}} "system": { "initialized": "{{context.system.initialized}}", "dialog_stack": [ {{#context.system.dialog_stack}} { {{#dialog_node}} "dialog_node": "{{.}}" {{/dialog_node}} {{#state}}, "state": "{{.}}" {{/state}} } {{/context.system.dialog_stack}} ], "dialog_request_counter": "{{context.system.dialog_request_counter}}", "dialog_turn_counter" : "{{context.system.dialog_turn_counter}}" },"counter_repeats": "{{context.counter_repeats}}", "counter_repeats_max": "{{context.counter_repeats_max}}" {{#context.product}}, "product": "{{context.product}}"{{/ context.product}} {{# context.product_type}}, "product_type": "{{context.product_type}}" {{/ context.product_type}} {{#context.code}}, "code": "{{context.code}}" {{/ context.code}}, "next_dialog": "{{context.next_dialog}}" }, "question":"{{msg.messageText}}" }',
SCRIPTING_XLSX_SHEETNAMES_UTTERANCES: 'DATA',
CONFIG: 'botium.rest.json' } } }
2018-12-19T09:16:10.422Z botium-ScriptingProvider ReadConvosFromDirectory(tests/test) found filenames: ~$hotline.xlsx,hotline.xlsx
2018-12-19T09:16:10.423Z botium-CompilerXlsx sheet names for SCRIPTING_TYPE_UTTERANCES: [ 'DATA' ]
2018-12-19T09:16:10.424Z botium-CompilerXlsx sheet names for SCRIPTING_TYPE_CONVO: [ 'general_flow' ]
2018-12-19T09:16:10.450Z botium-CompilerXlsx sheet names for SCRIPTING_TYPE_UTTERANCES: [ 'DATA' ]
2018-12-19T09:16:10.450Z botium-CompilerXlsx evaluating sheet name for SCRIPTING_TYPE_UTTERANCES: 'DATA', rowindex 2, colindex 0
2018-12-19T09:16:10.460Z botium-CompilerXlsx sheet names for SCRIPTING_TYPE_CONVO: [ 'general_flow' ]
2018-12-19T09:16:10.460Z botium-CompilerXlsx evaluating sheet name for SCRIPTING_TYPE_CONVO: 'general_flow', rowindex 2, colindex 0
2018-12-19T09:16:10.462Z botium-ScriptingProvider ReadConvosFromDirectory(tests/test) found convos:
1 general_flow-B2 ({ filename: 'hotline.xlsx' }): Cell B2: #bot - User | Cell B3: #bot - hi
2018-12-19T09:16:10.462Z botium-ScriptingProvider ReadConvosFromDirectory(tests/test) found utterances:

2018-12-19T09:16:10.462Z botium-cli-run ready reading convos (1), expanding convos ...
2018-12-19T09:16:10.462Z botium-ScriptingProvider ExpandConvos - Using utterances expansion mode: all
2018-12-19T09:16:10.462Z botium-cli-run ready expanding convos and utterances, number of test cases: (1).
2018-12-19T09:16:10.463Z botium-cli-run adding test case general_flow-B2 (from: { filename: 'hotline.xlsx' })
2018-12-19T09:16:10.467Z botium-BotDriver Build - Capabilites: { PROJECTNAME: 'Chatbot',
TEMPDIR: 'botiumwork',
CLEANUPTEMPDIR: true,
WAITFORBOTTIMEOUT: 10000,
SIMULATE_WRITING_SPEED: false,
DOCKERCOMPOSEPATH: 'docker-compose',
DOCKERMACHINEPATH: 'docker-machine',
DOCKERMACHINE: false,
DOCKERIMAGE: 'node:boron',
DOCKERUNIQUECONTAINERNAMES: false,
DOCKERSYSLOGPORT_RANGE: '47100-47299',
BOT_HEALTH_STATUS: 200,
SLACK_PUBLISHPORT_RANGE: '46100-46299',
FACEBOOK_PUBLISHPORT_RANGE: '46300-46499',
FACEBOOK_SEND_DELIVERY_CONFIRMATION: true,
BOTFRAMEWORK_PUBLISHPORT_RANGE: '46500-46699',
BOTFRAMEWORK_WEBHOOK_PORT: 3978,
BOTFRAMEWORK_WEBHOOK_PATH: 'api/messages',
BOTFRAMEWORK_CHANNEL_ID: 'facebook',
SIMPLEREST_METHOD: 'POST',
WEBSPEECH_SERVER_PORT: 46050,
WEBSPEECH_LANGUAGE: 'en-US',
WEBSPEECH_CLOSEBROWSER: true,
SCRIPTING_TXT_EOL: '\n',
SCRIPTING_XLSX_STARTROW: 2,
SCRIPTING_XLSX_STARTCOL: 1,
SCRIPTING_NORMALIZE_TEXT: true,
SCRIPTING_ENABLE_MEMORY: true,
SCRIPTING_MATCHING_MODE: 'includeLowerCase',
SCRIPTING_UTTEXPANSION_MODE: 'all',
SCRIPTING_UTTEXPANSION_RANDOM_COUNT: 1,
SCRIPTING_UTTEXPANSION_INCOMPREHENSION: 'INCOMPREHENSION',
ASSERTERS: [],
CONTAINERMODE: 'simplerest',
WATSON_USER: '',
WATSON_PASSWORD: '',
WATSON_WORKSPACE_ID: '',
WATSON_USE_INTENT: true,
SCRIPTING_FORMAT: 'xlsx',
SCRIPTING_XLSX_SHEETNAMES: 'general_flow',
SIMPLEREST_INIT_TEXT: 'hi',
SIMPLEREST_URL: 'http://localhost:58812/api/ChatbotApi/Ask',
SIMPLEREST_HEADERS_TEMPLATE:
'{ "Content-Type": "application/json", "Referer": "http://localhost:58812/en" }',
SIMPLEREST_RESPONSE_JSONPATH: '$.answer.0',
SIMPLEREST_CONTEXT_JSONPATH: '$.context',
SIMPLEREST_BODY_TEMPLATE:
'{ "context": { {{#context.conversation_id}} "conversation_id": "{{context.conversation_id}}", {{/ context.conversation_id}} "system": { "initialized": "{{context.system.initialized}}", "dialog_stack": [ {{#context.system.dialog_stack}} { {{#dialog_node}} "dialog_node": "{{.}}" {{/dialog_node}} {{#state}}, "state": "{{.}}" {{/state}} } {{/context.system.dialog_stack}} ], "dialog_request_counter": "{{context.system.dialog_request_counter}}", "dialog_turn_counter" : "{{context.system.dialog_turn_counter}}" },"counter_repeats": "{{context.counter_repeats}}", "counter_repeats_max": "{{context.counter_repeats_max}}" {{#context.product}}, "product": "{{context.product}}"{{/ context.product}} {{# context.product_type}}, "product_type": "{{context.product_type}}" {{/ context.product_type}} {{#context.code}}, "code": "{{context.code}}" {{/ context.code}}, "next_dialog": "{{context.next_dialog}}" }, "question":"{{msg.messageText}}" }',
SCRIPTING_XLSX_SHEETNAMES_UTTERANCES: 'DATA',
CONFIG: 'botium.rest.json' }
2018-12-19T09:16:10.467Z botium-BotDriver Build - Sources : { LOCALPATH: '.',
GITPATH: 'git',
GITBRANCH: 'master',
GITDIR: '.' }
2018-12-19T09:16:10.467Z botium-BotDriver Build - Envs : { IS_BOTIUM_CONTAINER: true }
2018-12-19T09:16:10.507Z botium-SimpleRestContainer constructed requestOptions {
"uri": "http://localhost:58812/api/ChatbotApi/Ask",
"method": "POST",
"json": true,
"headers": {
"Content-Type": "application/json",
"Referer": "http://localhost:58812/en"
},
"body": {
"context": {
"system": {
"initialized": "",
"dialog_stack": [],
"dialog_request_counter": "",
"dialog_turn_counter": ""
},
"counter_repeats": "",
"counter_repeats_max": "",
"next_dialog": ""
},
"question": "hi"
}
}

1..1
not ok 1 Botium Test-Suite "before each" hook
AssertionError [ERR_ASSERTION]: obj needs to be an object
at JSONPath.query (C:\Users\AppData\Roaming\npm\node_modules\botium-cli\node_modules\jsonpath\lib\index.js:91:10)
at Request.request [as _callback] (C:\Users\AppData\Roaming\npm\node_modules\botium-cli\node_modules\botium-core\src\containers\SimpleRestContainer.js:187:38)
at Request.self.callback (C:\Users\AppData\Roaming\npm\node_modules\botium-cli\node_modules\request\request.js:185:22)
at Request. (C:\Users\AppData\Roaming\npm\node_modules\botium-cli\node_modules\request\request.js:1161:10)
at IncomingMessage. (C:\Users\AppData\Roaming\npm\node_modules\botium-cli\node_modules\request\request.js:1083:12)
at endReadableNT (_stream_readable.js:1094:12)

tests 1

pass 0

fail 1

2018-12-19T09:16:11.172Z botium-BaseContainer Cleanup rimrafing temp dir D:\botiumwork\Chatbot-20181219-111610-UxAbp
`

@codeforequity-at
Copy link
Owner

one more question - what version are you using ? (botium-cli --version)

@codeforequity-at
Copy link
Owner

nevermind, please take the latest botium-cli version, this should be fixed now.

@codeforequity-at
Copy link
Owner

Any Update here ?

@sgolodychenko
Copy link
Author

Hello, tried changes from
"botium-cli": "0.0.40",
"botium-core": "^1.4.2"

and received "TranscriptError: Error: general_flow-A7/Cell B8: bot says nothing"

But once replaced line in SimpleRestContainer.json (line 165)
var body_parse = JSON.stringify(eval("(" + body + ")"))
body = JSON.parse(body_parse)
than works fine :)

@sgolodychenko
Copy link
Author

@codeforequity-at , sorry for delayed response, does fix from previous message make sense? Could it be fixed in scope of this issue, or should I create new one?
Thank you for your time.

@codeforequity-at
Copy link
Owner

We recently applied a fix to botium-core which will make your code changes obsolete (in fact, it solved the same problem as your code, just without using the evil "eval" call.

@sgolodychenko
Copy link
Author

how can i track applied fix? how to know proper version?
Thank you.

@codeforequity-at
Copy link
Owner

The fix is here:

if (_.isString(body)) {

check in your locale node_modules/botium-core - or remove the whole directory (and package-lock.json) and install again.

@sgolodychenko
Copy link
Author

verified with version 1.4.3, still reproducible.
for some reason context is not properly parsed and putted to next request.
With fix, mentioned upper (just replaced line 165 with provided two lines) - works fine.

Hello, tried changes from
"botium-cli": "0.0.40",
"botium-core": "^1.4.2"

and received "TranscriptError: Error: general_flow-A7/Cell B8: bot says nothing"

But once replaced line in SimpleRestContainer.json (line 165)
var body_parse = JSON.stringify(eval("(" + body + ")"))
body = JSON.parse(body_parse)
than works fine :)

@codeforequity-at
Copy link
Owner

I cannot add the code you posted to Botium, because it is a huge huge huge security leak - it would basically allow your chatbot server to execute any Javascript code on your test automation server, and I am pretty sure you don't want that ...
Can you please post the verbose output here - there should be a statement "got response body" somewhere, and this is where things start to get interesting - because it should actually fail with a very explicit error message if anything goes wrong here ("No valid JSON response", "Body not an object", ...).

@Romanogor
Copy link

Please find attached last verbose log
output.log

I hope it will be helpful
Thanks

@codeforequity-at
Copy link
Owner

Thanks it is somehow helpful. There is nothing wrong with your configuration, the JSON content and the JSON path settings are correct, I validated everything in detail. This means that I currently now idea why in your environment the context is not correctly evaluated.

What I can offer: if you could publish your localhost chatbot with ngrok and send me over the endpoint, I can use a debugger to reproduce and debug it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants