Skip to content

Commit

Permalink
Create functional tests for the health check section xwikisas#39
Browse files Browse the repository at this point in the history
* Added comments
  • Loading branch information
ChiuchiuSorin committed Jan 18, 2024
1 parent f39efb2 commit b0387a7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ public LastNLinesModalView clickViewLastLogsModal()
BACKEND_SECTION_VIEW_LAST_LOGS_MODAL_ID);
}

/**
* Get the {@link WebElement} representing the error that a non admin user should see.
*/
public WebElement getNonAdminUserView()
{
return this.getDriver().findElement(By.cssSelector(".xwikirenderingerror"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ public void clickConfigurationHyperlink()
filesContent.findElement(By.id("filesConfig")).click();
}

/**
* Get the {@link WebElement} representing the error that a non admin user should see.
*/
public WebElement getNonAdminUserView()
{
return this.getDriver().findElement(By.cssSelector(".xwikirenderingerror"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,46 +42,73 @@ public void clickHelpLinksHyperlink()
helpLinksPageHyperlink.click();
}

/**
* Start the health check job.
*/
public void clickHealthCheckJobStartButton()
{
healthCheckContent.findElement(By.id("healthCheckJobStart")).click();
}

/**
* Get the {@link WebElement} representing the time since the last health check.
*/
public WebElement getHealthCheckTimeElapsed()
{
return healthCheckContent.findElement(By.cssSelector("div.health-check-wrapper > p"));
}

/**
* Get the {@link WebElement} representing the result of the health check.
*/
public WebElement getHealthCheckResult()
{
return healthCheckContent.findElement(By.className("health-check-result-message"));
}

/**
* Get the {@link WebElement} representing the progress of the health check.
*/
public WebElement getJobProgress()
{
return healthCheckContent.findElement(By.cssSelector(".ui-progress"));
}

/**
* Get the {@link WebElement} representing the error that a non admin user should see.
*/
public WebElement getNonAdminUserView()
{
return this.getDriver().findElement(By.cssSelector(".xwikirenderingerror"));
}

/**
* Wait until the health check job is done by checking if the progress bar disappeared.
*/
public void waitUntilJobIsDone()
{
this.getDriver().waitUntilElementDisappears(healthCheckContent, By.cssSelector(".ui-progress"));
}

/**
* Click a toggle to view or hide the result logs.
*/
public void toggleLog()
{
healthCheckContent.findElement(By.cssSelector(".collapse-toggle")).click();
}

/**
* Get the result logs.
*/
public WebElement getResultLog()
{
return healthCheckContent.findElement(By.cssSelector(".log"));
}

/**
* Get the number of logs stored inside the health check job.
*/
public int getNumberOfLogs()
{
return healthCheckContent.findElements(By.cssSelector(".log-item")).size();
Expand Down

0 comments on commit b0387a7

Please sign in to comment.