Hey,
I already have a .env file that I am using, would it be possible to use this to also store some of the keys in the codeception yml files?
For example
config:
WebDriver:
url: <%= ENV['SELENIUM_URL'] %>
browser: firefox
host: <%= ENV['SELENIUM_HOST'] %>
port: 80
restart: true
Just wondering if anyone has a solution to this?
Thanks
’<%= ENV['SELENIUM_URL'] %>’
0.о Are you using erb template engine? I think not, thus such templates won't work :)
What you can do is to reconfigure WebDriver via Extension or Helper. Also there was some kind of solution at PhpTestClub
It would be great if it was covered in the doc.
Sidenote for everybody else who came to this issue with a google search:
Enviroment variables are supported in multiple ways in Codeception by now: http://codeception.com/docs/06-ModulesAndHelpers#Dynamic-Configuration-With-Params
One of them is to read already set enviroment variables directly from $_ENV, eg. $_ENV['URL']. To do so the env parser needs to be activated:
_codeception.yml_
params:
- env
Then wrap the desired enviroment variable in percentage signs:
_acceptance.suite.yml_
modules:
enabled:
- PhpBrowser:
url: '%URL%'
Most helpful comment
Sidenote for everybody else who came to this issue with a google search:
Enviroment variables are supported in multiple ways in Codeception by now: http://codeception.com/docs/06-ModulesAndHelpers#Dynamic-Configuration-With-Params
One of them is to read already set enviroment variables directly from
$_ENV, eg.$_ENV['URL']. To do so the env parser needs to be activated:_codeception.yml_
Then wrap the desired enviroment variable in percentage signs:
_acceptance.suite.yml_