From 78e9d338ae6648616c5346d1a391d36537ed629e Mon Sep 17 00:00:00 2001 From: Sergii Pavlenko Date: Mon, 2 Sep 2024 12:20:43 +0300 Subject: [PATCH] EWPP-4693: Fix assertion for html elements stripping exception. --- .../src/Functional/NodeViewRoutesMetadataTest.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/oe_theme_helper/tests/src/Functional/NodeViewRoutesMetadataTest.php b/modules/oe_theme_helper/tests/src/Functional/NodeViewRoutesMetadataTest.php index 5d5fe6404..188804bd1 100644 --- a/modules/oe_theme_helper/tests/src/Functional/NodeViewRoutesMetadataTest.php +++ b/modules/oe_theme_helper/tests/src/Functional/NodeViewRoutesMetadataTest.php @@ -81,11 +81,14 @@ public function setUp(): void { */ public function testNodeRoutes(): void { // Create a published revision for a node. - $published_revision_body = $this->randomString() . 'published'; + $published_revision_body = 'Custom page introduction with richtexthighlighted.'; $node = $this->drupalCreateNode([ 'type' => 'test', 'moderation_state' => 'published', - 'body' => $published_revision_body, + 'body' => [ + 'value' => $published_revision_body, + 'format' => 'full_html', + ], ]); // Save the revision url for later access. $first_revision_url = $node->toUrl('revision'); @@ -101,7 +104,7 @@ public function testNodeRoutes(): void { // Verify that the page header block is shown in the node canonical route // and contains the correct revision text. $this->drupalGet($node->toUrl()); - $this->assertSession()->elementTextContains('css', '.ecl-page-header__description', $published_revision_body); + $this->assertEquals($published_revision_body, $this->getSession()->getPage()->find('css', '.ecl-page-header__description')->getHtml()); // Verify that the block is also shown in the latest version route with the // correct draft revision loaded. @@ -110,7 +113,7 @@ public function testNodeRoutes(): void { // Verify also for the node single revision route. $this->drupalGet($first_revision_url); - $this->assertSession()->elementTextContains('css', '.ecl-page-header__description', $published_revision_body); + $this->assertEquals($published_revision_body, $this->getSession()->getPage()->find('css', '.ecl-page-header__description')->getHtml()); } }