From f66e7549fcfe08f68912694fd428a2caa3089ebe Mon Sep 17 00:00:00 2001 From: ChrisJoosse Date: Thu, 11 Sep 2025 13:27:48 -0700 Subject: [PATCH 1/6] Add setter for ConditionalFormatPanel that takes a ConditionalFormat --- .../domain/ConditionalFormatPanel.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/org/labkey/test/components/domain/ConditionalFormatPanel.java b/src/org/labkey/test/components/domain/ConditionalFormatPanel.java index b776ff900b..9258344509 100644 --- a/src/org/labkey/test/components/domain/ConditionalFormatPanel.java +++ b/src/org/labkey/test/components/domain/ConditionalFormatPanel.java @@ -1,5 +1,6 @@ package org.labkey.test.components.domain; +import org.labkey.remoteapi.domain.ConditionalFormat; import org.labkey.remoteapi.query.Filter; import org.labkey.test.Locator; import org.labkey.test.components.WebDriverComponent; @@ -24,6 +25,32 @@ public ConditionalFormatPanel(WebElement element, ConditionalFormatDialog dialog _dialog = dialog; } + public ConditionalFormatPanel setConditionalFormat(ConditionalFormat conditionalFormat) + { + for (int i = 0; i < conditionalFormat.getQueryFilter().size(); i++) + { + var filterCondition = conditionalFormat.getQueryFilter().get(i); + if (i==0) + { + setFirstCondition(filterCondition.getOperator()); + if (filterCondition.getValue() != null) + setFirstValue(filterCondition.getValue().toString()); + } + if (i==1) + { + setSecondCondition(filterCondition.getOperator()); + if (filterCondition.getValue() != null) + setSecondValue(filterCondition.getValue().toString()); + } + } + setBoldCheckbox(conditionalFormat.getBold()); + setItalicsCheckbox(conditionalFormat.getItalic()); + setStrikethroughCheckbox(conditionalFormat.getStrikethrough()); + setTextColor(conditionalFormat.getTextColor()); + setFillColor(conditionalFormat.getBackgroundColor()); + return this; + } + public ConditionalFormatPanel setFirstCondition(Filter.Operator operator) { expand(); From 7982a0d62c3aee0979c29d7174d8bf837d5d0a8f Mon Sep 17 00:00:00 2001 From: ChrisJoosse Date: Thu, 11 Sep 2025 13:28:35 -0700 Subject: [PATCH 2/6] provide means for DetailTable and GridRow to be format-pill-aware --- src/org/labkey/test/components/ui/grids/DetailTable.java | 5 +++++ src/org/labkey/test/components/ui/grids/GridRow.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/org/labkey/test/components/ui/grids/DetailTable.java b/src/org/labkey/test/components/ui/grids/DetailTable.java index 5bf3c13446..786f0f68a0 100644 --- a/src/org/labkey/test/components/ui/grids/DetailTable.java +++ b/src/org/labkey/test/components/ui/grids/DetailTable.java @@ -105,6 +105,11 @@ else if (elementCache().siblingField(identifier).isDisplayed()) } } + public boolean fieldHasFormatPill(String identifier) + { + return Locator.tagWithClass("*", "status-pill").existsIn(getField(identifier)); + } + /** * Return the value of a cell identified by the text in the left most column. * diff --git a/src/org/labkey/test/components/ui/grids/GridRow.java b/src/org/labkey/test/components/ui/grids/GridRow.java index 932b3bf1bf..0ae1f676a0 100644 --- a/src/org/labkey/test/components/ui/grids/GridRow.java +++ b/src/org/labkey/test/components/ui/grids/GridRow.java @@ -45,6 +45,11 @@ public boolean hasSelectColumn() return _grid.hasSelectColumn(); } + public boolean hasConditionalFormatPill(CharSequence columnIdentifier) + { + return Locator.tagWithClass("*", "status-pill").existsIn(getCell(columnIdentifier)); + } + /** * Returns the selected state of the row selector checkbox, if one is present * @return true if the select checkbox is checked. From 9967b90a956d7f0dad9bc01c51ee009c87ce739b Mon Sep 17 00:00:00 2001 From: ChrisJoosse Date: Fri, 19 Sep 2025 14:21:58 -0700 Subject: [PATCH 3/6] getters for ConditionalFormatPanel --- .../domain/ConditionalFormatPanel.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/src/org/labkey/test/components/domain/ConditionalFormatPanel.java b/src/org/labkey/test/components/domain/ConditionalFormatPanel.java index 9258344509..5f1efcff8e 100644 --- a/src/org/labkey/test/components/domain/ConditionalFormatPanel.java +++ b/src/org/labkey/test/components/domain/ConditionalFormatPanel.java @@ -57,12 +57,21 @@ public ConditionalFormatPanel setFirstCondition(Filter.Operator operator) elementCache().firstConditionSelect().selectByValue(operator.getUrlKey()); return this; } + public String getFirstCondition() + { + return elementCache().firstConditionSelect().getFirstSelectedOption().getText(); + } + public ConditionalFormatPanel setFirstValue(String value) { expand(); elementCache().firstFilterValueInput().setValue(value); return this; } + public String getFirstValue() + { + return elementCache().firstFilterValueInput().getValue(); + } public ConditionalFormatPanel setSecondCondition(Filter.Operator operator) { @@ -70,12 +79,21 @@ public ConditionalFormatPanel setSecondCondition(Filter.Operator operator) elementCache().secondConditionSelect().selectByValue(operator.getUrlKey()); return this; } + public String getSecondCondition() + { + return elementCache().secondConditionSelect().getFirstSelectedOption().getText(); + } + public ConditionalFormatPanel setSecondValue(String value) { expand(); elementCache().secondFilterValueInput().setValue(value); return this; } + public String getSecondValue() + { + return elementCache().secondFilterValueInput().getValue(); + } public ConditionalFormatPanel setBoldCheckbox(boolean checked) { @@ -83,12 +101,24 @@ public ConditionalFormatPanel setBoldCheckbox(boolean checked) elementCache().boldCheckbox().set(checked); return this; } + + public boolean getBoldChecked() + { + return elementCache().boldCheckbox().get(); + } + public ConditionalFormatPanel setItalicsCheckbox(boolean checked) { expand(); elementCache().italicsCheckbox().set(checked); return this; } + + public boolean getItalicsChecked() + { + return elementCache().italicsCheckbox().get(); + } + public ConditionalFormatPanel setStrikethroughCheckbox(boolean checked) { expand(); @@ -96,6 +126,11 @@ public ConditionalFormatPanel setStrikethroughCheckbox(boolean checked) return this; } + public boolean getStrikethroughChecked() + { + return elementCache().strikethroughCheckbox().get(); + } + public ConditionalFormatPanel setTextColor(String colorHex) { expand(); @@ -105,6 +140,12 @@ public ConditionalFormatPanel setTextColor(String colorHex) return this; } + public String getTextStyle() + { + expand(); + return elementCache().textColorPreview.getAttribute("style"); + } + public ConditionalFormatPanel setFillColor(String colorHex) { expand(); @@ -114,6 +155,18 @@ public ConditionalFormatPanel setFillColor(String colorHex) return this; } + public String getFillStyle() + { + expand(); + return elementCache().fillColorPreview.getAttribute("style"); + } + + public String getPreviewTextStyle() + { + expand(); + return elementCache().previewTextInput.getAttribute("style"); + } + public ConditionalFormatDialog clickRemove() { expand(); @@ -198,7 +251,10 @@ public Checkbox strikethroughCheckbox() final Locator collapseIconLocator = Locator.tagWithClass("div", "domain-validator-collapse-icon"); final WebElement textColor = Locator.tagWithName("button", "domainpropertiesrow-textColor").findWhenNeeded(this); + final WebElement textColorPreview = Locator.tagWithClass("div", "domain-color-preview").index(0).findWhenNeeded(this); final WebElement fillColor = Locator.tagWithName("button", "domainpropertiesrow-backgroundColor").findWhenNeeded(this); + final WebElement fillColorPreview = Locator.tagWithClass("div", "domain-color-preview").index(1).findWhenNeeded(this); + final WebElement previewTextInput = Locator.tagWithAttribute("input", "value", "Preview Text").findWhenNeeded(this); final WebElement removeButton = Locator.button("Remove Formatting").findWhenNeeded(this); } From 497f0c1b5e1d14b5f88e7e9d2c9be46cf87781f5 Mon Sep 17 00:00:00 2001 From: ChrisJoosse Date: Fri, 19 Sep 2025 14:22:54 -0700 Subject: [PATCH 4/6] get style for a grid value-wrapper --- src/org/labkey/test/components/ui/grids/GridRow.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/org/labkey/test/components/ui/grids/GridRow.java b/src/org/labkey/test/components/ui/grids/GridRow.java index 0ae1f676a0..4e0906efbd 100644 --- a/src/org/labkey/test/components/ui/grids/GridRow.java +++ b/src/org/labkey/test/components/ui/grids/GridRow.java @@ -95,6 +95,16 @@ public WebElement getCell(CharSequence columnIdentifier) return getCell(_grid.getColumnIndex(columnIdentifier)); } + /** + * gets the style attribute of the value-wrapper for the specified cell + * @return + */ + public String getCellStyle(CharSequence columnIdentifier) + { + var cell = getCell(columnIdentifier); + return Locator.tagWithClass("span", "ws-pre-wrap").findElement(cell).getAttribute("style"); + } + /** * Returns true if the row contains all of the specified column/value pairs * @param partialMap Map of key (column) value (text) From 0581250c297f4761e59fd0602c9ca02269f463d5 Mon Sep 17 00:00:00 2001 From: ChrisJoosse Date: Thu, 25 Sep 2025 09:59:11 -0700 Subject: [PATCH 5/6] avoid timing condition in DetailTable --- .../test/components/ui/grids/DetailTable.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/org/labkey/test/components/ui/grids/DetailTable.java b/src/org/labkey/test/components/ui/grids/DetailTable.java index 786f0f68a0..9ab9e68370 100644 --- a/src/org/labkey/test/components/ui/grids/DetailTable.java +++ b/src/org/labkey/test/components/ui/grids/DetailTable.java @@ -99,6 +99,10 @@ else if (elementCache().siblingField(identifier).isDisplayed()) { return elementCache().siblingField(identifier); } + else if (elementCache().dataFieldByKey(identifier).isDisplayed()) + { + return elementCache().dataFieldByKey(identifier); + } else { throw new NoSuchElementException(String.format("Could not find field '%s'.", identifier)); @@ -234,18 +238,21 @@ protected class ElementCache extends Component.ElementCache { public final WebElement dataByLabel(String fieldLabel) { - return Locator.tagWithAttribute("td", "data-caption", fieldLabel).findWhenNeeded(this); + return Locator.tagWithAttribute("td", "data-caption", fieldLabel).findWhenNeeded(this) + .withTimeout(2000); } public final WebElement dataFieldByKey(String fieldKey) { - return Locator.tagWithAttribute("td", "data-fieldkey", fieldKey).findElement(this); + return Locator.tagWithAttribute("td", "data-fieldkey", fieldKey) + .findWhenNeeded(this).withTimeout(2000); } // Some tables will show a value in a td with no attributes, use the td that has the text (label) to find the value. public final WebElement siblingField(String fieldLabel) { - return Locator.tagContainingText("td", fieldLabel).followingSibling("td").findWhenNeeded(this); + return Locator.tagContainingText("td", fieldLabel).followingSibling("td") + .findWhenNeeded(this).withTimeout(2000); } } From 4e1a476fffaec1c59295bd87f0413d5fd551b1c5 Mon Sep 17 00:00:00 2001 From: ChrisJoosse Date: Thu, 25 Sep 2025 20:52:17 -0700 Subject: [PATCH 6/6] revert waits for field elements --- src/org/labkey/test/components/ui/grids/DetailTable.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/org/labkey/test/components/ui/grids/DetailTable.java b/src/org/labkey/test/components/ui/grids/DetailTable.java index 9ab9e68370..10d505df50 100644 --- a/src/org/labkey/test/components/ui/grids/DetailTable.java +++ b/src/org/labkey/test/components/ui/grids/DetailTable.java @@ -238,21 +238,18 @@ protected class ElementCache extends Component.ElementCache { public final WebElement dataByLabel(String fieldLabel) { - return Locator.tagWithAttribute("td", "data-caption", fieldLabel).findWhenNeeded(this) - .withTimeout(2000); + return Locator.tagWithAttribute("td", "data-caption", fieldLabel).findWhenNeeded(this); } public final WebElement dataFieldByKey(String fieldKey) { - return Locator.tagWithAttribute("td", "data-fieldkey", fieldKey) - .findWhenNeeded(this).withTimeout(2000); + return Locator.tagWithAttribute("td", "data-fieldkey", fieldKey).findWhenNeeded(this); } // Some tables will show a value in a td with no attributes, use the td that has the text (label) to find the value. public final WebElement siblingField(String fieldLabel) { - return Locator.tagContainingText("td", fieldLabel).followingSibling("td") - .findWhenNeeded(this).withTimeout(2000); + return Locator.tagContainingText("td", fieldLabel).followingSibling("td").findWhenNeeded(this); } }