Search in sources :

Example 1 with GraphConfigurationView

use of org.jenkinsci.test.acceptance.plugins.analysis_core.GraphConfigurationView in project acceptance-test-harness by jenkinsci.

the class AbstractAnalysisTest method deactivateTrendGraph.

private void deactivateTrendGraph(final Job job, final AnalysisAction action) {
    GraphConfigurationView view = action.configureTrendGraphForUser();
    view.open();
    view.deactivateTrend();
    view.save();
    List<WebElement> enableLinks = job.all(By.partialLinkText("Enable"));
    assertThat(enableLinks.size(), is(1));
    enableLinks.get(0).click();
    elasticSleep(500);
    assertThat(getCurrentUrl(), containsRegexp(action.getUrl() + "/configure/"));
}
Also used : GraphConfigurationView(org.jenkinsci.test.acceptance.plugins.analysis_core.GraphConfigurationView) WebElement(org.openqa.selenium.WebElement)

Example 2 with GraphConfigurationView

use of org.jenkinsci.test.acceptance.plugins.analysis_core.GraphConfigurationView in project acceptance-test-harness by jenkinsci.

the class CheckStylePluginTest method should_show_warnings_per_user.

/**
 * Verifies that blaming of warnings works on agents: creates a new project in a Git repository in a docker
 * container. Registers the same docker container as slave agent to build the project. Uses the recorded build
 * results in checkstyle-result.xml (no actual maven goal is invoked). Verifies that the blame information is
 * correctly assigned for each of the warnings. Also checks, that the age is increased for yet another build.
 */
@Test
@WithPlugins({ "git", "dashboard-view", "analysis-core@1.88-SNAPSHOT", "ssh-slaves" })
@WithDocker
@Issue("JENKINS-6748")
@WithCredentials(credentialType = WithCredentials.SSH_USERNAME_PRIVATE_KEY, values = { CREDENTIALS_ID, CREDENTIALS_KEY })
public void should_show_warnings_per_user() {
    // avoid JENKINS-49026
    jenkins.restart();
    DumbSlave agent = createDockerAgent();
    String gitRepositoryUrl = createGitRepositoryInDockerContainer();
    FreeStyleJob job = createFreeStyleJob(jenkins, null, settings -> settings.pattern.set("**/checkstyle-result.xml"));
    job.configure(() -> {
        job.useScm(GitScm.class).url(gitRepositoryUrl).credentials(CREDENTIALS_ID);
        job.setLabelExpression(agent.getName());
    });
    buildSuccessfulJob(job);
    CheckStyleAction action = new CheckStyleAction(job);
    action.open();
    SortedMap<String, Integer> expectedPeople = new TreeMap<>();
    expectedPeople.put("Unknown authors", 1);
    expectedPeople.put("Jenkins-ATH <jenkins-ath@example.org>", 11);
    assertThat(action.getPeopleTabContents(), is(expectedPeople));
    action.find(By.partialLinkText("Jenkins-ATH")).click();
    assertThat(driver, hasContent("Checkstyle Warnings - Jenkins-ATH"));
    action.open();
    SortedMap<String, String> expectedOrigin = new TreeMap<>();
    expectedOrigin.put("Main.java:0", "-");
    expectedOrigin.put("Main.java:2", "Jenkins-ATH");
    expectedOrigin.put("Main.java:4", "Jenkins-ATH");
    expectedOrigin.put("Main.java:6", "Jenkins-ATH");
    expectedOrigin.put("Main.java:9", "Jenkins-ATH");
    expectedOrigin.put("Main.java:13", "Jenkins-ATH");
    expectedOrigin.put("Main.java:18", "Jenkins-ATH");
    expectedOrigin.put("Main.java:23", "Jenkins-ATH");
    expectedOrigin.put("Main.java:24", "Jenkins-ATH");
    expectedOrigin.put("Main.java:27", "Jenkins-ATH");
    assertThat(action.getOriginTabContentsAsStrings(AUTHOR), is(expectedOrigin));
    assertThatAgeIsAt(action, expectedOrigin, 1);
    buildSuccessfulJob(job);
    assertThatAgeIsAt(action, expectedOrigin, 2);
    GraphConfigurationView view = action.configureTrendGraphForUser();
    view.open();
    view.setUserGraph();
    view.save();
    WebElement graph = find(getUsersTrendGraphXpath());
    assertThat(graph.isDisplayed(), is(true));
    verifyNoAuthors(action, true);
    WebElement nothing = getElement(getUsersTrendGraphXpath());
    assertThat(nothing, nullValue());
    verifyNoAuthors(action, false);
}
Also used : CheckStyleAction(org.jenkinsci.test.acceptance.plugins.checkstyle.CheckStyleAction) GraphConfigurationView(org.jenkinsci.test.acceptance.plugins.analysis_core.GraphConfigurationView) FreeStyleJob(org.jenkinsci.test.acceptance.po.FreeStyleJob) DumbSlave(org.jenkinsci.test.acceptance.po.DumbSlave) TreeMap(java.util.TreeMap) WebElement(org.openqa.selenium.WebElement) Issue(org.jvnet.hudson.test.Issue) WithCredentials(org.jenkinsci.test.acceptance.junit.WithCredentials) Test(org.junit.Test) WithPlugins(org.jenkinsci.test.acceptance.junit.WithPlugins) WithDocker(org.jenkinsci.test.acceptance.junit.WithDocker)

Aggregations

GraphConfigurationView (org.jenkinsci.test.acceptance.plugins.analysis_core.GraphConfigurationView)2 WebElement (org.openqa.selenium.WebElement)2 TreeMap (java.util.TreeMap)1 WithCredentials (org.jenkinsci.test.acceptance.junit.WithCredentials)1 WithDocker (org.jenkinsci.test.acceptance.junit.WithDocker)1 WithPlugins (org.jenkinsci.test.acceptance.junit.WithPlugins)1 CheckStyleAction (org.jenkinsci.test.acceptance.plugins.checkstyle.CheckStyleAction)1 DumbSlave (org.jenkinsci.test.acceptance.po.DumbSlave)1 FreeStyleJob (org.jenkinsci.test.acceptance.po.FreeStyleJob)1 Test (org.junit.Test)1 Issue (org.jvnet.hudson.test.Issue)1