use of org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView in project acceptance-test-harness by jenkinsci.
the class AbstractAnalysisTest method addDashboardViewAndBottomPortlet.
/**
* Creates a new Dashboard-View and adds the given portlet as "bottom portlet".
*
* @param <T> the type constraint of the portlet
* @param portlet the portlet to add
* @param owner the owner of the view
* @return The view.
*/
protected <T extends AbstractDashboardViewPortlet> DashboardView addDashboardViewAndBottomPortlet(final Class<T> portlet, final Container owner) {
DashboardView view = createNewViewForAllJobs(DashboardView.class, owner);
view.addBottomPortlet(portlet);
view.save();
return view;
}
use of org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView in project acceptance-test-harness by jenkinsci.
the class AnalysisCollectorPluginTest method should_aggregate_warnings_in_dashboard_portlet.
/**
* Sets up a dashboard view with a warnings-per-project portlet. Builds a job and checks if the portlet shows the
* correct number of warnings. Then one of the tools is deselected. The portlet should then show only the remaining
* number of warnings.
*/
@Test
@WithPlugins("dashboard-view")
public void should_aggregate_warnings_in_dashboard_portlet() {
// avoid JENKINS-49026
checkExtensionAreDeployed("hudson.plugins.analysis.dashboard.AbstractPortlet", Collections.EMPTY_SET);
FreeStyleJob job = createFreeStyleJob();
buildSuccessfulJob(job);
DashboardView dashboard = jenkins.views.create(DashboardView.class, createRandomName());
dashboard.configure();
dashboard.matchAllJobs();
WarningsPerProjectPortlet portlet = addWarningsPortlet(dashboard);
dashboard.save();
dashboard.open();
verifyWarningsCountInPortlet(job.name, dashboard);
// uncheck Open Tasks
dashboard.configure(() -> portlet.checkCollectedPlugin(TASKS, false));
dashboard.open();
assertThat(dashboard, not(hasWarnings(job.name, TASKS.getId(), TASKS_ALL)));
}
use of org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView in project acceptance-test-harness by jenkinsci.
the class AnalysisCollectorPluginTest method hasWarnings.
public static Matcher<DashboardView> hasWarnings(final String jobName, final String pluginId, final int warningsCount) {
return new Matcher<DashboardView>(" shows %s warnings for plugin %s and job %s", warningsCount, pluginId, jobName) {
@Override
public boolean matchesSafely(final DashboardView view) {
view.open();
try {
WebElement warningsLink = findPortletLink(view, jobName, pluginId);
String linkText = warningsLink.getText();
return Integer.parseInt(linkText) == warningsCount;
} catch (NoSuchElementException | NumberFormatException e) {
return false;
}
}
@Override
public void describeMismatchSafely(final DashboardView view, final Description desc) {
desc.appendText("Portlet does not show expected warnings for plugin " + pluginId);
}
};
}
use of org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView in project acceptance-test-harness by jenkinsci.
the class DashboardViewPluginTest method jobsGridPortlet_notFillColumnsFirst.
@Test
public void jobsGridPortlet_notFillColumnsFirst() {
createFreeStyleJob();
createFreeStyleJob();
createFreeStyleJob();
createFreeStyleJob();
DashboardView v = createDashboardView();
JobsGridPortlet jobsGridPortlet = v.addBottomPortlet(JobsGridPortlet.class);
jobsGridPortlet.setNumberOfColumns(3);
jobsGridPortlet.setFillColumnFirst(false);
v.save();
assertThat(jobsGridPortlet.getJob(1, 3), notNullValue());
assertThat(jobsGridPortlet.getJob(2, 2), nullValue());
}
use of org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView in project acceptance-test-harness by jenkinsci.
the class DashboardViewPluginTest method jobsGridPortlet_invalidNumberOfColumn.
@Test
public void jobsGridPortlet_invalidNumberOfColumn() {
// One job is required for the portlet to be displayed
createFreeStyleJob();
DashboardView v = createDashboardView();
JobsGridPortlet jobsGridPortlet = v.addBottomPortlet(JobsGridPortlet.class);
jobsGridPortlet.setNumberOfColumns(2);
v.save();
expectedException.expect(NoSuchElementException.class);
jobsGridPortlet.getJob(1, 3);
}
Aggregations