Skip to content

Commit

Permalink
Adapt to new CSP design (#1839)
Browse files Browse the repository at this point in the history
  • Loading branch information
timja authored Nov 20, 2024
1 parent 4cd71ba commit fdd6a49
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public Statement apply(final Statement base, final Description d) {
public void evaluate() throws Throwable {
Jenkins jenkins = injector.getInstance(Jenkins.class);

if (isEnabled() && !isSkipped()) {
// TODO enable for LogParserTest when JENKINS-74890 is resolved
if (isEnabled() && !isSkipped() && !d.getTestClass().getName().equals("plugins.LogParserTest")) {
PluginSpec plugin = new PluginSpec("csp");
jenkins.getPluginManager().installPlugins(plugin);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.jenkinsci.test.acceptance.plugins.csp;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.jenkinsci.test.acceptance.po.Jenkins;
import org.jenkinsci.test.acceptance.po.PageObject;
Expand All @@ -14,7 +15,16 @@ public ContentSecurityPolicyReport(Jenkins context) {

public List<String> getReport() {
List<String> lines = new ArrayList<>();
WebElement table = find(By.className("bigtable"));
WebElement table = getElement(By.className("jenkins-table"));
if (table == null) {
String text = find(By.className("jenkins-notice")).getText();
if (text.contains("No reports")) {
return Collections.emptyList();
} else {
throw new AssertionError("Couldn't find any results or the no results message");
}
}

List<WebElement> headers = table.findElements(By.tagName("th"));
StringBuilder sb = new StringBuilder();
for (WebElement header : headers) {
Expand Down

0 comments on commit fdd6a49

Please # to comment.