diff --git a/src/org/labkey/test/BootstrapLocators.java b/src/org/labkey/test/BootstrapLocators.java index bdf1e7551a..07f57e48fc 100644 --- a/src/org/labkey/test/BootstrapLocators.java +++ b/src/org/labkey/test/BootstrapLocators.java @@ -37,6 +37,10 @@ public static Locator.XPathLocator button(String text) return button().withText(text); } + public static final String APP_USER_MENU_CLASS = "user-dropdown"; + // Part of '@labkey/components/navigation/UserMenuGroup.tsx' + public static final Locator appUserMenu = Locator.byClass(APP_USER_MENU_CLASS); + // '@labkey/components/base/Alert.tsx' public static final Locator infoBanner = Locator.tagWithClass("div", BannerType.INFO.getCss()); public static final Locator successBanner = Locator.tagWithClass("div", BannerType.SUCCESS.getCss()); diff --git a/src/org/labkey/test/LabKeySiteWrapper.java b/src/org/labkey/test/LabKeySiteWrapper.java index 26d3eb52f3..a8f2ba8e02 100644 --- a/src/org/labkey/test/LabKeySiteWrapper.java +++ b/src/org/labkey/test/LabKeySiteWrapper.java @@ -51,7 +51,6 @@ import org.labkey.test.components.dumbster.EmailRecordTable; import org.labkey.test.components.html.RadioButton; import org.labkey.test.components.html.SiteNavBar; -import org.labkey.test.components.ui.navigation.UserMenu; import org.labkey.test.pages.core.admin.CustomizeSitePage; import org.labkey.test.pages.core.admin.ShowAdminPage; import org.labkey.test.pages.core.login.SignInPage; @@ -147,7 +146,7 @@ public void simpleSignIn() { beginAtAcceptingAlerts(buildURL("login", "login")); waitForAnyElement("Should be on login or Home portal", Locator.id("email"), SiteNavBar.Locators.userMenu, - UserMenu.appUserMenu()); + BootstrapLocators.appUserMenu); } if (PasswordUtil.getUsername().equals(getCurrentUser())) @@ -162,7 +161,7 @@ public void simpleSignIn() // verify we're signed in now if (!waitFor(() -> { - if(isElementPresent(UserMenu.appUserMenu())) + if (isElementPresent(BootstrapLocators.appUserMenu)) { goToHome(); } diff --git a/src/org/labkey/test/components/ManageSampleStatusesPanel.java b/src/org/labkey/test/components/ManageSampleStatusesPanel.java index 22cb170d0e..4b7b6547ef 100644 --- a/src/org/labkey/test/components/ManageSampleStatusesPanel.java +++ b/src/org/labkey/test/components/ManageSampleStatusesPanel.java @@ -31,6 +31,9 @@ import java.util.List; import java.util.stream.Collectors; +/** + * Wraps 'components/samples/ManageSampleStatusesPanel.tsx' + */ public class ManageSampleStatusesPanel extends WebDriverComponent { private final WebDriver _driver; diff --git a/src/org/labkey/test/components/html/BootstrapMenu.java b/src/org/labkey/test/components/html/BootstrapMenu.java index 7a8cabc47a..7f938647e1 100644 --- a/src/org/labkey/test/components/html/BootstrapMenu.java +++ b/src/org/labkey/test/components/html/BootstrapMenu.java @@ -29,11 +29,21 @@ public class BootstrapMenu extends BaseBootstrapMenu { /* componentElement should contain the toggle anchor *and* the UL containing list items */ + public BootstrapMenu(WebElement componentElement, WebDriver driver) + { + super(componentElement, driver); + } + + /** + * @deprecated Non-standard parameter order + */ + @Deprecated (since = "26.8") public BootstrapMenu(WebDriver driver, WebElement componentElement) { super(componentElement, driver); } + static public BootstrapMenuFinder finder(WebDriver driver) { return new BootstrapMenuFinder(driver); diff --git a/src/org/labkey/test/components/ui/navigation/NavBar.java b/src/org/labkey/test/components/ui/navigation/NavBar.java deleted file mode 100644 index 35b6de009c..0000000000 --- a/src/org/labkey/test/components/ui/navigation/NavBar.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2019-2026 LabKey Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.labkey.test.components.ui.navigation; - -import org.labkey.test.Locator; -import org.labkey.test.components.Component; -import org.labkey.test.components.WebDriverComponent; -import org.labkey.test.components.html.Input; -import org.labkey.test.components.react.MultiMenu; -import org.labkey.test.components.ui.notifications.ServerNotificationMenu; -import org.labkey.test.components.ui.search.SampleFinder; -import org.labkey.test.util.search.HasSearchResults; -import org.openqa.selenium.Keys; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; - -public abstract class NavBar extends WebDriverComponent -{ - private final WebDriver _driver; - private final WebElement _navBarElement; - - protected NavBar(WebDriver driver) - { - this(Locator.tagWithClass("nav", "navbar").findElement(driver), driver); - } - - protected NavBar(WebElement element, WebDriver driver) - { - _navBarElement = element; - _driver = driver; - } - - public void clickHeaderLogo() - { - elementCache().headerLogo.click(); - } - - public String getHeaderLogoImgSrc() - { - return elementCache().headerLogoImage.getAttribute("src"); - } - - public HasSearchResults searchFor(String searchString) - { - elementCache().searchBox.set(searchString); - elementCache().searchBox.getComponentElement().sendKeys(Keys.ENTER); - return null; - } - - public FindByIdsDialog findBySampleIds() - { - elementCache().searchMenu.doMenuAction("Find Samples by ID"); - return new FindByIdsDialog(getDriver()); - } - - public FindByIdsDialog findByBarcodes() - { - elementCache().searchMenu.doMenuAction("Find Samples by Barcode"); - return new FindByIdsDialog(getDriver()); - } - - public SampleFinder goToSampleFinder() - { - elementCache().searchMenu.doMenuAction("Sample Finder"); - return new SampleFinder(getDriver()); - } - - public String getDisplayedProjectName() - { - return elementCache().projectNameDisplay.getText(); - } - - public String getUserAvatarSource() - { - return elementCache().userIcon.getAttribute("src"); - } - - /** - * Get the {@link ServerNotificationMenu} on the menu bar. - * - * @return A {@link ServerNotificationMenu} - */ - public ServerNotificationMenu getNotificationMenu() - { - return elementCache().notificationsMenu; - } - - public ProductMenu getProductMenu() - { - return elementCache().productMenu; - } - - public abstract UserMenu getUserMenu(); - - @Override - public WebElement getComponentElement() - { - return _navBarElement; - } - - @Override - public WebDriver getDriver() - { - return _driver; - } - - @Override - protected abstract ElementCache newElementCache(); - - protected abstract class ElementCache extends Component.ElementCache - { - public WebElement headerLogo = Locator.tagWithClass("a", "header-logo__link").refindWhenNeeded(this); - public WebElement headerLogoImage = Locator.tagWithClass("img", "header-logo__image").refindWhenNeeded(this); - public WebElement userMenuButton = Locator.tagWithId("a", "user-menu-dropdown").refindWhenNeeded(this); - public WebElement userIcon = Locator.tagWithAttribute("img", "alt", "User Avatar").refindWhenNeeded(this); - public WebElement projectNameDisplay = Locator.tagWithClass("span", "project-name").refindWhenNeeded(this); - public Input searchBox = Input.Input(Locator.tagWithClass("input", "navbar__search-input"), getDriver()).refindWhenNeeded(this); - public MultiMenu searchMenu = new MultiMenu.MultiMenuFinder(getDriver()).withButtonClass("navbar__find-and-search-button").refindWhenNeeded(this); - public final ProductMenu productMenu = ProductMenu.finder(getDriver()).timeout(1000).refindWhenNeeded(this); - public final ServerNotificationMenu notificationsMenu = ServerNotificationMenu.finder(getDriver()).timeout(1000).refindWhenNeeded(this); - } -} diff --git a/src/org/labkey/test/components/ui/navigation/UserMenu.java b/src/org/labkey/test/components/ui/navigation/UserMenu.java deleted file mode 100644 index 4dd9c4c516..0000000000 --- a/src/org/labkey/test/components/ui/navigation/UserMenu.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2019-2026 LabKey Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.labkey.test.components.ui.navigation; - -import org.labkey.test.Locator; -import org.labkey.test.components.html.BootstrapMenu; -import org.labkey.test.components.react.MultiMenu; -import org.labkey.test.pages.LabKeyPage; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; - -import java.util.function.BiFunction; - -/** - * Base class for app user menus implemented using @labkey-components/UserMenu - */ -public abstract class UserMenu extends BootstrapMenu -{ - private static final String MENU_CLASS = "user-dropdown"; - - protected UserMenu(WebElement element, WebDriver driver) - { - super(driver, element); - } - - protected static SimpleWebDriverComponentFinder baseMenuFinder(WebDriver driver, BiFunction factory) - { - return new MultiMenu.MultiMenuFinder(driver).withClass(MENU_CLASS).wrap(factory); - } - - // TODO: Placeholder for product update - protected LabKeyPage login() - { - clickSubMenu(true, "Sign In"); - return new LabKeyPage<>(getDriver()); - } - - // TODO: Placeholder for product update - protected LabKeyPage logout() - { - clickSubMenu(true, "Sign Out"); - return new LabKeyPage<>(getDriver()); - } - - /** - * The button for the drop down user menu. The user menu on the SampleManager app is an example of this button. - * - * @return A locator to the drop down user menu button. - */ - public static Locator appUserMenu() - { - return Locator.byClass(MENU_CLASS).childTag("a"); - } -} diff --git a/src/org/labkey/test/pages/experiment/DeleteDataClassPage.java b/src/org/labkey/test/pages/experiment/DeleteDataClassPage.java new file mode 100644 index 0000000000..da348af9c6 --- /dev/null +++ b/src/org/labkey/test/pages/experiment/DeleteDataClassPage.java @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2026 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.labkey.test.pages.experiment; + +import org.labkey.test.Locator; +import org.labkey.test.pages.LabKeyPage; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; + + +public class DeleteDataClassPage extends LabKeyPage +{ + public DeleteDataClassPage(WebDriver driver) + { + super(driver); + } + + public void confirmDelete() + { + clickAndWait(elementCache().deleteButton); + } + + @Override + protected ElementCache newElementCache() + { + return new ElementCache(); + } + + protected class ElementCache extends LabKeyPage.ElementCache + { + WebElement deleteButton = Locator.lkButton("Confirm Delete").findWhenNeeded(this); + } +} diff --git a/src/org/labkey/test/pages/experiment/ShowDataClassPage.java b/src/org/labkey/test/pages/experiment/ShowDataClassPage.java new file mode 100644 index 0000000000..b79f7a8c86 --- /dev/null +++ b/src/org/labkey/test/pages/experiment/ShowDataClassPage.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2026 LabKey Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.labkey.test.pages.experiment; + +import org.labkey.test.Locator; +import org.labkey.test.WebDriverWrapper; +import org.labkey.test.WebTestHelper; +import org.labkey.test.pages.LabKeyPage; +import org.labkey.test.util.DataRegionTable; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; + +import java.util.Map; + +public class ShowDataClassPage extends LabKeyPage +{ + public ShowDataClassPage(WebDriver driver) + { + super(driver); + } + + public static ShowDataClassPage beginAt(WebDriverWrapper webDriverWrapper, String containerPath, int rowId) + { + webDriverWrapper.beginAt(WebTestHelper.buildURL("experiment", containerPath, "showDataClass", Map.of("rowId", rowId))); + return new ShowDataClassPage(webDriverWrapper.getDriver()); + } + + public CreateDataClassPage clickEditDataClass() + { + clickAndWait(elementCache().editDataClassButton); + return new CreateDataClassPage(getDriver()); + } + + public DeleteDataClassPage clickDeleteDataClass() + { + clickAndWait(elementCache().deleteDataClassButton); + return new DeleteDataClassPage(getDriver()); + } + + public DataRegionTable getDataRegion() + { + return elementCache()._dataRegionTable; + } + + @Override + protected ElementCache newElementCache() + { + return new ElementCache(); + } + + protected class ElementCache extends LabKeyPage.ElementCache + { + private final WebElement editDataClassButton = Locator.lkButton("Edit Data Class").findWhenNeeded(this); + private final WebElement deleteDataClassButton = Locator.lkButton("Delete Data Class").findWhenNeeded(this); + private final DataRegionTable _dataRegionTable = new DataRegionTable.DataRegionFinder(getDriver()).withName("query").findWhenNeeded(this); + } +} diff --git a/src/org/labkey/test/util/TestUser.java b/src/org/labkey/test/util/TestUser.java index a762437703..40519f8c88 100644 --- a/src/org/labkey/test/util/TestUser.java +++ b/src/org/labkey/test/util/TestUser.java @@ -213,4 +213,10 @@ private WebDriverWrapper getWrapper() } return _test; } + + @Override + public String toString() + { + return getEmail(); + } }