@Test 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)); }
@Test 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.configure(); job.setName("new_name"); job.save(); clickButton("Yes"); // confirm rename assertThat(view, containsJob(job)); }
/** * Sets up a list view with a warnings column. Builds a job and checks if the column shows the * correct number of warnings and provides a direct link to the actual warning results. Also * verifies that the mouse-over tooltip will show the correct number of warnings per checked * plugin. */ @Test public void should_set_warnings_count_in_list_view_column() { FreeStyleJob job = createFreeStyleJob(); buildSuccessfulJob(job); ListView view = jenkins.views.create(ListView.class, createRandomName()); view.configure(); view.matchAllJobs(); view.addColumn(AnalysisCollectorColumn.class); view.save(); view.open(); WebElement warningsCell = view.find(by.xpath(XPATH_LISTVIEW_WARNING_TD)); assertThat(warningsCell.getText(), is(String.valueOf(TOTAL))); String tooltip = warningsCell.getAttribute("tooltip"); assertThat( tooltip, allOf( containsString( "<a href=\"job/" + job.name + "/checkstyle\">" + CHECKSTYLE_ALL + "</a>"), containsString("<a href=\"job/" + job.name + "/findbugs\">" + FINDBUGS_ALL + "</a>"), containsString("<a href=\"job/" + job.name + "/pmd\">" + PMD_ALL + "</a>"), containsString("<a href=\"job/" + job.name + "/warnings\">" + WARNINGS_ALL + "</a>"))); view.configure(); AnalysisCollectorColumn column = view.getColumn(AnalysisCollectorColumn.class); column.checkPlugin(PMD, false); view.save(); view.open(); // check that PMD warnings are not collected to total warning number and tooltip warningsCell = view.find(by.xpath(XPATH_LISTVIEW_WARNING_TD)); assertThat(warningsCell.getText(), is(String.valueOf(TOTAL - PMD_ALL))); tooltip = warningsCell.getAttribute("tooltip"); assertThat( tooltip, not(containsString("<a href=\"job/" + job.name + "/pmd\">" + PMD_ALL + "</a>"))); }