use of org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView in project acceptance-test-harness by jenkinsci.
the class DashboardViewPluginTest method filterByRegex.
@Test
public void filterByRegex() {
jenkins.jobs.create(FreeStyleJob.class, "a");
jenkins.jobs.create(FreeStyleJob.class, "aa");
jenkins.jobs.create(FreeStyleJob.class, "b");
final DashboardView view = createDashboardView();
view.configure(() -> view.dashboardPortlets.checkIncludeStdJobList(true));
view.open();
final List<String> jobIDs = view.projectStatus.getJobIDs();
assertEquals(Arrays.asList("a", "aa", "b"), jobIDs);
view.configure(() -> view.jobFilters.setIncludeRegex("a*"));
view.open();
final List<String> jobIDsFiltered = view.projectStatus.getJobIDs();
assertEquals(Arrays.asList("a", "aa"), jobIDsFiltered);
}
use of org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView in project acceptance-test-harness by jenkinsci.
the class DashboardViewPluginTest method buildStatisticsPortlet_success.
@Test
public void buildStatisticsPortlet_success() {
DashboardView v = createDashboardView();
BuildStatisticsPortlet stats = v.addBottomPortlet(BuildStatisticsPortlet.class);
v.save();
buildSuccessfulJob(createFreeStyleJob());
v.open();
assertThat(stats.getNumberOfBuilds(JobType.SUCCESS), is(1));
}
use of org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView in project acceptance-test-harness by jenkinsci.
the class DashboardViewPluginTest method testStatisticsChart_failureAndSuccess.
@Test
public void testStatisticsChart_failureAndSuccess() throws IOException {
DashboardView v = createDashboardView();
TestStatisticsChartPortlet chart = v.addBottomPortlet(TestStatisticsChartPortlet.class);
v.save();
FreeStyleJob unstableFreeStyleJob = createUnstableFreeStyleJob();
FreeStyleJob successJob = createFreeStyleJob(job -> {
String resultFileName = "status.xml";
job.addShellStep("echo '<testsuite><testcase classname=\"\">" + "</testcase></testsuite>'>" + resultFileName);
job.addPublisher(JUnitPublisher.class).testResults.set(resultFileName);
});
buildSuccessfulJob(successJob);
buildUnstableJob(unstableFreeStyleJob);
v.open();
Map<Integer, Integer> colorsOccurrences = getColorDistributionOfSignificantColors(chart.getImage());
assertThat(colorsOccurrences.size(), is(2));
Iterator<Integer> colorIt = colorsOccurrences.values().iterator();
double failureSuccessRatio = Math.abs(((double) colorIt.next() / (double) colorIt.next()) - 1);
assertThat(failureSuccessRatio, lessThan(0.10));
}
use of org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView in project acceptance-test-harness by jenkinsci.
the class DashboardViewPluginTest method configureDashboardFilterOnlyActivatedJobs.
@Test
public void configureDashboardFilterOnlyActivatedJobs() {
DashboardView v = createDashboardView();
BuildStatisticsPortlet stats = v.addBottomPortlet(BuildStatisticsPortlet.class);
v.configure(() -> {
v.jobFilters.setStatusFilter(JobFiltersArea.StatusFilter.ENABLED);
});
final FreeStyleJob active = createFreeStyleJob();
final FreeStyleJob disabled = createFreeStyleJob();
buildSuccessfulJob(active);
buildSuccessfulJob(disabled);
v.open();
assertThat(stats.getNumberOfBuilds(JobType.TOTAL), is(2));
assertThat(stats.getNumberOfBuilds(JobType.DISABLED), is(0));
disabled.configure(disabled::disable);
v.open();
assertThat(stats.getNumberOfBuilds(JobType.TOTAL), is(1));
assertThat(stats.getNumberOfBuilds(JobType.DISABLED), is(0));
}
use of org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView in project acceptance-test-harness by jenkinsci.
the class DashboardViewPluginTest method unstableJobsPortlet_success.
@Test
public void unstableJobsPortlet_success() {
DashboardView v = createDashboardView();
UnstableJobsPortlet unstableJobsPortlet = v.addBottomPortlet(UnstableJobsPortlet.class);
unstableJobsPortlet.setShowOnlyFailedJobs(true);
v.save();
FreeStyleJob successfulJob = createFreeStyleJob();
buildSuccessfulJob(successfulJob);
assertJobInUnstableJobsPortlet(unstableJobsPortlet, successfulJob.name, false);
}
Aggregations