Huzzah!
Jasmine定製記者
您將需要創建一個自定義Jasmine記者。將下面的代碼片段放入onPrepare鉤子的Protractor配置文件中。我試過以下,它的工作原理:
這是我的規格:
import {browser} from 'protractor';
describe('our first Protractor test',() => {
it('should load a page and verify the url',() => {
browser.get('https://angularjs.org/');
expect(browser.getCurrentUrl()).toEqual('https://angularjs.org/');
});
});
這
onPrepare:() => {
myReporter = {
suiteStarted: function(result) {
console.log('Suite started: ' + result.description);
},
specStarted: function(result) {
console.log('Spec started: ' + result.description);
}
};
jasmine.getEnv().addReporter(myReporter);
}
您可以在Jasmine docs site
例閱讀更多關於定製記者是我的主機輸出:
[18:37:52] I/launcher - Running 1 instances of WebDriver
[18:37:52] I/direct - Using ChromeDriver directly...
Started
Suite started: our first Protractor test
Spec started: should load a page and verify the url
.
1 spec, 0 failures
Finished in 2.541 seconds
你能提供你的電流輸出是什麼樣子的例子,你想* *它看起來像? – tehbeardedone
在任何情況下,我認爲這個包可能是你正在尋找的包https://www.npmjs.com/package/jasmine-reporters – tehbeardedone