mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[8.11] [Security Solution][Endpoint][Cypress] Update endpoint cypress config to include videos (#170499) (#170841)
# Backport This will backport the following commits from `main` to `8.11`: - [[Security Solution][Endpoint][Cypress] Update endpoint cypress config to include videos (#170499)](https://github.com/elastic/kibana/pull/170499) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Ash","email":"1849116+ashokaditya@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-11-06T16:04:42Z","message":"[Security Solution][Endpoint][Cypress] Update endpoint cypress config to include videos (#170499)\n\n## Summary\r\n\r\nAdds videos to failed cypress tests for debugging.","sha":"1c2521705a1ece1ebe87740a4c99c27b254630f9","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Defend Workflows","OLM Sprint","v8.11.0","v8.12.0"],"number":170499,"url":"https://github.com/elastic/kibana/pull/170499","mergeCommit":{"message":"[Security Solution][Endpoint][Cypress] Update endpoint cypress config to include videos (#170499)\n\n## Summary\r\n\r\nAdds videos to failed cypress tests for debugging.","sha":"1c2521705a1ece1ebe87740a4c99c27b254630f9"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/170499","number":170499,"mergeCommit":{"message":"[Security Solution][Endpoint][Cypress] Update endpoint cypress config to include videos (#170499)\n\n## Summary\r\n\r\nAdds videos to failed cypress tests for debugging.","sha":"1c2521705a1ece1ebe87740a4c99c27b254630f9"}}]}] BACKPORT--> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
9522ef2414
commit
fab4c97b47
3 changed files with 32 additions and 1 deletions
|
@ -14,6 +14,7 @@ if [[ "$IS_TEST_EXECUTION_STEP" == "true" ]]; then
|
|||
buildkite-agent artifact upload 'target/kibana-coverage/functional/**/*'
|
||||
buildkite-agent artifact upload 'target/kibana-*'
|
||||
buildkite-agent artifact upload 'target/kibana-security-solution/**/*.png'
|
||||
buildkite-agent artifact upload 'target/kibana-security-solution/**/management/**/*.mp4'
|
||||
buildkite-agent artifact upload 'target/kibana-osquery/**/*.png'
|
||||
buildkite-agent artifact upload 'target/kibana-osquery/**/*.mp4'
|
||||
buildkite-agent artifact upload 'target/kibana-fleet/**/*.png'
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
import { merge } from 'lodash';
|
||||
import { getVideosForFailedSpecs } from './support/filter_videos';
|
||||
import { dataLoaders, dataLoadersForRealEndpoints } from './support/data_loaders';
|
||||
import { responseActionTasks } from './support/response_actions';
|
||||
|
||||
|
@ -31,7 +32,9 @@ export const getCypressBaseConfig = (
|
|||
screenshotsFolder:
|
||||
'../../../target/kibana-security-solution/public/management/cypress/screenshots',
|
||||
trashAssetsBeforeRuns: false,
|
||||
video: false,
|
||||
video: true,
|
||||
videoCompression: 15,
|
||||
videosFolder: '../../../target/kibana-security-solution/public/management/cypress/videos',
|
||||
viewportHeight: 900,
|
||||
viewportWidth: 1440,
|
||||
experimentalStudio: true,
|
||||
|
@ -71,6 +74,10 @@ export const getCypressBaseConfig = (
|
|||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
require('@cypress/grep/src/plugin')(config);
|
||||
|
||||
on('after:spec', (_, results) => {
|
||||
getVideosForFailedSpecs(results);
|
||||
});
|
||||
|
||||
return config;
|
||||
},
|
||||
},
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue