0

I am trying to test an Play 2 app with Fluentlenium.

This is the code for one of the test cases:

import org.junit.*;

import play.mvc.*;
import play.test.*;
import play.libs.F.*;

import static play.test.Helpers.*;
import static org.fest.assertions.Assertions.*;

import static org.fluentlenium.core.filter.FilterConstructor.*;
public class IntegrationTest {

/**
 * Verify if the Login Page is rendered correctly
 */
@Test
public void LoginPage() {
    running(testServer(3333, fakeApplication(inMemoryDatabase())), HTMLUNIT_, new Callback<TestBrowser>() {
        public void invoke(TestBrowser browser) {
            browser.goTo("http://localhost:3333");
            assertThat(browser.pageSource()).contains("Login");
        }
    });
}

When I execute this using HTMLUNIT it works fine, but there are some pages with complex javascript so HTMLUNIT brokes on some test cases.

When I replace HTMLUNIT with FIREFOX it launches Firefox but doesn't do anything on the browser.

And when I try to use CHROME it gives me an "Cannot find symbol" compilation error. I tried downloading the ChromeWebDriver and copying it in "/usr/bin" folder, but still doesn't work.

I don't know where could be the problem.

victorvartan
  • 1,002
  • 2
  • 11
  • 31

2 Answers2

-1

You need the Chrome driver library and may need to tell your application explicitly where to find it like e.g. so:

System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + "/extra/chromedriver")
Manuel Bernhardt
  • 3,135
  • 2
  • 29
  • 36
-1

I had the same problem with Firefox starting up and nothing happening. The latest Fluentlenium version that is included in the Play Framework is not up to date with the changes in the latest Firefox version.

What I had to do is upgrade Fluentlenium (currently at version 0.10.13)

// For Scala, add the latest fluentlenium dependency in build.sbt
libraryDependencies ++= Seq(
  <other dependencies of the project>
  "org.fluentlenium" % "fluentlenium-core" % "0.10.3" % "test"
)

and at the same time downgrade Firefox (28.0 seems to work with Fluentlenium 0.10.3)

sudo apt-get purge firefox
sudo apt-get install firefox=28.0+build2-0ubuntu2
victorvartan
  • 1,002
  • 2
  • 11
  • 31