Search in sources :

Example 16 with View

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

the class JobDslPluginTest method job_filters_include_jobs_that_have_been_built.

/**
 * This test creates jobs and a list view. The job filter only allows jobs that have been built yet.
 */
@Test
@WithPlugins("view-job-filters")
public void job_filters_include_jobs_that_have_been_built() {
    List<Job> notBuiltJobs = createAmountOfJobs(2, false);
    List<Job> builtJobs = createAmountOfJobs(3, true);
    String jobDslScript = "listView('" + LIST_VIEW_NAME + "') {\n" + "  columns {\n" + "    name()\n" + "  }\n" + "  jobFilters {\n" + "    buildTrend {\n" + "      matchType(MatchType.INCLUDE_MATCHED)\n" + "      amountType(AmountType.BUILDS)\n" + "    }\n" + "  }\n" + "}";
    View view = openNewlyCreatedListView(jobDslScript, LIST_VIEW_NAME);
    assertThat(view, containsJob(builtJobs.get(0)));
    assertThat(view, containsJob(builtJobs.get(1)));
    assertThat(view, containsJob(builtJobs.get(2)));
    assertThat(view, not(containsJob(notBuiltJobs.get(0))));
    assertThat(view, not(containsJob(notBuiltJobs.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 17 with View

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

the class JobDslPluginTest method job_filters_regex_name_exclude_unmatched.

/**
 * This test creates a listView and 4 jobs. The job filters are checking the name with a regex and
 * jobs not matching the regex are excluded in the listView.
 */
@Test
@WithPlugins("view-job-filters")
public void job_filters_regex_name_exclude_unmatched() {
    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" + "    names('" + job1.name + "','" + job2.name + "','" + jobs.get(0).name + "','" + jobs.get(1).name + "')\n" + "  }\n" + "  jobFilters {\n" + "        regex {\n" + "            matchType(MatchType.EXCLUDE_UNMATCHED)\n" + "            matchValue(RegexMatchValue.NAME)\n" + "            regex('" + LIST_VIEW_REGEX + "')\n" + "        }\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) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins)

Example 18 with View

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

the class JobDslPluginTest method status_filter_only_shows_disabled_jobs.

/**
 * Test if the created jobs are correctly added to the ListView and if the status filter works correctly.
 * In this case only disabled jobs shall be shown.
 */
@Test
public void status_filter_only_shows_disabled_jobs() {
    List<Job> jobs = createAmountOfJobs(3, false);
    Job jobDisabled = createDisabledJob();
    String jobDslScript = "listView('" + LIST_VIEW_NAME + "') {\n" + "  statusFilter(StatusFilter.DISABLED)\n" + "  columns {\n" + "    name()\n" + "  }\n" + "  jobs {\n" + "    names('" + jobs.get(0).name + "', '" + jobs.get(1).name + "', '" + jobs.get(2).name + "', '" + jobDisabled.name + "')\n" + "  }\n" + "}";
    View view = openNewlyCreatedListView(jobDslScript, LIST_VIEW_NAME);
    assertThat(view, containsJob(jobDisabled));
    assertThat(view, not(containsJob(jobs.get(0))));
    assertThat(view, not(containsJob(jobs.get(1))));
    assertThat(view, not(containsJob(jobs.get(2))));
}
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 19 with View

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

the class JobDslPluginTest method job_filters_status_failed_include_matched.

/**
 * This test creates a job and runs a build which fails. Afterwards 4 new jobs get created as well as a listView.
 * The job filter of the listView is set to show jobs which build status is 'FAILED'.
 */
@Test
@WithPlugins("view-job-filters")
public void job_filters_status_failed_include_matched() {
    Job failedJob = createJobThatFails();
    List<Job> jobs = createAmountOfJobs(4, true);
    String jobDslScript = "listView('" + LIST_VIEW_NAME + "') {\n" + "  columns {\n" + "    name()\n" + "  }\n" + "  jobFilters {\n" + "        status {\n" + "            matchType(MatchType.INCLUDE_MATCHED)\n" + "            status(Status.FAILED)\n" + "        }\n" + "  }\n" + "}";
    View view = openNewlyCreatedListView(jobDslScript, LIST_VIEW_NAME);
    assertThat(view, containsJob(failedJob));
    assertThat(view, not(containsJob(jobs.get(0))));
    assertThat(view, not(containsJob(jobs.get(1))));
    assertThat(view, not(containsJob(jobs.get(2))));
    assertThat(view, not(containsJob(jobs.get(3))));
}
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 20 with View

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

the class JobDslPluginTest method job_filters_status_failed_exclude_matched.

/**
 * This test creates a job and runs a build which fails. Afterwards 4 new jobs get created as well as a listView.
 * The job filter of the listView is set to not show jobs which build status is 'FAILED'.
 */
@Test
@WithPlugins("view-job-filters")
public void job_filters_status_failed_exclude_matched() {
    Job failedJob = createJobThatFails();
    List<Job> jobs = createAmountOfJobs(4, true);
    String jobDslScript = "listView('" + LIST_VIEW_NAME + "') {\n" + "  columns {\n" + "    name()\n" + "  }\n" + "  jobs{\n" + "    names('" + failedJob.name + "','" + jobs.get(0).name + "','" + jobs.get(1).name + "','" + jobs.get(2).name + "','" + jobs.get(3).name + "')\n" + "  }\n" + "  jobFilters {\n" + "        status {\n" + "            matchType(MatchType.EXCLUDE_MATCHED)\n" + "            status(Status.FAILED)\n" + "        }\n" + "  }\n" + "}";
    View view = openNewlyCreatedListView(jobDslScript, LIST_VIEW_NAME);
    assertThat(view, not(containsJob(failedJob)));
    assertThat(view, containsJob(jobs.get(0)));
    assertThat(view, containsJob(jobs.get(1)));
    assertThat(view, containsJob(jobs.get(2)));
    assertThat(view, containsJob(jobs.get(3)));
}
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