Skip to content

Commit

Permalink
[JENKINS-31088] show displayName by default
Browse files Browse the repository at this point in the history
  • Loading branch information
ovorobio committed Jun 14, 2016
1 parent 3f507f6 commit c772b2b
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 2 deletions.
Expand Up @@ -42,6 +42,7 @@ class BuildJSONBuilder {
project {
disabled(pipelineBuild.projectDisabled)
name(pipelineBuild.project.getRelativeNameFromGroup(context))
displayName(pipelineBuild.project.displayName)
url(pipelineBuild.projectURL)
health(pipelineBuild.projectHealth)
id(projectId)
Expand Down
Expand Up @@ -30,8 +30,12 @@
{{/if}}
{{/unless}}
{{/unless}}
{{project.name}}
</a>
{{#if project.displayName}}
{{project.displayName}}
{{else}}
{{project.name}}
{{/if}}
</a>
</div>
<div class="build-info">
<ul>
Expand Down
@@ -0,0 +1,74 @@
package au.com.centrumsystems.hudson.plugin.buildpipeline;

import au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView;
import au.com.centrumsystems.hudson.plugin.buildpipeline.DownstreamProjectGridBuilder;
import au.com.centrumsystems.hudson.plugin.buildpipeline.testsupport.BuildCardComponent;
import au.com.centrumsystems.hudson.plugin.buildpipeline.testsupport.PipelinePage;
import hudson.model.FreeStyleProject;
import hudson.tasks.BuildTrigger;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.WebDriverWait;

import static org.junit.Assert.*;

public class BuildPipelineViewDisplayNameTest {
protected WebDriver webDriver;

@Rule
public JenkinsRule j = new JenkinsRule();

@Before
public void before() {
webDriver = new FirefoxDriver();
WebDriverWait wait = new WebDriverWait(webDriver, 30);
}

@After
public void cleanUpWebDriver() {
if (webDriver != null) {
webDriver.close();
webDriver.quit();
}
}

/**
* checks that pipeline box uses displayName
*/
@Ignore
@Test
public void testDisplayName() throws Exception {
final FreeStyleProject freestyle1 = j.createFreeStyleProject("freestyle1");

freestyle1.setDisplayName("fancyname1");

freestyle1.scheduleBuild();
j.waitUntilNoActivity();

BuildPipelineView pipeline = new BuildPipelineView("pipeline", "",
new DownstreamProjectGridBuilder(freestyle1.getFullName()),
"1", //num displayed
false, //trigger only latest
true, // manual trigger
false, // parameters
false, //params in header
false, //definition header
1, null, null);

j.getInstance().addView(pipeline);

PipelinePage pipelinePage = new PipelinePage(webDriver, pipeline.getViewName(), j.getURL());
pipelinePage.open();

BuildCardComponent buildCardComponent = pipelinePage.buildCard(1, 1, 2);

assertTrue("The displayName should be visible",
buildCardComponent.hasDisplayName("fancyname1"));
}
}
Expand Up @@ -54,6 +54,10 @@ public boolean hasManualTriggerButton() {
return elementIsPresent(By.xpath(TRIGGER_SPAN_XPATH), webDriver);
}

public boolean hasDisplayName(String displayName) {
return elementIsPresent(By.xpath(".//a[@title='" + displayName + "']"), webDriver);
}

public boolean hasRetryButton() {
return elementIsPresent(By.xpath(RETRY_IMG_XPATH), webDriver);
}
Expand Down

0 comments on commit c772b2b

Please sign in to comment.