Skip to content

Commit

Permalink
Stop testing advanced reports (#2152)
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-adam authored Nov 22, 2024
1 parent 6454021 commit 578cd23
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 130 deletions.
21 changes: 0 additions & 21 deletions data/api/security-api.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,15 @@
"groups": [
{
"id": -1,
"roleLabel": "No Permissions",
"name": "Site Administrators",
"roles": [],
"isSystemGroup": true,
"permissions": 0,
"role": "NO_PERMISSIONS",
"isProjectGroup": false,
"type": "g",
"effectivePermissions": [],
"groups": []
},
{
"role": "NO_PERMISSIONS",
"permissions": 0,
"isSystemGroup": true,
"roles": [],
"name": "Developers",
Expand All @@ -34,42 +29,32 @@
"id": -4,
"type": "g",
"isProjectGroup": false,
"roleLabel": "No Permissions"
},
{
"id": -3,
"roleLabel": "No Permissions",
"name": "Guests",
"roles": [],
"isSystemGroup": true,
"permissions": 0,
"role": "NO_PERMISSIONS",
"isProjectGroup": false,
"type": "g",
"effectivePermissions": [],
"groups": []
},
{
"id": -2,
"roleLabel": "No Permissions",
"name": "All Site Users",
"roles": [],
"isSystemGroup": true,
"permissions": 0,
"role": "NO_PERMISSIONS",
"isProjectGroup": false,
"type": "g",
"effectivePermissions": [],
"groups": []
},
{
"id": 1672,
"roleLabel": "Editor",
"name": "testgroup1",
"roles": ["org.labkey.api.security.roles.EditorRole"],
"isSystemGroup": false,
"permissions": 15,
"role": "EDITOR",
"isProjectGroup": true,
"type": "g",
"effectivePermissions": [
Expand Down Expand Up @@ -97,12 +82,9 @@
},
{
"id": 1673,
"roleLabel": "Reader",
"name": "testgroup2",
"roles": ["org.labkey.api.security.roles.ReaderRole"],
"isSystemGroup": false,
"permissions": 1,
"role": "READER",
"isProjectGroup": true,
"type": "g",
"effectivePermissions": [
Expand All @@ -117,12 +99,9 @@
},
{
"id": 1671,
"roleLabel": "No Permissions",
"name": "Users",
"roles": [],
"isSystemGroup": false,
"permissions": 0,
"role": "NO_PERMISSIONS",
"isProjectGroup": true,
"type": "g",
"effectivePermissions": [],
Expand Down
57 changes: 0 additions & 57 deletions src/org/labkey/test/tests/DataReportsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,22 @@
import org.labkey.test.BaseWebDriverTest;
import org.labkey.test.Locator;
import org.labkey.test.SortDirection;
import org.labkey.test.TestFileUtils;
import org.labkey.test.TestProperties;
import org.labkey.test.TestTimeoutException;
import org.labkey.test.WebTestHelper;
import org.labkey.test.categories.Daily;
import org.labkey.test.categories.Reports;
import org.labkey.test.components.html.BootstrapMenu;
import org.labkey.test.pages.reports.ScriptReportPage;
import org.labkey.test.util.ApiPermissionsHelper;
import org.labkey.test.util.DataRegionTable;
import org.labkey.test.util.Ext4Helper;
import org.labkey.test.util.LogMethod;
import org.labkey.test.util.OptionalFeatureHelper;
import org.labkey.test.util.PermissionsHelper;
import org.labkey.test.util.RReportHelper;
import org.openqa.selenium.WebElement;

import java.io.File;
import java.util.List;

import static org.hamcrest.CoreMatchers.hasItem;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

Expand Down Expand Up @@ -301,56 +294,6 @@ public void doGridViewTest()
deleteReport(viewName);
}

@Test
public void doAdvancedViewTest()
{
clickAndWait(Locator.linkWithText("DEM-1: Demographics"));
DataRegionTable dataRegion = DataRegionTable.DataRegion(getDriver()).find();
String create_advanced_report = "Create Advanced Report";

// Note: Enabling this feature flag requires a server restart
if (TestProperties.isPrimaryUserAppAdmin() || !OptionalFeatureHelper.isOptionalFeatureEnabled(createDefaultConnection(), "enableExternalReport"))
{
List<String> menuItems = dataRegion.getHeaderMenuOptions("Charts / Reports");
assertThat("App admin shouldn't be able to create an advanced report.", menuItems, not(hasItem(create_advanced_report)));
assertThat("Sanity check failed. Check menu text for advanced report.", menuItems, hasItem("Create Chart"));
// Site admins can still navigate to the externalReport page. It isn't functional though, so skipping this check
if (TestProperties.isPrimaryUserAppAdmin())
{
beginAt(WebTestHelper.buildURL("study-reports", getCurrentContainerPath(), "externalReport"));
assertEquals("App admin shouldn't be able to create an advanced report.", 403, getResponseCode());
}
return; // success
}

dataRegion.goToReport(create_advanced_report);

log("Verify txt report");
selectOptionByText(Locator.name("queryName"), "DEM-1 (DEM-1: Demographics)");
String java = System.getProperty("java.home") + "/bin/java";
setFormElement(Locator.name("program"), java);
setFormElement(Locator.name("arguments"), "-cp " + new File(TestFileUtils.getTestBuildDir(), "classes/java/uiTest") + " org.labkey.test.util.Echo ${DATA_FILE} ${REPORT_FILE}");
clickAndWait(Locator.lkButton("Submit"));
assertElementPresent(Locator.tag("pre").containing("Female"));

log("Verify tsv report");
setFormElement(Locator.name("program"), java);
setFormElement(Locator.name("arguments"), "-cp " + new File(TestFileUtils.getTestBuildDir(), "classes/java/uiTest") + " org.labkey.test.util.Echo ${DATA_FILE}");
selectOptionByValue(Locator.name("fileExtension"), "tsv");
clickAndWait(Locator.lkButton("Submit"));
assertElementPresent(Locator.tag("td").withClass("labkey-header").containing("DEMsex"));
assertElementPresent(Locator.tag("td").containing("Female"));

log("Verify saved tsv report");
setFormElement(Locator.name("label"), "tsv");
selectOptionByText(Locator.name("showWithDataset"), "DEM-1: Demographics");
clickAndWait(Locator.lkButton("Save"));
clickAndWait(Locator.linkWithText(getFolderName()));
clickAndWait(Locator.linkWithText("tsv"));
assertElementPresent(Locator.tag("td").withClass("labkey-header").containing("DEMsex"));
assertElementPresent(Locator.tag("td").containing("Female"));
}

@Test
public void doRReportsTest()
{
Expand Down
5 changes: 1 addition & 4 deletions src/org/labkey/test/tests/SecurityApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.labkey.test.categories.Daily;
import org.labkey.test.util.APITestHelper;
import org.labkey.test.util.ApiPermissionsHelper;
import org.labkey.test.util.OptionalFeatureHelper;

import java.io.File;
import java.util.Arrays;
Expand Down Expand Up @@ -121,7 +120,7 @@ protected Pattern[] getIgnoredElements()
* If you run the test locally from the command line you might be better able to understand what the differences are.
* After running locally you should see a message at the end of the run output that looks like this:
*
* There were failing tests. See the report at: file:///Users/janedoe/labkey/trunk/build/modules/testAutomation/test/logs/reports/html/index.html
* There were failing tests. See the report at: [LABKEY-ROOT]/build/modules/testAutomation/test/logs/reports/html/index.html
*
* Open this file in a browser, click on the test name, then click on the "Standard output" button. This presents the
* output in a more readable way (basically a log). Near the top is an "Expected:" comment with the expected well formatted
Expand All @@ -144,12 +143,10 @@ protected Pattern[] getIgnoredElements()
@Test
public void testApiUserRolesAndPermissions() throws Exception
{
boolean previous = OptionalFeatureHelper.enableOptionalFeature(createDefaultConnection(), "restoreUseOfAcls");
APITestHelper apiTester = new APITestHelper(this);
apiTester.setTestFiles(getTestFiles());
apiTester.setIgnoredElements(getIgnoredElements());
apiTester.runApiTests(ADMIN_USER);
OptionalFeatureHelper.setOptionalFeature(createDefaultConnection(), "restoreUseOfAcls", previous);
}

@Override
Expand Down
48 changes: 0 additions & 48 deletions src/org/labkey/test/util/Echo.java

This file was deleted.

0 comments on commit 578cd23

Please sign in to comment.