Skip to content

LKSM Folder Archives Test Automation #2512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
2 changes: 2 additions & 0 deletions src/org/labkey/test/BaseWebDriverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ public abstract class BaseWebDriverTest extends LabKeySiteWrapper implements Cle
public static final String ALL_ILLEGAL_QUERY_KEY_CHARACTERS = StringUtils.join(FieldKey.getIllegalChars(), "");
// See TSVWriter.shouldQuote. Generally we are not able to use the tab and new line characters when creating field names in the UI, but including here for completeness
public static final String[] TRICKY_IMPORT_FIELD_CHARACTERS = {"\\", "\"", "\\t", ",", "\\n", "\\r"};
// Sample type names cannot contain: <>[]{};,`"~!@#$%^*=|?\
public static final String[] TRICKY_DOMAIN_NAME_CHARACTERS = {"&", "()", "-", "_", ":", "'", ".", "/"};

public static final String TRICKY_CHARACTERS = "><&/%\\' \"1\u00E4\u00F6\u00FC\u00C5";
public static final String TRICKY_CHARACTERS_NO_QUOTES = "></% 1\u00E4\u00F6\u00FC\u00C5";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected void waitForReady()
WebDriverWrapper.waitFor(()-> elementCache().body.isDisplayed() &&
!elementCache().title.getText().isEmpty() &&
!BootstrapLocators.loadingSpinner.existsIn(this),
"The delete confirmation dialog did not become ready.", 1_000);
"The delete / archive confirmation dialog did not become ready.", 1_000);
}

public DeleteConfirmationDialog<ConfirmPage> setSkipAuditEventCheck(boolean skipAuditEventCheck)
Expand All @@ -91,11 +91,16 @@ public ConfirmPage confirmDelete()
}

public ConfirmPage confirmDelete(Integer waitSeconds)
{
return clickConfirmButton(waitSeconds, "Yes, Delete");
}

protected ConfirmPage clickConfirmButton(Integer waitSeconds, String buttonText)
{
Integer count = getCountFromTitle();
AuditLogHelper.AuditEvent auditEventName = getAuditEvent();

var confirmPage = _confirmationSynchronizationFunction.apply(() -> this.dismiss("Yes, Delete", waitSeconds));
var confirmPage = _confirmationSynchronizationFunction.apply(() -> this.dismiss(buttonText, waitSeconds));

if (!skipAuditEventCheck && count != null && auditEventName != null && !TestProperties.isTrialServer())
verifyAuditEvents(getWrapper(), getWrapper().getCurrentProject(), auditEventName, count);
Expand Down
39 changes: 39 additions & 0 deletions src/org/labkey/test/components/ui/FolderArchiveDialog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package org.labkey.test.components.ui;

import org.jetbrains.annotations.NotNull;
import org.labkey.test.WebDriverWrapper;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions;

import java.util.function.Supplier;

public class FolderArchiveDialog <ConfirmPage extends WebDriverWrapper> extends DeleteConfirmationDialog<ConfirmPage>
{

public FolderArchiveDialog(String dialogTitle, @NotNull WebDriverWrapper sourcePage, WebElement staleOnConfirmElement, Supplier<ConfirmPage> confirmPageSupplier)
{
super(dialogTitle, sourcePage, runnable -> {
runnable.run();
sourcePage.longWait().until(ExpectedConditions.stalenessOf(staleOnConfirmElement));
return confirmPageSupplier.get();
}
);

}

public ConfirmPage clickYesArchive()
{
return clickYesArchive(10);
}

public ConfirmPage clickYesArchive(Integer waitSeconds)
{
return super.clickConfirmButton(waitSeconds, "Yes, Archive Folder");
}

public void clickCancel()
{
this.dismiss("Cancel");
}

}
2 changes: 1 addition & 1 deletion src/org/labkey/test/components/ui/navigation/NavBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public abstract class NavBar extends WebDriverComponent<NavBar.ElementCache>

protected NavBar(WebDriver driver)
{
this(Locator.tagWithClass("nav", "navbar-container").findElement(driver), driver);
this(Locator.tagWithClass("nav", "navbar").findElement(driver), driver);
}

protected NavBar(WebElement element, WebDriver driver)
Expand Down