2016-09-14 6 views
0

私はアプリケーションのE2Eテストに分度器(Cucumber js)を使用しています。私はそれを使用して否定的なシナリオをテストしようとしている、つまり、ユーザーがオブジェクトを作成するための重複値を入力すると、それは作成されるべきではなく、ユーザーはモーダルボックス(2-3秒後に消える)。しかし、クリックしたときにモーダルボックスの表示をテストしている間、分度器はエラーを投げています。ここで分度器のモーダルポップアップ処理(キュウリjsあり)

Scenario: User sets in a duplicate logical object name 

     If a user enters a name which is the duplicate of an existing logical object, they should not be able 
     to create the logical object 

     When the user clicks on the "New" button 
     Then the "New Logical Object" panel should be displayed 

     Given the user enters "Part" in the "Name" field in the form 
     And the user enters "Part Description" in the "Description" textarea in the form 
     And the user uploads the "ProjectManagement.png" file 

     When the user clicks on the "Create" button in the form 
     Then there should be an error message in the form of a popup 

stepdefファイルです:

@Then(/^there should be an error message in the form of a popup$/) 
    public assertPopUpError() { 
     return StepDefUtil.executeInIFrame<BladePanelPage>(BladePanelPage, (page: BladePanelPage) => { 
      page.assertPopUpErrorMessage(); 
     }); 
    } 

ページファイル(BladePanelPage.ts)

/** 
    * Asserts presence of popup message- for a step which fails . 
    * 
    * 
    * @return Promise. 
    */ 
    public assertPopUpErrorMessage(): Chai.PromisedAssertion { 

     let xpathString = '//aw-pop-up-message//div[contains(@class, 'aw-modal-content')]'; 
     return expect(element(by.xpath(xpathString)).isPresent()).to.eventually.equal(true, 'The Element with xpath "' + xpath + '" is not displayed'); 
    } 

AW-ポップアップ・メッセージ

は、ここに私のコードです

はカスタムAngular2ですコンポーネント。

分度器から来ているエラーメッセージは次のとおりです。

E /ランチャー - 要素は、XPath で "// AW-ポップアップ・メッセージ// divの[含まれています(@class、" AW -modalコンテンツ「)」 表示されない:真

に等しくなるように偽期待Iはherehereを示す方法を試みたが、それは動作していません。 protractor.config.jsファイルのアニメーションを無効にすることも機能していないようです。 ご協力いただければ幸いです。答え上記は、私のために働いた

答えて

0

https://stackoverflow.com/a/32076359/1989583

。これは分度器issueであり、この回答の回避策を使用すると、ポップアップ要素をテストできます。回避策のために@Chris Traynorに感謝します。

注:以前、私は同じ質問に対して受け入れられた回答を使用していましたが、それは私のためには機能しませんでした。