Search in sources :

Example 11 with DashboardView

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);
}
Also used : DashboardView(org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView) Test(org.junit.Test)

Example 12 with DashboardView

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));
}
Also used : BuildStatisticsPortlet(org.jenkinsci.test.acceptance.plugins.dashboard_view.BuildStatisticsPortlet) DashboardView(org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView) Test(org.junit.Test)

Example 13 with DashboardView

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));
}
Also used : DashboardView(org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) TestStatisticsChartPortlet(org.jenkinsci.test.acceptance.plugins.dashboard_view.TestStatisticsChartPortlet) Test(org.junit.Test)

Example 14 with DashboardView

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));
}
Also used : BuildStatisticsPortlet(org.jenkinsci.test.acceptance.plugins.dashboard_view.BuildStatisticsPortlet) DashboardView(org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Test(org.junit.Test)

Example 15 with DashboardView

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);
}
Also used : UnstableJobsPortlet(org.jenkinsci.test.acceptance.plugins.dashboard_view.UnstableJobsPortlet) DashboardView(org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Test(org.junit.Test)

Aggregations

DashboardView (org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView)35 Test (org.junit.Test)32 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)16 BuildStatisticsPortlet (org.jenkinsci.test.acceptance.plugins.dashboard_view.BuildStatisticsPortlet)7 JobsGridPortlet (org.jenkinsci.test.acceptance.plugins.dashboard_view.JobsGridPortlet)4 LatestBuildsPortlet (org.jenkinsci.test.acceptance.plugins.dashboard_view.LatestBuildsPortlet)4 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)3 TestStatisticsChartPortlet (org.jenkinsci.test.acceptance.plugins.dashboard_view.TestStatisticsChartPortlet)3 UnstableJobsPortlet (org.jenkinsci.test.acceptance.plugins.dashboard_view.UnstableJobsPortlet)3 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 NestedView (org.jenkinsci.test.acceptance.plugins.nested_view.NestedView)2 Build (org.jenkinsci.test.acceptance.po.Build)2 Folder (org.jenkinsci.test.acceptance.po.Folder)2 Issue (org.jvnet.hudson.test.Issue)2 Description (org.hamcrest.Description)1 Matcher (org.jenkinsci.test.acceptance.Matcher)1 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)1 WithCredentials (org.jenkinsci.test.acceptance.junit.WithCredentials)1 WithDocker (org.jenkinsci.test.acceptance.junit.WithDocker)1 AnalysisPlugin (org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisPlugin)1