Search in sources :

Example 1 with LogParserOutputPage

use of org.jenkinsci.test.acceptance.plugins.logparser.LogParserOutputPage in project acceptance-test-harness by jenkinsci.

the class LogParserTest method testLinksAndColor.

/**
 * Test that the link from the sidebar points to a valid position in the content page and
 * that the text in the content page has the correct color.
 */
@Test
public void testLinksAndColor() throws Exception {
    Job job = configureSampleJob();
    Build build = job.startBuild().waitUntilFinished();
    build.open();
    LogParserOutputPage outputPage = new LogParserOutputPage(build);
    outputPage.open();
    assertThat(outputPage.getFragmentOfContentFrame("Error", 1), is("ERROR1"));
    assertThat(outputPage.getColor("Error", 1), is("red"));
}
Also used : LogParserOutputPage(org.jenkinsci.test.acceptance.plugins.logparser.LogParserOutputPage) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 2 with LogParserOutputPage

use of org.jenkinsci.test.acceptance.plugins.logparser.LogParserOutputPage in project acceptance-test-harness by jenkinsci.

the class LogParserTest method invalidRulePath.

/**
 * Test information for failed log parsing.
 */
@Test
public void invalidRulePath() {
    FreeStyleJob job = jenkins.jobs.create(FreeStyleJob.class, "fail-job");
    // configure invalid route
    job.configure(() -> {
        LogParserPublisher lpp = job.addPublisher(LogParserPublisher.class);
        lpp.setRule(LogParserPublisher.RuleType.PROJECT, "invalidPath");
    });
    Build build = job.startBuild().waitUntilFinished();
    // check information on build overview
    build.open();
    WebElement tableRow = find(By.xpath(SUMMARY_XPATH));
    WebElement logParserSummary = findLogParserSummary(tableRow);
    WebElement icon = logParserSummary.findElement(By.xpath("td[1]/img"));
    assertThat(icon.getAttribute("src"), containsString("graph"));
    WebElement text = logParserSummary.findElement(By.xpath("td[2]"));
    assertThat(text.getText(), is("Log parsing has failed"));
    LogParserOutputPage outputPage = new LogParserOutputPage(build);
    outputPage.open();
    WebElement output = find(By.id("main-panel"));
    assertThat(output.getText(), containsString("ERROR: Failed to parse console log"));
}
Also used : LogParserOutputPage(org.jenkinsci.test.acceptance.plugins.logparser.LogParserOutputPage) LogParserPublisher(org.jenkinsci.test.acceptance.plugins.logparser.LogParserPublisher) WebElement(org.openqa.selenium.WebElement) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 3 with LogParserOutputPage

use of org.jenkinsci.test.acceptance.plugins.logparser.LogParserOutputPage in project acceptance-test-harness by jenkinsci.

the class LogParserTest method testErrorReporting.

/**
 * Test the number of warnings and errors recognized by the plugin.
 */
@Test
public void testErrorReporting() throws Exception {
    Job job = configureSampleJob();
    Build build = job.startBuild().waitUntilFinished();
    build.open();
    WebElement buildSummary = find(by.xpath(SUMMARY_XPATH));
    WebElement summary = findLogParserSummary(buildSummary).findElement(By.xpath("td[2]"));
    assertThat(summary.getText(), is("13 errors, 4 warnings"));
    LogParserOutputPage outputPage = new LogParserOutputPage(build);
    outputPage.open();
    assertThat(outputPage.getNumberOfMatches("Error"), is(13));
    assertThat(outputPage.getLinkList("Error"), hasSize(13));
    assertThat(outputPage.getNumberOfMatches("Warning"), is(4));
    assertThat(outputPage.getLinkList("Warning"), hasSize(4));
    assertThat(outputPage.getNumberOfMatches("Info"), is(2));
    assertThat(outputPage.getLinkList("Info"), hasSize(2));
}
Also used : LogParserOutputPage(org.jenkinsci.test.acceptance.plugins.logparser.LogParserOutputPage) WebElement(org.openqa.selenium.WebElement) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Aggregations

AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)3 LogParserOutputPage (org.jenkinsci.test.acceptance.plugins.logparser.LogParserOutputPage)3 Test (org.junit.Test)3 WebElement (org.openqa.selenium.WebElement)2 LogParserPublisher (org.jenkinsci.test.acceptance.plugins.logparser.LogParserPublisher)1