Search in sources :

Example 6 with WorkflowJob

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

the class StageViewTest method createPipelineFromFile.

/**
 * Helper Method for Workflow job generation. The filename represents
 * the File to be read as the pipeline definition file
 *
 * @param fileName the naame of the file including path
 * @return return the newly generated workflow job with a defined pipeline
 */
private WorkflowJob createPipelineFromFile(String fileName) {
    WorkflowJob job = jenkins.jobs.create(WorkflowJob.class);
    job.script.set(readFromRessourceFolder(fileName));
    job.sandbox.check();
    job.save();
    return job;
}
Also used : WorkflowJob(org.jenkinsci.test.acceptance.po.WorkflowJob)

Example 7 with WorkflowJob

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

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

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

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

Aggregations

WorkflowJob (org.jenkinsci.test.acceptance.po.WorkflowJob)36 Test (org.junit.Test)24 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)21 Build (org.jenkinsci.test.acceptance.po.Build)19 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)14 DockerTest (org.jenkinsci.test.acceptance.junit.DockerTest)8 StageView (org.jenkinsci.test.acceptance.plugins.stageview.StageView)8 Matchers.containsString (org.hamcrest.Matchers.containsString)4 WithDocker (org.jenkinsci.test.acceptance.junit.WithDocker)4 Issue (org.jvnet.hudson.test.Issue)4 WithCredentials (org.jenkinsci.test.acceptance.junit.WithCredentials)3 DumbSlave (org.jenkinsci.test.acceptance.po.DumbSlave)3 Category (org.junit.experimental.categories.Category)3 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 Ignore (org.junit.Ignore)2 File (java.io.File)1 IOException (java.io.IOException)1 Pattern (java.util.regex.Pattern)1 StringContains.containsString (org.hamcrest.core.StringContains.containsString)1 LocalController (org.jenkinsci.test.acceptance.controller.LocalController)1