Search in sources :

Example 1 with WorkflowMultiBranchJob

use of org.jenkinsci.test.acceptance.po.WorkflowMultiBranchJob in project acceptance-test-harness by jenkinsci.

the class WorkflowMultibranchTest method testMultibranchPipeline.

@Ignore("cannot run quickly as anonymous due to github rate limiting")
@Test
public void testMultibranchPipeline() {
    final WorkflowMultiBranchJob multibranchJob = jenkins.jobs.create(WorkflowMultiBranchJob.class);
    this.configureJobWithGithubBranchSource(multibranchJob);
    multibranchJob.save();
    multibranchJob.waitForBranchIndexingFinished(20);
    this.assertBranchIndexing(multibranchJob);
    final WorkflowJob successJob = multibranchJob.getJob("jenkinsfile_success");
    final WorkflowJob failureJob = multibranchJob.getJob("jenkinsfile_failure");
    this.assertExistAndRun(successJob, true);
    this.assertExistAndRun(failureJob, false);
    multibranchJob.open();
    multibranchJob.reIndex();
    multibranchJob.waitForBranchIndexingFinished(20);
    this.assertExistAndRun(successJob, true);
    this.assertExistAndRun(failureJob, false);
}
Also used : WorkflowMultiBranchJob(org.jenkinsci.test.acceptance.po.WorkflowMultiBranchJob) WorkflowJob(org.jenkinsci.test.acceptance.po.WorkflowJob) Ignore(org.junit.Ignore) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 2 with WorkflowMultiBranchJob

use of org.jenkinsci.test.acceptance.po.WorkflowMultiBranchJob 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

WorkflowMultiBranchJob (org.jenkinsci.test.acceptance.po.WorkflowMultiBranchJob)2 Test (org.junit.Test)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)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 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)1 AnalysisPlugin (org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisPlugin)1 DashboardView (org.jenkinsci.test.acceptance.plugins.dashboard_view.DashboardView)1 NestedView (org.jenkinsci.test.acceptance.plugins.nested_view.NestedView)1 GitBranchSource (org.jenkinsci.test.acceptance.plugins.workflow_multibranch.GitBranchSource)1 Folder (org.jenkinsci.test.acceptance.po.Folder)1 WorkflowJob (org.jenkinsci.test.acceptance.po.WorkflowJob)1 Ignore (org.junit.Ignore)1 Issue (org.jvnet.hudson.test.Issue)1