2014-03-25 34 views
1

我正在使用selenium-webdriver.js寫摩卡測試,並且只在當前測試失敗的情況下嘗試截屏。在selenium-webdriver.js測試中獲取測試標題和狀態

在摩卡,我能得到這樣的標題和狀態目前的測試信息如下:各地摩卡界面

afterEach(function(){ 
    console.log('afterEach', this.currentTest.title, this.currentTest.state); 
}); 

但硒webdriver.js包裝與硒的webdriver /測試,和原來這一點。 currentTest不再暴露:

var test = require('selenium-webdriver/testing'); 
test.afterEach(function(){ 
    //console.log('afterEach', this.currentTest.title, this.currentTest.state); 
}); 

我想知道這樣的信息是否仍然暴露在某種程度上或有任何解決方法。

+0

這仍然不適合你嗎?我可以在this.currentTest.state上過濾得很好,這可能是在你問這個問題之後實現的,也許吧? – Rubicon

回答

1
this.title - returns suite name 
this.ctx.currentTest.title - returns current test name 
this.ctx.currentTest.state - returns current test state 

如果使用箭頭函數進行「描述」,則不起作用。