2016-09-19 14 views
2

角度2(2.0.0リリース)、角度-cli(1.0.0-beta.14)を使用してアプリケーションを開発しています。エースエディタ+角度2 =>分度器が同期できない

私はできるだけ早くエースエディタがインスタンス化されるようhttps://github.com/fxmontigny/ng2-ace-editor

を以下の角度2ディレクティブを使用してエースエディタを統合した、分度器はもう同期できません。

✗ 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) 

エースエディタを使用してインスタンス化されます。

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 
    } 
} 

何が問題なのですか?

+0

Ace Editorがインスタンス化されたときのように見えますが、Angularは準備ができていることをもう分かりません:window.getAngularTestability($( 'app-root'))。whenStable(function(){console.log( 'stable')} ) 'は何も印刷しません。 – rcomblen

答えて

1

[OK]をクリックします。 AngularはAce Editorの変更を追跡していないようです。したがって、常に変化が続いていると思います。したがって

window.getAngularTestability($('app-root')) 
    .whenStable(funct‌​ion(){ 
     console.log('s‌​table') 
    }) 

エースエディタがインスタンス化されてももう戻りません。

簡単な解決策:ゾーンのうちのエースエディタをインスタンス化:

constructor(elementRef: ElementRef, zone: NgZone) { 
    let el = elementRef.nativeElement; 
    zone.runOutsideAngular(() => { 
    this.editor = ace['edit'](el); 
    }); 
} 
1

、私はむしろ、分度器で複数のテストを行った上で、その代わりに角の外エースエディタを実行しているのと、私は同じ問題に直面しました以前のテストが中止された場所から継続します。エースエディタはブラウザが同期を完了させないようにするので、私の分度器テストはタイムアウトになります。

次のようにして、テストを持つことができます:

it('Runs Tests for components with ace edit') 
    browser.ignoreSynchronization = true; 
    testAngularElements(); 

it('Runs the rest of the test in which the ace edit is not present') 
    browser.ignoreSynchronization = false; 
    remainingTests(); 

残念ながら私はまだ別のアプローチを見つけることができませんでした。

関連する問題