use of com.jenkinsci.plugins.badge.action.BadgeSummaryAction in project badge-plugin by jenkinsci.
the class CreateSummaryStepTest method createSummary_all.
@Test
public void createSummary_all() throws Exception {
String text = randomUUID().toString();
BadgeSummaryAction action = createSummary("summary.appendText('" + text + "', false, true, true, 'grey')");
assertEquals("<b><i><font color=\"grey\">" + text + "</font></i></b>", action.getText());
}
use of com.jenkinsci.plugins.badge.action.BadgeSummaryAction in project badge-plugin by jenkinsci.
the class CreateSummaryStepTest method createSummary_html_escaped.
@Test
public void createSummary_html_escaped() throws Exception {
String text = randomUUID().toString();
BadgeSummaryAction action = createSummary("summary.appendText('<li>" + text + "</li>', true)");
assertEquals("<li>" + text + "</li>", action.getText());
}
use of com.jenkinsci.plugins.badge.action.BadgeSummaryAction in project badge-plugin by jenkinsci.
the class CreateSummaryStepTest method createSummary_html_unescaped.
@Test
public void createSummary_html_unescaped() throws Exception {
String text = randomUUID().toString();
BadgeSummaryAction action = createSummary("summary.appendText('<li>" + text + "</li>', false)");
assertEquals("<li>" + text + "</li>", action.getText());
}
use of com.jenkinsci.plugins.badge.action.BadgeSummaryAction in project badge-plugin by jenkinsci.
the class CreateSummaryStepTest method createSummary_with_text.
@Test
public void createSummary_with_text() throws Exception {
String icon = randomUUID().toString();
String text = randomUUID().toString();
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition("def summary = createSummary(icon:\"" + icon + "\", text:\"" + text + "\")", true));
WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
List<BadgeSummaryAction> summaryActions = b.getActions(BadgeSummaryAction.class);
assertEquals(1, summaryActions.size());
BadgeSummaryAction action = summaryActions.get(0);
assertTrue(action.getIconPath().endsWith(icon));
assertEquals(text, action.getText());
}
use of com.jenkinsci.plugins.badge.action.BadgeSummaryAction in project badge-plugin by jenkinsci.
the class CreateSummaryStepTest method createSummary.
private BadgeSummaryAction createSummary(String script) throws Exception {
String icon = randomUUID().toString();
WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
p.setDefinition(new CpsFlowDefinition("def summary = createSummary(\"" + icon + "\")\n" + script, true));
WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
List<BadgeSummaryAction> summaryActions = b.getActions(BadgeSummaryAction.class);
assertEquals(1, summaryActions.size());
BadgeSummaryAction action = summaryActions.get(0);
assertTrue(action.getIconPath().endsWith(icon));
return action;
}
Aggregations