Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 4 additions & 55 deletions src/org/labkey/test/tests/ContainerContextTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protected String getProjectName()
@Override
public List<String> getAssociatedModules()
{
return Arrays.asList("query", "viscstudies");
return Arrays.asList("query");
}

@Override
Expand Down Expand Up @@ -122,13 +122,13 @@ protected void doSetup() throws Exception
_RReportHelper.ensureRConfig();

_containerHelper.createProject(getProjectName(), null);
_containerHelper.enableModules(Arrays.asList("simpletest", "ViscStudies"));
_containerHelper.enableModules(Arrays.asList("simpletest"));
_portalHelper.doInAdminMode(ph -> {
ph.addWebPart("Workbooks");
ph.addWebPart("Lists");
_containerHelper.createSubfolder(getProjectName(), SUB_FOLDER_A, new String[]{"List", "Study", "ViscStudies", "Wiki"});
_containerHelper.createSubfolder(getProjectName(), SUB_FOLDER_A, new String[]{"List", "Study", "Wiki"});
ph.addWebPart("Lists");
_containerHelper.createSubfolder(getProjectName(), SUB_FOLDER_B, new String[]{"List", "Study", "ViscStudies", "Wiki"});
_containerHelper.createSubfolder(getProjectName(), SUB_FOLDER_B, new String[]{"List", "Study", "Wiki"});
ph.addWebPart("Lists");
});
}
Expand Down Expand Up @@ -203,57 +203,6 @@ public void testListLookupURL() throws Exception
href.contains(getProjectName() + "/" + SUB_FOLDER_A) && href.contains("fake") && href.contains("action.view?key=2"));
}

// TODO: Move this to 'CAVDStudyTest'
// Issue 15610: viscstudieslist - URLs generated from lookups are broken
@Test
public void testIssue15610() throws Exception
{
log("** Creating study in " + SUB_FOLDER_A);
goToProjectHome();
clickFolder(SUB_FOLDER_A);
goToManageStudy();
clickButton("Create Study");
setFormElement(Locator.name("label"), SUB_FOLDER_A + "-Study");
clickButton("Create Study");

log("** Creating study in " + SUB_FOLDER_B);
goToProjectHome();
clickFolder(SUB_FOLDER_B);
goToManageStudy();
clickButton("Create Study");
setFormElement(Locator.name("label"), SUB_FOLDER_B + "-Study");
clickButton("Create Study");

log("** Creating list with lookup to viscstudies.studies");
List<FieldDefinition> cols = List.of(
new FieldDefinition("StudyLookup", new FieldDefinition.LookupInfo(null, "viscstudies", "studies").setTableType(FieldDefinition.ColumnType.String)).setDescription("Study Lookup")
);
new IntListDefinition("Issue15610-List", LIST_KEY_NAME).setFields(cols)
.create(createDefaultConnection(), getProjectName());

log("** Inserting row into list");
goToProjectHome();
clickAndWait(Locator.linkWithText("Issue15610-List"));
DataRegionTable.findDataRegion(this).clickInsertNewRow();
selectOptionByText(Locator.name("quf_StudyLookup"), SUB_FOLDER_A + "-Study");
clickButton("Submit");

DataRegionTable.findDataRegion(this).clickInsertNewRow();
selectOptionByText(Locator.name("quf_StudyLookup"), SUB_FOLDER_B + "-Study");
clickButton("Submit");

log("** Checking URLs go to correct container...");
String href = getAttribute(Locator.linkWithText(SUB_FOLDER_A + "-Study"), "href");
assertTrue("Expected 'MyStudy' link to go to " + getProjectName() + "/" + SUB_FOLDER_A + " container: " + href,
href.contains("/study/" + getProjectName() + "/" + SUB_FOLDER_A + "/studySchedule.view") ||
href.contains("/" + getProjectName() + "/" + SUB_FOLDER_A + "/study-studySchedule.view"));

href = getAttribute(Locator.linkWithText(SUB_FOLDER_B + "-Study"), "href");
assertTrue("Expected 'MyStudy' link to go to " + getProjectName() + "/" + SUB_FOLDER_B + " container: " + href,
href.contains("/study/" + getProjectName() + "/" + SUB_FOLDER_B + "/studySchedule.view") ||
href.contains("/" + getProjectName() + "/" + SUB_FOLDER_B + "/study-studySchedule.view"));
}

// Issue 15751: Pipeline job list generates URLs without correct container
@Test
public void testIssue15751() throws Exception
Expand Down
9 changes: 5 additions & 4 deletions src/org/labkey/test/util/Crawler.java
Original file line number Diff line number Diff line change
Expand Up @@ -669,12 +669,13 @@ public static class ControllerActionId
{
@NotNull private final String _controller;
@NotNull private String _action = "";
private String _folder;
private final String _folder;

public ControllerActionId(@NotNull String controller, @NotNull String action)
{
_controller = controller;
_action = action;
_folder = "";
}

public ControllerActionId(@NotNull String url)
Expand All @@ -684,13 +685,13 @@ public ControllerActionId(@NotNull String url)
if (rootRelativeURL.startsWith("_webdav/"))
{
_controller = "_webdav";
_folder = rootRelativeURL.substring("_webdav/".length());
_folder = EscapeUtil.decode(rootRelativeURL.substring("_webdav/".length()));
return;
}
if (rootRelativeURL.startsWith("_webfiles/"))
{
_controller = "_webfiles";
_folder = rootRelativeURL.substring("_webfiles/".length());
_folder = EscapeUtil.decode(rootRelativeURL.substring("_webfiles/".length()));
return;
}

Expand Down Expand Up @@ -723,7 +724,7 @@ public ControllerActionId(@NotNull String url)
_controller = rootRelativeURL.substring(0, postControllerSlashIdx);
rootRelativeURL = rootRelativeURL.substring(postControllerSlashIdx+1);
}
_folder = StringUtils.strip(rootRelativeURL, "/");
_folder = EscapeUtil.decode(StringUtils.strip(rootRelativeURL, "/"));
}

@NotNull public String getAction()
Expand Down