You are here

protected function WebDriverTestBase::initFrontPage in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php \Drupal\FunctionalJavascriptTests\WebDriverTestBase::initFrontPage()
  2. 10 core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php \Drupal\FunctionalJavascriptTests\WebDriverTestBase::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.

Overrides BrowserTestBase::initFrontPage

See also

https://w3c.github.io/webdriver/webdriver-spec.html#add-cookie

https://www.w3.org/Bugs/Public/show_bug.cgi?id=20975

1 call to WebDriverTestBase::initFrontPage()
QuickEditLoadingTest::testConcurrentEdit in core/modules/quickedit/tests/src/FunctionalJavascript/QuickEditLoadingTest.php
Tests Quick Edit on a node that was concurrently edited on the full node form.

File

core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php, line 83

Class

WebDriverTestBase
Runs a browser test using a driver that supports JavaScript.

Namespace

Drupal\FunctionalJavascriptTests

Code

protected function initFrontPage() {
  parent::initFrontPage();

  // Set a standard window size so that all javascript tests start with the
  // same viewport.
  $this
    ->getSession()
    ->resizeWindow(1024, 768);
}