Search in sources :

Example 31 with DashboardView

use of org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView in project acceptance-test-harness by jenkinsci.

the class DashboardViewPluginTest method configureDashboardFilterOnlyDisabledJobs.

@Test
@Ignore("The statistics portlet shows only one job in total (the disabled one). it is shown as successful (1) but disabled(0)." + "I found no way to get a disabled number other than zero when status filter is set to disabled. ")
public void configureDashboardFilterOnlyDisabledJobs() {
    DashboardView v = createDashboardView();
    BuildStatisticsPortlet stats = v.addBottomPortlet(BuildStatisticsPortlet.class);
    v.configure(() -> {
        v.jobFilters.setStatusFilter(JobFiltersArea.StatusFilter.DISABLED);
    });
    final FreeStyleJob active = createFreeStyleJob();
    final FreeStyleJob disabled = createFreeStyleJob();
    buildSuccessfulJob(active);
    buildSuccessfulJob(disabled);
    disabled.configure(disabled::disable);
    v.open();
    assertThat(stats.getNumberOfBuilds(JobType.TOTAL), is(1));
    // When run the number of disabled jobs is zero.
    assertThat(stats.getNumberOfBuilds(JobType.DISABLED), is(1));
}
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) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 32 with DashboardView

use of org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView in project acceptance-test-harness by jenkinsci.

the class DashboardViewPluginTest method changeColumns.

@Test
public void changeColumns() {
    DashboardView v = createDashboardView();
    v.configure(() -> {
        v.columnsArea.removeAll();
        v.columnsArea.add(ColumnsArea.Column.NAME);
        v.columnsArea.add(ColumnsArea.Column.LAST_FAILURE);
        v.dashboardPortlets.checkIncludeStdJobList(true);
    });
    createFreeStyleJob();
    v.open();
    final List<String> titles = v.projectStatus.getHeaders();
    // last is not a name
    titles.remove(titles.size() - 1);
    assertThat(titles, hasSize(2));
    assertThat(titles.get(0), containsString(ColumnsArea.Column.NAME.getText()));
    assertThat(titles.get(1), containsString(ColumnsArea.Column.LAST_FAILURE.getText()));
}
Also used : DashboardView(org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView) Test(org.junit.Test)

Example 33 with DashboardView

use of org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView in project acceptance-test-harness by jenkinsci.

the class DashboardViewPluginTest method jobsGridPortlet_fillColumnsFirst.

@Test
public void jobsGridPortlet_fillColumnsFirst() {
    createFreeStyleJob();
    createFreeStyleJob();
    createFreeStyleJob();
    createFreeStyleJob();
    DashboardView v = createDashboardView();
    JobsGridPortlet jobsGridPortlet = v.addBottomPortlet(JobsGridPortlet.class);
    jobsGridPortlet.setNumberOfColumns(3);
    jobsGridPortlet.setFillColumnFirst(true);
    v.save();
    assertThat(jobsGridPortlet.getJob(1, 3), nullValue());
    assertThat(jobsGridPortlet.getJob(2, 2), notNullValue());
}
Also used : JobsGridPortlet(org.jenkinsci.test.acceptance.plugins.dashboard_view.JobsGridPortlet) DashboardView(org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView) Test(org.junit.Test)

Example 34 with DashboardView

use of org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView in project acceptance-test-harness by jenkinsci.

the class AbstractAnalysisTest method should_show_warnings_in_folder.

/**
 * Sets up a nested view that contains a dashboard view with a warnings-per-project portlet.
 * Creates a folder in this view and a freestyle job in this folder.
 * Finally checks if the warnings-per-project portlet and warnings column show the
 * correct number of warnings and provide a direct link to the actual warning results.
 */
@Test
@Issue("JENKINS-39947")
@WithPlugins({ "dashboard-view", "nested-view", "cloudbees-folder", "analysis-core@1.87" })
public void should_show_warnings_in_folder() {
    // avoid JENKINS-49026
    checkExtensionAreDeployed("hudson.plugins.analysis.dashboard.AbstractPortlet", Collections.EMPTY_SET);
    NestedView nested = jenkins.getViews().create(NestedView.class);
    DashboardView dashboard = nested.getViews().create(DashboardView.class);
    dashboard.configure(() -> {
        dashboard.matchAllJobs();
        dashboard.checkRecurseIntoFolders();
    });
    Folder folder = dashboard.jobs.create(Folder.class);
    folder.save();
    folder.open();
    FreeStyleJob job = createFreeStyleJob(folder);
    runAndVerifyJobResults(job);
    P projectAction = createProjectAction(job);
    dashboard.configure(() -> {
        dashboard.addBottomPortlet(projectAction.getTablePortlet());
    });
    verifyPortlet(projectAction);
    addListViewColumn(projectAction.getViewColumn(), folder);
    verifyColumn(projectAction);
}
Also used : NestedView(org.jenkinsci.test.acceptance.plugins.nested_view.NestedView) DashboardView(org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) Folder(org.jenkinsci.test.acceptance.po.Folder) Issue(org.jvnet.hudson.test.Issue) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 35 with DashboardView

use of org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView in project acceptance-test-harness by jenkinsci.

the class AnalysisCollectorPluginTest method should_open_links_in_folder_dashboard_and_nested_views.

/**
 * Sets up a nested view that contains a dashboard view with a warnings-per-project portlet.
 * Creates a folder in this view and a multi-branch job in this folder.
 * The multi-branch job is based on a git repository with two branches (master and branch).
 * Each branch contains a Jenkinsfile and several warnings results files.
 * Builds the jobs and verifies that the portlet is correctly filled and that all links open the correct page.
 */
@Test
@Issue({ "JENKINS-39950" })
@WithPlugins({ "dashboard-view", "nested-view", "git", "workflow-job", "workflow-cps", "workflow-basic-steps", "workflow-durable-task-step", "workflow-multibranch" })
@WithDocker
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { "warnings", "/org/jenkinsci/test/acceptance/docker/fixtures/GitContainer/unsafe" })
public void should_open_links_in_folder_dashboard_and_nested_views() {
    // avoid JENKINS-49026
    checkExtensionAreDeployed("hudson.plugins.analysis.dashboard.AbstractPortlet", Collections.EMPTY_SET);
    // Given
    NestedView nested = jenkins.getViews().create(NestedView.class);
    DashboardView dashboard = nested.getViews().create(DashboardView.class);
    dashboard.configure(() -> {
        dashboard.matchAllJobs();
        dashboard.checkRecurseIntoFolders();
        addWarningsPortlet(dashboard);
    });
    Folder folder = dashboard.jobs.create(Folder.class);
    folder.save();
    folder.open();
    String repoUrl = createGitRepositoryInDockerContainer();
    WorkflowMultiBranchJob job = folder.getJobs().create(WorkflowMultiBranchJob.class);
    GitBranchSource branchSource = job.addBranchSource(GitBranchSource.class);
    branchSource.setRemote(repoUrl);
    branchSource.setCredentials("warnings");
    job.save();
    job.waitForBranchIndexingFinished(20);
    // When
    List<String> jobs = Arrays.asList("master", "branch");
    for (String name : jobs) {
        buildBranch(job, name);
    }
    // Then
    dashboard.open();
    for (String name : jobs) {
        verifyWarningsCountInPortlet(name, dashboard);
    }
    for (AnalysisPlugin plugin : ANALYSIS_PLUGINS) {
        for (String name : jobs) {
            dashboard.open();
            findPortletLink(dashboard, name, plugin.getId()).click();
            assertThat(driver, hasContent(plugin.getName()));
        }
    }
}
Also used : NestedView(org.jenkinsci.test.acceptance.plugins.nested_view.NestedView) DashboardView(org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Folder(org.jenkinsci.test.acceptance.po.Folder) WorkflowMultiBranchJob(org.jenkinsci.test.acceptance.po.WorkflowMultiBranchJob) GitBranchSource(org.jenkinsci.test.acceptance.plugins.workflow_multibranch.GitBranchSource) AnalysisPlugin(org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisPlugin) Issue(org.jvnet.hudson.test.Issue) WithCredentials(org.jenkinsci.test.acceptance.junit.WithCredentials) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins) WithDocker(org.jenkinsci.test.acceptance.junit.WithDocker)

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