function BrowserTestBase::initFrontPage
Same name in other branches
- 9 core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::initFrontPage()
- 8.9.x core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::initFrontPage()
- 11.x core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::initFrontPage()
Visits the front page when initializing Mink.
According to the W3C WebDriver specification a cookie can only be set if the cookie domain is equal to the domain of the active document. When the browser starts up the active document is not our domain but 'about:blank' or similar. To be able to set our User-Agent and Xdebug cookies at the start of the test we now do a request to the front page so the active document matches the domain.
See also
https://w3c.github.io/webdriver/webdriver-spec.html#add-cookie
https://www.w3.org/Bugs/Public/show_bug.cgi?id=20975
3 calls to BrowserTestBase::initFrontPage()
- BrowserTestBase::initMink in core/
tests/ Drupal/ Tests/ BrowserTestBase.php - Initializes Mink sessions.
- SessionTest::testDataPersistence in core/
modules/ system/ tests/ src/ Functional/ Session/ SessionTest.php - Tests data persistence via the session_test module callbacks.
- WebDriverTestBase::initFrontPage in core/
tests/ Drupal/ FunctionalJavascriptTests/ WebDriverTestBase.php - Visits the front page when initializing Mink.
3 methods override BrowserTestBase::initFrontPage()
- InstallerTestBase::initFrontPage in core/
tests/ Drupal/ FunctionalTests/ Installer/ InstallerTestBase.php - Visits the front page when initializing Mink.
- UpdatePathTestBase::initFrontPage in core/
tests/ Drupal/ FunctionalTests/ Update/ UpdatePathTestBase.php - Visits the front page when initializing Mink.
- WebDriverTestBase::initFrontPage in core/
tests/ Drupal/ FunctionalJavascriptTests/ WebDriverTestBase.php - Visits the front page when initializing Mink.
File
-
core/
tests/ Drupal/ Tests/ BrowserTestBase.php, line 282
Class
- BrowserTestBase
- Provides a test case for functional Drupal tests.
Namespace
Drupal\TestsCode
protected function initFrontPage() {
$session = $this->getSession();
$session->visit($this->baseUrl);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.