codeforequity-at / codeforequity-at/botium-bindings
Overriding botium.json config inside botium.spec.js file
- Dominant language
- JavaScript
- Stars
- 106
- Forks
- 36
- PR merge metrics
- No merged PRs in 30d
Description
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 variable `BOTIUM_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:
```
const bb = require('botium-bindings');
bb.helper.jest().setupJestTestSuite();
```
I found that I can modify the header setting inside custom asserter
```
assertConvoBegin({ convo, container, args }) {
console.log(`MyAsserter assertConvoBegin: ${convo.header.name}`);
return Promise.resolve();
}
```
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.
Contributor guide
Assessment
This issue has not been assessed yet.