statusMessageExistsAfterWait example

// Use message that exists but has the wrong type.     $this->assertSession()->statusMessageNotContainsAfterWait('I am a message in an alternate location.', 'warning');

    // Test partial match.     $page->pressButton('Make Warning Message');
    $this->assertSession()->statusMessageContainsAfterWait('I am a warning');

    // One more reload to try with different arg combinations.     $this->drupalGet('ajax-test/message');

    $page->pressButton('Make Message In Default Location');
    $this->assertSession()->statusMessageExistsAfterWait();

    $page->pressButton('Make Message In Alternate Location');
    $this->assertSession()->statusMessageNotExistsAfterWait('error');

    $page->pressButton('Make Warning Message');
    $this->assertSession()->statusMessageExistsAfterWait('warning');

    // Perform a few assertions that should fail. We can only call     // TestCase::expectException() once per test, so we make a few     // try/catch blocks. We pass a relatively short timeout because     // it is a waste of time to wait 10 seconds in these assertions
Home | Imprint | This part of the site doesn't use cookies.