Reputation: 28750
Here's my conf file:
// An example configuration file.
exports.config = {
// The address of a running selenium server.
seleniumAddress: 'http://localhost:4444/wd/hub',
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'phantomjs',
'phantomjs.binary.path': 'C:/Users/MY_USER_NAME/AppData/Roaming/npm/node_modules/phantomjs/phantomjs.exe'
},
// Spec patterns are relative to the current working directly when
// protractor is called.
specs: ['example_spec.js'],
// Options to be passed to Jasmine-node.
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
};
And here's my example_spec.js file
describe('angularjs homepage', function() {
it('should greet the named user', function() {
browser.get('http://www.angularjs.org');
element(by.model('yourName')).sendKeys('Julie');
var greeting = element(by.binding('yourName'));
expect(greeting.getText()).toEqual('Hello Julie!');
});
});
When I run it I always get the error:
Error: Timed out waiting for page to load
Wait timed out after 10129ms
If I switch to testing just chrome it works fine, but I can't seem to get the phantomjs to work. I have the latest build of both phantomjs and protractor, freshly installed.
Upvotes: 4
Views: 1898
Reputation: 28750
Turns out two things were up.
1) The angularjs site just did not want to work
2) You need to set the browsers resolution with phantomjs if there is not one default set like so: browser.driver.manage().window().setSize(1124, 850);
I ran that in my before each:
beforeEach(function(){
browser.driver.manage().window().setSize(1124, 850);
});
And then I started having tests that pass.
Upvotes: 4