Skip to content

Optional features ui coverage - #2559

Merged
labkey-chrisj merged 5 commits into
developfrom
fb_optionalFeatures
Jul 15, 2025
Merged

Optional features ui coverage#2559
labkey-chrisj merged 5 commits into
developfrom
fb_optionalFeatures

Conversation

@labkey-chrisj

Copy link
Copy Markdown
Contributor

Rationale

This change adds UI coverage for optional features and experimental features.
Recent changes have refactored the implementation for exp features, optional features, and deprecated features under the singular optionalFeaturesService implementation. This coverage seeks to validate the UI continues to work as expected.

Related Pull Requests

LabKey/platform#6828

Changes

New page class to wrap all three of the optional features pages

@labkey-adam labkey-adam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionally, this looks great... exactly what we discussed. However, you can drastically reduce the test method code duplication to improve maintenance, etc. Create a method like:

private void testUIOptionalFeatures(String linkText, OptionalFeatureType type, List<String> featureIds)
{
    goToAdminConsole();
    waitAndClickAndWait(Locator.linkWithText(linkText));
    var optionalFeaturesPage = new OptionalFeaturesPage(getDriver());
    ...
}

The two test methods each then become a single line that calls this method.

import java.util.Set;

/*
Wraps Optional Features, Experimental Featueres, Deprecated Features pages linked

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Wraps Optional Features, Experimental Featueres, Deprecated Features pages linked
Wraps Optional Features, Experimental Features, Deprecated Features pages linked

Comment thread src/org/labkey/test/tests/AdminConsoleTest.java Outdated

@labkey-adam labkey-adam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big deal, but if you passed in the link text to the shared method, you could avoid a couple more lines of redundant code. The test*() methods could literally be one-liners.

Also, not a big deal... but in my review I had added a suggestion to fix a comment typo.

@@ -247,7 +247,7 @@ public void testUIExperimentalFeatures()
waitAndClickAndWait(Locator.linkWithText("experimental features"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should remove this line as well

@labkey-danield labkey-danield left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The getListItems method should be moved out of the ElementCache.

Comment on lines +76 to +93
public final Locator listItemLabelLoc = Locator.tagWithClass("div", "list-group-item")
.child(Locator.tag("Label"));
private Map<String, String> _listItems;

public Map<String, String> getListItems()
{
if (_listItems == null) {
_listItems = new HashMap<String, String>();
for (WebElement el : listItemLabelLoc.findElements(listGroupElement)) {
WebElement idEl = Locator.tagWithAttribute("type", "checkbox")
.findElement(el);
WebElement labelEl = Locator.tagWithClass("span", "toggle-label-text")
.findElement(el);
_listItems.put(idEl.getText(), labelEl.getText());
}
}
return _listItems;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't belong in the ElementCache, it should be broken out to a private method in the class. The Locator doesn't need to be public it is used only in the getListItems method.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this code can be removed altogether. The method getListItems is only called by getFeatureMap() which is only called by getFeatureIds(), which is not called.

This method never gets executed.

@labkey-danield labkey-danield left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have unused code in OptionalFeaturesPage that should be removed.

Comment thread src/org/labkey/test/pages/core/admin/OptionalFeaturesPage.java Outdated
Comment on lines +76 to +93
public final Locator listItemLabelLoc = Locator.tagWithClass("div", "list-group-item")
.child(Locator.tag("Label"));
private Map<String, String> _listItems;

public Map<String, String> getListItems()
{
if (_listItems == null) {
_listItems = new HashMap<String, String>();
for (WebElement el : listItemLabelLoc.findElements(listGroupElement)) {
WebElement idEl = Locator.tagWithAttribute("type", "checkbox")
.findElement(el);
WebElement labelEl = Locator.tagWithClass("span", "toggle-label-text")
.findElement(el);
_listItems.put(idEl.getText(), labelEl.getText());
}
}
return _listItems;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this code can be removed altogether. The method getListItems is only called by getFeatureMap() which is only called by getFeatureIds(), which is not called.

This method never gets executed.

@labkey-chrisj
labkey-chrisj merged commit dbcb9bf into develop Jul 15, 2025
7 checks passed
@labkey-chrisj
labkey-chrisj deleted the fb_optionalFeatures branch July 15, 2025 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants