use of org.jenkinsci.test.acceptance.po.ListView in project acceptance-test-harness by jenkinsci.
the class JobDslPluginTest method should_ignore_existing_views.
/**
* Verifies whether previously generated views will be ignored or updated.
* By default, all previous generated views will be updated.
* If existing views should be ignored, the plugin do not modify previous
* generated views.
*/
@Test
public void should_ignore_existing_views() {
FreeStyleJob seedJob = createSeedJob();
JobDslBuildStep jobDsl = seedJob.addBuildStep(JobDslBuildStep.class);
jobDsl.setScript("listView('Existing_View') {\n" + " description('Existing description');\n" + "}");
seedJob.save();
seedJob.scheduleBuild().shouldSucceed();
ListView existingView = getView("Existing_View");
seedJob.configure(() -> {
jobDsl.setScript("listView('Existing_View') {\n" + " description('This is a description');\n" + "}");
jobDsl.setIgnoreExisting(true);
});
Build build = seedJob.scheduleBuild().shouldSucceed();
Pattern expected = Pattern.compile("Existing views:(\\s*)GeneratedView[{]name='Existing_View'}");
assertThat(build.getConsole(), containsRegexp(expected));
checkDescription(existingView, "Existing description");
seedJob.configure(() -> jobDsl.setIgnoreExisting(false));
Build build2 = seedJob.scheduleBuild().shouldSucceed();
assertThat(build2.getConsole(), containsRegexp(expected));
checkDescription(existingView, "This is a description");
}
use of org.jenkinsci.test.acceptance.po.ListView in project acceptance-test-harness by jenkinsci.
the class JobDslPluginTest method should_delete_removed_views.
/**
* Verifies whether a previously generated view will be deleted if it
* is not referenced anymore.
*/
@Test
public void should_delete_removed_views() {
FreeStyleJob seedJob = executeRemovedViewAction(JobDslRemovedViewAction.DELETE);
Build build = seedJob.scheduleBuild().shouldSucceed();
Pattern expected = Pattern.compile("Unreferenced views:(\\s*)GeneratedView[{]name='Old_View'}(\\s*)Removed views:(\\s*)GeneratedView[{]name='Old_View'}");
assertThat(build.getConsole(), containsRegexp(expected));
ListView oldView = getView("Old_View");
assertThat(oldView, pageObjectDoesNotExist());
}
use of org.jenkinsci.test.acceptance.po.ListView in project acceptance-test-harness by jenkinsci.
the class ViewTest method renameJob.
@Test
@Category(SmokeTest.class)
public void renameJob() {
FreeStyleJob job = jenkins.jobs.create(FreeStyleJob.class, "original_name");
ListView view = jenkins.views.create(ListView.class, "a_view");
view.configure();
view.check(job.name);
view.save();
assertThat(view, containsJob(job));
job = job.renameTo("new_name");
assertThat(view, containsJob(job));
}
use of org.jenkinsci.test.acceptance.po.ListView in project acceptance-test-harness by jenkinsci.
the class ViewTest method findJobThroughRegexp.
@Test
@Category(SmokeTest.class)
public void findJobThroughRegexp() {
FreeStyleJob job = jenkins.jobs.create(FreeStyleJob.class, "my_name");
ListView view = jenkins.views.create(ListView.class, "a_view");
view.configure();
view.check("Use a regular expression to include jobs into the view");
fillIn("includeRegex", "my.*");
view.save();
assertThat(view, containsJob(job));
}
use of org.jenkinsci.test.acceptance.po.ListView in project acceptance-test-harness by jenkinsci.
the class FormValidationTest method ajaxValidation.
private void ajaxValidation() {
ListView lv = jenkins.views.create(ListView.class);
lv.configure();
lv.matchJobs(".*");
assertThat(lv.includeRegex.getFormValidation(), silent());
lv.matchJobs("[");
assertThat(lv.includeRegex.getFormValidation().getKind(), equalTo(Kind.ERROR));
}
Aggregations