Skip to content

Optional features ui coverage #2559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open

Conversation

labkey-chrisj
Copy link
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

Copy link
Contributor

@labkey-adam labkey-adam left a comment

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
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

Copy link
Contributor

@labkey-adam labkey-adam left a comment

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
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

Copy link
Contributor

@labkey-danield labkey-danield left a comment

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
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
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.

Copy link
Contributor

@labkey-danield labkey-danield left a comment

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 on lines 45 to 53
public Map<String, String> getFeatureMap()
{
return elementCache().getListItems();
}

public Set<String> getFeatureIds()
{
return getFeatureMap().keySet();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not called and should be removed.

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
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.

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