function WebDriverTestBase::drupalGet

Same name and namespace in other branches
  1. main core/tests/Drupal/FunctionalJavascriptTests/WebDriverTestBase.php \Drupal\FunctionalJavascriptTests\WebDriverTestBase::drupalGet()

Retrieves a Drupal path or an absolute path.

Parameters

string|\Drupal\Core\Url $path: Drupal path or URL to load into Mink controlled browser.

array $options: (optional) Options to be forwarded to the URL generator.

string[] $headers: An array containing additional HTTP request headers, the array keys are the header names and the array values the header values. This is useful to set for example the "Accept-Language" header for requesting the page in a different language. Note that not all headers are supported, for example the "Accept" header is always overridden by the browser. For testing REST APIs it is recommended to obtain a separate HTTP client using getHttpClient() and performing requests that way.

Return value

string The retrieved HTML string, also available as $this->getRawContent()

Overrides UiHelperTrait::drupalGet

425 calls to WebDriverTestBase::drupalGet()
ActiveLinkTest::testQueryStringQuotes in core/modules/system/tests/src/FunctionalJavascript/ActiveLinkTest.php
Ensures no JS error is thrown with query strings containing special chars.
AdminAjaxTest::testAjaxRebuild in core/modules/views_ui/tests/src/FunctionalJavascript/AdminAjaxTest.php
Confirms that form_alter is triggered after AJAX rebuilds.
AdminAjaxTest::testBodyScroll in core/modules/views_ui/tests/src/FunctionalJavascript/AdminAjaxTest.php
Tests body scroll.
AdminUiTest::testImageUploadSettingsAreValidated in core/modules/ckeditor5/tests/src/FunctionalJavascript/AdminUiTest.php
Tests that image upload settings (stored out of band) are validated too.
AdminUiTest::testMessagesDoNotAccumulate in core/modules/ckeditor5/tests/src/FunctionalJavascript/AdminUiTest.php
Ensure CKEditor 5 admin UI's real-time validation errors do not accumulate.

... See full list

1 method overrides WebDriverTestBase::drupalGet()
OffCanvasTestBase::drupalGet in core/modules/system/tests/src/FunctionalJavascript/OffCanvasTestBase.php
Retrieves a Drupal path or an absolute path.

File

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

Class

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

Namespace

Drupal\FunctionalJavascriptTests

Code

protected function drupalGet($path, array $options = [], array $headers = []) {
  $result = parent::drupalGet($path, $options, $headers);
  // Wait for all requests to finish.
  $this->getSession()
    ->wait(5000, 'window.drupalActiveXhrCount === 0 || typeof window.drupalActiveXhrCount === "undefined"');
  // Process Javascript deprecations.
  $driver = $this->getSession()
    ->getDriver();
  assert($driver instanceof DrupalSelenium2Driver);
  $driver->processJavascriptDeprecations();
  return $result;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.