Skip to content

Commit

Permalink
Add functional tests xwikisas#16 - draft
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiuchiuSorin committed Nov 10, 2023
1 parent d07aae7 commit d629057
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#includeMacros("AdminTools.Code.Macros")
#viewLastNLinesMoldal("configuration")
#if ($configuration['serverFound'] == 'true')
<div class="adminToolsDashboardItem">
<div id="adminToolsBackendSection" class="adminToolsDashboardItem">
<h2>$services.icon.renderHTML('world')
$escapetool.xml($services.localization.render('adminTools.dashboard.section.backend.title'))</h2>
<p>$escapetool.xml($services.localization.render('adminTools.dashboard.section.backend.description'))</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#viewLastNLinesMoldal("files")
#downloadArchiveModal()
#if ($found)
<div class="adminToolsDashboardItem">
<div id="adminToolsFilesSection" class="adminToolsDashboardItem">
<h2>$services.icon.renderHTML('download')
$escapetool.xml($services.localization.render('adminTools.dashboard.section.download.title'))</h2>
<p>$escapetool.xml($services.localization.render('adminTools.dashboard.section.download.description'))</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
## 02110-1301 USA, or see the FSF site: http://www.fsf.org.
## ---------------------------------------------------------------------------
#if($security['serverFound'] == 'true')
<div class="adminToolsDashboardItem">
<div id="adminToolsSecuritySection" class="adminToolsDashboardItem">
<h2>$services.icon.renderHTML('lock')
$escapetool.xml($services.localization.render('adminTools.dashboard.section.security.title'))</h2>
<p>$escapetool.xml($services.localization.render('adminTools.dashboard.section.security.description'))</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,19 @@
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.test.docker.junit5.TestConfiguration;
import org.xwiki.test.docker.junit5.UITest;
import org.xwiki.test.docker.junit5.servletengine.ServletEngine;
import org.xwiki.test.ui.TestUtils;

import com.xwiki.admintools.test.po.AdminToolsHomePage;
import com.xwiki.admintools.test.po.AdminToolsViewPage;

import static org.junit.jupiter.api.Assertions.assertEquals;

@UITest
@UITest(servletEngine = ServletEngine.TOMCAT, servletEngineTag = "9")
class AdminToolsIT
{
private final List<String> supportedServers = List.of("TOMCAT");
Expand Down Expand Up @@ -65,5 +68,10 @@ void AdminToolsHomePage(TestUtils testUtils, TestConfiguration testConfiguration
} else {
assertEquals(2, webHomePage.getDashboardElements().size());
}
WebElement test1 = webHomePage.getBackendContent();
String a = test1.getText();
System.out.println(test1.getText());
List<WebElement> test2 = test1.findElements(By.tagName("li"));
System.out.println(test1.getCssValue("width"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,24 @@

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.xwiki.test.ui.po.ViewPage;

public class AdminToolsViewPage extends ViewPage
{
public List<WebElement> dashboardElements =
getDriver().findElements(By.xpath("//div[contains(@class, 'adminToolsDashboardItem')]"));

@FindBy(xpath = "//div[@id = 'adminToolsBackendSection'] /ul")
public WebElement backendContent;

public List<WebElement> getDashboardElements()
{
return dashboardElements;
}

public WebElement getBackendContent()
{
return backendContent;
}
}

0 comments on commit d629057

Please sign in to comment.