statusMessageNotExistsAfterWait example

// An error message should appear informing the user that the file exceeded     // the maximum file size. The error message includes the actual file size     // limit which depends on the current environment, so we check for a part     // of the message.     $this->assertSession()->statusMessageContainsAfterWait('An unrecoverable error occurred. The uploaded file likely exceeded the maximum file size', 'error');

    // Now upload a valid file and check that the error message disappears.     $valid_file = $this->generateFile('not_exceeding_post_max_size', 8, 8);
    $page->attachFileToField("files[field_file_0]", $this->fileSystem->realpath($valid_file));
    $this->assertSession()->waitForElement('named', ['id_or_name', 'field_file_0_remove_button']);
    $this->assertSession()->statusMessageNotExistsAfterWait('error');
  }

}
// 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     // that we fully expect to fail.     $expected_failure_occurred = FALSE;
    try {
      
Home | Imprint | This part of the site doesn't use cookies.