selenium: Explicitly make screenshots for passing and failing tests
There is code in wdio.conf.js to only take screenshots of failed tests. For a while now, `test.passed` is returning `undefined`, so screenshots are taken for both passing and failing tests. The change probably happened when we upgraded webdriverio to v5 or v6, but nobody noticed it. I actually like the current behavior. We take videos for both passing and failing tests, so it makes sense to take screenshots too. Both screenshots and videos are small files. (The biggest screenshot is 539 KB, the biggest video is 21 KB.) Bug: T280355 Change-Id: I8a73afcda19d6dc1cad75256835448488aff37d5
This commit is contained in:
parent
c6a8b0c033
commit
2320f00eef
1 changed files with 5 additions and 10 deletions
|
|
@ -103,16 +103,11 @@ exports.config = {
|
|||
timeout: 60 * 1000
|
||||
},
|
||||
|
||||
/**
|
||||
* Executed after a Mocha test ends.
|
||||
*
|
||||
* @param {Object} test Mocha Test object
|
||||
*/
|
||||
afterTest: function ( test ) {
|
||||
// if test passed, ignore, else take and save screenshot
|
||||
if ( test.passed ) {
|
||||
return;
|
||||
}
|
||||
// =====
|
||||
// Hooks
|
||||
// =====
|
||||
// Executed after a Mocha test ends.
|
||||
afterTest: function () {
|
||||
// save screenshot
|
||||
const screenshotfile = filePath( test, logPath, 'png' );
|
||||
browser.saveScreenshot( screenshotfile );
|
||||
|
|
|
|||
Loading…
Reference in a new issue