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
1 change: 1 addition & 0 deletions src/org/labkey/test/Locators.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ private Locators() { }
public static final Locator.XPathLocator panelWebpartTitle = Locator.byClass("labkey-wp-title-text");
public static final Locator.XPathLocator folderTitle = Locator.tagWithClass("a", "lk-body-title-folder");
public static final Locator.XPathLocator loadingSpinner = Locator.byClass("fa-spinner");
public static final Locator.CssLocator floatingGridHeader = Locator.css(".grid-panel__grid .table-responsive thead, .editable-grid__container .table-responsive thead");

public static Locator.XPathLocator headerContainer()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected ElementCache newElementCache()

public T setSystemFieldVisibility(String fieldName, boolean isVisible)
{
var xpath = "//div[contains(@class, 'domain-system-fields__grid')]//td[text()='" + fieldName + "']/preceding-sibling::td//input";
var xpath = "//div[contains(@class, 'domain-system-fields__grid')]//td[.//div[text()='" + fieldName + "']]/preceding-sibling::td//input";
var checkBox = Checkbox.Checkbox(Locator.xpath(xpath));
var enabledCheckBox = checkBox.find(getFieldsPanel());
enabledCheckBox.set(isVisible);
Expand Down
2 changes: 1 addition & 1 deletion src/org/labkey/test/components/ui/grids/EditableGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ protected class ElementCache extends Component<?>.ElementCache

Checkbox getCheckbox(int rowIndex)
{
return new Checkbox(Locator.css("td > input[type=checkbox]").findElement(getRow(rowIndex)));
return new Checkbox(Locator.css("td > .table-cell-content > input[type=checkbox]").findElement(getRow(rowIndex)));
}

protected WebElement getColumnHeaderCell(CharSequence columnIdentifier)
Expand Down
2 changes: 1 addition & 1 deletion src/org/labkey/test/components/ui/grids/GridRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public WebElement getCell(CharSequence columnIdentifier)
public String getCellStyle(CharSequence columnIdentifier)
{
var cell = getCell(columnIdentifier);
return Locator.tagWithClass("span", "ws-pre-wrap").findElement(cell).getAttribute("style");
return Locator.byClass("table-cell-content").child(Locator.tag("span")).findElement(cell).getAttribute("style");
}

/**
Expand Down
7 changes: 2 additions & 5 deletions src/org/labkey/test/components/ui/grids/ResponsiveGrid.java
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,8 @@ public void clickColumnMenuItem(CharSequence columnIdentifier, String menuText,
WebElement headerCell = elementCache().getColumnHeaderCell(columnIdentifier);
// Scroll to middle in order to make room for the dropdown menu
getWrapper().scrollToMiddle(headerCell);

WebElement toggle = Locator.tagWithClass("span", "fa-chevron-circle-down")
.findElement(headerCell);
getWrapper().shortWait().until(ExpectedConditions.elementToBeClickable(toggle));
toggle.click();
getWrapper().shortWait().until(ExpectedConditions.elementToBeClickable(headerCell));
headerCell.click();

// Use getDriver() because the grid menus are rendered in a "react portal" at the end of the HTML body, so they
// are totally detached from the rest of the grid.
Expand Down
24 changes: 15 additions & 9 deletions src/org/labkey/test/util/selenium/ScrollUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import org.labkey.test.util.DataRegionTable;
import org.labkey.test.util.TestLogger;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Point;
import org.openqa.selenium.Rectangle;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Locatable;
Expand Down Expand Up @@ -53,17 +55,15 @@ public static boolean scrollUnderFloatingHeader(WebElement webElement)
Locators.floatingHeaderContainer(),
Locators.appFloatingHeader(),
Locators.domainDesignerFloatingHeader(),
DataRegionTable.Locators.floatingHeader().notHidden());
DataRegionTable.Locators.floatingHeader().notHidden(),
Locators.floatingGridHeader);

int headerHeight = 0;
for (WebElement floatingHeader : floatingHeaders)
if (!floatingHeaders.isEmpty())
{
headerHeight += floatingHeader.getSize().getHeight();
}
if (headerHeight > 0)
{
int elYInViewPort = webElement.getLocation().getY() - getWindowScrollY(webDriver).intValue();
if (headerHeight > elYInViewPort)
Rectangle rect = webElement.getRect();
Point elementCenter = new Point(rect.getX() + rect.getWidth()/2, rect.getY() + rect.getHeight()/2);

if (floatingHeaders.stream().anyMatch(el -> pointInRect(elementCenter, el.getRect())))
{
TestLogger.debug("Scrolled under floating headers:\n" + floatingHeaders.stream().map(WebElement::toString).collect(Collectors.joining("\n")));
((Locatable) webElement).getCoordinates().inViewPort(); // 'inViewPort()' will scroll element into view
Expand All @@ -73,6 +73,12 @@ public static boolean scrollUnderFloatingHeader(WebElement webElement)
return false;
}

private static boolean pointInRect(Point point, Rectangle rect)
{
return rect.getX() <= point.getX() && point.getX() <= rect.getX() + rect.getWidth() &&
rect.getY() <= point.getY() && point.getY() <= rect.getY() + rect.getHeight();
}

public static Long getWindowScrollY(WebDriver webDriver)
{
Number N = (Number) executeScript(webDriver, "return window.scrollY;");
Expand Down