Encountering an issue where my Protractor tests consistently fail with the following 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 documentation indicates that the problem arises when the application is manually bootstrapped. In my scenario, we are simply using:
<html lang="en" data-ng-app="pmApp">
The regular site functions without any errors or warnings. However, once I configure my tests with Protractor, the error surfaces. Notably, the test passed with AngularJS 1.08 but failed with version 1.25.
The test structure is as follows:
describe('Campaigns page', function() {
var ptor;
beforeEach(function() {
// Adjusts window width to prevent login page display issues
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));
});
});
// Ensures the angular app is loaded and acknowledged
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);
});
});
*Login details have been removed for security reasons.
Upon calling: browser.get('#/campaigns');
The error occurs.
I also attempted to use the login functionality as an onPrepare in the Protractor configuration file, but encountered the same issue.
Any insights or assistance would be greatly 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'