From f3cfb75da89a918c56a5987fd49dbd89427877e2 Mon Sep 17 00:00:00 2001 From: LucasC Date: Mon, 28 Oct 2024 14:43:04 +0100 Subject: [PATCH] XWIKI-12629: Page Right is shown when administering inexistent WebHome page (#3603) * Fixed test that relied on an uncreated page's administration section * Serialized the reference * Serialize the local reference --------- Co-authored-by: Simon Urli --- .../administration/test/ui/AdministrationIT.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-test/xwiki-platform-administration-test-docker/src/test/it/org/xwiki/administration/test/ui/AdministrationIT.java b/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-test/xwiki-platform-administration-test-docker/src/test/it/org/xwiki/administration/test/ui/AdministrationIT.java index e517f7b281fe..2679f8611c20 100644 --- a/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-test/xwiki-platform-administration-test-docker/src/test/it/org/xwiki/administration/test/ui/AdministrationIT.java +++ b/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-test/xwiki-platform-administration-test-docker/src/test/it/org/xwiki/administration/test/ui/AdministrationIT.java @@ -24,6 +24,7 @@ import org.junit.jupiter.api.Test; import org.xwiki.administration.test.po.AdministrablePage; import org.xwiki.administration.test.po.AdministrationPage; +import org.xwiki.test.docker.junit5.TestReference; import org.xwiki.test.docker.junit5.UITest; import org.xwiki.test.ui.TestUtils; @@ -43,12 +44,12 @@ class AdministrationIT * Validate presence of default sections for Administration UIs (Global, Page). */ @Test - void verifyAdministrationSections(TestUtils setup) + void verifyAdministrationSections(TestUtils setup, TestReference testReference) { setup.loginAsSuperAdmin(); - // Navigate to a (non existent for test performance reasons) page in view mode. - setup.gotoPage("NonExistentSpace", "NonExistentPage"); + // Navigate to a page in view mode. + setup.createPage(testReference, ""); // Verify that pages have an Admin menu and navigate to the wiki admin UI (which happens to be the global // admin UI too since we're on the main wiki). @@ -71,11 +72,12 @@ void verifyAdministrationSections(TestUtils setup) assertTrue(wikiAdministrationPage.hasNotSection("PageRights")); // Select XWiki page administration. - setup.gotoPage("NonExistentSpace", "WebHome"); + setup.gotoPage(testReference); page = new AdministrablePage(); AdministrationPage pageAdministrationPage = page.clickAdministerPage(); - - assertEquals("Page Administration: NonExistentSpace", pageAdministrationPage.getDocumentTitle()); + String fullName = setup.serializeLocalReference(testReference.getParent()); + assertEquals("Page Administration: " + fullName, + pageAdministrationPage.getDocumentTitle()); assertTrue(pageAdministrationPage.getBreadcrumbContent().endsWith("/Page Administration")); assertTrue(pageAdministrationPage.hasSection("Themes"));