Loading javascript assets from integration tests (Play / Selenium)

I am trying to test our 2.4.x application for games, which makes heavy use of the reaction to rendering tables and similar things. With a simple application launch, all javascript is processed and output properly. However, at our test integration stage (using something that extends WithBrowser to support selenium in specs2 examples), the assets are clearly unavailable.

We get a lot of errors, such as the following (one for each javascript file we are trying to download):

[error] - com.gargoylesoftware.htmlunit.html.HtmlPage - Error loading JavaScript from [http://localhost:19001/assets/lib/react/react-with-addons.js]

Is there anything that can be added to tell the game to process our javascript pipeline before the testing / integration phase?

+4
source share
1 answer

Are you using IntegrationTest configuration in SBT?

I had the same problem and finally it was solved by adding:

(managedClasspath in IntegrationTest) += (packageBin in Assets).value

in my build.sbt

It may not be the same for you, but I use Gulp to create my css and js files and put them in the "out" directory. Therefore, to get them from the assembly, I also had to add:

unmanagedResourceDirectories in Assets <+= baseDirectory { _ / "out" }
+2
source

Source: https://habr.com/ru/post/1627036/


All Articles