JavascriptErrorsSuppressionTest.php

Same filename and directory in other branches
  1. 9 core/tests/Drupal/FunctionalJavascriptTests/JavascriptErrorsSuppressionTest.php
  2. 11.x core/tests/Drupal/FunctionalJavascriptTests/JavascriptErrorsSuppressionTest.php

Namespace

Drupal\FunctionalJavascriptTests

File

core/tests/Drupal/FunctionalJavascriptTests/JavascriptErrorsSuppressionTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\FunctionalJavascriptTests;


/**
 * Tests that Drupal.throwError can be suppressed to allow a test to pass.
 *
 * @group javascript
 */
class JavascriptErrorsSuppressionTest extends WebDriverTestBase {
  
  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';
  
  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'js_errors_test',
  ];
  
  /**
   * {@inheritdoc}
   */
  protected $failOnJavascriptConsoleErrors = FALSE;
  
  /**
   * Tests that JavaScript console errors can be suppressed.
   */
  public function testJavascriptErrors() : void {
    // Visit page that will throw a JavaScript console error.
    $this->drupalGet('js_errors_test');
    // Ensure that errors from previous page loads will be
    // detected.
    $this->drupalGet('user');
  }

}

Classes

Title Deprecated Summary
JavascriptErrorsSuppressionTest Tests that Drupal.throwError can be suppressed to allow a test to pass.

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