diff --git a/src/org/labkey/test/BaseWebDriverTest.java b/src/org/labkey/test/BaseWebDriverTest.java index eb48e12217..f1e95b99ac 100644 --- a/src/org/labkey/test/BaseWebDriverTest.java +++ b/src/org/labkey/test/BaseWebDriverTest.java @@ -49,6 +49,7 @@ import org.labkey.remoteapi.query.ContainerFilter; import org.labkey.remoteapi.query.Filter; import org.labkey.remoteapi.query.SelectRowsResponse; +import org.labkey.remoteapi.security.CreateUserResponse; import org.labkey.serverapi.reader.TabLoader; import org.labkey.serverapi.writer.PrintWriters; import org.labkey.test.components.CustomizeView; @@ -94,7 +95,6 @@ import org.labkey.test.util.search.SearchAdminAPIHelper; import org.labkey.test.util.selenium.WebDriverUtils; import org.openqa.selenium.By; -import org.openqa.selenium.Dimension; import org.openqa.selenium.ElementClickInterceptedException; import org.openqa.selenium.StaleElementReferenceException; import org.openqa.selenium.TimeoutException; @@ -309,20 +309,9 @@ public void setUp() doTearDown(); } - SingletonWebDriver.getInstance().setUp(this); + SingletonWebDriver.getInstance().setUpWebDriver(this); - getDriver().manage().timeouts().scriptTimeout(Duration.ofMillis(WAIT_FOR_PAGE)); - getDriver().manage().timeouts().pageLoadTimeout(Duration.ofMillis(defaultWaitForPage)); - try - { - getDriver().manage().window().setSize(new Dimension(TestProperties.getBrowserWidth(), TestProperties.getBrowserHeight())); - } - catch (WebDriverException ex) - { - // Ignore occasional error from attempting to resize maximized window - if (!ex.getMessage().contains("current state is maximized")) - throw ex; - } + initWebDriverTimeouts(); closeExtraWindows(); if (!TestProperties.isCspCheckSkipped() && cspFailFast()) @@ -331,6 +320,15 @@ public void setUp() } } + @LogMethod + private void initWebDriverTimeouts() + { + TestLogger.debug("set script timeout"); + getDriver().manage().timeouts().scriptTimeout(Duration.ofMillis(WAIT_FOR_PAGE)); + TestLogger.debug("page load timeout set"); + getDriver().manage().timeouts().pageLoadTimeout(Duration.ofMillis(defaultWaitForPage)); + } + /** * Specifies whether the CSP log should be checked before each page load. * Tests that only want the CSP log to be checked at the end should override this method. @@ -365,6 +363,7 @@ public BrowserType getBrowserType() return BROWSER_TYPE; } + @LogMethod private static void doTearDown() { boolean closeWindow = !_testFailed || isRunWebDriverHeadless() || Boolean.parseBoolean(System.getProperty("close.on.fail", "true")); @@ -1948,15 +1947,17 @@ public void setPipelineRootToDefault() /** * Create a user with the specified permissions for the specified project */ - public void createUserWithPermissions(String userName, String projectName, String permissions) + public CreateUserResponse createUserWithPermissions(String userName, String projectName, String permissions) { if (projectName == null) { projectName = getProjectName(); } - _userHelper.createUser(userName, true); + CreateUserResponse ret = _userHelper.createUser(userName, true); new ApiPermissionsHelper(this) .addMemberToRole(userName, permissions, PermissionsHelper.MemberType.user, projectName); + + return ret; } public ApiPermissionsHelper createSiteDeveloper(String userEmail) @@ -2766,7 +2767,8 @@ private File getDownloadDir() return _downloadDir; } - private void setUp(BaseWebDriverTest test) + @LogMethod + private void setUpWebDriver(BaseWebDriverTest test) { WebDriver oldWebDriver = getWebDriver(); File newDownloadDir = new File(ArtifactCollector.ensureDumpDir(test.getClass().getSimpleName()), "downloads"); diff --git a/src/org/labkey/test/LabKeySiteWrapper.java b/src/org/labkey/test/LabKeySiteWrapper.java index 69cf4cdc39..d5795ad8a7 100644 --- a/src/org/labkey/test/LabKeySiteWrapper.java +++ b/src/org/labkey/test/LabKeySiteWrapper.java @@ -412,19 +412,25 @@ public void signInShouldFail(String email, String password, String... expectedMe assertTrue(String.format("Wrong errors.\nExpected: ['%s']\nActual: '%s'", String.join("',\n'", expectedMessages), errorText), missingErrors.isEmpty()); } - protected String setInitialPassword(String user) + @Deprecated // TODO: Call the variant that takes a userId instead + protected String setInitialPassword(String email) + { + return setInitialPassword(_userHelper.getUserId(email)); + } + + protected String setInitialPassword(int userId) { String password = PasswordUtil.getPassword(); - SetPasswordForm.goToInitialPasswordForUser(this, user) - .setNewPassword(password) - .clickSubmit(); + SetPasswordForm.goToInitialPasswordForUser(this, userId) + .setNewPassword(password) + .clickSubmit(); return password; } - protected String getPasswordResetUrl(String username) + protected String getPasswordResetUrl(int userId) { - beginAt(buildURL("security", "showResetEmail", Map.of("email", username))); + beginAt(buildURL("security", "showResetEmail", Map.of("userId", userId))); WebElement resetLink = Locator.xpath("//a[contains(@href, 'setPassword.view')]").findElement(getDriver()); shortWait().until(ExpectedConditions.elementToBeClickable(resetLink)); @@ -608,8 +614,10 @@ private void checkForUpgrade() refresh(); // Clear form log("Testing bad email addresses"); - verifyInitialUserError(null, null, null, "Invalid email address"); - verifyInitialUserError("bogus@bogus@bogus", null, null, "Invalid email address: bogus@bogus@bogus"); + verifyInitialUserError(null, null, null, "email: '' is not a valid email address. Please enter an email address in this form: user@domain.tld"); + verifyInitialUserError("bogus@bogus@bogus", null, null, "email: 'bogus@bogus@bogus' is not a valid email address. Please enter an email address in this form: user@domain.tld"); + // In the past, email address was getting double encoded + verifyInitialUserError("<>\"&%", null, null, "email: '<>\"&%' is not a valid email address. Please enter an email address in this form: user@domain.tld"); log("Testing bad passwords"); verifyInitialUserError(email, null, null, "You must enter a password."); diff --git a/src/org/labkey/test/TestProperties.java b/src/org/labkey/test/TestProperties.java index 067483e654..a7b984402c 100644 --- a/src/org/labkey/test/TestProperties.java +++ b/src/org/labkey/test/TestProperties.java @@ -18,6 +18,7 @@ import org.apache.commons.lang3.StringUtils; import org.labkey.serverapi.reader.Readers; import org.labkey.test.util.TestLogger; +import org.openqa.selenium.Dimension; import java.io.File; import java.io.IOException; @@ -30,6 +31,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Properties; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -180,14 +182,20 @@ public static String getCloudPipelineBucketName() return System.getProperty("cloud.pipeline.bucket"); } - public static int getBrowserWidth() + public static Optional getWindowSize() { - return getIntegerProperty("webtest.browser.width", 1280); - } - - public static int getBrowserHeight() - { - return getIntegerProperty("webtest.browser.height", 1024); + String dimensionStr = System.getProperty("webtest.window.size", "1280x1024"); + if (!dimensionStr.isEmpty()) + { + String[] dimensionParts = dimensionStr.split("x", 2); + int browserWidth = Integer.parseInt(dimensionParts[0]); + int browserHeight = Integer.parseInt(dimensionParts[1]); + return Optional.of(new Dimension(browserWidth, browserHeight)); + } + else + { + return Optional.empty(); + } } public static boolean isWebDriverLoggingEnabled() diff --git a/src/org/labkey/test/WebDriverWrapper.java b/src/org/labkey/test/WebDriverWrapper.java index ca7377a264..0ee53d3879 100644 --- a/src/org/labkey/test/WebDriverWrapper.java +++ b/src/org/labkey/test/WebDriverWrapper.java @@ -403,6 +403,14 @@ protected Pair createNewWebDriver(@NotNull Pair windowSize = TestProperties.getWindowSize(); + if (windowSize.isPresent()) + { + TestLogger.info("Set window size: " + windowSize.get()); + newWebDriver.manage().window().setSize(windowSize.get()); + } + Capabilities caps = ((HasCapabilities) newWebDriver).getCapabilities(); String browserName = caps.getBrowserName(); String browserVersion = caps.getBrowserVersion(); @@ -1008,6 +1016,7 @@ public void switchToWindow(int index) } } + @LogMethod protected void closeExtraWindows() { List windows = new ArrayList<>(getDriver().getWindowHandles()); diff --git a/src/org/labkey/test/components/core/ApiKeyDialog.java b/src/org/labkey/test/components/core/ApiKeyDialog.java index a3cc4f1a6e..c986244935 100644 --- a/src/org/labkey/test/components/core/ApiKeyDialog.java +++ b/src/org/labkey/test/components/core/ApiKeyDialog.java @@ -9,8 +9,10 @@ import java.awt.*; import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; import java.io.IOException; +import java.util.Arrays; public class ApiKeyDialog extends ModalDialog { @@ -42,8 +44,48 @@ public ApiKeyDialog copyKey() public String getClipboardContent() throws IOException, UnsupportedFlavorException { - return (String) Toolkit.getDefaultToolkit().getSystemClipboard() - .getData(DataFlavor.stringFlavor); + DataFlavor[] flavors = Toolkit.getDefaultToolkit().getSystemClipboard().getAvailableDataFlavors(); + Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null); + + // Adding debug info for TeamCity run. + // Windows is not giving DataFlavor (MIME Type) for the data on the clipboard. + getWrapper().log("Available flavors: " + Arrays.stream(flavors).toList()); + getWrapper().log("Best flavor: " + DataFlavor.selectBestTextFlavor(flavors)); + + if (t != null) + { + + // Adding debug info for TeamCity run. + getWrapper().log("Is DataFlavor.imageFlavor supported? " + t.isDataFlavorSupported(DataFlavor.imageFlavor)); + getWrapper().log("Is DataFlavor.allHtmlFlavor supported? " + t.isDataFlavorSupported(DataFlavor.allHtmlFlavor)); + getWrapper().log("Is DataFlavor.fragmentHtmlFlavor supported? " + t.isDataFlavorSupported(DataFlavor.fragmentHtmlFlavor)); + getWrapper().log("Is DataFlavor.selectionHtmlFlavor supported? " + t.isDataFlavorSupported(DataFlavor.selectionHtmlFlavor)); + getWrapper().log("Is DataFlavor.javaFileListFlavor supported? " + t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)); + getWrapper().log("Is DataFlavor.stringFlavor supported? " + t.isDataFlavorSupported(DataFlavor.stringFlavor)); + + DataFlavor[] transferFlavors = t.getTransferDataFlavors(); + getWrapper().log("Transferable supported data flavors: " + Arrays.stream(transferFlavors).toList()); + + if (flavors.length > 0) + { + getWrapper().log("Best Text Flavor: " + DataFlavor.selectBestTextFlavor(flavors)); + return (String) Toolkit.getDefaultToolkit().getSystemClipboard() + .getData(DataFlavor.selectBestTextFlavor(flavors)); + } + else + { + getWrapper().log("There are no DataFlavors to use."); + // Return a value to indicate something is on the clipboard but no DataFlavor was provided. + return "There are no DataFlavors to use."; + } + + } + else + { + getWrapper().log("The clipboard is empty."); + return ""; + } + } public boolean isCopyButtonDisplayed() diff --git a/src/org/labkey/test/components/core/login/SetPasswordForm.java b/src/org/labkey/test/components/core/login/SetPasswordForm.java index b5e1cae5e0..4971592a40 100644 --- a/src/org/labkey/test/components/core/login/SetPasswordForm.java +++ b/src/org/labkey/test/components/core/login/SetPasswordForm.java @@ -55,9 +55,9 @@ public SetPasswordForm(WebDriver driver) } // Don't use this unless you're actually testing authentication functionality - public static SetPasswordForm goToInitialPasswordForUser(WebDriverWrapper wrapper, String email) + public static SetPasswordForm goToInitialPasswordForUser(WebDriverWrapper wrapper, int userId) { - wrapper.beginAt(WebTestHelper.buildURL("security", "showRegistrationEmail", Map.of("email", email))); + wrapper.beginAt(WebTestHelper.buildURL("security", "showRegistrationEmail", Map.of("userId", userId))); // Get setPassword URL from notification email. WebElement resetLink = Locator.linkWithHref("setPassword.view").findElement(wrapper.getDriver()); diff --git a/src/org/labkey/test/components/domain/DomainFormPanel.java b/src/org/labkey/test/components/domain/DomainFormPanel.java index cb11a22d8a..49abcf1991 100644 --- a/src/org/labkey/test/components/domain/DomainFormPanel.java +++ b/src/org/labkey/test/components/domain/DomainFormPanel.java @@ -10,7 +10,7 @@ import org.labkey.test.components.ui.grids.ResponsiveGrid; import org.labkey.test.params.FieldDefinition; import org.labkey.test.selenium.WebElementWrapper; -import org.openqa.selenium.TimeoutException; +import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; @@ -18,6 +18,7 @@ import java.io.File; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -519,18 +520,22 @@ public WebElement getPanelErrorWebElement() */ public String getPanelAlertText() { - WebElement alertEl = getPanelAlertWebElement(); - if (alertEl != null) - return alertEl.getText(); - - return ""; + return getPanelAlertText(0); } public String getPanelAlertText(int index) { - return getPanelAlertWebElement(index).getText(); + WebElement panelAlertWebElement = getPanelAlertWebElement(index); + if (panelAlertWebElement != null) + return panelAlertWebElement.getText(); + else + return ""; } + public List getPanelAlertTexts() + { + return getWrapper().getTexts(getPanelAlertElements()); + } /** * There may be an element in the alert that a test will need to interact with so return the alert element and let * the test find the control it needs. @@ -542,20 +547,24 @@ public WebElement getPanelAlertWebElement() } public WebElement getPanelAlertWebElement(int index) + { + List panelAlertElements = getPanelAlertElements(); + if (panelAlertElements.size() > index) + return panelAlertElements.get(index); + else + return null; + } + + public List getPanelAlertElements() { try { - getWrapper().waitFor(() -> BootstrapLocators.infoBanner.existsIn(getDriver()), - "the info alert did not appear as expected", 1000); + return BootstrapLocators.infoBanner.waitForElements(this, 1000); } - catch (TimeoutException e) + catch (NoSuchElementException nothing) { - return null; + return Collections.emptyList(); } - - // It would be better to not return a raw WebElement but who knows what the future holds, different alerts - // may show different controls. - return BootstrapLocators.infoBanner.index(index).findElement(this); } @Override diff --git a/src/org/labkey/test/components/ui/entities/EntityInsertPanel.java b/src/org/labkey/test/components/ui/entities/EntityInsertPanel.java index ce817d21f5..8236243f8e 100644 --- a/src/org/labkey/test/components/ui/entities/EntityInsertPanel.java +++ b/src/org/labkey/test/components/ui/entities/EntityInsertPanel.java @@ -1,5 +1,6 @@ package org.labkey.test.components.ui.entities; +import org.junit.Assert; import org.labkey.test.Locator; import org.labkey.test.WebDriverWrapper; import org.labkey.test.components.Component; @@ -140,18 +141,14 @@ public EntityInsertPanel addRecords(List> records) showGrid(); elementCache().grid.addRows(records.size()); - List rowIndices = elementCache().grid.getEditableRowIndices(); - - if(rowIndices.size() < records.size()) - { - throw new IllegalStateException("Trying to add more records than there are rows. Number of records to create: " + records.size() + " number of available rows: " + rowIndices.size()); - } + Assert.assertFalse(String.format("Trying to add more records than there are rows. Number of records to create: %d number of available rows: %d", + records.size(), elementCache().grid.getRowCount()), + elementCache().grid.getRowCount() < records.size()); int index = 0; - for(Map record : records) { - setRecordValues(record, rowIndices.get(index)); + setRecordValues(record, index); index++; } @@ -160,8 +157,7 @@ public EntityInsertPanel addRecords(List> records) public EntityInsertPanel setRecordValues(Map columnValues) { - int insertRowIndex = getEditableGrid().getEditableRowIndices().get(0); - return setRecordValues(columnValues, insertRowIndex); + return setRecordValues(columnValues, 0); } public EntityInsertPanel setRecordValues(Map columnValues, int row) diff --git a/src/org/labkey/test/components/ui/grids/DetailTableEdit.java b/src/org/labkey/test/components/ui/grids/DetailTableEdit.java index 6646a583e3..bd9f935ad6 100644 --- a/src/org/labkey/test/components/ui/grids/DetailTableEdit.java +++ b/src/org/labkey/test/components/ui/grids/DetailTableEdit.java @@ -452,8 +452,8 @@ public DetailDataPanel clickSave() elementCache().saveButton.click(); // If save causes some update, wait until it is completed. - WebDriverWrapper.waitFor(()->!BootstrapLocators.loadingSpinner.existsIn(getDriver()), - "Save has taken too long to complete.", 15_000); + getWrapper().longWait().withMessage("Update took too long to complete.") + .until(ExpectedConditions.stalenessOf(elementCache().saveButton)); return new DetailDataPanel.DetailDataPanelFinder(getDriver()).withTitle(title).waitFor(); } diff --git a/src/org/labkey/test/components/ui/grids/EditableGrid.java b/src/org/labkey/test/components/ui/grids/EditableGrid.java index eab1e1cc44..1dc285d1be 100644 --- a/src/org/labkey/test/components/ui/grids/EditableGrid.java +++ b/src/org/labkey/test/components/ui/grids/EditableGrid.java @@ -318,59 +318,6 @@ public int getRowCount() return getRows().size(); } - /** - * As best as possible get a list of row indices from the grid for editable rows. That is rows where the values can - * be entered or changed. - * - * @return A list of indices (0 based) for rows that can be edited. - */ - public List getEditableRowIndices() - { - return getRowTypes().get(0); - } - - /** - * Some EditableGrids have read only rows. These are rows in the grid that display data but cannot be updated. As - * best as possible return a list of those rows. - * - * @return A list of indices (0 based) of rows that cannot be edited. - */ - public List getReadonlyRowIndices() - { - return getRowTypes().get(1); - } - - private List> getRowTypes() - { - List unPopulatedRows = new ArrayList<>(); - List populatedRows = new ArrayList<>(); - - // Need to look at an attribute of a cell to see if it has pre-populated data. - // But this info will not be in the select or row-number cells, so we'll use the last column - // (CSS selector is 1-based not 0-based). - int checkColumn = getColumnNames().size(); - int rowCount = 0; - - for (WebElement row : getRows()) - { - String classAttribute = row.findElement(By.cssSelector("td:nth-child(" + checkColumn + ") > div")) - .getAttribute("class"); - - if ((!classAttribute.contains("cell-selection")) && (!classAttribute.contains("cell-read-only"))) - { - unPopulatedRows.add(rowCount); - } - else - { - populatedRows.add(rowCount); - } - - rowCount++; - } - - return new ArrayList<>(Arrays.asList(unPopulatedRows, populatedRows)); - } - /** *

* For a given column, 'columnNameToSet', set the lookup cell in the first row where the value in column 'columnNameToSearch' diff --git a/src/org/labkey/test/pages/query/QueryMetadataEditorPage.java b/src/org/labkey/test/pages/query/QueryMetadataEditorPage.java index 14c8cc102b..8b94b63f7e 100644 --- a/src/org/labkey/test/pages/query/QueryMetadataEditorPage.java +++ b/src/org/labkey/test/pages/query/QueryMetadataEditorPage.java @@ -14,6 +14,7 @@ import java.util.Map; import static org.labkey.test.WebDriverWrapper.WAIT_FOR_JAVASCRIPT; +import static org.labkey.test.WebDriverWrapper.waitFor; /** * Automates the platform component defined in: query/src/client/QueryMetadataEditor/QueryMetadataEditor.tsx @@ -34,6 +35,11 @@ public static QueryMetadataEditorPage beginAt(WebDriverWrapper webDriverWrapper, { webDriverWrapper.beginAt(WebTestHelper.buildURL("query", containerPath, "metadataQuery", Map.of("schemaName", schemaName, "query.queryName", queryName))); + + // Wait for domain editor rows to show up. + waitFor(()->!Locator.tagWithClass("div", "domain-field-row domain-row-border-default").findElements(webDriverWrapper.getDriver()).isEmpty(), + "Query Metadata Editor Page did not load in time.", 5_000); + return new QueryMetadataEditorPage(webDriverWrapper.getDriver()); } diff --git a/src/org/labkey/test/tests/AdminConsoleTest.java b/src/org/labkey/test/tests/AdminConsoleTest.java index 2e343e53a3..97b2048e6c 100644 --- a/src/org/labkey/test/tests/AdminConsoleTest.java +++ b/src/org/labkey/test/tests/AdminConsoleTest.java @@ -32,7 +32,6 @@ import org.labkey.test.util.ApiPermissionsHelper; import org.labkey.test.util.LogMethod; import org.labkey.test.util.PermissionsHelper; -import org.openqa.selenium.WebElement; import java.io.IOException; import java.util.ArrayList; @@ -331,8 +330,8 @@ protected void doCleanup(boolean afterTest) throws TestTimeoutException private void createTestUser() { - _userHelper.createUser(APP_ADMIN_USER, true, false); - setInitialPassword(APP_ADMIN_USER); + int userId = _userHelper.createUser(APP_ADMIN_USER, true, false).getUserId(); + setInitialPassword(userId); ApiPermissionsHelper apiPermissionsHelper = new ApiPermissionsHelper(this); apiPermissionsHelper.addMemberToRole(APP_ADMIN_USER, "Application Admin", PermissionsHelper.MemberType.user, "/"); diff --git a/src/org/labkey/test/tests/SampleTypeTest.java b/src/org/labkey/test/tests/SampleTypeTest.java index b286dcf4ef..c0dd03695a 100644 --- a/src/org/labkey/test/tests/SampleTypeTest.java +++ b/src/org/labkey/test/tests/SampleTypeTest.java @@ -19,6 +19,7 @@ import org.apache.commons.io.FileUtils; import org.apache.poi.ss.usermodel.Sheet; import org.assertj.core.api.Assertions; +import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Ignore; @@ -1357,7 +1358,7 @@ public void testIgnoreReservedFieldNames() throws Exception DomainFormPanel domainForm = createPage .getFieldsPanel() .setInferFieldFile(inferenceFile); - checker().verifyEquals("Reserved field warning not as expected", expectedInfoMsg, domainForm.getPanelAlertText()); + checker().verifyThat("Reserved field warning not as expected", domainForm.getPanelAlertTexts(), CoreMatchers.hasItem(expectedInfoMsg)); createPage.clickSave(); DataRegionTable drt = DataRegion(getDriver()).find(); checker().verifyTrue("Sample type not found in list of sample types", drt.getColumnDataAsText("Name").contains(name)); diff --git a/src/org/labkey/test/tests/SecurityApiTest.java b/src/org/labkey/test/tests/SecurityApiTest.java index f9b88c5e7e..95c8bb6de2 100644 --- a/src/org/labkey/test/tests/SecurityApiTest.java +++ b/src/org/labkey/test/tests/SecurityApiTest.java @@ -81,8 +81,8 @@ public void createUsers(){ apiPermissionsHelper.setPermissions(GROUP_2, "Reader"); // Create the admin user that will be used to call the APIs. - _userHelper.createUserAndNotify(ADMIN_USER); - setInitialPassword(ADMIN_USER); + int userId = _userHelper.createUserAndNotify(ADMIN_USER).getUserId(); + setInitialPassword(userId); apiPermissionsHelper.addUserToSiteGroup(ADMIN_USER, "Site Administrators"); } diff --git a/src/org/labkey/test/tests/StudyBaseTest.java b/src/org/labkey/test/tests/StudyBaseTest.java index c78a6e63bc..c248fb8fba 100644 --- a/src/org/labkey/test/tests/StudyBaseTest.java +++ b/src/org/labkey/test/tests/StudyBaseTest.java @@ -27,6 +27,7 @@ import org.labkey.test.components.ext4.Checkbox; import org.labkey.test.pages.DatasetPropertiesPage; import org.labkey.test.pages.admin.ExportFolderPage; +import org.labkey.test.pages.compliance.FolderManagementComplianceTab; import org.labkey.test.params.FieldDefinition.PhiSelectType; import org.labkey.test.util.APITestHelper; import org.labkey.test.util.ApiPermissionsHelper; @@ -107,6 +108,14 @@ protected void initializeFolder() if (_studyHelper.isSpecimenModulePresent()) _containerHelper.enableModule("Specimen"); new ApiPermissionsHelper(this).checkInheritedPermissions(); + + if (_containerHelper.getAllModules().contains("compliance")) + { + FolderManagementComplianceTab.beginAt(this, getProjectName()).setPhiRolesRequired(true).save(); + new ApiPermissionsHelper(getProjectName()).setUserPermissions(getCurrentUser(), "Restricted PHI Reader"); + FolderManagementComplianceTab.beginAt(this, getProjectName() + "/" + getFolderName()).setPhiRolesRequired(true).save(); + goToProjectFolder(getProjectName(), getFolderName()); + } } // Start importing the specimen archive. This can load in the background while executing the first set of diff --git a/src/org/labkey/test/tests/UserDetailsPermissionTest.java b/src/org/labkey/test/tests/UserDetailsPermissionTest.java index 8ab94911b8..b873da5b03 100644 --- a/src/org/labkey/test/tests/UserDetailsPermissionTest.java +++ b/src/org/labkey/test/tests/UserDetailsPermissionTest.java @@ -94,13 +94,13 @@ private void doSetup() domainFormPanel.addField(CUSTOM_USER_COLUMN).setType(FieldDefinition.ColumnType.String); domainDesignerPage.clickFinish(); - _userHelper.createUser(ADMIN_USER, true, true); - _userHelper.createUser(USER_INFO_VIEWER, true, true); - _userHelper.createUser(IMPERSONATED_USER, true, true); + int adminId = _userHelper.createUser(ADMIN_USER, true, true).getUserId(); + int userInfoId = _userHelper.createUser(USER_INFO_VIEWER, true, true).getUserId(); + int impersonatedId = _userHelper.createUser(IMPERSONATED_USER, true, true).getUserId(); _userHelper.createUser(CHECKED_USER, true, true); - setInitialPassword(ADMIN_USER); - setInitialPassword(USER_INFO_VIEWER); - setInitialPassword(IMPERSONATED_USER); + setInitialPassword(adminId); + setInitialPassword(userInfoId); + setInitialPassword(impersonatedId); _containerHelper.createProject(getProjectName(), null); diff --git a/src/org/labkey/test/tests/UserPermissionsTest.java b/src/org/labkey/test/tests/UserPermissionsTest.java index e2a8f43657..ce52536fc4 100644 --- a/src/org/labkey/test/tests/UserPermissionsTest.java +++ b/src/org/labkey/test/tests/UserPermissionsTest.java @@ -23,7 +23,6 @@ import org.labkey.test.TestTimeoutException; import org.labkey.test.categories.Daily; import org.labkey.test.util.LogMethod; -import org.labkey.test.util.PasswordUtil; import org.labkey.test.util.PortalHelper; import org.openqa.selenium.WebElement; @@ -227,7 +226,7 @@ private void userPermissionRightsTest() impersonate(GAMMA_READER_USER); WebElement projectTree = projectMenu().expandProjectFully(PERM_PROJECT_NAME); assertNotNull("No link to subfolder: /" + PERM_PROJECT_NAME + "/" + GAMMA_SUB_FOLDER_NAME, Locator.linkWithText(GAMMA_SUB_FOLDER_NAME).findElementOrNull(projectTree)); - assertNotNull("Link found to inaccessable subfolder: /" + PERM_PROJECT_NAME + "/" + GAMMA_SUB_FOLDER_NAME, Locator.linkWithText(GAMMA_SUB_FOLDER_NAME).findElementOrNull(projectTree)); // it will appear as a span, no link + assertNotNull("Link found to inaccessible subfolder: /" + PERM_PROJECT_NAME + "/" + GAMMA_SUB_FOLDER_NAME, Locator.linkWithText(GAMMA_SUB_FOLDER_NAME).findElementOrNull(projectTree)); // it will appear as a span, no link // Ensure only one project visible during project impersonation. Regression test 13346 assertEquals("Only one project should be visible while impersonating", Arrays.asList(PERM_PROJECT_NAME), getTexts(projectMenu().projectMenuLinks())); diff --git a/src/org/labkey/test/tests/UserTest.java b/src/org/labkey/test/tests/UserTest.java index ff5fb6dc1e..30feeda32c 100644 --- a/src/org/labkey/test/tests/UserTest.java +++ b/src/org/labkey/test/tests/UserTest.java @@ -80,6 +80,8 @@ public class UserTest extends BaseWebDriverTest protected final UIUserHelper _userHelper = new UIUserHelper(this); + private static int _normalUserId; + @Nullable @Override protected String getProjectName() @@ -103,7 +105,7 @@ public static void setupProject() private void doSetup() { _containerHelper.createProject(getProjectName(), null); - createUserWithPermissions(NORMAL_USER, getProjectName(), "Editor"); + _normalUserId = createUserWithPermissions(NORMAL_USER, getProjectName(), "Editor").getUserId(); } @Override @@ -164,8 +166,8 @@ private boolean hasUserProfileFormLabel(String label) @Test public void testChangeUserEmail() { - new UIUserHelper(this).cloneUser(CHANGE_EMAIL_USER, NORMAL_USER); - setInitialPassword(CHANGE_EMAIL_USER); + int userId = new UIUserHelper(this).cloneUser(CHANGE_EMAIL_USER, NORMAL_USER).getUserId(); + setInitialPassword(userId); //change their email address changeUserEmail(CHANGE_EMAIL_USER, CHANGE_EMAIL_USER_ALTERNATE); @@ -198,8 +200,8 @@ public void testSelfServiceEmailSupport() assertEquals("Failed to set authentication param to enable self service email via http get", 200, getResponse); log("Create a new user."); - _userHelper.createUser(SELF_SERVICE_EMAIL_USER, true, true); - setInitialPassword(SELF_SERVICE_EMAIL_USER); + int selfServiceId = _userHelper.createUser(SELF_SERVICE_EMAIL_USER, true, true).getUserId(); + setInitialPassword(selfServiceId); goToHome(); @@ -250,7 +252,7 @@ public void testSelfServiceEmailSupport() log("Validate that trying to use the link from the email message again will result in an error."); goToURL(resetUrl, 30000); - assertTextPresent("This email address has already been verified."); + assertTextPresent("Verification failed."); goToHome(); log("If you got here there were no errors using the new email account."); @@ -263,7 +265,7 @@ public void testSelfServiceEmailSupport() public void testCustomFieldLogin() { String customFieldValue = "loginCredentials"; - setInitialPassword(NORMAL_USER); + setInitialPassword(_normalUserId); goToSiteUsers(); DataRegionTable table = new DataRegionTable("Users", getDriver()); @@ -341,7 +343,7 @@ private URL getUrlFromEmail(String subjectRegEx) } } - assertTrue("Could not find a url in the email to follow.", urlString.length() > 0); + assertTrue("Could not find a url in the email to follow.", !urlString.isEmpty()); try { resetUrl = new URL(urlString); @@ -413,8 +415,8 @@ public void testRequiredFields() { ensureRequiredFieldsSet(); - _userHelper.createUserAndNotify(BLANK_USER); - setInitialPassword(BLANK_USER); + int userId = _userHelper.createUserAndNotify(BLANK_USER).getUserId(); + setInitialPassword(userId); DomainDesignerPage domainDesignerPage = goToSiteUsers().clickChangeUserProperties(); DomainFormPanel domainFormPanel = domainDesignerPage.fieldsPanel(); diff --git a/src/org/labkey/test/tests/assay/UploadLargeExcelAssayTest.java b/src/org/labkey/test/tests/assay/UploadLargeExcelAssayTest.java index df91c6c2ef..9fa281c934 100644 --- a/src/org/labkey/test/tests/assay/UploadLargeExcelAssayTest.java +++ b/src/org/labkey/test/tests/assay/UploadLargeExcelAssayTest.java @@ -112,9 +112,7 @@ public void testUpload200kRows() throws Exception clickButton("Save and Finish"); // wait for import complete - var assayJobsPage1 = new AssayUploadJobsPage(getDriver()); - var pipelineDetailsPage1 = assayJobsPage1.clickJobStatus("200k", 3 * WebDriverWrapper.WAIT_FOR_PAGE); - pipelineDetailsPage1.waitForComplete(10 * WebDriverWrapper.WAIT_FOR_PAGE); + waitForPipelineJobsToComplete(1, "200k", false); // export assay1 data to excel log("exporting samples fields to excel"); @@ -135,9 +133,7 @@ public void testUpload200kRows() throws Exception setFormElement(Locator.input("__primaryFile__"), largeExportExcelFile); clickButton("Save and Finish"); - var assayJobsPage2 = new AssayUploadJobsPage(getDriver()); - var pipelineDetailsPage2 = assayJobsPage2.clickJobStatus("200k take 2", 3 * getDefaultWaitForPage()); - pipelineDetailsPage2.waitForComplete(10 * WebDriverWrapper.WAIT_FOR_PAGE); + waitForPipelineJobsToComplete(2, "200k take 2", false); var qPage = SourceQueryPage.beginAt(this, getProjectName(), "assay.General.large_assay_2", "Data"); var dataregion = qPage.viewData(Duration.ofSeconds(60)); diff --git a/src/org/labkey/test/tests/core/login/PasswordTest.java b/src/org/labkey/test/tests/core/login/PasswordTest.java index c484f056b0..b3c55d2362 100644 --- a/src/org/labkey/test/tests/core/login/PasswordTest.java +++ b/src/org/labkey/test/tests/core/login/PasswordTest.java @@ -58,6 +58,8 @@ public class PasswordTest extends BaseWebDriverTest { private static final String USER = "user_passwordtest@password.test"; + private int _userId; + @Override public List getAssociatedModules() { @@ -83,7 +85,7 @@ protected void doCleanup(boolean afterTest) throws TestTimeoutException public void resetUser() { _userHelper.deleteUsers(false, USER); - _userHelper.createUser(USER); + _userId = _userHelper.createUser(USER).getUserId(); } @Test @@ -121,7 +123,7 @@ public void testStrongPassword() PasswordStrength.Strong, PasswordExpiration.Never); - SetPasswordForm setPasswordForm = SetPasswordForm.goToInitialPasswordForUser(this, USER); + SetPasswordForm setPasswordForm = SetPasswordForm.goToInitialPasswordForUser(this, _userId); log("Verify strength gauge for 'SetPasswordAction'"); setPasswordForm.verifyPasswordStrengthGauge(USER); @@ -170,7 +172,7 @@ public void testReusePassword() String currentPassword = VERY_STRONG_PASSWORD + 0; - setInitialPassword(USER, currentPassword); + setInitialPassword(_userId, currentPassword); impersonate(USER); int i = 1; @@ -221,7 +223,7 @@ public void testPasswordReset() @Test public void testPasswordParameter() { - setInitialPassword(USER, WEAK_PASSWORD); + setInitialPassword(_userId, WEAK_PASSWORD); // 31000: fail login actions if parameters present on URL SimplePostCommand command = new SimplePostCommand("login", "loginAPI"); @@ -298,7 +300,7 @@ public String userInitiatePasswordReset(String username) clickButtonContainingText("Reset", 0); signIn(); - return getPasswordResetUrl(username); + return getPasswordResetUrl(_userId); } String[] wrongPasswordEntered = @@ -322,11 +324,12 @@ private String adminPasswordResetTest(String username, String password) .getUsersTable() .setFilter("Email", "Equals", username); clickAndWait(Locator.linkContainingText(_userHelper.getDisplayNameForEmail(username))); + int userId = Integer.valueOf(getUrlParam("userId")); clickButton("Reset Password"); assertTextPresent("You are about to clear the user's current password"); clickAndWait(Locator.lkButton("OK")); - String url = getPasswordResetUrl(username); + String url = getPasswordResetUrl(userId); //make sure user can't log in with current password signOut(); @@ -342,9 +345,9 @@ private String adminPasswordResetTest(String username, String password) return newPassword; } - protected String setInitialPassword(String user, String password) + protected String setInitialPassword(int userId, String password) { - SetPasswordForm.goToInitialPasswordForUser(this, user) + SetPasswordForm.goToInitialPasswordForUser(this, userId) .setNewPassword(password) .clickSubmit(); @@ -369,5 +372,4 @@ private SetPasswordForm goToChangePassword() clickButton("Change Password"); return new SetPasswordForm(getDriver()); } - } diff --git a/src/org/labkey/test/tests/core/security/AppAdminRoleTest.java b/src/org/labkey/test/tests/core/security/AppAdminRoleTest.java index 262279452f..54c5d924d4 100644 --- a/src/org/labkey/test/tests/core/security/AppAdminRoleTest.java +++ b/src/org/labkey/test/tests/core/security/AppAdminRoleTest.java @@ -71,8 +71,8 @@ public static void setupProject() private void doSetup() { _userHelper.createUser(USER); - _userHelper.createUserAndNotify(APP_ADMIN, true); - setInitialPassword(APP_ADMIN); + int userId = _userHelper.createUserAndNotify(APP_ADMIN, true).getUserId(); + setInitialPassword(userId); ApiPermissionsHelper apiPermissionsHelper = new ApiPermissionsHelper(this); apiPermissionsHelper.addUserAsAppAdmin(APP_ADMIN); diff --git a/src/org/labkey/test/tests/core/security/ImpersonatingTroubleshooterRoleTest.java b/src/org/labkey/test/tests/core/security/ImpersonatingTroubleshooterRoleTest.java index d27f255d03..097f147ef6 100644 --- a/src/org/labkey/test/tests/core/security/ImpersonatingTroubleshooterRoleTest.java +++ b/src/org/labkey/test/tests/core/security/ImpersonatingTroubleshooterRoleTest.java @@ -37,7 +37,7 @@ protected void doCleanup(boolean afterTest) protected void doSetup() { super.doSetup(); - setInitialPassword(TROUBLESHOOTER); + setInitialPassword(_troubleShooterId); } @Override diff --git a/src/org/labkey/test/tests/core/security/TroubleshooterRoleTest.java b/src/org/labkey/test/tests/core/security/TroubleshooterRoleTest.java index e21107d4b4..49331e9f25 100644 --- a/src/org/labkey/test/tests/core/security/TroubleshooterRoleTest.java +++ b/src/org/labkey/test/tests/core/security/TroubleshooterRoleTest.java @@ -27,6 +27,7 @@ public class TroubleshooterRoleTest extends BaseWebDriverTest { protected static final String TROUBLESHOOTER = "troubleshooter@troubleshooter.test"; + protected int _troubleShooterId; @BeforeClass public static void setupProject() @@ -44,7 +45,7 @@ protected void doCleanup(boolean afterTest) throws TestTimeoutException protected void doSetup() { - _userHelper.createUser(TROUBLESHOOTER); + _troubleShooterId = _userHelper.createUser(TROUBLESHOOTER).getUserId(); ApiPermissionsHelper apiPermissionsHelper = new ApiPermissionsHelper(this); apiPermissionsHelper.addMemberToRole(TROUBLESHOOTER, getRole(), PermissionsHelper.MemberType.user,"/"); _containerHelper.createProject(getProjectName()); diff --git a/src/org/labkey/test/tests/filecontent/FileContentActionButtonsTest.java b/src/org/labkey/test/tests/filecontent/FileContentActionButtonsTest.java index 28987f4768..cbd4066b2d 100644 --- a/src/org/labkey/test/tests/filecontent/FileContentActionButtonsTest.java +++ b/src/org/labkey/test/tests/filecontent/FileContentActionButtonsTest.java @@ -16,6 +16,7 @@ package org.labkey.test.tests.filecontent; import org.assertj.core.api.Assertions; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.junit.Before; import org.junit.BeforeClass; @@ -75,11 +76,12 @@ public void testDefaultActions() BrowserAction.UPLOAD, BrowserAction.IMPORT_DATA, BrowserAction.AUDIT_HISTORY, - BrowserAction.ADMIN) + BrowserAction.ADMIN, + BrowserAction.CREATE_RUN) ); // All icons are present by default - for (BrowserAction action : BrowserAction.values()) + for (BrowserAction action : filterActionsForAvailableModules(BrowserAction.values())) { assertElementPresent(action.getButtonIconLocator()); if (buttonsWithText.contains(action)) @@ -106,7 +108,8 @@ public void testEditorActions() BrowserAction.EDIT_PROPERTIES, BrowserAction.UPLOAD, BrowserAction.IMPORT_DATA, - BrowserAction.EMAIL_SETTINGS + BrowserAction.EMAIL_SETTINGS, + BrowserAction.CREATE_RUN ); stopImpersonatingRole(); @@ -126,7 +129,8 @@ public void testSubmitterReaderActions() BrowserAction.EDIT_PROPERTIES, BrowserAction.UPLOAD, BrowserAction.IMPORT_DATA, - BrowserAction.EMAIL_SETTINGS + BrowserAction.EMAIL_SETTINGS, + BrowserAction.CREATE_RUN ); stopImpersonatingRole(); @@ -146,7 +150,8 @@ public void testAuthorActions() BrowserAction.EDIT_PROPERTIES, BrowserAction.UPLOAD, BrowserAction.IMPORT_DATA, - BrowserAction.EMAIL_SETTINGS + BrowserAction.EMAIL_SETTINGS, + BrowserAction.CREATE_RUN ); stopImpersonatingRole(); @@ -251,7 +256,15 @@ public void testActionsWithSpecialCharactersInFileName() private void assertActionsAvailable(BrowserAction... actions) { - assertEquals(Arrays.asList(actions), _fileBrowserHelper.getAvailableBrowserActions()); + assertEquals(filterActionsForAvailableModules(actions), _fileBrowserHelper.getAvailableBrowserActions()); + } + + @NotNull + private List filterActionsForAvailableModules(BrowserAction[] actions) + { + Set allModules = _containerHelper.getAllModules(); + return Arrays.stream(actions) + .filter(action -> allModules.contains(action.getRequiredModule())).toList(); } private void resetToDefaultToolbar() diff --git a/src/org/labkey/test/tests/viability/ViabilityTest.java b/src/org/labkey/test/tests/viability/ViabilityTest.java index 778a029dc2..3593bf685d 100644 --- a/src/org/labkey/test/tests/viability/ViabilityTest.java +++ b/src/org/labkey/test/tests/viability/ViabilityTest.java @@ -93,6 +93,7 @@ protected void runUploadTest() assertNotChecked(Locator.checkboxByName("_pool_1604505335_0_Unreliable")); assertEquals("", getFormElement(Locator.name("_pool_1604505335_0_IntValue"))); + sleep(500); clickButton(SAVE_AND_FINISH, 0); String alertText = cancelAlert(); assertTrue(alertText.contains("Save anyway")); diff --git a/src/org/labkey/test/util/APIUserHelper.java b/src/org/labkey/test/util/APIUserHelper.java index f977599ec1..9f8eac0b84 100644 --- a/src/org/labkey/test/util/APIUserHelper.java +++ b/src/org/labkey/test/util/APIUserHelper.java @@ -250,15 +250,16 @@ protected void _deleteUsers(boolean failIfNotFound, String... userEmails) } private static final Pattern regEmailVerification = Pattern.compile("verification=([A-Za-z0-9]+)"); + @Override - public String setInitialPassword(String email) + public String setInitialPassword(int userId) { String verification; try { SimpleGetCommand getRegEmailCommand = new SimpleGetCommand("security", "showRegistrationEmail"); - getRegEmailCommand.setParameters(Map.of("email", email)); + getRegEmailCommand.setParameters(Map.of("userId", userId)); String responseText = getRegEmailCommand.execute(connectionSupplier.get(), null).getText(); Matcher matcher = regEmailVerification.matcher(responseText); @@ -280,7 +281,7 @@ public String setInitialPassword(String email) try { String password = PasswordUtil.getPassword(); - new SetPasswordCommand(email, password, verification).execute(connectionSupplier.get(), null); + new SetPasswordCommand(password, verification).execute(connectionSupplier.get(), null); return password; } catch (IOException | CommandException e) @@ -292,14 +293,12 @@ public String setInitialPassword(String email) class SetPasswordCommand extends PostCommand { - private final String _email; private final String _password; private final String _verification; - public SetPasswordCommand(String email, String password, String verification) + public SetPasswordCommand(String password, String verification) { super("login", "setPassword"); - _email = email; _password = password; _verification = verification; } @@ -307,7 +306,6 @@ public SetPasswordCommand(String email, String password, String verification) protected List getPostData() { List postData = new ArrayList<>(); - postData.add(new BasicNameValuePair("email", _email)); postData.add(new BasicNameValuePair("password", _password)); postData.add(new BasicNameValuePair("password2", _password)); postData.add(new BasicNameValuePair("verification", _verification)); diff --git a/src/org/labkey/test/util/AbstractUserHelper.java b/src/org/labkey/test/util/AbstractUserHelper.java index c7bb212ac9..1ecec6ef71 100644 --- a/src/org/labkey/test/util/AbstractUserHelper.java +++ b/src/org/labkey/test/util/AbstractUserHelper.java @@ -145,7 +145,7 @@ public final void deleteUsers(boolean failIfNotFound, TestUser... users) public abstract void ensureUsersExist(List userEmails); public abstract CreateUserResponse createUser(String userName, boolean sendEmail, boolean verifySuccess); - public abstract String setInitialPassword(String email); + public abstract String setInitialPassword(int userId); protected abstract void _deleteUser(String userEmail); protected abstract void _deleteUsers(boolean failIfNotFound, String... userEmails); } diff --git a/src/org/labkey/test/util/FileBrowserHelper.java b/src/org/labkey/test/util/FileBrowserHelper.java index ef4b2fdd9e..58cece3c2f 100644 --- a/src/org/labkey/test/util/FileBrowserHelper.java +++ b/src/org/labkey/test/util/FileBrowserHelper.java @@ -712,7 +712,13 @@ public enum BrowserAction EMAIL_SETTINGS("envelope", "Email Preferences", "emailPreferences"), AUDIT_HISTORY("users", "Audit History", "auditLog", true), ADMIN("cog", "Admin", "customize"), - CREATE_RUN("sitemap", "Create Run", "createRun"); + CREATE_RUN("sitemap", "Create Run", "createRun"){ + @Override + public String getRequiredModule() + { + return "Provenance"; + } + }; private final String _iconName; private final String _buttonText; @@ -771,6 +777,11 @@ public Locator getButtonTextLocator() { return button().containing(_buttonText); } + + public String getRequiredModule() + { + return "Core"; + } } public enum ActionStatus{ diff --git a/src/org/labkey/test/util/StudyHelper.java b/src/org/labkey/test/util/StudyHelper.java index d0b16ffdee..51f93abe10 100644 --- a/src/org/labkey/test/util/StudyHelper.java +++ b/src/org/labkey/test/util/StudyHelper.java @@ -290,7 +290,7 @@ public void exportStudy(String folder, boolean zipFile) _test.clickButton("Export Study"); ExportFolderPage exportFolderPage = new ExportFolderPage(_test.getDriver()); - List studyObjects = Arrays.asList("Visit Map", "Cohort Settings", "QC State Settings", "Datasets: Study Dataset Definitions", "Datasets: Study Dataset Data", "Datasets: Assay Dataset Definitions", "Datasets: Assay Dataset Data", "Participant Comment Settings", "Participant Groups", "Protocol Documents"); + List studyObjects = Arrays.asList("Visit Map", "Cohort Settings", _test._containerHelper.getAllModules().contains("samplemanagement") ? "Sample Status and QC State Settings" : "QC State Settings", "Datasets: Study Dataset Definitions", "Datasets: Study Dataset Data", "Datasets: Assay Dataset Definitions", "Datasets: Assay Dataset Data", "Participant Comment Settings", "Participant Groups", "Protocol Documents"); if (isSpecimenModuleActive()) { studyObjects = new ArrayList<>(studyObjects); diff --git a/src/org/labkey/test/util/TestUser.java b/src/org/labkey/test/util/TestUser.java index 345456a962..bddbbfd837 100644 --- a/src/org/labkey/test/util/TestUser.java +++ b/src/org/labkey/test/util/TestUser.java @@ -68,7 +68,7 @@ public TestUser setInitialPassword() { if (_password == null) // if null, this is the initial password - we can use the UI to set it now { - _password = _apiUserHelper.setInitialPassword(_email); + _password = _apiUserHelper.setInitialPassword(_createUserResponse.getUserId()); } else { diff --git a/src/org/labkey/test/util/UIUserHelper.java b/src/org/labkey/test/util/UIUserHelper.java index 63c48f1716..cd920f9f29 100644 --- a/src/org/labkey/test/util/UIUserHelper.java +++ b/src/org/labkey/test/util/UIUserHelper.java @@ -59,7 +59,7 @@ public CreateUserResponse cloneUser(@LoggedParam String userName, String cloneUs String email; Integer userId; List userInfo = Locator.css("meta").findElements(resultEl); - if (userInfo.size() > 0) + if (!userInfo.isEmpty()) { email = userInfo.get(0).getAttribute("email"); String userIdStr = userInfo.get(0).getAttribute("userId"); @@ -200,10 +200,10 @@ public void deactivateUser(String userEmail) } @Override - public String setInitialPassword(String user) + public String setInitialPassword(int userId) { String password = PasswordUtil.getPassword(); - SetPasswordForm.goToInitialPasswordForUser(getWrapper(), user) + SetPasswordForm.goToInitialPasswordForUser(getWrapper(), userId) .setNewPassword(password) .clickSubmit(); diff --git a/test.properties.template b/test.properties.template index 016f22c228..66e7f534e8 100644 --- a/test.properties.template +++ b/test.properties.template @@ -86,6 +86,8 @@ selenium.reuseWebDriver=true #webtest.webdriver.logging=false ## Run test browser in headless mode (experimental) #webtest.webdriver.headless=false +## Customize browser window size +#webtest.window.size=1280x1024 #==============================================================================