kpitn
kpitn

Reputation: 41

Current base url in _bootstrap file (Codeception)

Is there a way to have current base URL in _bootstrap file for my acceptance test ? Or Is there a way to have current environment in _bootstrap file for my acceptance test ?

Actually, I use environment variable to test different sites :

env:
  env1:
    modules:
      config:
        WebDriver:
          url: 'http://local.env1.fr/'
  env2:
    modules:
      config:
        WebDriver:
          url: 'http://local.env2.fr/'

Upvotes: 0

Views: 1300

Answers (2)

kpitn
kpitn

Reputation: 41

Finaly I find a variable with current environment.

$settings["current_environment"]

Upvotes: 1

rickroyce
rickroyce

Reputation: 1032

The WebDriver has a method with the name

public function _getUrl()
$url = $I->_getUrl();

https://github.com/Codeception/Codeception/blob/2.0/src/Codeception/Module/WebDriver.php#L207

It seems, that it doesn't work, because the builded WebGuy class hasn't such a method. I guess the _bootstrap.php file hasn't the possibility to read the config. Only a special "module" could read it's own config by passing the config array as argument by the constructor.

Upvotes: 0

Related Questions