-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution][Endpoint][Cypress] Update endpoint cypress config…
… to include videos (#170499) ## Summary Adds videos to failed cypress tests for debugging.
- Loading branch information
1 parent
3bf58b0
commit 1c25217
Showing
3 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
x-pack/plugins/security_solution/public/management/cypress/support/filter_videos.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
// eslint-disable-next-line import/no-nodejs-modules | ||
import fs from 'fs'; | ||
|
||
// makes sure we save videos just for failed specs | ||
export const getVideosForFailedSpecs = (results: CypressCommandLine.RunResult) => { | ||
if (results && results.video) { | ||
// Do we have failures for any retry attempts? | ||
const failures = results.tests.some((test) => | ||
test.attempts.some((attempt) => attempt.state === 'failed') | ||
); | ||
if (!failures) { | ||
// delete the video if the spec passed and no tests retried | ||
fs.unlinkSync(results.video); | ||
} | ||
} | ||
}; |