Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/org/labkey/test/pages/core/login/LoginConfigurePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;

import java.util.List;

Expand Down Expand Up @@ -140,6 +141,37 @@ public LoginConfigRow getSecondaryConfigurationRow(String description)
.withDescription(description).waitFor(toggleSecondaryConfiguration());
}

// Login attempt settings (in the Global Settings panel)

public LoginConfigurePage setLoginAttemptEnabled(boolean enable)
{
elementCache().loginAttemptEnabledCheckbox.set(enable);
return this;
}

public boolean getLoginAttemptEnabled()
{
return elementCache().loginAttemptEnabledCheckbox.get();
}

public LoginConfigurePage setLoginAttemptLimit(String value)
{
new Select(elementCache().loginAttemptLimitSelect).selectByValue(value);
return this;
}

public LoginConfigurePage setLoginAttemptPeriod(String value)
{
new Select(elementCache().loginAttemptPeriodSelect).selectByValue(value);
return this;
}

public LoginConfigurePage setLoginAttemptResetTime(String value)
{
new Select(elementCache().loginAttemptResetTimeSelect).selectByValue(value);
return this;
}

public ShowAdminPage clickSaveAndFinish()
{
shortWait().until(ExpectedConditions.elementToBeClickable(elementCache().saveAndFinishBtn()));
Expand All @@ -166,6 +198,11 @@ protected class ElementCache extends LabKeyPage<?>.ElementCache
.withText("Add New Secondary Configuration").timeout(WAIT_FOR_JAVASCRIPT);
MultiMenu addSecondaryMenu = secondaryMenuFinder.findWhenNeeded(this);

Checkbox loginAttemptEnabledCheckbox = new Checkbox(this, "Limit unsuccessful login attempts");
WebElement loginAttemptLimitSelect = Locator.css("select[name='LoginAttemptLimit']").findWhenNeeded(this);
WebElement loginAttemptPeriodSelect = Locator.css("select[name='LoginAttemptPeriod']").findWhenNeeded(this);
WebElement loginAttemptResetTimeSelect = Locator.css("select[name='LoginAttemptResetTime']").findWhenNeeded(this);

WebElement globalSettingsPanel()
{
return Locator.tagWithClass("div", "panel-default")
Expand Down
Loading