From a16930fc5b022a5c93912be7faf343b203598f3a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 May 2023 05:40:21 -0700 Subject: [PATCH] Update cypress (main) (#152647) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [cypress](https://togithub.com/cypress-io/cypress) | [`^12.6.0` -> `^12.10.0`](https://renovatebot.com/diffs/npm/cypress/12.6.0/12.10.0) | [![age](https://badges.renovateapi.com/packages/npm/cypress/12.10.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/cypress/12.10.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/cypress/12.10.0/compatibility-slim/12.6.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/cypress/12.10.0/confidence-slim/12.6.0)](https://docs.renovatebot.com/merge-confidence/) | | [cypress-axe](https://togithub.com/component-driven/cypress-axe) | [`^1.3.0` -> `^1.4.0`](https://renovatebot.com/diffs/npm/cypress-axe/1.3.0/1.4.0) | [![age](https://badges.renovateapi.com/packages/npm/cypress-axe/1.4.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/cypress-axe/1.4.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/cypress-axe/1.4.0/compatibility-slim/1.3.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/cypress-axe/1.4.0/confidence-slim/1.3.0)](https://docs.renovatebot.com/merge-confidence/) | | [cypress-multi-reporters](https://togithub.com/you54f/cypress-multi-reporters) | [`^1.6.2` -> `^1.6.3`](https://renovatebot.com/diffs/npm/cypress-multi-reporters/1.6.2/1.6.3) | [![age](https://badges.renovateapi.com/packages/npm/cypress-multi-reporters/1.6.3/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/cypress-multi-reporters/1.6.3/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/cypress-multi-reporters/1.6.3/compatibility-slim/1.6.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/cypress-multi-reporters/1.6.3/confidence-slim/1.6.2)](https://docs.renovatebot.com/merge-confidence/) | | [cypress-recurse](https://togithub.com/bahmutov/cypress-recurse) | [`^1.27.0` -> `^1.31.2`](https://renovatebot.com/diffs/npm/cypress-recurse/1.27.0/1.31.2) | [![age](https://badges.renovateapi.com/packages/npm/cypress-recurse/1.31.2/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/cypress-recurse/1.31.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/cypress-recurse/1.31.2/compatibility-slim/1.27.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/cypress-recurse/1.31.2/confidence-slim/1.27.0)](https://docs.renovatebot.com/merge-confidence/) | | [eslint-plugin-cypress](https://togithub.com/cypress-io/eslint-plugin-cypress) | [`^2.12.1` -> `^2.13.2`](https://renovatebot.com/diffs/npm/eslint-plugin-cypress/2.12.1/2.13.2) | [![age](https://badges.renovateapi.com/packages/npm/eslint-plugin-cypress/2.13.2/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/eslint-plugin-cypress/2.13.2/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/eslint-plugin-cypress/2.13.2/compatibility-slim/2.12.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/eslint-plugin-cypress/2.13.2/confidence-slim/2.12.1)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes
cypress-io/cypress ### [`v12.10.0`](https://togithub.com/cypress-io/cypress/releases/tag/v12.10.0) [Compare Source](https://togithub.com/cypress-io/cypress/compare/v12.9.0...v12.10.0) Changelog: https://docs.cypress.io/guides/references/changelog#​12-10-0 ### [`v12.9.0`](https://togithub.com/cypress-io/cypress/releases/tag/v12.9.0) [Compare Source](https://togithub.com/cypress-io/cypress/compare/v12.8.1...v12.9.0) Changelog: https://docs.cypress.io/guides/references/changelog#​12-9-0 ### [`v12.8.1`](https://togithub.com/cypress-io/cypress/releases/tag/v12.8.1) [Compare Source](https://togithub.com/cypress-io/cypress/compare/v12.8.0...v12.8.1) Changelog: https://docs.cypress.io/guides/references/changelog#​12-8-1 ### [`v12.8.0`](https://togithub.com/cypress-io/cypress/releases/tag/v12.8.0) [Compare Source](https://togithub.com/cypress-io/cypress/compare/v12.7.0...v12.8.0) Changelog: https://docs.cypress.io/guides/references/changelog#​12.8.0 ### [`v12.7.0`](https://togithub.com/cypress-io/cypress/releases/tag/v12.7.0) [Compare Source](https://togithub.com/cypress-io/cypress/compare/v12.6.0...v12.7.0) Changelog: https://docs.cypress.io/guides/references/changelog#​12.7.0
component-driven/cypress-axe ### [`v1.4.0`](https://togithub.com/component-driven/cypress-axe/releases/tag/v1.4.0) [Compare Source](https://togithub.com/component-driven/cypress-axe/compare/v1.3.0...v1.4.0) ##### Features - retry option ([#​151](https://togithub.com/component-driven/cypress-axe/issues/151)) ([682ba11](https://togithub.com/component-driven/cypress-axe/commit/682ba11d1d52a00d08a828da25f8a033b67916e0))
bahmutov/cypress-recurse ### [`v1.31.2`](https://togithub.com/bahmutov/cypress-recurse/releases/tag/v1.31.2) [Compare Source](https://togithub.com/bahmutov/cypress-recurse/compare/v1.31.1...v1.31.2) ##### Bug Fixes - compute limit from timeout and delay, closes [#​159](https://togithub.com/bahmutov/cypress-recurse/issues/159) ([ae325c9](https://togithub.com/bahmutov/cypress-recurse/commit/ae325c9436f7318e0cd6c34dc7e11c454b09f46e)) ### [`v1.31.1`](https://togithub.com/bahmutov/cypress-recurse/releases/tag/v1.31.1) [Compare Source](https://togithub.com/bahmutov/cypress-recurse/compare/v1.31.0...v1.31.1) ##### Bug Fixes - yield value on time limit ([6a8af64](https://togithub.com/bahmutov/cypress-recurse/commit/6a8af6440055f89795931a9d65d4dbcae9149b26)) ### [`v1.31.0`](https://togithub.com/bahmutov/cypress-recurse/releases/tag/v1.31.0) [Compare Source](https://togithub.com/bahmutov/cypress-recurse/compare/v1.30.0...v1.31.0) ##### Features - yield the last value ([#​158](https://togithub.com/bahmutov/cypress-recurse/issues/158)) ([2a089f4](https://togithub.com/bahmutov/cypress-recurse/commit/2a089f4543c688c0683166d3e9788936d43463c5)) ### [`v1.30.0`](https://togithub.com/bahmutov/cypress-recurse/releases/tag/v1.30.0) [Compare Source](https://togithub.com/bahmutov/cypress-recurse/compare/v1.29.0...v1.30.0) ##### Bug Fixes - include commands in the list of files ([3ce4aad](https://togithub.com/bahmutov/cypress-recurse/commit/3ce4aad9236bc1183cbcd4a88b6ec2ba34385485)) ##### Features - add optional custom command cy.recurse ([#​156](https://togithub.com/bahmutov/cypress-recurse/issues/156)) ([8cb1a6f](https://togithub.com/bahmutov/cypress-recurse/commit/8cb1a6fb3f42f7e58dc458be34cb267464e09b01)) ### [`v1.29.0`](https://togithub.com/bahmutov/cypress-recurse/releases/tag/v1.29.0) [Compare Source](https://togithub.com/bahmutov/cypress-recurse/compare/v1.28.0...v1.29.0) ##### Features - print better error message ([#​148](https://togithub.com/bahmutov/cypress-recurse/issues/148)) ([6dfb97e](https://togithub.com/bahmutov/cypress-recurse/commit/6dfb97e48f6aa4bebcad16daf145e98bc63fedd4)) ### [`v1.28.0`](https://togithub.com/bahmutov/cypress-recurse/releases/tag/v1.28.0) [Compare Source](https://togithub.com/bahmutov/cypress-recurse/compare/v1.27.1...v1.28.0) ##### Features - add do not fail option ([#​146](https://togithub.com/bahmutov/cypress-recurse/issues/146)) ([4621825](https://togithub.com/bahmutov/cypress-recurse/commit/46218259d1adefce91f2bc2c73c0276b928db7d2)) ### [`v1.27.1`](https://togithub.com/bahmutov/cypress-recurse/releases/tag/v1.27.1) [Compare Source](https://togithub.com/bahmutov/cypress-recurse/compare/v1.27.0...v1.27.1) ##### Bug Fixes - put labels on the logs ([#​145](https://togithub.com/bahmutov/cypress-recurse/issues/145)) ([2fa4dea](https://togithub.com/bahmutov/cypress-recurse/commit/2fa4dea883129d650a4b5730ec69cc40783fae56))
cypress-io/eslint-plugin-cypress ### [`v2.13.2`](https://togithub.com/cypress-io/eslint-plugin-cypress/releases/tag/v2.13.2) [Compare Source](https://togithub.com/cypress-io/eslint-plugin-cypress/compare/v2.13.1...v2.13.2) ##### Bug Fixes - Wait incorrectly reported as unsafe to chain ([7c20206](https://togithub.com/cypress-io/eslint-plugin-cypress/commit/7c20206)) ### [`v2.13.1`](https://togithub.com/cypress-io/eslint-plugin-cypress/releases/tag/v2.13.1) [Compare Source](https://togithub.com/cypress-io/eslint-plugin-cypress/compare/v2.13.0...v2.13.1) ##### Bug Fixes - Solve unsafe to chain command does not exist ([#​126](https://togithub.com/cypress-io/eslint-plugin-cypress/issues/126)) ([1fdfef7](https://togithub.com/cypress-io/eslint-plugin-cypress/commit/1fdfef7)) ### [`v2.13.0`](https://togithub.com/cypress-io/eslint-plugin-cypress/releases/tag/v2.13.0) [Compare Source](https://togithub.com/cypress-io/eslint-plugin-cypress/compare/v2.12.1...v2.13.0) ##### Features - Add 'unsafe-to-chain-command' rule ([bf6a75d](https://togithub.com/cypress-io/eslint-plugin-cypress/commit/bf6a75d))
--- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/elastic/kibana). --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Patryk Kopyciński --- package.json | 10 ++-- .../cypress/e2e/all/add_integration.cy.ts | 8 +-- .../osquery/cypress/e2e/all/alerts.cy.ts | 48 +++++++++------- .../osquery/cypress/tasks/live_query.ts | 4 +- .../cypress/e2e/mocked_data/isolate.cy.ts | 54 +++++++++--------- yarn.lock | 55 ++++++++++--------- 6 files changed, 91 insertions(+), 88 deletions(-) diff --git a/package.json b/package.json index ca0dab0ebd14f..01793344399ed 100644 --- a/package.json +++ b/package.json @@ -1349,14 +1349,14 @@ "cssnano": "^5.1.12", "cssnano-preset-default": "^5.2.12", "csstype": "^3.0.2", - "cypress": "^12.6.0", - "cypress-axe": "^1.3.0", + "cypress": "^12.10.0", + "cypress-axe": "^1.4.0", "cypress-file-upload": "^5.0.8", - "cypress-multi-reporters": "^1.6.2", + "cypress-multi-reporters": "^1.6.3", "cypress-pipe": "^2.0.0", "cypress-react-selector": "^3.0.0", "cypress-real-events": "^1.7.6", - "cypress-recurse": "^1.27.0", + "cypress-recurse": "^1.31.2", "date-fns": "^2.29.3", "debug": "^2.6.9", "delete-empty": "^2.0.0", @@ -1370,7 +1370,7 @@ "eslint-config-prettier": "^8.5.0", "eslint-module-utils": "^2.6.2", "eslint-plugin-ban": "^1.5.2", - "eslint-plugin-cypress": "^2.12.1", + "eslint-plugin-cypress": "^2.13.2", "eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-import": "^2.24.2", "eslint-plugin-jest": "^24.5.0", diff --git a/x-pack/plugins/osquery/cypress/e2e/all/add_integration.cy.ts b/x-pack/plugins/osquery/cypress/e2e/all/add_integration.cy.ts index e35cc40bbc749..552c3ae1e8c90 100644 --- a/x-pack/plugins/osquery/cypress/e2e/all/add_integration.cy.ts +++ b/x-pack/plugins/osquery/cypress/e2e/all/add_integration.cy.ts @@ -183,15 +183,11 @@ describe('ALL - Add Integration', () => { cy.get(`[title="${policyName}"]`).click(); cy.getBySel('PackagePoliciesTableUpgradeButton').click(); cy.contains(/^Advanced$/).click(); - cy.getBySel('codeEditorContainer').within(() => { - cy.contains(`"${packName}":`); - }); + cy.get('.kibanaCodeEditor').should('contain', `"${packName}":`); cy.getBySel('saveIntegration').click(); cy.get(`a[title="${integrationName}"]`).click(); cy.contains(/^Advanced$/).click(); - cy.getBySel('codeEditorContainer').within(() => { - cy.contains(`"${packName}":`); - }); + cy.get('.kibanaCodeEditor').should('contain', `"${packName}":`); cy.contains('Cancel').click(); closeModalIfVisible(); cy.get(`[title="${integrationName}"]`) diff --git a/x-pack/plugins/osquery/cypress/e2e/all/alerts.cy.ts b/x-pack/plugins/osquery/cypress/e2e/all/alerts.cy.ts index e988cd36425d3..ec0c8c65b7faf 100644 --- a/x-pack/plugins/osquery/cypress/e2e/all/alerts.cy.ts +++ b/x-pack/plugins/osquery/cypress/e2e/all/alerts.cy.ts @@ -122,8 +122,10 @@ describe('Alert Event Details', () => { it('adds response actions with osquery with proper validation and form values', () => { cy.visit('/app/security/rules'); cy.contains(ruleName).click(); - cy.getBySel('editRuleSettingsLink').click({ force: true }); - cy.getBySel('edit-rule-actions-tab').wait(500).click(); + cy.getBySel('editRuleSettingsLink').click(); + cy.getBySel('globalLoadingIndicator').should('exist'); + cy.getBySel('globalLoadingIndicator').should('not.exist'); + cy.getBySel('edit-rule-actions-tab').click(); cy.contains('Response actions are run on each rule execution'); cy.getBySel(OSQUERY_RESPONSE_ACTION_ADD_BUTTON).click(); cy.getBySel(RESPONSE_ACTIONS_ITEM_0).within(() => { @@ -160,8 +162,10 @@ describe('Alert Event Details', () => { cy.contains(`${ruleName} was saved`).should('exist'); closeToastIfVisible(); - cy.getBySel('editRuleSettingsLink').click({ force: true }); - cy.getBySel('edit-rule-actions-tab').wait(500).click(); + cy.getBySel('editRuleSettingsLink').click(); + cy.getBySel('globalLoadingIndicator').should('exist'); + cy.getBySel('globalLoadingIndicator').should('not.exist'); + cy.getBySel('edit-rule-actions-tab').click(); cy.getBySel(RESPONSE_ACTIONS_ITEM_0).within(() => { cy.contains('select * from uptime1'); }); @@ -204,8 +208,10 @@ describe('Alert Event Details', () => { cy.contains(`${ruleName} was saved`).should('exist'); closeToastIfVisible(); - cy.getBySel('editRuleSettingsLink').click({ force: true }); - cy.getBySel('edit-rule-actions-tab').wait(500).click(); + cy.getBySel('editRuleSettingsLink').click(); + cy.getBySel('globalLoadingIndicator').should('exist'); + cy.getBySel('globalLoadingIndicator').should('not.exist'); + cy.getBySel('edit-rule-actions-tab').click(); cy.getBySel(RESPONSE_ACTIONS_ITEM_0).within(() => { cy.contains(packName); cy.getBySel('comboBoxInput').type(`${multiQueryPackName}{downArrow}{enter}`); @@ -268,8 +274,10 @@ describe('Alert Event Details', () => { 'You have queries in the investigation guide. Add them as response actions?'; cy.visit('/app/security/rules'); cy.contains(ruleName).click(); - cy.getBySel('editRuleSettingsLink').click({ force: true }); - cy.getBySel('edit-rule-actions-tab').wait(500).click(); + cy.getBySel('editRuleSettingsLink').click(); + cy.getBySel('globalLoadingIndicator').should('exist'); + cy.getBySel('globalLoadingIndicator').should('not.exist'); + cy.getBySel('edit-rule-actions-tab').click(); cy.contains(investigationGuideNote); cy.getBySel('osqueryAddInvestigationGuideQueries').click(); @@ -305,9 +313,9 @@ describe('Alert Event Details', () => { it('should be able to run live query and add to timeline (-depending on the previous test)', () => { const TIMELINE_NAME = 'Untitled timeline'; loadRuleAlerts(ruleName); - cy.getBySel('timeline-context-menu-button').first().click({ force: true }); + cy.getBySel('timeline-context-menu-button').first().click(); cy.contains('Run Osquery'); - cy.getBySel('expand-event').first().click({ force: true }); + cy.getBySel('expand-event').first().click(); cy.getBySel('take-action-dropdown-btn').click(); cy.getBySel('osquery-action-item').click(); cy.contains('1 agent selected.'); @@ -349,7 +357,7 @@ describe('Alert Event Details', () => { it('should substitute parameters in investigation guide', () => { loadRuleAlerts(ruleName); - cy.getBySel('expand-event').first().click({ force: true }); + cy.getBySel('expand-event').first().click(); cy.contains('Get processes').click(); cy.getBySel('flyout-body-osquery').within(() => { cy.contains("SELECT * FROM os_version where name='Ubuntu';"); @@ -381,7 +389,7 @@ describe('Alert Event Details', () => { it('sees osquery results from last action and add to a case', () => { loadRuleAlerts(ruleName); - cy.getBySel('expand-event').first().click({ force: true }); + cy.getBySel('expand-event').first().click(); cy.contains('Osquery Results').click(); cy.getBySel('osquery-results').should('exist'); cy.contains('select * from users;'); @@ -431,7 +439,7 @@ describe('Alert Event Details', () => { it('can visit discover from response action results', () => { const discoverRegex = new RegExp(`action_id: ${UUID_REGEX}`); loadRuleAlerts(ruleName); - cy.getBySel('expand-event').first().click({ force: true }); + cy.getBySel('expand-event').first().click(); cy.contains('Osquery Results').click(); cy.getBySel('osquery-results').should('exist'); checkActionItemsInResults({ @@ -472,7 +480,7 @@ describe('Alert Event Details', () => { it('can visit lens from response action results', () => { const lensRegex = new RegExp(`Action ${UUID_REGEX} results`); loadRuleAlerts(ruleName); - cy.getBySel('expand-event').first().click({ force: true }); + cy.getBySel('expand-event').first().click(); cy.contains('Osquery Results').click(); cy.getBySel('osquery-results').should('exist'); checkActionItemsInResults({ @@ -522,7 +530,7 @@ describe('Alert Event Details', () => { const timelineRegex = new RegExp(`Added ${UUID_REGEX} to timeline`); const filterRegex = new RegExp(`action_id: "${UUID_REGEX}"`); loadRuleAlerts(ruleName); - cy.getBySel('expand-event').first().click({ force: true }); + cy.getBySel('expand-event').first().click(); cy.contains('Osquery Results').click(); cy.getBySel('osquery-results').should('exist'); checkActionItemsInResults({ @@ -565,7 +573,7 @@ describe('Alert Event Details', () => { let initialNotificationCount: number; let updatedNotificationCount: number; loadRuleAlerts(ruleName); - cy.getBySel('expand-event').first().click({ force: true }); + cy.getBySel('expand-event').first().click(); cy.getBySel('osquery-actions-notification') .should('not.have.text', '0') .then((element) => { @@ -606,7 +614,7 @@ describe('Alert Event Details', () => { it('should be able to run take action query against all enrolled agents', () => { loadRuleAlerts(ruleName); - cy.getBySel('expand-event').first().click({ force: true }); + cy.getBySel('expand-event').first().click(); cy.getBySel('take-action-dropdown-btn').click(); cy.getBySel('osquery-action-item').click(); cy.getBySel('agentSelection').within(() => { @@ -620,8 +628,8 @@ describe('Alert Event Details', () => { cy.wait(1000); submitQuery(); cy.getBySel('flyout-body-osquery').within(() => { - // at least 2 agents should have responded - cy.get('[data-grid-row-index]').should('have.length.at.least', 2); + // at least 2 agents should have responded, sometimes it takes a while for the agents to respond + cy.get('[data-grid-row-index]', { timeout: 6000000 }).should('have.length.at.least', 2); }); }); }); @@ -643,7 +651,7 @@ describe('Alert Event Details', () => { it('should substitute params in osquery ran from timelines alerts', () => { loadRuleAlerts(ruleName); - cy.getBySel('send-alert-to-timeline-button').first().click({ force: true }); + cy.getBySel('send-alert-to-timeline-button').first().click(); cy.getBySel('query-events-table').within(() => { cy.getBySel('expand-event').first().click(); }); diff --git a/x-pack/plugins/osquery/cypress/tasks/live_query.ts b/x-pack/plugins/osquery/cypress/tasks/live_query.ts index b241366995eda..51213ee57f8c3 100644 --- a/x-pack/plugins/osquery/cypress/tasks/live_query.ts +++ b/x-pack/plugins/osquery/cypress/tasks/live_query.ts @@ -159,7 +159,5 @@ export const takeOsqueryActionWithParams = () => { cy.getBySel('osqueryColumnValueSelect').type('platform_like{downArrow}{enter}'); cy.wait(1000); submitQuery(); - cy.getBySel('dataGridHeader').within(() => { - cy.contains('tags'); - }); + cy.getBySel('dataGridHeader').should('contain', 'tags', { timeout: 6000000 }); }; diff --git a/x-pack/plugins/security_solution/public/management/cypress/e2e/mocked_data/isolate.cy.ts b/x-pack/plugins/security_solution/public/management/cypress/e2e/mocked_data/isolate.cy.ts index 97ba50b3cce9b..cc949b39404e9 100644 --- a/x-pack/plugins/security_solution/public/management/cypress/e2e/mocked_data/isolate.cy.ts +++ b/x-pack/plugins/security_solution/public/management/cypress/e2e/mocked_data/isolate.cy.ts @@ -30,10 +30,11 @@ import { indexEndpointRuleAlerts } from '../../tasks/index_endpoint_rule_alerts' describe('Isolate command', () => { describe('from Manage', () => { - let endpointData: ReturnTypeFromChainable; - let isolatedEndpointData: ReturnTypeFromChainable; + let endpointData: ReturnTypeFromChainable | undefined; + let isolatedEndpointData: ReturnTypeFromChainable | undefined; let isolatedEndpointHostnames: [string, string]; let endpointHostnames: [string, string]; + before(() => { indexEndpointHosts({ count: 2, @@ -63,16 +64,15 @@ describe('Isolate command', () => { after(() => { if (endpointData) { endpointData.cleanup(); - // @ts-expect-error ignore setting to undefined endpointData = undefined; } if (isolatedEndpointData) { isolatedEndpointData.cleanup(); - // @ts-expect-error ignore setting to undefined isolatedEndpointData = undefined; } }); + beforeEach(() => { login(); }); @@ -89,35 +89,33 @@ describe('Isolate command', () => { }); describe('from Alerts', () => { - let endpointData: ReturnTypeFromChainable; - let alertData: ReturnTypeFromChainable; + let endpointData: ReturnTypeFromChainable | undefined; + let alertData: ReturnTypeFromChainable | undefined; let hostname: string; before(() => { - indexEndpointHosts({ withResponseActions: false, isolation: false }) - .then((indexEndpoints) => { + indexEndpointHosts({ withResponseActions: false, isolation: false }).then( + (indexEndpoints) => { endpointData = indexEndpoints; hostname = endpointData.data.hosts[0].host.name; - }) - .then(() => { + return indexEndpointRuleAlerts({ endpointAgentId: endpointData.data.hosts[0].agent.id, endpointHostname: endpointData.data.hosts[0].host.name, endpointIsolated: false, }); - }); + } + ); }); after(() => { if (endpointData) { endpointData.cleanup(); - // @ts-expect-error ignore setting to undefined endpointData = undefined; } if (alertData) { alertData.cleanup(); - // @ts-expect-error ignore setting to undefined alertData = undefined; } }); @@ -192,9 +190,9 @@ describe('Isolate command', () => { }); describe('from Cases', () => { - let endpointData: ReturnTypeFromChainable; - let caseData: ReturnTypeFromChainable; - let alertData: ReturnTypeFromChainable; + let endpointData: ReturnTypeFromChainable | undefined; + let caseData: ReturnTypeFromChainable | undefined; + let alertData: ReturnTypeFromChainable | undefined; let caseAlertActions: ReturnType; let alertId: string; let caseUrlPath: string; @@ -210,41 +208,39 @@ describe('Isolate command', () => { .then((indexEndpoints) => { endpointData = indexEndpoints; hostname = endpointData.data.hosts[0].host.name; - }) - .then(() => { + return indexEndpointRuleAlerts({ endpointAgentId: endpointData.data.hosts[0].agent.id, endpointHostname: endpointData.data.hosts[0].host.name, endpointIsolated: false, - }).then((indexedAlert) => { - alertData = indexedAlert; - alertId = alertData.alerts[0]._id; }); }) - .then(() => { - caseAlertActions = addAlertsToCase({ - caseId: caseData.data.id, - alertIds: [alertId], - }); + .then((indexedAlert) => { + alertData = indexedAlert; + alertId = alertData.alerts[0]._id; + + if (caseData) { + caseAlertActions = addAlertsToCase({ + caseId: caseData.data.id, + alertIds: [alertId], + }); + } }); }); after(() => { if (caseData) { caseData.cleanup(); - // @ts-expect-error ignore setting to undefined caseData = undefined; } if (endpointData) { endpointData.cleanup(); - // @ts-expect-error ignore setting to undefined endpointData = undefined; } if (alertData) { alertData.cleanup(); - // @ts-expect-error ignore setting to undefined alertData = undefined; } }); diff --git a/yarn.lock b/yarn.lock index e42d31edfada7..b9ef08891dd5e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12365,7 +12365,7 @@ commander@^4.0.1, commander@^4.1.1: resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== -commander@^5.0.0, commander@^5.1.0: +commander@^5.0.0: version "5.1.0" resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae" integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg== @@ -13076,23 +13076,23 @@ cyclist@~0.2.2: resolved "https://registry.yarnpkg.com/cyclist/-/cyclist-0.2.2.tgz#1b33792e11e914a2fd6d6ed6447464444e5fa640" integrity sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA= -cypress-axe@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/cypress-axe/-/cypress-axe-1.3.0.tgz#255ef8ef8e88747f2a72ceb7f7c60e8185b7852b" - integrity sha512-b2zAva1+uRwGA7r/JzP7C/64YHu9Fa8RsHRIrapUDzJeGLEQImz86FbwRW/lBamrEt7YHzGRwuJizXKTyQBsfQ== +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-file-upload@^5.0.8: version "5.0.8" resolved "https://registry.yarnpkg.com/cypress-file-upload/-/cypress-file-upload-5.0.8.tgz#d8824cbeaab798e44be8009769f9a6c9daa1b4a1" integrity sha512-+8VzNabRk3zG6x8f8BWArF/xA/W0VK4IZNx3MV0jFWrJS/qKn8eHfa5nU73P9fOQAgwHFJx7zjg4lwOnljMO8g== -cypress-multi-reporters@^1.6.2: - version "1.6.2" - resolved "https://registry.yarnpkg.com/cypress-multi-reporters/-/cypress-multi-reporters-1.6.2.tgz#129dfeffa00d4deca3e9f58d84570b9962c28c2b" - integrity sha512-lvwGwHqZG5CwGxBJ6UJXWaxlWGkJgxBjP0h+IVLrrwRlJpT4coSwwt+UzMdeqEMrzT4IDfhbtmUNOiDleisOYA== +cypress-multi-reporters@^1.6.3: + version "1.6.3" + resolved "https://registry.yarnpkg.com/cypress-multi-reporters/-/cypress-multi-reporters-1.6.3.tgz#0f0da8db4caf8d7a21f94e5209148348416d7c71" + integrity sha512-klb9pf6oAF4WCLHotu9gdB8ukYBdeTzbEMuESKB3KT54HhrZj65vQxubAgrULV5H2NWqxHdUhlntPbKZChNvEw== dependencies: - debug "^4.1.1" - lodash "^4.17.15" + debug "^4.3.4" + lodash "^4.17.21" cypress-pipe@^2.0.0: version "2.0.0" @@ -13111,17 +13111,17 @@ cypress-real-events@^1.7.6: resolved "https://registry.yarnpkg.com/cypress-real-events/-/cypress-real-events-1.7.6.tgz#6f17e0b2ceea1d6dc60f6737d8f84cc517bbbb4c" integrity sha512-yP6GnRrbm6HK5q4DH6Nnupz37nOfZu/xn1xFYqsE2o4G73giPWQOdu6375QYpwfU1cvHNCgyD2bQ2hPH9D7NMw== -cypress-recurse@^1.27.0: - version "1.27.0" - resolved "https://registry.yarnpkg.com/cypress-recurse/-/cypress-recurse-1.27.0.tgz#0c61e809c5f7740a7e907714614c49c72dcb5c1f" - integrity sha512-BCD83UqaxlD+JiqZn1PvIhHRXasgfCt57vLC1Fcyifvxh4QklELRcYUJV3MdhKamMkmajaErLfnCNbZ8VJ5SIg== +cypress-recurse@^1.31.2: + version "1.31.2" + resolved "https://registry.yarnpkg.com/cypress-recurse/-/cypress-recurse-1.31.2.tgz#c926b28207c9d49acb1caf89b818cb4910af43eb" + integrity sha512-McSjAaL95bq6NSg0vLA0GI5rMShqKmNlCQXpuQcAga5n2Yf/t3NgELBjPk1mXE0RfpLwymVFjiFQgmxkBgwK7A== dependencies: humanize-duration "^3.27.3" -cypress@^12.6.0: - version "12.6.0" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-12.6.0.tgz#d71a82639756173c0682b3d467eb9f0523460e91" - integrity sha512-WdHSVaS1lumSd5XpVTslZd8ui9GIGphrzvXq9+3DtVhqjRZC5M70gu5SW/Y/SLPq3D1wiXGZoHC6HJ7ESVE2lw== +cypress@^12.10.0: + version "12.10.0" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-12.10.0.tgz#b6264f77c214d63530ebac2b33c4d099bd40b715" + integrity sha512-Y0wPc221xKKW1/4iAFCphkrG2jNR4MjOne3iGn4mcuCaE7Y5EtXL83N8BzRsAht7GYfWVjJ/UeTqEdDKHz39HQ== dependencies: "@cypress/request" "^2.88.10" "@cypress/xvfb" "^1.2.4" @@ -13137,7 +13137,7 @@ cypress@^12.6.0: check-more-types "^2.24.0" cli-cursor "^3.1.0" cli-table3 "~0.6.1" - commander "^5.1.0" + commander "^6.2.1" common-tags "^1.8.0" dayjs "^1.10.4" debug "^4.3.4" @@ -13155,7 +13155,7 @@ cypress@^12.6.0: listr2 "^3.8.3" lodash "^4.17.21" log-symbols "^4.0.0" - minimist "^1.2.6" + minimist "^1.2.8" ospath "^1.2.2" pretty-bytes "^5.6.0" proxy-from-env "1.0.0" @@ -15022,10 +15022,10 @@ eslint-plugin-ban@^1.5.2: dependencies: requireindex "~1.2.0" -eslint-plugin-cypress@^2.12.1: - version "2.12.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-cypress/-/eslint-plugin-cypress-2.12.1.tgz#9aeee700708ca8c058e00cdafe215199918c2632" - integrity sha512-c2W/uPADl5kospNDihgiLc7n87t5XhUbFDoTl6CfVkmG+kDAb5Ux10V9PoLPu9N+r7znpc+iQlcmAqT1A/89HA== +eslint-plugin-cypress@^2.13.2: + version "2.13.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-cypress/-/eslint-plugin-cypress-2.13.2.tgz#b42b763f449ff713cecf6bdf1903e7cee6e48bfc" + integrity sha512-LlwjnBTzuKuC0A4H0RxVjs0YeAWK+CD1iM9Dp8un3lzT713ePQxfpPstCD+9HSAss8emuE3b2hCNUST+NrUwKw== dependencies: globals "^11.12.0" @@ -21122,6 +21122,11 @@ minimist@^1.1.1, minimist@^1.1.3, minimist@^1.2.0, minimist@^1.2.3, minimist@^1. resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44" integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q== +minimist@^1.2.8: + version "1.2.8" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" + integrity sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA== + minipass-collect@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/minipass-collect/-/minipass-collect-1.0.2.tgz#22b813bf745dc6edba2576b940022ad6edc8c617"