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;
}
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"));
}
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));
}
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(",.-;:_*+#"));
}
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())));
}
Aggregations