I recently integrated end-to-end tests using Protractor into my AngularJS application. Testing them locally showed that they all pass, but upon committing to GitHub and Travis for CI, most of the tests fail.
The failing tests seem to be those requiring navigation to different states (utilizing Angular UI Router).
scenarios.js
describe('Test', function () {
beforeEach(function () {
browser.get('/');
})
it('should navigate to the user page', function () {
//browser.get("/");
browser.sleep(3000);
var button = element(by.id('createSession'));
button.click().then(function () {
browser.sleep(3000);
expect(browser.getLocationAbsUrl()).toEqual("/user");
});
});
// Further test cases go here...
});
protractor.conf.js
exports.config = {
allScriptsTimeout: 11000,
specs: [
"scenarios.js"
],
capabilities: {
"browserName": "chrome"
},
baseUrl: "http://localhost:8000/",
framework: "jasmine",
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
package.json
{
// Package details go here...
}
.travis.yml
language: node_js
node_js:
- '4.4'
addons:
firefox: "latest"
// Configuration details go here...
It appears that the issue arises due to how the routing is handled with angular-seed's template. Any insights on why this discrepancy in test results is occurring?