I want to test an url with a redirect.
In the _output folder I get an empty screenshot and a html file with this html markup:
<html><head></head><body></body></html>
Console output:
peter@computer ~/Websites/pbt-d8/modules/permissions_by_term/tests/codeception $ codeception run --debug
Codeception PHP Testing Framework v2.1.4
Powered by PHPUnit 4.8.18 by Sebastian Bergmann and contributors.
Functional Tests (0) ------------------------
Modules: \Helper\Functional
---------------------------------------------
---------------------------------------------
Unit Tests (0) ------------------------------
Modules: Asserts, \Helper\Unit
---------------------------------------------
---------------------------------------------
Acceptance Tests (1) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Modules: WebDriver, \Helper\Acceptance
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Check that an node with restricted access is not accessible for guests. (RestrictNodeCept)
Scenario:
* I am on url "node/1"
[Selenium har Logs]
17:54:30.248 INFO - {"log":{"version":"1.2","creator":{"name":"PhantomJS","version":"2.1.1"},"pages":[{"startedDateTime":null,"id":"","title":"","pageTimings":{"onLoad":null}}],"entries":[]}}
[Selenium browser Logs] EMPTY
Screenshot and page source were saved into '_output' dir
ERROR
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Time: 533 ms, Memory: 10.00Mb
There was 1 error:
---------
1) Failed to check that an node with restricted access is not accessible for guests. in RestrictNodeCept (tests/acceptance/RestrictNodeCept.php)
[InvalidArgumentException] Wrong URL passes, host and scheme not set
Scenario Steps:
1. $I->amOnUrl("node/1") at tests/acceptance/RestrictNodeCept.php:4
#1 phar:///home/peter/Programme/codeception/codeception-2.1.4.phar/src/Codeception/Module/WebDriver.php:498
#2 Codeception\Module\WebDriver->amOnUrl
#3 /home/peter/Websites/pbt-d8/modules/permissions_by_term/tests/codeception/tests/_support/_generated/AcceptanceTesterActions.php:247
#4 /home/peter/Websites/pbt-d8/modules/permissions_by_term/tests/codeception/tests/acceptance/RestrictNodeCept.php:4
#5 /home/peter/Programme/codeception/codeception-2.1.4.phar:7
FAILURES!
Tests: 1, Assertions: 0, Errors: 1.
Provide test source code if related
<?php
$I = new AcceptanceTester($scenario);
$I->wantTo('Check that an node with restricted access is not accessible for guests.');
$I->amOnUrl('node/1');
$I->see('Access denied');
class_name: AcceptanceTester
modules:
enabled:
- WebDriver
#- PhpBrowser
- \Helper\Acceptance
#- Db
config:
WebDriver:
# Change this URL for your project.
url: 'http://pbt-d8'
browser: phantomjs
window_size: 1280x768
clear_cookies: true
http_proxy: direct
extensions:
config:
Codeception\Extension\Recorder:
delete_successful: false
And the main clue is [InvalidArgumentException] Wrong URL passes, host and scheme not set
amOnUrl accepts a full url only, use amOnPage instead.
Thanks! $I->amOnUrl('node/1'); does the trick.
Most helpful comment
And the main clue is
[InvalidArgumentException] Wrong URL passes, host and scheme not setamOnUrlaccepts a full url only, useamOnPageinstead.