FluentLenium/FluentLenium — pull request #42 by jroper (2012-08-21 13:14:44+00:00)
Title: Added support for making it easy to make the base URL for relative URLs configurable

It is often the case that you don't want the base URL for the application you are testing embedded in the code, but rather, you want a way to configure it easily. For example:

* You might want to be able to run your fluent tests against different test servers
* You might want to be able to use different ports in different environments
* You might want to dynamically select ports to ensure they don't conflict with other ports currently in use, for example, on a continuous integration server

My specific use case is to make Play framework testing much easier, so when users write Fluentlenium tests, they never need to worry about what port the test server is running on, Play framework selects it for them.

So basically what I've implemented is that a user can override getDefaultBaseUrl() to return a base URL, for example, "http://localhost:8787". Then, when goTo is called with a relative URL, this base URL will be appended to it. Similarly, when Page.getUrl() returns a relative URL, the base URL will be appended then to.

This change is fully backward compatible, if getDefaultBaseUrl() is not overridden, then nothing is done when a relative URL is passed, the relative URL is passed straight to the driver.