You are here

protected function ThunderJavascriptTestBase::initFrontPage in Thunder 8.5

Same name and namespace in other branches
  1. 8.2 tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::initFrontPage()
  2. 8.3 tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::initFrontPage()
  3. 8.4 tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::initFrontPage()
  4. 6.2.x tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::initFrontPage()
  5. 6.0.x tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::initFrontPage()
  6. 6.1.x tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php \Drupal\Tests\thunder\FunctionalJavascript\ThunderJavascriptTestBase::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 WebDriverTestBase::initFrontPage

See also

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

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

File

tests/src/FunctionalJavascript/ThunderJavascriptTestBase.php, line 88

Class

ThunderJavascriptTestBase
Base class for Thunder Javascript functional tests.

Namespace

Drupal\Tests\thunder\FunctionalJavascript

Code

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

  // Set a standard window size so that all javascript tests start with the
  // same viewport.
  $windowSize = $this
    ->getWindowSize();
  $this
    ->getSession()
    ->resizeWindow($windowSize['width'], $windowSize['height']);
}