Search in sources :

Example 6 with StageView

use of org.jenkinsci.test.acceptance.plugins.stageview.StageView in project acceptance-test-harness by jenkinsci.

the class StageViewTest method multiBuildJobShouldContainCorrectNumberOfJobsHeadline.

/**
 * This tests verfies the width of the display. Stageviews have to adapt
 * to new stages with future builds.
 */
@Test
@WithPlugins("pipeline-stage-view@2.18")
public void multiBuildJobShouldContainCorrectNumberOfJobsHeadline() {
    WorkflowJob job = jenkins.jobs.create(WorkflowJob.class);
    String pre = "node {\n";
    String post = "}";
    String singleStage = "stage ('Clone sources'){\n" + "           echo 'cloned'\n" + "    }\n";
    job.script.set("");
    job.sandbox.check();
    job.save();
    Build build = job.startBuild().shouldSucceed();
    for (int i = 0; i < 10; i++) {
        String text = pre + repeatString(singleStage, i + 1) + post;
        job.configure(() -> job.script.set(text));
        build = job.startBuild().shouldSucceed();
    }
    assertThat(build, notNullValue());
    job.open();
    StageView stageView = new StageView(job, JOB_PATH);
    assertThat(stageView.getAllStageViewJobs(), hasSize(10));
    assertThat(stageView.getStageViewHeadlines(), hasSize(10));
}
Also used : Build(org.jenkinsci.test.acceptance.po.Build) WorkflowJob(org.jenkinsci.test.acceptance.po.WorkflowJob) StageView(org.jenkinsci.test.acceptance.plugins.stageview.StageView) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 7 with StageView

use of org.jenkinsci.test.acceptance.plugins.stageview.StageView in project acceptance-test-harness by jenkinsci.

the class StageViewTest method stageViewContainsMultipleStagesWithUnstable.

/**
 * Does check multiple jobs in the stage view. One with a unstable, and one with a success. Unstable jobs
 * are represented with yellow color and represented with the css class "UNSTABLE".
 */
@Test
public void stageViewContainsMultipleStagesWithUnstable() {
    WorkflowJob job = this.createPipelineFromFile(MUTLI_JOB_UNSTABLE);
    job.startBuild().shouldBeUnstable();
    job.open();
    job.getNavigationLinks();
    StageView stageView = new StageView(job, JOB_PATH);
    String firstJob = stageView.getLatestBuild().getStageViewItem(0).toString();
    assertThat(stageView.getLatestBuild().getCssClasses(), containsString("UNSTABLE"));
    assertThat(firstJob, containsString("ms"));
}
Also used : WorkflowJob(org.jenkinsci.test.acceptance.po.WorkflowJob) StageView(org.jenkinsci.test.acceptance.plugins.stageview.StageView) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 8 with StageView

use of org.jenkinsci.test.acceptance.plugins.stageview.StageView in project acceptance-test-harness by jenkinsci.

the class StageViewTest method stageViewContainsMultipleStagesWithAborted.

/**
 * Does check multiple jobs in the stage view. One with a success, and one with aborted.
 * Aborted jobs are not represented in the satgeview. They are also shown green.
 */
@Test
public void stageViewContainsMultipleStagesWithAborted() {
    WorkflowJob job = this.createPipelineFromFile(MUTLI_JOB_ABORTED);
    job.startBuild().shouldAbort();
    job.open();
    job.getNavigationLinks();
    StageView stageView = new StageView(job, JOB_PATH);
    String firstJob = stageView.getLatestBuild().getStageViewItem(0).toString();
    assertThat(stageView.getLatestBuild().getCssClasses(), containsString("ABORTED"));
    assertThat(firstJob, containsString("ms"));
}
Also used : WorkflowJob(org.jenkinsci.test.acceptance.po.WorkflowJob) StageView(org.jenkinsci.test.acceptance.plugins.stageview.StageView) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Aggregations

AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)8 StageView (org.jenkinsci.test.acceptance.plugins.stageview.StageView)8 WorkflowJob (org.jenkinsci.test.acceptance.po.WorkflowJob)8 Test (org.junit.Test)8 Build (org.jenkinsci.test.acceptance.po.Build)3 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)2