Protractor selenium standalone终止时出现未知错误

Protractor selenium standalone终止时出现未知错误,protractor,Protractor,当我开始测试时,浏览器打开,几秒钟后显示一个ip,ip变为“数据”;在终端中,测试被循环并发送err ms empresss Mac mini:myApp admin$量角器测试/e2e.js 使用位于的selenium服务器 [launcher]正在运行1个WebDriver实例 起动 茉莉花规格超时。重置WebDriver控制流。 F 我把它命名为e2e.js 我的测试文件是 describe('header Module', function(){ beforeEach(funct

当我开始测试时,浏览器打开,几秒钟后显示一个ip,ip变为“数据”;在终端中,测试被循环并发送err ms

empresss Mac mini:myApp admin$量角器测试/e2e.js 使用位于的selenium服务器 [launcher]正在运行1个WebDriver实例 起动 茉莉花规格超时。重置WebDriver控制流。 F

我把它命名为e2e.js 我的测试文件是

describe('header Module', function(){

   beforeEach(function() {
        var header = element(by.css('title'));
    });

   it('should check title text',function(){
        expect(header.getText()).toContain('Ionic Blank Starter');    
    });
});

我下载了一个空白的ionic应用程序,我想测试标题中包含的元素“ionic blank Starter”

您在项目中没有很好地处理异步代码
header.getText()
返回一个承诺,在断言文本之前需要解决该承诺。您可以这样做:

describe('header Module', function(){
it('should check title text',function(callback){
    var header = element(by.css('.title'));
    header.getText()
       .then(function (text) {
           expect(text).toContain('Ionic Blank Starter');
           callback();
       }); 
});
});

没有变化,同样的错误再次出现在终端(上面显示的错误)更新了我的答案,错误是因为您在每个之前的
中定义了该方法的本地头,并在其他方法中使用该头。失败:1)头模块应检查标题文本消息:错误:超时-在jasmine指定的超时内未调用异步回调。默认超时时间间隔。堆栈:错误:超时-在jasmine.DEFAULT\u Timeout\u INTERVAL指定的超时内未调用异步回调。我开始测试浏览器打开但显示空白页我没有打开该应用程序它打开给定的url吗?在地址栏中首先“数据”;几秒钟后我的url,然后浏览器自动关闭而不打开我的应用程序,即不显示标题页
describe('header Module', function(){

   beforeEach(function() {
        var header = element(by.css('title'));
    });

   it('should check title text',function(){
        expect(header.getText()).toContain('Ionic Blank Starter');    
    });
});
describe('header Module', function(){
it('should check title text',function(callback){
    var header = element(by.css('.title'));
    header.getText()
       .then(function (text) {
           expect(text).toContain('Ionic Blank Starter');
           callback();
       }); 
});
});