view console.log output in angular protractor jasmine test

后端 未结 7 1840
忘掉有多难
忘掉有多难 2020-12-24 05:12

How can I view console.log output in an angularjs protractor jasmine test? As of now, the browser closes by itself too quickly.

more info - I am working with the ang

7条回答
  •  北荒
    北荒 (楼主)
    2020-12-24 06:07

    You could always just override console.log in your test :)

    logMessages = [];
    
    console.log = function(message) {
        logMessages.push(message);
    }
    

    You could also use $log instead of console.log and use a solution like this to put some hooks into the log messages: https://gist.github.com/lrvick/6938531

提交回复
热议问题