diff --git a/tests/src/Functional/EntityPrintActionTest.php b/tests/src/Functional/EntityPrintActionTest.php index 0768a6d..5f58538 100644 --- a/tests/src/Functional/EntityPrintActionTest.php +++ b/tests/src/Functional/EntityPrintActionTest.php @@ -58,7 +58,16 @@ class EntityPrintActionTest extends BrowserTestBase { 'action' => 'entity_print_pdf_download_action', 'node_bulk_form[0]' => 1, ], 'Apply to selected items'); - $this->assertSession()->pageTextContains('Download PDF was applied to 1 item.'); + $this->assertSession()->pageTextContains('Using testprintengine'); + } + + /** + * {@inheritdoc} + */ + protected function checkForMetaRefresh() { + // A meta refresh is inserted when using the test PDF engine, but this is + // not present for real engines. So the test can assert the engine is + // invoked, do not follow the meta refresh. } } diff --git a/tests/src/Functional/EntityPrintTest.php b/tests/src/Functional/EntityPrintTest.php index 6cc7b17..5f0a19b 100644 --- a/tests/src/Functional/EntityPrintTest.php +++ b/tests/src/Functional/EntityPrintTest.php @@ -64,9 +64,8 @@ class EntityPrintTest extends BrowserTestBase { public function testExceptionOnRender() { $this->drupalGet('/entityprint/pdf/node/1'); - $assert = $this->assertSession(); - $assert->pageTextContains('Error generating document: Exception thrown by PrintExceptionEngine'); - $assert->pageTextNotContains('The website encountered an unexpected error'); + $this->assertSession()->elementContains('css', '[aria-label="Error message"]', 'Error generating document: Exception thrown by PrintExceptionEngine'); + $this->assertSession()->pageTextNotContains('The website encountered an unexpected error'); } /** @@ -76,9 +75,8 @@ class EntityPrintTest extends BrowserTestBase { $this->drupalGet('/my-test-view'); $this->clickLink('View PDF'); - $assert = $this->assertSession(); - $assert->pageTextContains('Error generating document: Exception thrown by PrintExceptionEngine'); - $assert->pageTextNotContains('The website encountered an unexpected error'); + $this->assertSession()->elementContains('css', '[aria-label="Error message"]', 'Error generating document: Exception thrown by PrintExceptionEngine'); + $this->assertSession()->pageTextNotContains('The website encountered an unexpected error'); } }