use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method createFreeStyleJob.
@Override
protected FreeStyleJob createFreeStyleJob(final Container owner) {
FreeStyleJob job = createFreeStyleJob(settings -> settings.addConsoleParser(JAVA_ID), owner);
catWarningsToConsole(job);
return job;
}
use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method should_handle_invalid_ulr_gracefully.
/**
* Verifies that providing a wrong URL to the detail factories should navigate to the top-level page.
*/
@Test
@Issue("JENKINS-37195")
public void should_handle_invalid_ulr_gracefully() {
FreeStyleJob job = createFreeStyleJob(settings -> settings.addConsoleParser(JAVA_ID));
catWarningsToConsole(job);
buildSuccessfulJob(job);
WarningsAction action = createJavaProjectAction(job);
action.open();
visitLastPackage();
String packageRegex = "package.-?\\d+";
driver.get(driver.getCurrentUrl().replaceAll(packageRegex, "package.01234"));
assertThat(driver, hasContent("Aggregated Compiler Warnings"));
visitLastPackage();
driver.get(driver.getCurrentUrl().replaceAll(packageRegex, "package.NO_NUMBER"));
assertThat(driver, hasContent("Aggregated Compiler Warnings"));
visitLastPackage();
List<WebElement> fileLinks = all(by.xpath("//table[@id='files']//td[@class='pane']//a"));
int size = fileLinks.size();
assertThat(size, is(5));
fileLinks.get(size - 1).click();
assertThat(driver, hasContent("tmp/clover55196.tmp/net/sourceforge/pmd/renderers - File YAHTMLRenderer.java"));
driver.get(driver.getCurrentUrl().replaceAll("file.-?\\d+", "file.NO_NUMBER"));
assertThat(driver, hasContent("Compiler Warnings - Source Folder tmp/clover55196.tmp/net/sourceforge/pmd/renderers"));
}
use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class WarningsPluginTest method should_detect_warnings_of_multiple_compilers_in_console_freestyle.
/**
* Checks that warning results are correctly created for a freestyle project with the parsers "Java", "JavaDoc" and
* "MSBuild" if the console log contains multiple warnings of these types.
*/
@Test
public void should_detect_warnings_of_multiple_compilers_in_console_freestyle() {
FreeStyleJob job = createFreeStyleJobWith3Parsers();
catWarningsToConsole(job);
verify3ParserResults(job, 1);
}
use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class MissionControlTest method testJobStatuses.
/**
* Test Case: Check the correct highlighting of different jobs statuses.
*/
@Test
public void testJobStatuses() {
// create new mission control view and configure it
MissionControlView view = jenkins.views.create(MissionControlView.class, "mission-control-sample-view");
view.configure();
view.setHideBuildHistory(false);
view.setHideJobs(false);
view.save();
view.reloadConfiguration();
// create freestyle jobs with different statuses
String strJobNotBuild = "simple-job-not-build";
String strBuildSuccess = "simple-job-success";
String strBuildFailed = "simple-job-failed";
FreeStyleJob jobNotBuild = jenkins.jobs.create(FreeStyleJob.class, strJobNotBuild);
FreeStyleJob jobSuccess = jenkins.jobs.create(FreeStyleJob.class, strBuildSuccess);
jobSuccess.startBuild().waitUntilFinished();
FreeStyleJob jobFailed = jenkins.jobs.create(FreeStyleJob.class, strBuildFailed);
jobFailed.configure();
// add invalid shell build step to cause the job to fail
jobFailed.addShellStep("sh <");
jobFailed.save();
jobFailed.startBuild().waitUntilFinished();
view.open();
// check for the correct highlighting of the jobs
assertThat(view.getJobStatusArea().getStatusOfJob(strJobNotBuild), containsString("invert-text-color"));
assertThat(view.getJobStatusArea().getStatusOfJob(strBuildSuccess), containsString("success"));
assertThat(view.getJobStatusArea().getStatusOfJob(strBuildFailed), containsString("danger"));
}
use of org.jenkinsci.test.acceptance.po.FreeStyleJob in project acceptance-test-harness by jenkinsci.
the class MissionControlTest method testBuildQueue.
/**
* Test the existence and number of builds in the queue.
*/
@Test
public void testBuildQueue() {
MissionControlView view = jenkins.views.create(MissionControlView.class, "mission-control-sample-view");
view.configure(() -> view.setHideBuildQueue(true));
view.open();
assertThat(driver, not(hasContent("Build queue")));
view.configure(() -> view.setHideBuildQueue(false));
JenkinsConfig master = jenkins.getConfigPage();
master.configure(() -> master.labels.set("notQueued"));
FreeStyleJob job = jenkins.jobs.create(FreeStyleJob.class, "queuedJob");
job.configure(() -> job.setLabelExpression("queued"));
job.scheduleBuild();
view.open();
assertThat(view.getBuildQueueArea().getBuildQueueSize(), is(1));
job.configure(() -> job.setLabelExpression("notQueued"));
job.getLastBuild().waitUntilFinished();
view.open();
assertThat(view.getBuildQueueArea().getBuildQueueSize(), is(0));
}
Aggregations