mercredi 7 octobre 2015

how can I control the browser agent in my wicket unit test

I have some server side Wicket code using Apache Wicket that needs to follow a different flow for IE8, it looks roughly like this:

ClientProperties clientProperties = WebSession.get().getClientInfo().getProperties();
if (clientProperties.isBrowserInternetExplorer() && clientProperties.getBrowserVersionMajor() == 8) {
    // do this
} else {
    // do that
}

I want to test this code in combination with some other Wicket components, and test the combined output. I'm using the WicketTester helper class, and when I debug my code, it seems that the Wicket test framework gets reported as Firefox 9.

Now, the question is: can I easily control which browser agent is used in my test? As you can imagine, I'd rather not start mocking these classes.

Aucun commentaire:

Enregistrer un commentaire