From d6227216379f3a65c3ec003403791d419a575cd2 Mon Sep 17 00:00:00 2001 From: Christian Fritsch Date: Thu, 11 Jul 2024 14:42:59 +0200 Subject: [PATCH] Fix tests --- tests/src/FunctionalJavascript/MediaGalleryModifyTest.php | 1 - tests/src/FunctionalJavascript/NodeCreationTest.php | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/src/FunctionalJavascript/MediaGalleryModifyTest.php b/tests/src/FunctionalJavascript/MediaGalleryModifyTest.php index 30a41ca72..7e5a4c269 100644 --- a/tests/src/FunctionalJavascript/MediaGalleryModifyTest.php +++ b/tests/src/FunctionalJavascript/MediaGalleryModifyTest.php @@ -107,7 +107,6 @@ public function testAddRemove(): void { $this->clickSave(); - // Check that there are 4 images in gallery. $this->assertEquals( 4, diff --git a/tests/src/FunctionalJavascript/NodeCreationTest.php b/tests/src/FunctionalJavascript/NodeCreationTest.php index fe88923c6..7955305f7 100644 --- a/tests/src/FunctionalJavascript/NodeCreationTest.php +++ b/tests/src/FunctionalJavascript/NodeCreationTest.php @@ -90,8 +90,11 @@ public function testCreateNode(string $contentType, string $contentTypeDisplayNa $this->assertSession()->pageTextContains('Awesome text'); // Check Gallery paragraph. Ensure that there are 2 images in gallery. - $this->assertSession() - ->elementsCount('xpath', '//div[contains(@class, "field--name-field-paragraphs")]/div[contains(@class, "field__item")][3]//div[contains(@class, "slick-track")]/div[not(contains(@class, "slick-cloned"))]//img', 2); + $this->assertEquals( + 2, + $this->getSession()->evaluateScript('document.querySelectorAll("div.field--name-field-media-images div.field__item img").length'), + 'There should be five images shown in frontend.' + ); // Check Quote paragraph. $this->assertSession()->pageTextContains('Awesome quote');