Reputation: 402
After a day or two of working on e2e tests, I've got something that I want to run via Bamboo. I can get all the e2e tests running on my own local server, but Bamboo fails with the following response and when the Chrome browser window pops up, it says "403 forbidden":
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://192.168.100.107:54926/wd/hub
Spec started
Web App
Sign In Page
— should redirect to sign in page if not authenticated[39m
- Failed: Angular could not be found on the page https://localhost/ : retries looking for angular exceeded
- Failed: Error while waiting for Protractor to sync with the page: "angular could not be found on the window"
Here's a sample test:
'use strict';
describe('Web App', function() {
beforeEach(function() {
browser.get('https://localhost/');
});
describe('Sign In Page', function() {
it('should redirect to sign in page if not authenticated', function() {
expect(browser.getLocationAbsUrl()).toMatch('/sign_in');
});
});
});
and here's what I believe is relevant from my protractor-conf.js file:
exports.config = {
allScriptsTimeout: 300000,
baseUrl: 'https://localhost/',
framework: 'jasmine2',
specs: [
'e2e/sign-in.scenarios.js'
],
capabilities: {
'browserName': 'chrome'
},
onPrepare: function() {
browser.driver.manage().window().maximize();
var SpecReporter = require('jasmine-spec-reporter');
jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: true}));
},
getPageTimeout: 10000,
jasmineNodeOpts: {
showColors: true,
print: function() {},
defaultTimeoutInterval: 300000
}
};
Finally, we run a 'npm install' before 'grunt test', so I would expect the versions to all be the same except for maybe Chrome?
My coworker who's in charge of Bamboo is able to recreate the run in the temp directory that's created by Bamboo. In trying to figure out what is going on, I have moved "ng-app" from the head tag to the body tag, I've messed with the baseUrl in the protractor-conf.js file and my coworker is now using my nginx config file (which was different than his).
I'm running out of ideas to try and would welcome any suggestions!
Julie
Upvotes: 3
Views: 1478
Reputation: 586
At first, it's not a good practice running e2e tests in your CI server. The CI server should just trigger the Protractor tests which may run in another machine (on you network or on the cloud like AWS or Sauce labs) - See http://angular.github.io/protractor/#/server-setup
With a Selenium server running on you network you can set the protractor-conf.js file with the new address, like this:
seleniumAddress: 'http://<seleniumServer_ip>:4444/wd/hub'
Another thing I didn't understand is your baseUrl. You should deploy your web application in another server (and never in your CI server) and access it in any browser on your network. Then you can pass the web app address as an argument to Protractor, for example:
protractor protractor-conf.js --baseUrl="http://<webAppIP>"
With this architecture you can stay logged in on your seleniumServer and watch what is happening when the tests are run.
++ You can enhance the results taking screenshots.
Upvotes: 3