Search in sources :

Example 1 with AnalysisCollectorColumn

use of org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorColumn in project acceptance-test-harness by jenkinsci.

the class AnalysisCollectorPluginTest method should_set_warnings_count_in_list_view_column.

/**
 * 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, "list");
    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=\"view/list/job/" + job.name + "/checkstyle\">" + CHECKSTYLE_ALL + "</a>"), containsString("<a href=\"view/list/job/" + job.name + "/findbugs\">" + FINDBUGS_ALL + "</a>"), containsString("<a href=\"view/list/job/" + job.name + "/pmd\">" + PMD_ALL + "</a>"), containsString("<a href=\"view/list/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>")));
}
Also used : ListView(org.jenkinsci.test.acceptance.po.ListView) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) AnalysisCollectorColumn(org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorColumn) WebElement(org.openqa.selenium.WebElement) Test(org.junit.Test)

Aggregations

CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)1 AnalysisCollectorColumn (org.jenkinsci.test.acceptance.plugins.analysis_collector.AnalysisCollectorColumn)1 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)1 ListView (org.jenkinsci.test.acceptance.po.ListView)1 Test (org.junit.Test)1 WebElement (org.openqa.selenium.WebElement)1