使用量角器时使角度应用程序运行 [英] Getting the angular app to run when using protractor

查看:201
本文介绍了使用量角器时使角度应用程序运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在这里丢失一些东西...

我正在尝试使用量角器为我的角度应用程序运行e2e测试。配置文件的内容如下:

  allScriptsTimeout:11000,

specs:[
'src / ** / *。e2e.js'
],

功能:{
browserName:'firefox'
},

baseUrl:'http:// localhost:8000 / app /',

框架:'jasmine',

jasmineNodeOpts:{
showColors :true,
isVerbose:true,
includeStackTrace:true,
defaultTimeoutInterval:30000
}

测试看起来像这样:

  describe('example test',function ){
beforeEach(function(){
browser.get('index.html');
});

it('should test something trivial' ,function(){
expect(2).toEqual(2);
});
});

我使用grunt来运行它,使用grunt-protractor-runner。
当咕噜声到达量角器任务时,我看到以下内容(使用--verbose运行咕噜声):

 开始硒独立服务器... 
[launcher]运行1个WebDriver实例
Selenium独立服务器启动时间为http://172.17.113.30:53524/wd/hub

然后打开Firefox浏览器窗口,并正确解析URL: http:// localhost:8000 / app / index .html



然而(这里是最后的问题......),firefox找不到页面,即出现以下错误:





我试着用Chrome来运行它,但是得到了同样的结果。



我的问题是,我错过了什么?
换言之,谁的工作是将角度应用程序部署在localhost:8000上?
部署是由protractor / selenium / grunt完成的,还是我需要将它部署到某个web服务器上?

鉴于我找不到任何像我的在线问题,我想我在这里错过了一些微不足道的东西。请帮助。

解决方案

如上所述。在执行任何测试之前需要部署Angular App。首先部署Angular应用程序,然后使用量角器开始测试。


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.

解决方案

So, as discussed. Angular App needs to be deployed before executing any tests. Deploy the Angular app first and then start Testing using Protractor.

这篇关于使用量角器时使角度应用程序运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆