Skip to content

Commit

Permalink
Fix HTML tests on the local FS not being served correctly.
Browse files Browse the repository at this point in the history
This fixes issue #2706.
  • Loading branch information
shs96c committed Sep 9, 2016
1 parent 031456c commit 2683fbc
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ private URL determineSuiteUrl(String browserUrl, String suiteURL) throws IOExcep

ResourceHandler handler = new ResourceHandler();
handler.setDirectoriesListed(true);
handler.setWelcomeFiles(new String[]{"index.html"});
handler.setBaseResource(Resource.newResource(path.toFile()));
handler.setWelcomeFiles(new String[]{path.getFileName().toString(), "index.html"});
handler.setBaseResource(Resource.newResource(path.getParent().toFile()));

ContextHandler context = new ContextHandler("/tests");
context.setHandler(handler);

server.setHandler(handler);
server.setHandler(context);
server.start();

PortProber.pollPort(port);
Expand Down Expand Up @@ -211,7 +211,7 @@ private URL verifySuiteUrl(URL url) throws IOException {
}

public static int mainInt(String... args) throws Exception {
if (args.length != 5 && args.length != 4) {
if (args.length != 5) {
throw new IllegalAccessException(
"Usage: HTMLLauncher outputDir testSuite startUrl multiWindow browser");
}
Expand Down

1 comment on commit 2683fbc

@staniere
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hello,
i does not achieve to launch test suite which is not located in same directory than test case.
i Wonder if is not linked to this patch ?

when launching this command : (with suite URL = "file:///C:/")
java -Dwebdriver.gecko.driver=C:\dev\SeleniumMyScm\geckodriver.exe -cp C:\dev\SeleniumMyScm -jar "C:\dev\SeleniumMyScm\selenium-html-runner-3.4.0.jar" -htmlSuite "*firefox" "http://myfmtest/" "file:///C:/dev/SeleniumMyScm/001_TestSuites/TntSearchAndOpen.suite" "C:\dev\SeleniumMyScm\TntSearchAndOpen"

i get this error :
java.nio.file.InvalidPathException: Illegal char <:> at index 4: file:///C:/dev/ SeleniumMyScm/001_TestSuites/TntSearchAndOpen.suite at sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182) at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153) at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77) at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94) at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255) at java.nio.file.Paths.get(Paths.java:84) at org.openqa.selenium.server.htmlrunner.HTMLLauncher.determineSuiteUrl( HTMLLauncher.java:150) at org.openqa.selenium.server.htmlrunner.HTMLLauncher.runHTMLSuite(HTMLL auncher.java:108) at org.openqa.selenium.server.htmlrunner.HTMLLauncher.mainInt(HTMLLaunch er.java:245) at org.openqa.selenium.server.htmlrunner.HTMLLauncher.main(HTMLLauncher. java:273)

if i launch this command : (with suite URL = "C:/dev/...")

java -Dwebdriver.gecko.driver=C:\dev\SeleniumMyScm\geckodriver.exe -cp C:\dev\SeleniumMyScm -jar "C:\dev\SeleniumMyScm\selenium-html-runner-3.4.0.jar" -htmlSuite "*firefox" "http://myfmtest/" "C:/dev/SeleniumMyScm/001_TestSuites/TntSearchAndOpen.suite" "C:\dev\SeleniumMyScm\TntSearchAndOpen"

I get this error :

2017-05-16 17:11:15.218:INFO::main: Logging initialized @8496ms to org.seleniumh
q.jetty9.util.log.StdErrLog
2017-05-16 17:11:15.282:INFO:osjs.Server:main: jetty-9.4.z-SNAPSHOT
2017-05-16 17:11:15.311:INFO:osjsh.ContextHandler:main: Started o.s.j.s.h.Contex
tHandler@2e377400{/tests,null,AVAILABLE}
2017-05-16 17:11:15.343:INFO:osjs.AbstractConnector:main: Started ServerConnecto
r@175b9425{HTTP/1.1,[http/1.1]}{0.0.0.0:23502}
2017-05-16 17:11:15.343:INFO:osjs.Server:main: Started @8621ms
../11_Tnt/Tnt_open_order.sel
<a href="../11_Tnt/Tnt_open_order.sel">Tnt_open_order</a></td></tr>
</tbody></table>
../11_Tnt/Tnt_search.sel
<a href="../11_Tnt/Tnt_search.sel">Tnt_search</a></td></tr>
<tr class="status_passed"><td>
../10_Login/Login_pass.sel
<a href="../10_Login/Login_pass.sel">Login_pass</a></td></tr>
<tr class="status_passed"><td>
../04_GoToUrl/GoTo_MyFmTest.sel
<a href="../04_GoToUrl/GoTo_MyFmTest.sel">GoTo_MyFmTest</a></td></tr>
<tr class="status_passed"><td>
../03_Datasheets/data_Tnt_search.sel
<a href="../03_Datasheets/data_Tnt_search.sel">data_Tnt_search</a></td></tr>
<tr class="status_passed"><td>

Please sign in to comment.