I am running into an issue where my Protractor tests always fail with the error message:
UnknownError: Error Message => '[ng:btstrpd] App Already Bootstrapped with this Element '<html lang="en" data-ng-app="pmApp" class="js draganddrop no-video no-audio ng-scope">'
The current Angularjs docs suggest the issue is when the application is being manually bootstrapped, whereas in my case, this is not the case, we are just using:
<html lang="en" data-ng-app="pmApp">
The normal site works fine, without an error or warning, but as soon as I set up my tests using Protractor the error occurs. To note, the test was passing when I was using angularjs 1.08, but has since failed when using 1.25
The test is like so:
describe('Campaigns page', function() {
var ptor;
beforeEach(function() {
// Sets the width of the window, otherwise the default min width
// of our site is to small and the login page un-usable
browser.driver.manage().window().setSize(1200, 800);
ptor = protractor.getInstance();
browser.driver.get(ptor.baseUrl + '/login');
browser.driver.findElement(by.id('user_email')).sendKeys('admin@aperture.*************.com');
browser.driver.findElement(by.id('user_password')).sendKeys('*************');
browser.driver.findElement(by.css('.button.primary')).click();
browser.driver.wait(function() {
return browser.driver.getCurrentUrl().then(function(url) {
return (/\/#\/$/.test(url));
});
});
// Now ensure the angular app is loaded and it knows about it
browser.get('#/');
});
it('Should list campaigns on the page', function() {
browser.get('#/campaigns');
browser.findElements(by.css('.main-campaign')).then(function(results) {
expect(results.length).toBeGreaterThan(0);
});
});
});
*note actual login details removed for safety.
As soon as the: browser.get('#/campaigns');
is called, the error happens.
I have also tried using the login functionality as an onPrepare in the protractor conf file, but the same thing happens.
Any thoughts or help would be appreciated!
Full stack trace:
Stacktrace:
UnknownError: Error Message => '[ng:btstrpd] App Already Bootstrapped with this Element '<html lang="en" data-ng-app="pmApp" class="js draganddrop no-video no-audio ng-scope">'
http://errors.angularjs.org/1.2.5/ng/btstrpd?p0=%3Chtml%20lang%3D%22en%22%20data-ng-app%3D%22pmApp%22%20class%3D%22js%20draganddrop%20no-video%20no-audio%20ng-scope%22%3E' caused by Request => {"headers":{"Accept":"application/json, image/png","Connection":"Keep-Alive","Content-Length":"159","Content-Type":"application/json; charset=utf-8","Host":"localhost:29064"},"httpVersion":"1.1","method":"POST","post":"{\"args\":[[]],\"script\":\"return (function () {\n // Continue to bootstrap Angular.\n angular.resumeBootstrap(arguments[0]);\n }).apply(null, arguments);\"}","url":"/execute","urlParsed":{"anchor":"","query":"","file":"execute","directory":"/","path":"/execute","relative":"/execute","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/execute","queryKey":{},"chunks":["execute"]},"urlOriginal":"/session/64b440e0-68b9-11e3-b92a-e1efe36914bc/execute"} Build info: version: '2.37.0', revision: 'a7c61cb', time: '2013-10-18 17:14:00' System info: host: 'peters-mbp', ip: '192.168.0.3', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9', java.version: '1.6.0_65'