【发布时间】:2016-09-19 10:34:41
【问题描述】:
我正在使用 Angular 2(2.0.0 版本)、angular-cli (1.0.0-beta.14) 开发应用程序。
我使用 Angular 2 指令集成了 Ace 编辑器,遵循 https://github.com/fxmontigny/ng2-ace-editor
一旦实例化 Ace 编辑器,量角器就无法再同步:
✗ should display app name
- Failed: Timed out waiting for Protractor to synchronize with the page after 11 seconds. Please see https://github.com/angular/protractor/blob/master/docs/faq.md
While waiting for element with locator - Locator: By(css selector, app-root .navbar a.active)
Ace 编辑器通过以下方式实例化:
import { EventEmitter, Output, ElementRef, Input, Directive } from '@angular/core';
import 'brace';
import 'brace/theme/chrome';
import 'brace/mode/html';
declare var ace: any;
@Directive({
selector: '[aceEditor]'
})
export class AceEditorDirective {
editor: any;
constructor(elementRef: ElementRef) {
let el = elementRef.nativeElement;
this.editor = ace['edit'](el); // Comment this line and Protractor works again
}
}
任何提示是什么问题?
【问题讨论】:
-
看起来当 Ace 编辑器被实例化时,Angular 不能再告诉它已经准备好了:
window.getAngularTestability($('app-root')).whenStable(function(){console.log('stable')})不再打印任何东西。
标签: angular protractor ace-editor angular-cli