You are here

protected function SiteAlertWebDriverTestBase::assertSiteAlertNotAppears in Site Alert 8

Checks that the alert with the given message does not appear on the page.

Parameters

string $message: The message contained in the alert that is expected to appear.

int $timeout: (Optional) Timeout in milliseconds, defaults to 10000.

1 call to SiteAlertWebDriverTestBase::assertSiteAlertNotAppears()
SiteAlertCacheWorkaroundTest::testPageCacheWorkaround in tests/src/FunctionalJavascript/SiteAlertCacheWorkaroundTest.php
Tests that the workaround to display alerts on cached pages works.

File

tests/src/FunctionalJavascript/SiteAlertWebDriverTestBase.php, line 56

Class

SiteAlertWebDriverTestBase
Base class for functional JS tests for the Site Alerts module.

Namespace

Drupal\Tests\site_alert\FunctionalJavascript

Code

protected function assertSiteAlertNotAppears($message, $timeout = 10000) {
  $condition = 'jQuery(\'.site-alert div.text:contains("' . $message . '")\').length > 0;';
  try {
    $this
      ->assertJsCondition($condition, $timeout);
  } catch (AssertionFailedError $e) {

    // The alert has not appeared, the test has passed.
    return;
  }

  // The alert has unexpectedly appeared, the test has failed.
  $this
    ->fail();
}