Sorry for my bad english. I'm only starting to use codeception. There is need to use two urls in one acceptance test (website (url: example.com) and administrator interface(url: edit-example.com)). But I don't know how to realize this. I tried to do something like this:
acceptance.suite.yml
modules:
enabled:
- WebDriver:
url: example.com
testCept.php
$website = example.com
$adm_int = edit-example.com
$I = new AcceptanceTester($scenario);
// Go to website and do some actions
$I->amOnPage($website);
// some code
// Then go to administrator interface and do some actions
$I->amOnPage($adm_int);
//some code
// Then I go again to website and look that changes confirmed
$I->amOnPage($website);
// some code
But in this case url of website concatenates with url, specified in config file acceptance.suite.yml. And test goes to url example.com/example.com and in case with administrator interface it goes to example.com/edit-example.com.
The problem is in url, that specified in config file acceptance.suite.yml. If I delete url from this config file - codeception returns exception:
[Codeception\Exception\ModuleConfigException]
WebDriver module is not configured!
Options: browser, url are required
Please, update the configuration and set all the required fields
Exception trace:
() at PhpstormProjects\MyProject\general\data\lib\vendor\codeception\codeception\src\Codeception\Module.php:89
Codeception\Module->validateConfig() at PhpstormProjects\MyProject\general\data\lib\vendor\codeception\codeception\src\Codeception\Module.php:65
Codeception\Module->_setConfig() at PhpstormProjects\MyProject\general\data\lib\vendor\codeception\codeception\src\Codeception\Module.php:58
Codeception\Module->__construct() at n/a:n/a
ReflectionClass->newInstanceArgs() at PhpstormProjects\MyProject\general\data\lib\vendor\codeception\codeception\src\Codeception\Lib\Di.php:75
Codeception\Lib\Di->instantiate() at PhpstormProjects\MyProject\general\data\lib\vendor\codeception\codeception\src\Codeception\Lib\ModuleContainer.php:109
Codeception\Lib\ModuleContainer->instantiate() at PhpstormProjects\MyProject\general\data\lib\vendor\codeception\codeception\src\Codeception\Lib\ModuleContainer.php:62
Codeception\Lib\ModuleContainer->create() at PhpstormProjects\MyProject\general\data\lib\vendor\codeception\codeception\src\Codeception\SuiteManager.php:71
Codeception\SuiteManager->__construct() at PhpstormProjects\MyProject\general\data\lib\vendor\codeception\codeception\src\Codeception\Codecept.php:200
Codeception\Codecept->runSuite() at PhpstormProjects\MyProject\general\data\lib\vendor\codeception\codeception\src\Codeception\Codecept.php:172
Codeception\Codecept->run() at PhpstormProjects\MyProject\general\data\lib\vendor\codeception\codeception\src\Codeception\Command\Run.php:184
Codeception\Command\Run->execute() at PhpstormProjects\MyProject\general\data\lib\vendor\symfony\console\Symfony\Component\Console\Command\Command.php:257
Symfony\Component\Console\Command\Command->run() at PhpstormProjects\MyProject\general\data\lib\vendor\symfony\console\Symfony\Component\Console\Application.php:874
Symfony\Component\Console\Application->doRunCommand() at PhpstormProjects\MyProject\general\data\lib\vendor\symfony\console\Symfony\Component\Console\Application.php:195
Symfony\Component\Console\Application->doRun() at PhpstormProjects\MyProject\general\data\lib\vendor\symfony\console\Symfony\Component\Console\Application.php:126
Symfony\Component\Console\Application->run() at PhpstormProjects\MyProject\general\data\lib\vendor\codeception\codeception\codecept:28
May be there are some instruments in codeception that allow to use absolute urls in function amOnPage()?
Did somebody solve this problem? May be someone have an idea how to help with that problem?
Thanks!
Use full url with protocol:
$website = 'http://example.com';
$adm_int = 'http://edit-example.com';
And use amOnUrl method instead of amOnPage
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With