diff --git a/modules/thunder_gqls/tests/src/Functional/JsonLdSchemaTest.php b/modules/thunder_gqls/tests/src/Functional/JsonLdSchemaTest.php index 319346dbf..c2b62e4c2 100644 --- a/modules/thunder_gqls/tests/src/Functional/JsonLdSchemaTest.php +++ b/modules/thunder_gqls/tests/src/Functional/JsonLdSchemaTest.php @@ -22,7 +22,16 @@ public function testSchema(): void { $this->config('metatag.metatag_defaults.node__article')->set('tags', $tags) ->save(); - $this->runAndTestQuery('jsonld'); + $schema = 'jsonld'; + + $query = $this->getQueryFromFile($schema); + $variables = $this->getVariablesFromFile($schema); + + $responseData = $this->jsonDecode(strip_tags($this->getResponseData($query, $variables)['jsonld'])); + $expectedData = $this->jsonDecode(strip_tags($this->jsonDecode($this->getExpectedResponseFromFile($schema))['data']['jsonld'])); + + $this->assertEqualsCanonicalizing($expectedData, $responseData); + } } diff --git a/tests/src/FunctionalJavascript/MediaGalleryModifyTest.php b/tests/src/FunctionalJavascript/MediaGalleryModifyTest.php index 139ab4346..0a57d6fd2 100644 --- a/tests/src/FunctionalJavascript/MediaGalleryModifyTest.php +++ b/tests/src/FunctionalJavascript/MediaGalleryModifyTest.php @@ -67,12 +67,11 @@ public function testOrderChange(): void { $this->clickSave(); - $gallery = $this->loadMediaByUuid('df67621b-518f-4159-a59e-1bad0700800c'); - $this->clickCssSelector('#slick-media-gallery-media-images-default-' . $gallery->id() . '-1 button.slick-next'); + $this->clickCssSelector('div.slick--initialized.slick--field-media-images button.slick-next'); // Check that, 2nd image is file: 26357237683_0891e46ba5_k.jpg. $fileNamePosition = $this->getSession() - ->evaluateScript('jQuery(\'#slick-media-gallery-media-images-default-' . $gallery->id() . '-1 div.slick-slide:not(.slick-cloned):nth(1) img\').attr(\'src\').indexOf("26357237683_0891e46ba5_k.jpg")'); + ->evaluateScript('jQuery(\'div.slick--initialized.slick--field-media-images div.slick-slide:not(.slick-cloned):nth(1) img\').attr(\'src\').indexOf("26357237683_0891e46ba5_k.jpg")'); $this->assertNotEquals(-1, $fileNamePosition, 'For 2nd image in gallery, used file should be "26357237683_0891e46ba5_k.jpg".'); } @@ -99,17 +98,16 @@ public function testAddRemove(): void { $this->clickSave(); - $gallery = $this->loadMediaByUuid('df67621b-518f-4159-a59e-1bad0700800c'); - $this->clickCssSelector('#slick-media-gallery-media-images-default-' . $gallery->id() . '-1 button.slick-next'); + $this->clickCssSelector('div.slick--initialized.slick--field-media-images button.slick-next'); // Check that, there are 4 images in gallery. $numberOfImages = $this->getSession() - ->evaluateScript('jQuery(\'#slick-media-gallery-media-images-default-' . $gallery->id() . '-1 div.slick-slide:not(.slick-cloned)\').length;'); + ->evaluateScript('jQuery(\'div.slick--initialized.slick--field-media-images div.slick-slide:not(.slick-cloned)\').length;'); $this->assertEquals(4, $numberOfImages, 'There should be 4 images in Gallery.'); // Check that, 2nd image is file: 26315068204_24ffa6cfc4_o.jpg. $fileNamePosition = $this->getSession() - ->evaluateScript('jQuery(\'#slick-media-gallery-media-images-default-' . $gallery->id() . '-1 div.slick-slide:not(.slick-cloned):nth(1) img\').attr(\'src\').indexOf("26315068204_24ffa6cfc4_o.jpg")'); + ->evaluateScript('jQuery(\'div.slick--initialized.slick--field-media-images div.slick-slide:not(.slick-cloned):nth(1) img\').attr(\'src\').indexOf("26315068204_24ffa6cfc4_o.jpg")'); $this->assertNotEquals(-1, $fileNamePosition, 'For 2nd image in gallery, used file should be "26315068204_24ffa6cfc4_o.jpg".'); // Test add + reorder inside media library. @@ -131,15 +129,15 @@ public function testAddRemove(): void { // Check that, there are 5 images in gallery. $numberOfImages = $this->getSession() - ->evaluateScript('jQuery(\'#slick-media-gallery-media-images-default-' . $gallery->id() . '-1 div.slick-slide:not(.slick-cloned)\').length;'); + ->evaluateScript('jQuery(\'div.slick--initialized.slick--field-media-images div.slick-slide:not(.slick-cloned)\').length;'); $this->assertEquals(5, $numberOfImages, 'There should be 5 images in Gallery.'); - $this->clickCssSelector('#slick-media-gallery-media-images-default-' . $gallery->id() . '-1 button.slick-next'); - $this->clickCssSelector('#slick-media-gallery-media-images-default-' . $gallery->id() . '-1 button.slick-next'); + $this->clickCssSelector('div.slick--initialized.slick--field-media-images button.slick-next'); + $this->clickCssSelector('div.slick--initialized.slick--field-media-images button.slick-next'); // Check that, 3rd image is file: reference.jpg. $fileNamePosition = $this->getSession() - ->evaluateScript('jQuery(\'#slick-media-gallery-media-images-default-' . $gallery->id() . '-1 div.slick-slide:not(.slick-cloned):nth(2) img\').attr(\'src\').indexOf("reference.jpg")'); + ->evaluateScript('jQuery(\'div.slick--initialized.slick--field-media-images div.slick-slide:not(.slick-cloned):nth(2) img\').attr(\'src\').indexOf("reference.jpg")'); $this->assertNotEquals(-1, $fileNamePosition, 'For 3rd image in gallery, used file should be "reference.jpg".'); // Test remove inside media library. @@ -159,15 +157,15 @@ public function testAddRemove(): void { // Check that, there are 4 images in gallery. $numberOfImages = $this->getSession() - ->evaluateScript('jQuery(\'#slick-media-gallery-media-images-default-' . $gallery->id() . '-1 div.slick-slide:not(.slick-cloned)\').length;'); + ->evaluateScript('jQuery(\'div.slick--initialized.slick--field-media-images div.slick-slide:not(.slick-cloned)\').length;'); $this->assertEquals(4, $numberOfImages, 'There should be 4 images in Gallery.'); - $this->clickCssSelector('#slick-media-gallery-media-images-default-' . $gallery->id() . '-1 button.slick-next'); - $this->clickCssSelector('#slick-media-gallery-media-images-default-' . $gallery->id() . '-1 button.slick-next'); + $this->clickCssSelector('div.slick--initialized.slick--field-media-images button.slick-next'); + $this->clickCssSelector('div.slick--initialized.slick--field-media-images button.slick-next'); // Check that, 3rd image is not file: reference.jpg. $fileNamePosition = $this->getSession() - ->evaluateScript('jQuery(\'#slick-media-gallery-media-images-default-' . $gallery->id() . '-1 div.slick-slide:not(.slick-cloned):nth(2) img\').attr(\'src\').indexOf("reference.jpg")'); + ->evaluateScript('jQuery(\'div.slick--initialized.slick--field-media-images div.slick-slide:not(.slick-cloned):nth(2) img\').attr(\'src\').indexOf("reference.jpg")'); $this->assertEquals(-1, $fileNamePosition, 'For 2nd image in gallery, used file should not be "reference.jpg".'); }