Skip to content
Open
Show file tree
Hide file tree
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
10 changes: 10 additions & 0 deletions src/org/labkey/test/BaseWebDriverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.commons.lang3.time.FastDateFormat;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.hc.core5.http.HttpStatus;
import org.awaitility.Awaitility;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -2734,6 +2735,15 @@ private File clickExportImageIcon(String chartParentCls, int chartIndex, Locator
}
}

public void verifyImagePopupInGrid(File imageFile)
{
mouseOver(Locator.xpath("//img[contains(@title, '" + imageFile.getName() + "')]"));
longWait().until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#helpDiv")));
String src = Locator.xpath("//div[@id='helpDiv']//img[contains(@src, 'download')]").findElement(getDriver()).getAttribute("src");
assertTrue("Wrong image in popup: " + src, src.contains(imageFile.getName()));
assertEquals("Bad response from image pop-up", HttpStatus.SC_OK, WebTestHelper.getHttpResponse(src).getResponseCode());
}

public List<Map<String, Object>> loadTsv(File tsv)
{
try (TabLoader loader = new TabLoader(tsv, true))
Expand Down
21 changes: 20 additions & 1 deletion src/org/labkey/test/components/list/ManageListsGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,30 @@ public File exportSelectedLists()

public BeginPage deleteSelectedLists()
{
clickHeaderButtonAndWait("Delete");
if (getHeaderButton("Delete").getAttribute("class").contains("labkey-down-arrow"))
clickHeaderMenu("Delete", true, "Delete List");
else
clickHeaderButtonAndWait("Delete");

ConfirmDeletePage confirmPage = new ConfirmDeletePage(getDriver());
return confirmPage.confirmDelete();
}

public BeginPage deleteAllDataFromSelectedLists()
{
clickHeaderMenu("Delete", true, "Delete All Data from List");
ConfirmDeletePage confirmPage = new ConfirmDeletePage(getDriver(), "Confirm Delete All Data");
return confirmPage.confirmDelete();
}

public ManageListsGrid selectLists(List<String> listNames)
{
for (String listName : listNames)
checkCheckbox(getRowIndex("Name", listName));

return this;
}

public List<String> getListNames()
{
return getColumnDataAsText("Name");
Expand Down
10 changes: 9 additions & 1 deletion src/org/labkey/test/pages/list/ConfirmDeletePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@

public class ConfirmDeletePage extends LabKeyPage<ConfirmDeletePage.ElementCache>
{
private String _deleteBtnText;

public ConfirmDeletePage(WebDriver driver)
{
this(driver, "Confirm Delete");
}

public ConfirmDeletePage(WebDriver driver, String deleteBtnText)
{
super(driver);
_deleteBtnText = deleteBtnText;
}

public BeginPage confirmDelete()
Expand All @@ -27,6 +35,6 @@ protected ElementCache newElementCache()

protected class ElementCache extends LabKeyPage<?>.ElementCache
{
WebElement deleteButton = Locator.lkButton("Confirm Delete").findWhenNeeded(this);
WebElement deleteButton = Locator.lkButton(_deleteBtnText == null ? "Confirm Delete" : _deleteBtnText).findWhenNeeded(this);
}
}
8 changes: 2 additions & 6 deletions src/org/labkey/test/tests/InlineImagesListTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,7 @@ public final void testList() throws Exception
// Mouse over the logo, migh help with the following mouse over the image.
mouseOver(Locator.tagWithAttributeContaining("img", "src", "logo.image"));
sleep(500);
mouseOver(Locator.xpath("//img[contains(@title, '" + LRG_PNG_FILE.getName() + "')]"));
longWait().until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#helpDiv")));
String src = Locator.xpath("//div[@id='helpDiv']//img[contains(@src, 'download')]").findElement(getDriver()).getAttribute("src");
assertTrue("Wrong image in popup: " + src, src.contains(LRG_PNG_FILE.getName()));
assertEquals("Bad response from image pop-up", HttpStatus.SC_OK, WebTestHelper.getHttpResponse(src).getResponseCode());
verifyImagePopupInGrid(LRG_PNG_FILE);

// Commenting out for now. There is a random behavior where sometimes the thumbnail image will not show up when you move from one cell to another.
/*
Expand Down Expand Up @@ -303,7 +299,7 @@ public final void testList() throws Exception
sleep(500);
mouseOver(Locator.xpath("//img[contains(@title, '" + LRG_PNG_FILE.getName() + "')]"));
shortWait().until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("#helpDiv")));
src = Locator.xpath("//div[@id='helpDiv']//img[contains(@src, 'download')]").findElement(getDriver()).getAttribute("src");
var src = Locator.xpath("//div[@id='helpDiv']//img[contains(@src, 'download')]").findElement(getDriver()).getAttribute("src");
assertTrue("Wrong image in popup: " + src, src.contains(LRG_PNG_FILE.getName()));
assertEquals("Bad response from image pop-up", HttpStatus.SC_OK, WebTestHelper.getHttpResponse(src).getResponseCode());

Expand Down
11 changes: 5 additions & 6 deletions src/org/labkey/test/tests/TriggerScriptTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -824,12 +824,11 @@ public void updateDataSetRow(int id, String tableName, Map<String, String> data)
*/
private void cleanUpListRows()
{
goToManagedList(LIST_NAME);
clickButton("Delete All Rows", 0);
waitForElement(Locator.xpath("//*[text()='Confirm Deletion']"));
clickButton("Yes", 0);
waitForText("Success");
clickButton("OK");
var listsPage = goToManageLists();
var grid = listsPage.getGrid();
grid.uncheckAllOnPage();
grid.selectLists(List.of(LIST_NAME));
grid.deleteAllDataFromSelectedLists();
}

/**
Expand Down
Loading