Search in sources :

Example 1 with StageView

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

the class StageViewTest method jobShouldContainStageView.

@Test
public void jobShouldContainStageView() {
    WorkflowJob job = this.createPipelineFromFile(SINGLE_JOB);
    job.startBuild().shouldSucceed();
    job.open();
    StageView stageView = new StageView(job, JOB_PATH);
    assertThat(stageView.getRootElementName().getText(), containsString("Stage View"));
}
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 2 with StageView

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

the class StageViewTest method multiBuildJobShouldContainCorrectNumberOfJobsBuilt.

/**
 * This tests verifies the height of the diplay. The standard height is 11 of the maximum builds dislayed
 * aka Pagination
 */
@Test
@WithPlugins("pipeline-stage-view@2.18")
public void multiBuildJobShouldContainCorrectNumberOfJobsBuilt() {
    WorkflowJob job = this.createPipelineFromFile(SINGLE_JOB);
    Build build = null;
    for (int i = 0; i < 8; i++) {
        build = job.startBuild().shouldSucceed();
    }
    assertThat(build, notNullValue());
    job.open();
    StageView stageView = new StageView(job, JOB_PATH);
    // as not max display
    assertThat(stageView.getAllStageViewJobs(), hasSize(8));
    for (int i = 0; i < 10; i++) {
        build = job.startBuild().shouldSucceed();
    }
    assertThat(build, notNullValue());
    job.open();
    stageView = new StageView(job, JOB_PATH);
    // max diplay is 10
    assertThat(stageView.getAllStageViewJobs(), 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 3 with StageView

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

the class StageViewTest method stageViewContainsMultipleStages.

/**
 * Does check multiple jobs in the stage view. Second part uses long name to verify the display.
 * Note: emptyjob names are not allowed
 */
@Test
public void stageViewContainsMultipleStages() {
    WorkflowJob job = this.createPipelineFromFile(MULTI_JOB);
    job.startBuild().shouldSucceed();
    job.open();
    StageView stageView = new StageView(job, JOB_PATH);
    assertThat(stageView.getStageViewHeadlines().get(0).getName(), containsString("Clone sources"));
    assertThat(stageView.getStageViewHeadlines().get(1).getName(), containsString("Build"));
    job = this.createPipelineFromFile(MULTI_JOB_IRR_NAMES);
    job.startBuild().shouldSucceed();
    job.open();
    stageView = new StageView(job, JOB_PATH);
    assertThat(stageView.getStageViewHeadlines().get(0).getName(), containsString("-"));
    assertThat(stageView.getStageViewHeadlines().get(1).getName(), containsString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"));
    assertThat(stageView.getStageViewHeadlines().get(2).getName(), containsString(",.-;:_*+#"));
}
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 4 with StageView

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

the class StageViewTest method jobNumberShouldbeCorrect.

@Test
public void jobNumberShouldbeCorrect() {
    WorkflowJob job = this.createPipelineFromFile(SINGLE_JOB);
    Build build = job.startBuild().shouldSucceed();
    job.open();
    job.getNavigationLinks();
    StageView stageView = new StageView(job, JOB_PATH);
    assertThat(stageView.getLatestBuild().getBuildNo(), containsString(String.valueOf(build.getNumber())));
}
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)

Example 5 with StageView

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

the class StageViewTest method stageViewContainsMultipleStagesWithFail.

/**
 * Does check multiple jobs in the stage view. One with a failed, and one with a success.
 */
@Test
public void stageViewContainsMultipleStagesWithFail() {
    WorkflowJob job = this.createPipelineFromFile(MUTLI_JOB_FAIL);
    job.startBuild().shouldFail();
    job.open();
    job.getNavigationLinks();
    StageView stageView = new StageView(job, JOB_PATH);
    String firstJob = stageView.getLatestBuild().getStageViewItem(0).toString();
    String secondJob = stageView.getLatestBuild().getStageViewItem(1).toString();
    assertThat(stageView.getLatestBuild().getCssClasses(), containsString("FAILED"));
    assertThat(firstJob, containsString("ms"));
    assertThat(secondJob, containsString("failed"));
}
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