如何在angular2中的e2e量角器测试用例中记录消息

时间:2016-11-01 12:20:51

标签: javascript angular typescript protractor e2e-testing

我想在我的量角器e2e测试用例中使用console.log()来获得angular2。

import { HomePage } from './home.page.ts';
describe('App', () => {
  let homePage;
  beforeEach(() => {
    homePage = new HomePage();
    browser.get('/#/home');
  });

  it('should find the nested class using a page', () => {
    let addElem = element(by.css('.add-btn'));
    console.log(addElem);  // I tried this, but it doesnt work .I am expecting this can be logged in console 
  })
})

任何输入? 感谢。

1 个答案:

答案 0 :(得分:1)

方法console.log是同步执行的,所以你需要在控制流程中推送它:

function log(arg) {
  browser.call(function() {
    console.log(arg);
  });
}
let addElem = element(by.css('.add-btn'));
log(addElem);