0

メニューバーにドロップダウンがあります。ドロップダウンをテストしているときは、正常に機能しています。しかし、ドロップダウンのアイテムをクリックすると、そのアイテムに関連するデータが表示されません。

テスト :

it('Add Patient', function(){
          ptor = protractor.getInstance();
    var dropdown = element.all(by.css('.dropdown')).get(3);
    var toggle = dropdown.element(by.css('.dropdown-toggle'));
    toggle.click();
    toggle.click();
    ptor.sleep(2000);     
    var list = dropdown.all(by.css('.dropdown-menu li'));
    expect(list.get(1).getText()).toEqual('Patients');
    var test = list.get(1);
    test.click(); 
        });

そして、ログはこのように印刷されます。

Dropdown Log***** { parentElementArrayFinder: 
   { getWebElements: [Function],
     actionResults_: undefined,
     locator_: { using: 'css selector', value: '.dropdown' },
     click: [Function],
     sendKeys: [Function],
     getTagName: [Function],
     getCssValue: [Function],
     getAttribute: [Function],
     getText: [Function],
     getSize: [Function],
     getLocation: [Function],
     isEnabled: [Function],
     isSelected: [Function],
     submit: [Function],
     clear: [Function],
     isDisplayed: [Function],
     getOuterHtml: [Function],
     getInnerHtml: [Function],
     getId: [Function] },
  elementArrayFinder_: 
   { getWebElements: [Function],
     actionResults_: undefined,
     locator_: { using: 'css selector', value: '.dropdown' },
     click: [Function],
     sendKeys: [Function],
     getTagName: [Function],
     getCssValue: [Function],
     getAttribute: [Function],
     getText: [Function],
     getSize: [Function],
     getLocation: [Function],
     isEnabled: [Function],
     isSelected: [Function],
     submit: [Function],
     clear: [Function],
     isDisplayed: [Function],
     getOuterHtml: [Function],
     getInnerHtml: [Function],
     getId: [Function] },
  click: [Function],
  sendKeys: [Function],
  getTagName: [Function],
  getCssValue: [Function],
  getAttribute: [Function],
  getText: [Function],
  getSize: [Function],
  getLocation: [Function],
  isEnabled: [Function],
  isSelected: [Function],
  submit: [Function],
  clear: [Function],
  isDisplayed: [Function],
  getOuterHtml: [Function],
  getInnerHtml: [Function],
  getId: [Function] }
Toggle Log******** { parentElementArrayFinder: 
   { getWebElements: [Function],
     actionResults_: undefined,
     locator_: { using: 'css selector', value: '.dropdown-toggle' },
     click: [Function],
     sendKeys: [Function],
     getTagName: [Function],
     getCssValue: [Function],
     getAttribute: [Function],
     getText: [Function],
     getSize: [Function],
     getLocation: [Function],
     isEnabled: [Function],
     isSelected: [Function],
     submit: [Function],
     clear: [Function],
     isDisplayed: [Function],
     getOuterHtml: [Function],
     getInnerHtml: [Function],
     getId: [Function] },
  elementArrayFinder_: 
   { getWebElements: [Function],
     actionResults_: undefined,
     locator_: { using: 'css selector', value: '.dropdown-toggle' },
     click: [Function],
     sendKeys: [Function],
     getTagName: [Function],
     getCssValue: [Function],
     getAttribute: [Function],
     getText: [Function],
     getSize: [Function],
     getLocation: [Function],
     isEnabled: [Function],
     isSelected: [Function],
     submit: [Function],
     clear: [Function],
     isDisplayed: [Function],
     getOuterHtml: [Function],
     getInnerHtml: [Function],
     getId: [Function] },
  click: [Function],
  sendKeys: [Function],
  getTagName: [Function],
  getCssValue: [Function],
  getAttribute: [Function],
  getText: [Function],
  getSize: [Function],
  getLocation: [Function],
  isEnabled: [Function],
  isSelected: [Function],
  submit: [Function],
  clear: [Function],
  isDisplayed: [Function],
  getOuterHtml: [Function],
  getInnerHtml: [Function],
  getId: [Function] }
List log***** { getWebElements: [Function],
  actionResults_: undefined,
  locator_: { using: 'css selector', value: '.dropdown-menu li' },
  click: [Function],
  sendKeys: [Function],
  getTagName: [Function],
  getCssValue: [Function],
  getAttribute: [Function],
  getText: [Function],
  getSize: [Function],
  getLocation: [Function],
  isEnabled: [Function],
  isSelected: [Function],
  submit: [Function],
  clear: [Function],
  isDisplayed: [Function],
  getOuterHtml: [Function],
  getInnerHtml: [Function],
  getId: [Function] }
Test log***** { parentElementArrayFinder: 
   { getWebElements: [Function],
     actionResults_: undefined,
     locator_: { using: 'css selector', value: '.dropdown-menu li' },
     click: [Function],
     sendKeys: [Function],
     getTagName: [Function],
     getCssValue: [Function],
     getAttribute: [Function],
     getText: [Function],
     getSize: [Function],
     getLocation: [Function],
     isEnabled: [Function],
     isSelected: [Function],
     submit: [Function],
     clear: [Function],
     isDisplayed: [Function],
     getOuterHtml: [Function],
     getInnerHtml: [Function],
     getId: [Function] },
  elementArrayFinder_: 
   { getWebElements: [Function],
     actionResults_: undefined,
     locator_: { using: 'css selector', value: '.dropdown-menu li' },
     click: [Function],
     sendKeys: [Function],
     getTagName: [Function],
     getCssValue: [Function],
     getAttribute: [Function],
     getText: [Function],
     getSize: [Function],
     getLocation: [Function],
     isEnabled: [Function],
     isSelected: [Function],
     submit: [Function],
     clear: [Function],
     isDisplayed: [Function],
     getOuterHtml: [Function],
     getInnerHtml: [Function],
     getId: [Function] },
  click: [Function],
  sendKeys: [Function],
  getTagName: [Function],
  getCssValue: [Function],
  getAttribute: [Function],
  getText: [Function],
  getSize: [Function],
  getLocation: [Function],
  isEnabled: [Function],
  isSelected: [Function],
  submit: [Function],
  clear: [Function],
  isDisplayed: [Function],
  getOuterHtml: [Function],
  getInnerHtml: [Function],
  getId: [Function] }
4

2 に答える 2

0

Angular のテストは困難です。自分に落ち込まないでください。:)

次の 2 つのことを試してください。

  1. CSS セレクターをより具体的にします。を追加して、必要な正確な要素を #idTagクリックしていることを確認します。element(by.id('idTag')).click();

  2. アサーションを書きます。あなたのテストは何もテストしていません。メニュー項目をクリックするだけです。クリックするとどうなりますか?たとえば、新しい要素を画面に表示する必要がありますか? expect(element(by.id('newPatient')).isPresent()).toBe(true);

于 2014-12-16T05:41:41.970 に答える