Skip to content

Commit a53cd24

Browse files
committed
Merge remote-tracking branch 'origin/develop' into fb_editableGridNeedsAutomation
2 parents c33e754 + dfa845c commit a53cd24

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

src/org/labkey/test/tests/AdminConsoleNavigationTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.labkey.test.tests;
22

3+
import org.assertj.core.api.Assertions;
34
import org.jetbrains.annotations.Nullable;
45
import org.junit.Assert;
56
import org.junit.BeforeClass;
@@ -86,6 +87,7 @@ public void testAdminNavTrails()
8687
{
8788
linkHrefs.put(link.getText(), link.getAttribute("href"));
8889
}
90+
Assertions.assertThat(linkHrefs.keySet()).as("Expected links").containsAll(ignoredLinks);
8991

9092
List<String> pagesMissingNavTrail = new ArrayList<>();
9193

@@ -121,6 +123,7 @@ public void testTroubleshooterLinkAccess()
121123
impersonate(TROUBLESHOOTER);
122124
Map<String, String> linkHrefs = new LinkedHashMap<>();
123125
List<WebElement> troubleshooterLinks = adminConsole.getAllAdminConsoleLinks();
126+
assertTrue(String.format("Failed sanity check. Only found %s admin links. There should be more.", troubleshooterLinks.size()), troubleshooterLinks.size() > 10);
124127
for (WebElement link : troubleshooterLinks)
125128
linkHrefs.put(link.getText(), link.getAttribute("href"));
126129

@@ -155,6 +158,7 @@ public void testAdminConsoleLinksForAdminAndNonAdmin()
155158
));
156159
ShowAdminPage adminConsole = goToAdminConsole();
157160
List<WebElement> adminLinks = adminConsole.getAllAdminConsoleLinks();
161+
assertTrue(String.format("Failed sanity check. Only found %s admin links. There should be more.", adminLinks.size()), adminLinks.size() > 10);
158162
Map<String, String> linkHrefs = new LinkedHashMap<>();
159163
for (WebElement link : adminLinks)
160164
linkHrefs.put(link.getText(), link.getAttribute("href"));

src/org/labkey/test/tests/CrawlerTest.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package org.labkey.test.tests;
22

3+
import org.assertj.core.api.Assertions;
34
import org.junit.After;
45
import org.junit.Assert;
56
import org.junit.Assume;
67
import org.junit.BeforeClass;
78
import org.junit.Test;
89
import org.junit.experimental.categories.Category;
10+
import org.labkey.remoteapi.SimpleGetCommand;
911
import org.labkey.test.BaseWebDriverTest;
1012
import org.labkey.test.Locator;
1113
import org.labkey.test.Locators;
@@ -117,18 +119,25 @@ public void testEnforceCsp() throws Exception
117119
beginAt(getInjectUrl(Crawler.injectScriptBlock), 10_000);
118120

119121
log("Verify that enforced CSP is also reported");
120-
CspLogUtil.checkNewCspWarnings(getArtifactCollector());
122+
CspLogUtil.checkNewCspWarnings(getArtifactCollector()); // throws CspWarningDetectedException
121123
}
122124

123125
@Test (expected = CspLogUtil.CspWarningDetectedException.class)
124-
public void testCspWarning()
126+
public void testCspWarning() throws Exception
125127
{
126128
Assume.assumeFalse("Can't test for CSP report", TestProperties.isCspCheckSkipped());
127129

128130
_cspConfigHelper.setEnforceCsp(false);
129131

130-
beginAt(WebTestHelper.buildRelativeUrl(MODULE_NAME, getProjectName(), "cspWarning"));
131-
CspLogUtil.checkNewCspWarnings(getArtifactCollector());
132+
int initialLength = getCspReportLog().length();
133+
134+
String cspWarningUrl = WebTestHelper.buildRelativeUrl(MODULE_NAME, getProjectName(), "cspWarning");
135+
beginAt(cspWarningUrl);
136+
137+
// 53261: Provide visibility into CSP reports for cloud clients
138+
Assertions.assertThat(getCspReportLog().substring(initialLength)).as("CSP warning").contains(cspWarningUrl);
139+
140+
CspLogUtil.checkNewCspWarnings(getArtifactCollector()); // throws CspWarningDetectedException
132141
}
133142

134143
// Crawler should flag external links without the correct 'rel' attribute
@@ -188,6 +197,13 @@ protected boolean cspFailFast()
188197
return false;
189198
}
190199

200+
public String getCspReportLog() throws Exception
201+
{
202+
return new SimpleGetCommand("admin", "showCspReportLog")
203+
.execute(createDefaultConnection(), null)
204+
.getText();
205+
}
206+
191207
@After
192208
public void postTest()
193209
{

0 commit comments

Comments
 (0)