Search in sources :

Example 6 with View

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

the class JobDslPluginTest method job_filters_all_jobs_are_added.

/**
 * This test creates a listView and creates two additional jobs. The job filter of the script is set to "all jobs".
 * The two additional jobs as well as the seed job is added to the listView.
 */
@Test
@WithPlugins("view-job-filters")
public void job_filters_all_jobs_are_added() {
    List<Job> jobs = createAmountOfJobs(2, false);
    String jobDslScript = "listView('" + LIST_VIEW_NAME + "') {\n" + "  columns {\n" + "    name()\n" + "  }\n" + "  jobFilters {\n" + "        all()\n" + "  }\n" + "\n" + "}";
    View view = openNewlyCreatedListView(jobDslScript, LIST_VIEW_NAME);
    assertThat(view, containsJob(jobs.get(0)));
    assertThat(view, containsJob(jobs.get(1)));
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Job(org.jenkinsci.test.acceptance.po.Job) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) ListView(org.jenkinsci.test.acceptance.po.ListView) View(org.jenkinsci.test.acceptance.po.View) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 7 with View

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

the class JobDslPluginTest method is_ListView_created.

/**
 * Test if a new ListView is created via Job DSL script TextBox.
 * The created View shall contain a description.
 */
@Test
public void is_ListView_created() {
    String descriptionText = "This is the description of testView";
    String jobDslScript = "listView('" + LIST_VIEW_NAME + "') {\n" + "    description('" + descriptionText + "')\n" + "}";
    View view = openNewlyCreatedListView(jobDslScript, LIST_VIEW_NAME);
    checkDescription(view, descriptionText);
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ListView(org.jenkinsci.test.acceptance.po.ListView) View(org.jenkinsci.test.acceptance.po.View) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 8 with View

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

the class JobDslPluginTest method openNewlyCreatedListView.

/**
 * Opens a newly created ListView. The View gets created by a seed job via Job DSL script.
 * @param script The Job DSL script
 */
private View openNewlyCreatedListView(String script, String viewName) {
    FreeStyleJob seed = createJobAndSetJobDslScript(script, true);
    seed.scheduleBuild().shouldSucceed();
    seed.open();
    View view = getView(viewName);
    view.open();
    return view;
}
Also used : FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) ListView(org.jenkinsci.test.acceptance.po.ListView) View(org.jenkinsci.test.acceptance.po.View)

Example 9 with View

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

the class JobDslPluginTest method only_jobs_matching_regex_are_added.

/**
 * Test if the created jobs are correctly added to the ListView using a regex.
 */
@Test
public void only_jobs_matching_regex_are_added() {
    Job job1 = createJobWithName(EXAMPLE_DISABLED_NAME);
    Job job2 = createJobWithName(EXAMPLE_ENABLED_NAME);
    List<Job> jobs = createAmountOfJobs(2, false);
    String jobDslScript = "listView('" + LIST_VIEW_NAME + "') {\n" + "  columns {\n" + "    name()\n" + "  }\n" + "  jobs {\n" + "    regex('" + LIST_VIEW_REGEX + "')\n" + "  }\n" + "}";
    View view = openNewlyCreatedListView(jobDslScript, LIST_VIEW_NAME);
    assertThat(view, containsJob(job1));
    assertThat(view, containsJob(job2));
    assertThat(view, not(containsJob(jobs.get(0))));
    assertThat(view, not(containsJob(jobs.get(1))));
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Job(org.jenkinsci.test.acceptance.po.Job) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) ListView(org.jenkinsci.test.acceptance.po.ListView) View(org.jenkinsci.test.acceptance.po.View) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 10 with View

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

the class JobDslPluginTest method job_filters_include_failed_jobs_built_at_least_once.

/**
 * This test creates 3 jobs and builds 3 of them immediately. One of the fails. A list view is created with its job filter set to only
 * include jobs that failed.
 */
@Test
@WithPlugins("view-job-filters")
public void job_filters_include_failed_jobs_built_at_least_once() {
    List<Job> jobs = createAmountOfJobs(2, true);
    Job job3 = createJobThatFails();
    String jobDslScript = "listView('" + LIST_VIEW_NAME + "') {\n" + "  columns {\n" + "    name()\n" + "  }\n" + "  jobFilters {\n" + "    buildTrend {\n" + "      matchType(MatchType.INCLUDE_MATCHED)\n" + "      buildCountType(BuildCountType.AT_LEAST_ONE)\n" + "      status(BuildStatusType.FAILED)\n" + "    }\n" + "  }\n" + "}";
    View view = openNewlyCreatedListView(jobDslScript, LIST_VIEW_NAME);
    assertThat(view, not(containsJob(jobs.get(0))));
    assertThat(view, not(containsJob(jobs.get(1))));
    assertThat(view, containsJob(job3));
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Job(org.jenkinsci.test.acceptance.po.Job) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) ListView(org.jenkinsci.test.acceptance.po.ListView) View(org.jenkinsci.test.acceptance.po.View) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Aggregations

ListView (org.jenkinsci.test.acceptance.po.ListView)20 View (org.jenkinsci.test.acceptance.po.View)20 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)19 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)19 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)19 Test (org.junit.Test)19 Job (org.jenkinsci.test.acceptance.po.Job)18 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)13 WebElement (org.openqa.selenium.WebElement)1