Thanks for suggestion, Jesse!
I added the dependency to my Maven POM:
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>form-element-path</artifactId>
<version>1.5</version>
<scope>test</scope>
</dependency>
After this I noticed that inputs on config page have IDs (not sure how constant they are though).
But this caused the problem with config form loading. I have this code:
JenkinsRule context = context();
JenkinsRule.WebClient webClient = context.createWebClient();
webClient.getPage(freeStyleProject, "configure");
When webClient.getPage() is called, the following appears in Jenkins log:
Jul 02, 2015 7:12:12 AM com.gargoylesoftware.htmlunit.WebClient printContentIfNecessary
INFO: <html><body>
<h1>404 Not Found</h1>
<p>Stapler processed this HTTP request as follows, but couldn't find the resource to consume the request
<pre>
-> evaluate(<hudson.model.Hudson@3766c667> :hudson.model.Hudson,"/plugin/form-element-path/script.js")
-> evaluate(((StaplerProxy)<hudson.model.Hudson@3766c667>).getTarget(),"/plugin/form-element-path/script.js")
-> evaluate(<hudson.model.Hudson@3766c667>.getPlugin("form-element-path"),"/script.js")
<font color=red>-> unexpected null!</font>
</pre>
<p>If this 404 is unexpected, double check the last part of the trace to see if it should have evaluated to null.
</body></html>
com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 404 Not Found for
http://localhost:51648/jenkins/static/93ae3bc9/plugin/form-element-path/script.js at com.gargoylesoftware.htmlunit.WebClient.throwFailingHttpStatusCodeExceptionIfNecessary(WebClient.java:549)
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:998)
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadExternalJavaScriptFile(HtmlPage.java:953)
at com.gargoylesoftware.htmlunit.html.HtmlScript.executeScriptIfNeeded(HtmlScript.java:359)
at com.gargoylesoftware.htmlunit.html.HtmlScript$1.execute(HtmlScript.java:223)
at com.gargoylesoftware.htmlunit.html.HtmlScript.onAllChildrenAddedToPage(HtmlScript.java:238)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:699)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.endElement(HTMLParser.java:657)
at org.cyberneko.html.HTMLTagBalancer.callEndElement(HTMLTagBalancer.java:1132)
at org.cyberneko.html.HTMLTagBalancer.endElement(HTMLTagBalancer.java:1034)
at org.cyberneko.html.filters.DefaultFilter.endElement(DefaultFilter.java:206)
at org.cyberneko.html.filters.NamespaceBinder.endElement(NamespaceBinder.java:329)
at org.cyberneko.html.HTMLScanner$ContentScanner.scanEndElement(HTMLScanner.java:3058)
at org.cyberneko.html.HTMLScanner$ContentScanner.scan(HTMLScanner.java:1994)
at org.cyberneko.html.HTMLScanner.scanDocument(HTMLScanner.java:907)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:499)
at org.cyberneko.html.HTMLConfiguration.parse(HTMLConfiguration.java:452)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at com.gargoylesoftware.htmlunit.html.HTMLParser$HtmlUnitDOMBuilder.parse(HTMLParser.java:901)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parse(HTMLParser.java:350)
at com.gargoylesoftware.htmlunit.html.HTMLParser.parseHtml(HTMLParser.java:304)
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:134)
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:101)
at org.jvnet.hudson.test.HudsonPageCreator.createPage(HudsonPageCreator.java:46)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:449)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:332)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:389)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:374)
at org.jvnet.hudson.test.JenkinsRule$WebClient.goTo(JenkinsRule.java:2016)
at org.jvnet.hudson.test.JenkinsRule$WebClient.goTo(JenkinsRule.java:1996)
at org.jvnet.hudson.test.JenkinsRule$WebClient.getPage(JenkinsRule.java:1956)
In a weird way, inability to load this JS resource interrupts the test with exception.
Regards,
Kirill.
суббота, 27 июня 2015 г., 17:16:57 UTC+1 пользователь Jesse Glick написал: