Skip to content

Commit

Permalink
Add functional tests xwikisas#16
Browse files Browse the repository at this point in the history
* Merged main branch
* Added test for application pannel
  • Loading branch information
ChiuchiuSorin committed Dec 20, 2023
1 parent d7a45e8 commit 1736eb5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.xwiki.platform</groupId>
<artifactId>xwiki-platform-panels-test-pageobjects</artifactId>
<version>${platform.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<testSourceDirectory>src/test/it</testSourceDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,19 @@
import java.util.Arrays;
import java.util.List;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.xwiki.model.reference.DocumentReference;
import org.xwiki.panels.test.po.ApplicationsPanel;
import org.xwiki.test.docker.junit5.TestConfiguration;
import org.xwiki.test.docker.junit5.UITest;
import org.xwiki.test.ui.TestUtils;
import org.xwiki.test.ui.po.ViewPage;

import com.xwiki.admintools.test.po.AdminToolsHomePage;
import com.xwiki.admintools.test.po.DashboardConfigurationSectionView;
Expand Down Expand Up @@ -88,6 +91,15 @@ void goToPage()

@Test
@Order(1)
void appEntryRedirectsToHomePage()
{
ApplicationsPanel applicationPanel = ApplicationsPanel.gotoPage();
ViewPage vp = applicationPanel.clickApplication("Admin Tools");
Assertions.assertTrue(AdminToolsHomePage.isCurrentPage(vp));
}

@Test
@Order(2)
void adminToolsHomePageBackend(TestConfiguration testConfiguration)
{
DashboardConfigurationSectionView configurationSectionView = AdminToolsHomePage.getConfigurationSection();
Expand All @@ -106,7 +118,7 @@ void adminToolsHomePageBackend(TestConfiguration testConfiguration)
}

@Test
@Order(2)
@Order(3)
void adminToolViewLastLogLinesModal(TestUtils testUtils)
{
DashboardConfigurationSectionView configurationSectionView = AdminToolsHomePage.getConfigurationSection();
Expand All @@ -120,7 +132,7 @@ void adminToolViewLastLogLinesModal(TestUtils testUtils)
}

@Test
@Order(3)
@Order(4)
void adminToolsHomePageFiles(TestUtils testUtils)
{
excludeContent(testUtils, excludedLines);
Expand All @@ -135,7 +147,7 @@ void adminToolsHomePageFiles(TestUtils testUtils)
}

@Test
@Order(4)
@Order(5)
void adminToolDownloadArchiveModal()
{
DashboardFilesSectionView filesSectionView = AdminToolsHomePage.getFilesSection();
Expand Down Expand Up @@ -167,7 +179,7 @@ void adminToolDownloadArchiveModal()
}

@Test
@Order(5)
@Order(6)
void adminToolsHomePageFilesNotAdmin(TestUtils testUtils)
{
testUtils.login(USER_NAME, PASSWORD);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,15 @@ public static DashboardFilesSectionView getFilesSection()
gotoPage();
return new DashboardFilesSectionView();
}

/**
* Check if the page is the same as Admin Tools WebHome.
*/
public static boolean isCurrentPage(ViewPage vp)
{
return vp.getMetaDataValue("page").equals(ADMIN_TOOLS_PAGE) && vp.getMetaDataValue("space")
.equals(ADMIN_TOOLS_SPACE);
}

}

0 comments on commit 1736eb5

Please sign in to comment.