“角度未定义"对存储在 Liferay 中的角度应用程序执行量角器测试时出错

quot;angular is not definedquot; error while executing Protractor test on angular application stored in Liferay(“角度未定义对存储在 Liferay 中的角度应用程序执行量角器测试时出错)

本文介绍了“角度未定义"对存储在 Liferay 中的角度应用程序执行量角器测试时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Ubuntu 14.04 虚拟主机上运行,​​我正在尝试使用 PROTRACTOR 和托管在Liferay"中的应用程序创建一些 E2E 测试.

i'm running on a Ubuntu 14.04 virtual-host and i'm trying to create some E2E tests with PROTRACTOR for and Application hosted in "Liferay".

对于登录部分(不需要角度),使用量角器的测试正常,页面登录并正确导航,但是当我尝试在基于 angularjs 的应用程序上打开下拉"菜单时,使用以下内容代码:

For the login section (that doesn't require angular) the test with protractor are Ok, the page logins and navigates correctly, but when i try to open a "drop-down" menu on the angularjs based app with the following code:

<select class = "form-control menu-select ng-pristine ng-valid"
ng-model = "topTitlesData.topFiveDateRange"
name = "topFiveDateRange"
ng-options = "range.name for range in        topTitlesData.topFiveDateRangeValues"
ng-change = "" > < option value = "0" > Last day < /option><option value="1">Last 5 days</option > < option value = "2" > Last 7 days < /option><option value="3">Last 30 days</option > < option value = "4" > last 90 days < /option></select>

我收到了这个错误日志:

i got this error log:

UnknownError:未知错误:未定义角度

UnknownError: unknown error: angular is not defined

This is the test script on js:


describe('pages with login', function() {
  it('should log in with a non-Angular page and select and option', funcion() {
    browser.ignoreSynchronization = true;
    browser.get('***************');
    element(by.id('_58_login')).clear();
    element(by.id('_58_login')).sendKeys('*******');
    expect(element(by.id('_58_login')).getAttribute('value')).toEqual('*****');
    element(by.id('_58_password')).sendKeys('*****', protractor.Key.ENTER);
    browser.get('***************');
    //browser.ignoreSynchronization = false;
    var selects = element.all(by.model('topTitlesData.topFiveDateRange'));
    expect(selects.count()).toEqual(5);
  });
});

我想知道,我错过了什么?

i'm wondering, what am i missing ?

我已经安装和更新了 nodejs、量角器、webadmin-manager、jdk7.*

i have nodejs, protractor, webadmin-manager,jdk7.* installed and updated

推荐答案

谢谢你,问题是测试没有等到 angular 加载到页面...所以我用"Grunt"、Yeoman"和 Ruby +ruby-compass" gem 并避免使用 liferay.我也设置了

thank you, the issue was that the tests didn't wait till angular in loaded to the page... so i setup a localhost with the application with "Grunt", "Yeoman" and Ruby + "ruby-compass" gem and avoided liferay. I also setup

allScriptsTimeout: 5000000,

在 config.js 文件中,现在测试运行正常.

in the config.js file and now the tests is running okay.

这篇关于“角度未定义"对存储在 Liferay 中的角度应用程序执行量角器测试时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:“角度未定义"对存储在 Liferay 中的角度应用程序执行量角器测试时出错

基础教程推荐