本文介绍了量角器+混合角度1 + 2应用=失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

量角器在Angular 1上运行良好但在将我的应用程序升级为混合Angular 1 + 2后,我收到此错误:

Protractor works well on Angular 1 but after upgrading my app to an hybrid Angular 1+2 I get this error:

当您没有ng-app标签< div ng-app = myAppManager> 时,这似乎是一个常见错误在你的Angular 1应用程序中,可以很容易地修复你的量角器配置文件中的 rootElement:'html',但它似乎没有改变混合应用程序的任何内容。

It seems a common error when you don't have a ng-app tag <div ng-app=myAppManager"> in your Angular 1 app and can be easily fixed wiyh rootElement : 'html' in your protractor config file but it doesn't seem to change anything on hybrid app.

我试过 rootElement:'html'甚至 useAllAngular2AppRoots:true

我怀疑问题来自异步加载混合角度(来自 doc):

I suspect the problem comes from the asynchronous loading of the hybrid angular (from the upgrade doc):

我的配置文件:

exports.config = {
    framework: 'jasmine2',
    seleniumAddress: 'http://localhost:4444/wd/hub',
    specs: ['protractor.js'],
    jasmineNodeOpts: {
        showColors: true,
        defaultTimeoutInterval: 50000,
    },
    allScriptsTimeout: 50000,//seb
    capabilities: {
        'browserName': 'chrome',
        'chromeOptions': {
            'prefs': {
                'profile.managed_default_content_settings.notifications':2
            }
        }
    },
    rootElement : 'html',
    // useAllAngular2AppRoots: true,
    jasmineNodeOpts: {
        realtimeFailure: true
    },
    onPrepare: function() {
      var failFast = require('jasmine-fail-fast');
      jasmine.getEnv().addReporter(failFast.init());
    }
}


推荐答案

量角器团队已经解决了这个问题:

Protractor team has fixed with this:

编辑:我还没有测试过

编辑2:似乎不起作用,我回到angularJs(版本1)

这篇关于量角器+混合角度1 + 2应用=失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 01:27