Skip to content

Commit

Permalink
XWIKI-12629: Page Right is shown when administering inexistent WebHom…
Browse files Browse the repository at this point in the history
…e 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 <[email protected]>
(cherry picked from commit f3cfb75)
  • Loading branch information
Sereza7 authored and surli committed Oct 28, 2024
1 parent f958509 commit 7dc47e2
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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).
Expand All @@ -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"));
Expand Down

0 comments on commit 7dc47e2

Please sign in to comment.