diff --git a/.buildkite/pipelines/pull_request/security_solution.yml b/.buildkite/pipelines/pull_request/security_solution.yml index 7e06d4f48c9ea..112d4287f2a42 100644 --- a/.buildkite/pipelines/pull_request/security_solution.yml +++ b/.buildkite/pipelines/pull_request/security_solution.yml @@ -5,7 +5,31 @@ steps: queue: n2-4-spot depends_on: build timeout_in_minutes: 60 - parallelism: 10 + parallelism: 16 + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/functional/security_solution_explore.sh + label: 'Explore - Security Solution Cypress Tests' + agents: + queue: n2-4-spot + depends_on: build + timeout_in_minutes: 60 + parallelism: 4 + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/functional/security_solution_investigations.sh + label: 'Investigations - Security Solution Cypress Tests' + agents: + queue: n2-4-spot + depends_on: build + timeout_in_minutes: 60 + parallelism: 8 retry: automatic: - exit_status: '*' @@ -18,8 +42,8 @@ steps: agents: queue: n2-4-spot depends_on: build - timeout_in_minutes: 120 + timeout_in_minutes: 60 parallelism: 1 soft_fail: true artifact_paths: - - "target/kibana-security-solution/**/*" \ No newline at end of file + - "target/kibana-security-solution/**/*" diff --git a/package.json b/package.json index d70dd5aac1ba2..840f2918c6d67 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "yarn": "^1.22.19" }, "resolutions": { - "**/@types/node": "18.17.1", + "**/@types/node": "18.17.5", "**/@typescript-eslint/utils": "5.62.0", "**/chokidar": "^3.5.3", "**/globule/minimatch": "^3.1.2", @@ -1316,7 +1316,7 @@ "@types/multistream": "^4.1.0", "@types/mustache": "^0.8.31", "@types/nock": "^10.0.3", - "@types/node": "18.17.1", + "@types/node": "18.17.5", "@types/node-fetch": "2.6.4", "@types/node-forge": "^1.3.1", "@types/nodemailer": "^6.4.0", @@ -1415,13 +1415,13 @@ "cssnano": "^5.1.12", "cssnano-preset-default": "^5.2.12", "csstype": "^3.0.2", - "cypress": "^12.17.4", - "cypress-axe": "^1.4.0", + "cypress": "^13.3.0", + "cypress-axe": "^1.5.0", "cypress-file-upload": "^5.0.8", "cypress-multi-reporters": "^1.6.3", "cypress-react-selector": "^3.0.0", - "cypress-real-events": "^1.8.1", - "cypress-recurse": "^1.35.1", + "cypress-real-events": "^1.10.3", + "cypress-recurse": "^1.35.2", "date-fns": "^2.29.3", "debug": "^2.6.9", "delete-empty": "^2.0.0", diff --git a/renovate.json b/renovate.json index fb8995b2d1b4b..9649d1aa584a3 100644 --- a/renovate.json +++ b/renovate.json @@ -256,11 +256,8 @@ }, { "groupName": "cypress", - "matchPackageNames": [ - "eslint-plugin-cypress" - ], "matchPackagePatterns": [ - "^cypress" + "cypress" ], "reviewers": [ "Team:apm", diff --git a/x-pack/plugins/apm/ftr_e2e/cypress.config.ts b/x-pack/plugins/apm/ftr_e2e/cypress.config.ts index 16a0e8effb28a..feb0a630043d4 100644 --- a/x-pack/plugins/apm/ftr_e2e/cypress.config.ts +++ b/x-pack/plugins/apm/ftr_e2e/cypress.config.ts @@ -22,7 +22,6 @@ export default defineCypressConfig({ viewportHeight: 1800, viewportWidth: 1440, video: true, - videoUploadOnPasses: false, screenshotOnRunFailure: true, retries: { runMode: 1, diff --git a/x-pack/plugins/apm/ftr_e2e/cypress_test_runner.ts b/x-pack/plugins/apm/ftr_e2e/cypress_test_runner.ts index 9bb705088735c..ffcbd47a8d588 100644 --- a/x-pack/plugins/apm/ftr_e2e/cypress_test_runner.ts +++ b/x-pack/plugins/apm/ftr_e2e/cypress_test_runner.ts @@ -64,7 +64,7 @@ export async function cypressTestRunner({ getService }: FtrProviderContext) { const res = await cypressExecution({ ...cypressCliArgs, project: cypressProjectPath, - browser: 'chrome', + browser: 'electron', config: { e2e: { baseUrl: kibanaUrlWithoutAuth, diff --git a/x-pack/plugins/apm/ftr_e2e/ftr_config.ts b/x-pack/plugins/apm/ftr_e2e/ftr_config.ts index 8a58424ff375e..47e5878e365a9 100644 --- a/x-pack/plugins/apm/ftr_e2e/ftr_config.ts +++ b/x-pack/plugins/apm/ftr_e2e/ftr_config.ts @@ -46,7 +46,12 @@ async function ftrConfig({ readConfigFile }: FtrConfigProviderContext) { const result = await cypressTestRunner(ftrProviderContext); // set exit code explicitly if at least one Cypress test fails - if (result && (result.status === 'failed' || result.totalFailed > 0)) { + if ( + result && + ((result as CypressCommandLine.CypressFailedRunResult)?.status === + 'failed' || + (result as CypressCommandLine.CypressRunResult)?.totalFailed) + ) { process.exitCode = 1; } }, diff --git a/x-pack/plugins/observability_onboarding/e2e/cypress.config.ts b/x-pack/plugins/observability_onboarding/e2e/cypress.config.ts index 93a2a543528c3..afbad0bac67d0 100644 --- a/x-pack/plugins/observability_onboarding/e2e/cypress.config.ts +++ b/x-pack/plugins/observability_onboarding/e2e/cypress.config.ts @@ -20,7 +20,6 @@ export default defineCypressConfig({ viewportHeight: 1800, viewportWidth: 1440, video: false, - videoUploadOnPasses: false, screenshotOnRunFailure: false, retries: { runMode: 1, diff --git a/x-pack/plugins/observability_onboarding/e2e/ftr_config_runner.ts b/x-pack/plugins/observability_onboarding/e2e/ftr_config_runner.ts index 9ce0abaeed231..549350df96189 100644 --- a/x-pack/plugins/observability_onboarding/e2e/ftr_config_runner.ts +++ b/x-pack/plugins/observability_onboarding/e2e/ftr_config_runner.ts @@ -25,7 +25,12 @@ async function testRunner(ftrProviderContext: FtrProviderContext) { cypressExecution: cypress.run, }); - if (result && (result.status === 'failed' || result.totalFailed > 0)) { + if ( + result && + ((result as CypressCommandLine.CypressFailedRunResult)?.status === + 'failed' || + (result as CypressCommandLine.CypressRunResult)?.totalFailed) + ) { process.exit(1); } } diff --git a/x-pack/plugins/profiling/e2e/cypress.config.ts b/x-pack/plugins/profiling/e2e/cypress.config.ts index 93a2a543528c3..afbad0bac67d0 100644 --- a/x-pack/plugins/profiling/e2e/cypress.config.ts +++ b/x-pack/plugins/profiling/e2e/cypress.config.ts @@ -20,7 +20,6 @@ export default defineCypressConfig({ viewportHeight: 1800, viewportWidth: 1440, video: false, - videoUploadOnPasses: false, screenshotOnRunFailure: false, retries: { runMode: 1, diff --git a/x-pack/plugins/profiling/e2e/ftr_config_runner.ts b/x-pack/plugins/profiling/e2e/ftr_config_runner.ts index 2b0bf611ceda5..a6af6d0ce1a82 100644 --- a/x-pack/plugins/profiling/e2e/ftr_config_runner.ts +++ b/x-pack/plugins/profiling/e2e/ftr_config_runner.ts @@ -22,8 +22,12 @@ async function ftrConfigRun({ readConfigFile }: FtrConfigProviderContext) { async function testRunner(ftrProviderContext: FtrProviderContext) { const result = await cypressTestRunner({ ftrProviderContext, cypressExecution: cypress.run }); - if (result && (result.status === 'failed' || result.totalFailed > 0)) { - process.exit(1); + if ( + result && + ((result as CypressCommandLine.CypressFailedRunResult)?.status === 'failed' || + (result as CypressCommandLine.CypressRunResult)?.totalFailed) + ) { + process.exitCode = 1; } } diff --git a/x-pack/plugins/security_solution/scripts/run_cypress/parallel.ts b/x-pack/plugins/security_solution/scripts/run_cypress/parallel.ts index 3617c8f467873..51dbf24531803 100644 --- a/x-pack/plugins/security_solution/scripts/run_cypress/parallel.ts +++ b/x-pack/plugins/security_solution/scripts/run_cypress/parallel.ts @@ -485,7 +485,9 @@ ${JSON.stringify(cyCustomEnv, null, 2)} renderSummaryTable(results as CypressCommandLine.CypressRunResult[]); const hasFailedTests = _.some( results, - (result) => result?.status === 'finished' && result.totalFailed > 0 + (result) => + (result as CypressCommandLine.CypressFailedRunResult)?.status === 'failed' || + (result as CypressCommandLine.CypressRunResult)?.totalFailed ); if (hasFailedTests) { throw createFailError('Not all tests passed'); diff --git a/x-pack/plugins/security_solution/scripts/run_cypress/print_run.ts b/x-pack/plugins/security_solution/scripts/run_cypress/print_run.ts index 2985f6c1ca577..b95eabb5fd65d 100644 --- a/x-pack/plugins/security_solution/scripts/run_cypress/print_run.ts +++ b/x-pack/plugins/security_solution/scripts/run_cypress/print_run.ts @@ -278,7 +278,6 @@ export function renderSummaryTable(results: CypressCommandLine.CypressRunResult[ const parsedResults = _.reduce( results, (acc: CypressCommandLine.CypressRunResult, result) => { - acc.status = result.status; acc.startedTestsAt = acc.startedTestsAt && new Date(result.startedTestsAt) > new Date(acc.startedTestsAt) ? acc.startedTestsAt @@ -358,12 +357,8 @@ export function renderSummaryTable(results: CypressCommandLine.CypressRunResult[ _.each(runs, (run) => { const { spec, stats } = run; - const ms = durationInMinutes(stats.duration); - const formattedSpec = formatPath(spec.relativeToCommonRoot, getWidth(table2, 1)); - - if (run.skippedSpec) { - return table2.push(['-', formattedSpec, color('SKIPPED', 'gray'), '-', '-', '-', '-', '-']); - } + const ms = durationInMinutes(stats?.duration ?? 0); + const formattedSpec = formatPath(spec.relative, getWidth(table2, 1)); return table2.push([ formatSymbolSummary(stats.failures), diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/detection_page_filters.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/detection_page_filters.cy.ts index f3806d8f070fb..c00865b7a8587 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/detection_page_filters.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/alerts/detection_page_filters.cy.ts @@ -262,21 +262,19 @@ describe(`Detections : Page Filters`, { tags: [tag.ESS, tag.BROKEN_IN_SERVERLESS }); it(`URL is updated when filters are updated`, () => { - cy.on('url:changed', (urlString) => { - const NEW_FILTERS = DEFAULT_DETECTION_PAGE_FILTERS.map((filter) => { - return { - ...filter, - selectedOptions: filter.title === 'Severity' ? ['high'] : filter.selectedOptions, - }; - }); - const expectedVal = encode(formatPageFilterSearchParam(NEW_FILTERS)); - expect(urlString).to.contain.text(expectedVal); - }); - openPageFilterPopover(1); cy.get(OPTION_SELECTABLE(1, 'high')).should('be.visible'); cy.get(OPTION_SELECTABLE(1, 'high')).click({}); closePageFilterPopover(1); + + const NEW_FILTERS = DEFAULT_DETECTION_PAGE_FILTERS.map((filter) => { + return { + ...filter, + selectedOptions: filter.title === 'Severity' ? ['high'] : filter.selectedOptions, + }; + }); + const expectedVal = encode(formatPageFilterSearchParam(NEW_FILTERS)); + cy.url().should('include', expectedVal); }); it(`Filters are restored from localstorage when user navigates back to the page.`, () => { diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/open_timeline.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/open_timeline.cy.ts index bc09f0318cc83..732ad3306d970 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/open_timeline.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/open_timeline.cy.ts @@ -70,35 +70,14 @@ describe('Open timeline', { tags: [tag.BROKEN_IN_SERVERLESS, tag.ESS] }, () => { openTimelineById(this.timelineId); }); - it('should open a modal', () => { + it('should display timeline info', () => { cy.get(OPEN_TIMELINE_MODAL).should('be.visible'); - }); - - it('should display timeline info - title', () => { cy.contains(getTimeline().title).should('exist'); - }); - - it('should display timeline info - description', () => { cy.get(TIMELINES_DESCRIPTION).last().should('have.text', getTimeline().description); - }); - - it('should display timeline info - pinned event count', () => { cy.get(TIMELINES_PINNED_EVENT_COUNT).last().should('have.text', '1'); - }); - - it('should display timeline info - notes count', () => { cy.get(TIMELINES_NOTES_COUNT).last().should('have.text', '1'); - }); - - it('should display timeline info - favorite timeline', () => { cy.get(TIMELINES_FAVORITE).last().should('exist'); - }); - - it('should display timeline content - title', () => { cy.get(TIMELINE_TITLE).should('have.text', getTimeline().title); - }); - - it('should display timeline content - description', () => { cy.get(TIMELINE_DESCRIPTION).should('have.text', getTimeline().description); }); }); diff --git a/x-pack/test_serverless/functional/test_suites/observability/cypress/cypress.config.ts b/x-pack/test_serverless/functional/test_suites/observability/cypress/cypress.config.ts index f078275aab2eb..8e4866a1fd079 100644 --- a/x-pack/test_serverless/functional/test_suites/observability/cypress/cypress.config.ts +++ b/x-pack/test_serverless/functional/test_suites/observability/cypress/cypress.config.ts @@ -20,7 +20,6 @@ export default defineCypressConfig({ viewportHeight: 1800, viewportWidth: 1440, video: false, - videoUploadOnPasses: false, screenshotOnRunFailure: false, retries: { runMode: 1, diff --git a/yarn.lock b/yarn.lock index ec64a7f01b794..3e9d3535f7a6c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1360,10 +1360,10 @@ find-test-names "^1.19.0" globby "^11.0.4" -"@cypress/request@2.88.12": - version "2.88.12" - resolved "https://registry.yarnpkg.com/@cypress/request/-/request-2.88.12.tgz#ba4911431738494a85e93fb04498cb38bc55d590" - integrity sha512-tOn+0mDZxASFM+cuAP9szGUGPI1HwWVSvdzm7V4cCsPdFTx6qMj29CwaQmRAMIEhORIUBFBsYROYJcveK4uOjA== +"@cypress/request@^3.0.0": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@cypress/request/-/request-3.0.1.tgz#72d7d5425236a2413bd3d8bb66d02d9dc3168960" + integrity sha512-TWivJlJi8ZDx2wGOw1dbLuHJKUYX7bWySw377nlnGOW3hP9/MUKIsEdXT/YngWxVdgNCHRBmFlBipE+5/2ZZlQ== dependencies: aws-sign2 "~0.7.0" aws4 "^1.8.0" @@ -1378,7 +1378,7 @@ json-stringify-safe "~5.0.1" mime-types "~2.1.19" performance-now "^2.1.0" - qs "~6.10.3" + qs "6.10.4" safe-buffer "^5.1.2" tough-cookie "^4.1.3" tunnel-agent "^0.6.0" @@ -9282,10 +9282,10 @@ dependencies: "@types/node" "*" -"@types/node@*", "@types/node@18.17.1", "@types/node@>= 8", "@types/node@>=12.12.47", "@types/node@>=13.7.0", "@types/node@>=8.9.0", "@types/node@^10.1.0", "@types/node@^14.0.10 || ^16.0.0", "@types/node@^14.14.20 || ^16.0.0", "@types/node@^16.18.39": - version "18.17.1" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.17.1.tgz#84c32903bf3a09f7878c391d31ff08f6fe7d8335" - integrity sha512-xlR1jahfizdplZYRU59JlUx9uzF1ARa8jbhM11ccpCJya8kvos5jwdm2ZAgxSCwOl0fq21svP18EVwPBXMQudw== +"@types/node@*", "@types/node@18.17.5", "@types/node@>= 8", "@types/node@>=12.12.47", "@types/node@>=13.7.0", "@types/node@>=8.9.0", "@types/node@^10.1.0", "@types/node@^14.0.10 || ^16.0.0", "@types/node@^14.14.20 || ^16.0.0", "@types/node@^18.17.5": + version "18.17.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.17.5.tgz#c58b12bca8c2a437b38c15270615627e96dd0bc5" + integrity sha512-xNbS75FxH6P4UXTPUJp/zNPq6/xsfdJKussCWNOnz4aULWIRwMgP1LgaB5RiBnMX1DPCYenuqGZfnIAx5mbFLA== "@types/nodemailer@^6.4.0": version "6.4.0" @@ -13664,10 +13664,10 @@ cyclist@~0.2.2: resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640" integrity sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA= -cypress-axe@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/cypress-axe/-/cypress-axe-1.4.0.tgz#e67482bfe9e740796bf77c7823f19781a8a2faff" - integrity sha512-Ut7NKfzjyKm0BEbt2WxuKtLkIXmx6FD2j0RwdvO/Ykl7GmB/qRQkwbKLk3VP35+83hiIr8GKD04PDdrTK5BnyA== +cypress-axe@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/cypress-axe/-/cypress-axe-1.5.0.tgz#95082734583da77b51ce9b7784e14a442016c7a1" + integrity sha512-Hy/owCjfj+25KMsecvDgo4fC/781ccL+e8p+UUYoadGVM2ogZF9XIKbiM6KI8Y3cEaSreymdD6ZzccbI2bY0lQ== cypress-file-upload@^5.0.8: version "5.0.8" @@ -13689,26 +13689,26 @@ cypress-react-selector@^3.0.0: dependencies: resq "1.10.2" -cypress-real-events@^1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/cypress-real-events/-/cypress-real-events-1.8.1.tgz#d00c7fe93124bbe7c0f27296684838614d24a840" - integrity sha512-8fFnA8EzS3EVbAmpSEUf3A8yZCmfU3IPOSGUDVFCdE1ke1gYL1A+gvXXV6HKUbTPRuvKKt2vpaMbUwYLpDRswQ== +cypress-real-events@^1.10.3: + version "1.10.3" + resolved "https://registry.yarnpkg.com/cypress-real-events/-/cypress-real-events-1.10.3.tgz#e2e949ea509cc4306df6c238de1a9982d67360e5" + integrity sha512-YN3fn+CJIAM638sE6uMvv2/n3PsWowdd0rOiN6ZoyezNAMyENfuQHvccLKZpN+apGfQZYetCml6QXLYgDid2fg== -cypress-recurse@^1.35.1: - version "1.35.1" - resolved "https://registry.yarnpkg.com/cypress-recurse/-/cypress-recurse-1.35.1.tgz#eb737be69231bb38579604f83a17e6e041245b0f" - integrity sha512-NuWKlHJreSbzOmMj1OM/VZgQ+odX22VMeIAKeWQFYflY5+OJCnXMltjOubs725+psB3nQnsgH7122MlGmx60ng== +cypress-recurse@^1.35.2: + version "1.35.2" + resolved "https://registry.yarnpkg.com/cypress-recurse/-/cypress-recurse-1.35.2.tgz#3f49db173beb117196cad82c5484e638e2dc3478" + integrity sha512-G6HfxP90xa7phw8oeOX4uabxcI9gE1ktkKHShcA3nCByrkMLs56+GIJVn0A+ws1tI0PGRKBz6+V9DHS5WnZX4A== dependencies: humanize-duration "^3.27.3" -cypress@^12.17.4: - version "12.17.4" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-12.17.4.tgz#b4dadf41673058493fa0d2362faa3da1f6ae2e6c" - integrity sha512-gAN8Pmns9MA5eCDFSDJXWKUpaL3IDd89N9TtIupjYnzLSmlpVr+ZR+vb4U/qaMp+lB6tBvAmt7504c3Z4RU5KQ== +cypress@^13.3.0: + version "13.3.0" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-13.3.0.tgz#d00104661b337d662c5a4280a051ee59f8aa1e31" + integrity sha512-mpI8qcTwLGiA4zEQvTC/U1xGUezVV4V8HQCOYjlEOrVmU1etVvxOjkCXHGwrlYdZU/EPmUiWfsO3yt1o+Q2bgw== dependencies: - "@cypress/request" "2.88.12" + "@cypress/request" "^3.0.0" "@cypress/xvfb" "^1.2.4" - "@types/node" "^16.18.39" + "@types/node" "^18.17.5" "@types/sinonjs__fake-timers" "8.1.1" "@types/sizzle" "^2.3.2" arch "^2.2.0" @@ -24615,6 +24615,13 @@ q@^1.5.1: resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" integrity sha1-fjL3W0E4EpHQRhHxvxQQmsAGUdc= +qs@6.10.4: + version "6.10.4" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.10.4.tgz#6a3003755add91c0ec9eacdc5f878b034e73f9e7" + integrity sha512-OQiU+C+Ds5qiH91qh/mg0w+8nwQuLjM4F4M/PbmhDOoYehPh+Fb0bDjtR1sOvy7YKxvj28Y/M0PhP5uVX0kB+g== + dependencies: + side-channel "^1.0.4" + qs@6.9.7: version "6.9.7" resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.7.tgz#4610846871485e1e048f44ae3b94033f0e675afe" @@ -24634,13 +24641,6 @@ qs@^6.11.0: dependencies: side-channel "^1.0.4" -qs@~6.10.3: - version "6.10.5" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.10.5.tgz#974715920a80ff6a262264acd2c7e6c2a53282b4" - integrity sha512-O5RlPh0VFtR78y79rgcgKK4wbAI0C5zGVLztOIdpWX6ep368q5Hv6XRxDvXuZ9q3C6v+e3n8UfZZJw7IIG27eQ== - dependencies: - side-channel "^1.0.4" - query-string@^6.13.2: version "6.13.2" resolved "https://registry.yarnpkg.com/query-string/-/query-string-6.13.2.tgz#3585aa9412c957cbd358fd5eaca7466f05586dda"