Skip to content
Merged
Changes from 1 commit
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
21 changes: 14 additions & 7 deletions src/org/labkey/test/tests/wiki/WikiCspTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
@BaseWebDriverTest.ClassTimeout(minutes = 2)
public class WikiCspTest extends BaseWebDriverTest
{
private static final String PROJECT_NAME = TRICKY_CHARACTERS_FOR_PROJECT_NAMES + "WikiCspTest";
// Add something unique to make sure log de-duping doesn't suppress the logging. Otherwise, running the test multiple
// times against the same server won't actually log the CSP error after the first hit
private static final String PROJECT_NAME = TRICKY_CHARACTERS_FOR_PROJECT_NAMES + "WikiCspTest" + System.currentTimeMillis();
Comment thread
labkey-jeckels marked this conversation as resolved.
Outdated
private static final String WIKI_PAGE_TITLE = "TOC_with_inline";
private static final String WIKI_PAGE_BODY =
// Issue 52483: HTML substitution patterns can throw errors during wiki validation
Expand Down Expand Up @@ -76,13 +78,18 @@ public void testCspChecks()

waitForText("Click me");

try
waitFor(() ->
{
CspLogUtil.checkNewCspWarnings(getArtifactCollector());
}
catch (CspLogUtil.CspWarningDetectedException ignore) {}

goToAdminConsole().goToSettingsSection();
try
{
CspLogUtil.checkNewCspWarnings(getArtifactCollector());
return false;
}
catch (CspLogUtil.CspWarningDetectedException ignore)
{
return true;
}
}, "Should have triggered a CSP error", WAIT_FOR_PAGE);

SiteValidationPage validationPage = goToAdminConsole().clickSiteValidation();
validationPage.setAllValidators(false);
Expand Down