diff --git a/tests/behat/features/edit-a-page.feature b/tests/behat/features/edit-a-page.feature index 1d12d47e..98e48aee 100644 --- a/tests/behat/features/edit-a-page.feature +++ b/tests/behat/features/edit-a-page.feature @@ -54,7 +54,7 @@ Feature: Edit a page Then the rendered HTML should contain "/about-modified-us" # Add metadata - When I click on the "#ui-accordion-Form_EditForm_Metadata-header-0" element + When I click on the ".ui-accordion-header" element And I wait for 1 second And I fill in "Meta Description" with "MyMetaDesc" diff --git a/tests/php/Model/SiteTreeTest.php b/tests/php/Model/SiteTreeTest.php index 00733778..e6e06ed6 100644 --- a/tests/php/Model/SiteTreeTest.php +++ b/tests/php/Model/SiteTreeTest.php @@ -2030,10 +2030,20 @@ class SiteTreeTest extends SapphireTest */ public function testSanitiseExtraMeta(string $extraMeta, string $expected, string $message): void { + // If using HTML5Value then the 'somethingdodgy' test won't be converted to valid html + // However if using the default HTMLValue, then it will be converted to valid html + $isDodgyAndUsingHTML5 = strpos($expected, 'somethingdodgy') !== false && + (HTMLValue::create() instanceof HTML5Value); + if ($isDodgyAndUsingHTML5) { + $this->expectException(ValidationException::class); + $this->expectExceptionMessage('Custom Meta Tags does not contain valid HTML'); + } $siteTree = new SiteTree(); $siteTree->ExtraMeta = $extraMeta; $siteTree->write(); - $this->assertSame($expected, $siteTree->ExtraMeta, $message); + if (!$isDodgyAndUsingHTML5) { + $this->assertSame($expected, $siteTree->ExtraMeta, $message); + } } public function provideSanitiseExtraMeta(): array