Static resources not found in (Selenium) JUnit test for Play 2.0 application made from Eclipse

For my Play 2.0 application, I want to run the (Selenium) JUnit test from Eclipse. The test script looks like this:

@Test public void runInBrowser() { running(testServer(47111, fakeApplication(...)), ChromeDriver.class, new Callback<TestBrowser>() { public void invoke(TestBrowser browser) { browser.goTo("http://localhost:47111"); assertThat(...); } }); } 

The test server starts, but during the test none of the static resources are available (for example, * .css, * .js, * .png), i.e. access to http://localhost:47111 calls 404 for these resources.

My routes file contains:

 GET /assets/*file controllers.Assets.at(path="/public", file) 

Static resources are located in the folders: public \ images (* .png), public \ javascripts (* .js), public \ stylesheets (* .css).

Outside of the Eclipse test environment, all static resources are detected (for example, running tests in the game console using a playback test).

Any ideas?

+4
eclipse junit selenium playframework
source share
2 answers

Finally, I found a solution:

Replace

 <classpathentry kind="lib" path="target/scala-2.10/classes_managed"/> 

from

 <classpathentry kind="lib" path="target/scala-2.10/classes"/> 

in the Eclispe.classpath file.

+2
source share

I found here additional information. Assets not available during functional tests.

0
source share

All Articles