Skip to content

Commit

Permalink
Merge pull request #29 from ikedam/feature/JENKINS-28841_ReproduceDoT…
Browse files Browse the repository at this point in the history
…estError

[JENKINS-28841] Added a test to reproduce JENKINS-28841
  • Loading branch information
ikedam committed Jun 16, 2015
2 parents 0d8c005 + dad7f37 commit 553735e
Showing 1 changed file with 36 additions and 0 deletions.
Expand Up @@ -37,6 +37,11 @@
import org.apache.commons.lang.SystemUtils;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.JenkinsRule.WebClient;

import com.gargoylesoftware.htmlunit.html.HtmlElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;

/**
* Tests for FilenameChoiceListProvider, concerned with Jenkins.
Expand Down Expand Up @@ -303,4 +308,35 @@ public void testDescriptor_doCheckExcludePattern() throws IOException
);
}
}

@Bug(28841)
@Test
public void testDoTest() throws Exception
{
FreeStyleProject p = j.createFreeStyleProject();
p.addProperty(new ParametersDefinitionProperty(new ExtensibleChoiceParameterDefinition(
"Choice",
new FilenameChoiceListProvider(
".",
"*",
"",
FilenameChoiceListProvider.ScanType.File,
false,
FilenameChoiceListProvider.EmptyChoiceType.None
),
false,
""
)));

WebClient wc = j.createWebClient();
HtmlPage page = wc.getPage(p, "configure");

// find the button to call doTest
//List<HtmlElement> elements = page.getElementsByName("choiceListProvider");
//assertEquals(1, elements.size());
//HtmlElement choiceListProviderBlock = elements.get(0);
HtmlElement button = page.<HtmlElement>getFirstByXPath("//*[@name='choiceListProvider']//button|//*[@name='choiceListProvider']//input[@type='button']");
assertNotNull(button);
button.click();
}
}

0 comments on commit 553735e

Please sign in to comment.