Reputation: 1
I would like to write conditional statements based on which environment the codeceptjs test code is run. The easiest way to identity the environment would be to read the URL value on the Puppeteer config in the codeceptjs.json file. How do I read this value into a variable at run time and construct an "if" block around it?
"Puppeteer": { "url": "<Test environment url>" }
Upvotes: 0
Views: 880
Reputation: 185
Load your configuration (codecept.json or codecept.conf.js) to helper and get a necessary values from it:
const config = require('./path/to/codecept.json');
let url = config.helpers.Puppeteer.url; // <Test environment url>
Upvotes: 0