问题
I must be missing something here ...
I'm trying to use protractor to run e2e tests for my angular application. The configuration file is something along the lines of:
allScriptsTimeout: 11000,
specs: [
'src/**/*.e2e.js'
],
capabilities: {
browserName: 'firefox'
},
baseUrl: 'http://localhost:8000/app/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
isVerbose : true,
includeStackTrace : true,
defaultTimeoutInterval: 30000
}
The test looks something like this:
describe('example test', function() {
beforeEach(function () {
browser.get('index.html');
});
it('should test something trivial', function() {
expect(2).toEqual(2);
});
});
I'm using grunt to run it, with "grunt-protractor-runner". When grunt gets to the protractor task, I see the following (running grunt with --verbose):
Starting selenium standalone server...
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://172.17.113.30:53524/wd/hub
Then the firefox browser window opens, and resolves the URL correctly to: http://localhost:8000/app/index.html
However (and here's the question finally ...), firefox cannot find the page, i.e. I get the following error:
I tried running it with Chrome as well, but I get the same result.
My question is, what am I missing ? In other words, who's job it is to get the angular app deployed at localhost:8000 ? Is the deployment done by protractor/selenium/grunt, or do I need to deploy it on some webserver myself ?
Given that I can't find any question like mine online, I guess I'm missing something trivial here. Please help.
回答1:
So, as discussed. Angular App needs to be deployed before executing any tests. Deploy the Angular app first and then start Testing using Protractor.
来源:https://stackoverflow.com/questions/27718703/getting-the-angular-app-to-run-when-using-protractor