Skip to content
Merged
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
8 changes: 8 additions & 0 deletions src/org/labkey/test/components/ui/AppPageHeader.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ public String getLabelColor()
throw new UnsupportedOperationException("Label color is not supported by AppPageHeader.");
}

/**
* @throws UnsupportedOperationException Sample color is not supported by AppPageHeader.
*/
public String getSampleColor()
{
throw new UnsupportedOperationException("Sample color is not supported by AppPageHeader.");
}

@Override
protected ElementCache newElementCache()
{
Expand Down
13 changes: 13 additions & 0 deletions src/org/labkey/test/components/ui/PageDetailHeader.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ public String getLabelColor()
return tryMapElement(elementCache().colorIcon, el -> el.getCssValue("background-color"));
}

/**
* Get the rgb style value for the sample color swatch that precedes the title. A sample with its own color shows
* this swatch instead of the sample type's label color in the subtitle.
*
* @return A string such as "rgb(104, 204, 202)", or an empty string if there is no sample color swatch.
*/
@Override
public String getSampleColor()
{
return tryMapElement(elementCache().sampleColorIcon, el -> el.getCssValue("background-color"));
}

@Override
protected ElementCache elementCache()
{
Expand Down Expand Up @@ -81,6 +93,7 @@ protected Locator.XPathLocator getIconLocator()
}

final WebElement colorIcon = Locator.byClass("color-icon__circle-small").findWhenNeeded(subtitle);
final WebElement sampleColorIcon = Locator.byClass("sample-color-header").findWhenNeeded(title);
}

public static class PageDetailHeaderFinder extends WebDriverComponentFinder<PageDetailHeader, PageDetailHeaderFinder>
Expand Down
13 changes: 13 additions & 0 deletions src/org/labkey/test/components/ui/grids/DetailTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,19 @@ public String getFieldValue(String fieldlabel)
return getField(fieldlabel).getText();
}

/**
* Return the color of the swatch rendered in a field's value, for example the sample color on a details panel.
*
* @param fieldLabel The label of the field to get.
* @return A string such as "rgb(104, 204, 202)", or an empty string if the field has no color swatch.
**/
public String getFieldColor(String fieldLabel)
{
WebElement icon = Locator.tagWithClassContaining("i", "color-icon__circle")
.findElementOrNull(getField(fieldLabel));
return icon == null ? "" : icon.getCssValue("background-color");
}

/**
* Gets the value of a cell identified by its data-fieldKey attribute
* @param fieldKey value of the data-fieldKey attribute on the intended element
Expand Down
12 changes: 12 additions & 0 deletions src/org/labkey/test/components/ui/grids/GridRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,18 @@ public String getCellStyle(CharSequence columnIdentifier)
return Locator.byClass("table-cell-content").child(Locator.tag("span")).findElement(cell).getAttribute("style");
}

/**
* gets the color of the swatch rendered in the specified cell, for example a sample color or a sample type's
* label color
* @return A string such as "rgb(104, 204, 202)", or an empty string if the cell has no color swatch
*/
public String getCellColor(CharSequence columnIdentifier)
{
WebElement icon = Locator.tagWithClassContaining("i", "color-icon__circle")
.findElementOrNull(getCell(columnIdentifier));
return icon == null ? "" : icon.getCssValue("background-color");
}

/**
* Returns true if the row contains all of the specified column/value pairs
* @param partialMap Map of key (column) value (text)
Expand Down
Loading