Open piotrjak opened 5 years ago
Question 1 Just convert JSON to string:
process.env.BOTIUM_SIMPLEREST_HEADERS_TEMPLATE = JSON.stringify({ "Authorization": "Bearer MYTOKEN" })
Question 2 Several options available. You can use a request hook:
"SIMPLEREST_REQUEST_HOOK": "requestOptions.headers.Authorization = 'Bearer ' + process.env.MY_TOKEN"
Or you can use Scripting functions in Moustache template:
"SIMPLEREST_HEADERS_TEMPLATE:" { "Authorization": "Bearer {{#fnc.func}}process.env.MY_TOKEN{{/fnc.func}}" }
Both should work.
Hi! First let me tell you that I've searched through FAQ and both closed and open github issues here and I haven't found an answer to my question.
Case: I have an authentication token that expires after a specific amount of time so I'd like to set this token inside
botium.spec.json
file, before any of the convos tests run.Question 1 In https://botium.atlassian.net/wiki/spaces/BOTIUM/pages/360603/Botium+Configuration+-+Capabilities -> Configuration Source -> fourth dot. You write that it's possible to overwrite a specific CAPABILITY config setting with env variable e.g. if I want to override
PROJECT_NAME
then I set env variableBOTIUM_PROJECT_NAME="My ProjectName". But what about SIMPLEREST_HEADERS_TEMPLATE CAPABILITY which is a JSON object? How can I change
SIMPLEREST_HEADERS_TEMPLATE: { "Authorization": "Bearer MYTOKEN" } with env variable? I can't see any example.Question 2 As I said - I'd like to fetch a token from a server BEFORE any of the tests run and set it on botium object. How can I do it in
botium.spec.js
file which contains:I found that I can modify the header setting inside custom asserter
in container desctructured parameter, but I don't want to bind changing the header to a specific test - I'd like to do it before the test. Can I use BotDriver to do it? How to import this object into this
botium.spec.js
file?Looking forward to the response and thank you for your work in botium-bindings. It looks like writing convos files will improve integration testing with our chatbot.