I've came across a specific problem, and I can't figure out a way to get around it. I'm using cucumber-js with nodejs using zombie as a headless browser to perform automated testing.
The HTML page I'm testing contains a javascript test:
if (!jQuery.support.boxModel) {
this.location = "upgradeyourbrowser.html";
}
if (/msie 6.0/.test(navigator.userAgent.toLowerCase())) {
this.location = "upgradeyourbrowser.html";
}
This code is redirecting me to "upgradeyourbrowser.html" when I launch an automated test with cucumber, even if I pass a user agent to the browser. Thus I can't test the page I wanted to...
Here is the step definition
this.World = require("../support/world.js").World;
this.Given(/^I am connecting to my page$/, function(callback) {
this.visit('https://thepageimtesting.com', callback);
});
Here is my world.js setup
var WorldConstructor = function WorldConstructor(callback) {
var zombie = require('zombie');
this.browser = new zombie(); // this.browser will be available in step definitions
this.browser.userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1944.0 Safari/537.36"
var world = {
visit: function(url, callback) {
this.browser.visit(url, callback);
}
};
callback(this.browser);
};
exports.World = WorldConstructor;
I've read somewhere that ZombieJS isn't using real rendering, would it be the reason? Should I switch to Phantomjs or is there a get around?