From 0b7517905ee11d4bd221906fc9fa381cc73f4bcc Mon Sep 17 00:00:00 2001 From: XingY Date: Mon, 23 Mar 2026 20:17:55 -0700 Subject: [PATCH] GitHub Issue 947, 955 & 988 --- .../test/components/domain/DomainFieldRow.java | 12 ++++++++++++ .../components/domain/TextChoiceValueDialog.java | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/org/labkey/test/components/domain/DomainFieldRow.java b/src/org/labkey/test/components/domain/DomainFieldRow.java index 5261edb788..334cd67eed 100644 --- a/src/org/labkey/test/components/domain/DomainFieldRow.java +++ b/src/org/labkey/test/components/domain/DomainFieldRow.java @@ -790,6 +790,18 @@ public DomainFieldRow setTextChoiceValues(List values) return addValuesDialog.clickApply(); } + public String setTextChoiceValuesExpectingError(List values) + { + WebElement button = Locator.tagWithClass("span", "container--action-button").withText("Add Values").findElement(this); + button.click(); + + TextChoiceValueDialog addValuesDialog = new TextChoiceValueDialog(this); + addValuesDialog.addValues(values); + String error = addValuesDialog.getError(); + addValuesDialog.clickCancel(); + return error; + } + /** * Get the displayed list of allowed values a TextChoice field. * diff --git a/src/org/labkey/test/components/domain/TextChoiceValueDialog.java b/src/org/labkey/test/components/domain/TextChoiceValueDialog.java index 0418d78494..9c1994e290 100644 --- a/src/org/labkey/test/components/domain/TextChoiceValueDialog.java +++ b/src/org/labkey/test/components/domain/TextChoiceValueDialog.java @@ -63,6 +63,18 @@ public String getValueCountText() return elementCache().valueCount.getText(); } + /** + * Get the error message displayed in the dialog, if any. + * + * @return The error text, or null if no error is displayed. + */ + public String getError() + { + WebElement error = Locator.tagWithClass("div", "domain-text-choices-error") + .findElementOrNull(this); + return error != null ? error.getText() : null; + } + /** * Click the apply button. *