diff --git a/x-pack/plugins/fleet/cypress/integration/a11y/home_page.spec.ts b/x-pack/plugins/fleet/cypress/integration/a11y/home_page.spec.ts index f923187c93653..b5d6e9d605f1e 100644 --- a/x-pack/plugins/fleet/cypress/integration/a11y/home_page.spec.ts +++ b/x-pack/plugins/fleet/cypress/integration/a11y/home_page.spec.ts @@ -9,50 +9,50 @@ import 'cypress-real-events/support'; import { checkA11y } from '../../support/commands'; import { FLEET, navigateTo } from '../../tasks/navigation'; import { + AGENT_FLYOUT, GENERATE_FLEET_SERVER_POLICY_BUTTON, - AGENTS_QUICK_START_TAB_BUTTON, PLATFORM_TYPE_LINUX_BUTTON, - AGENTS_ADVANCED_TAB_BUTTON, ADVANCED_FLEET_SERVER_ADD_HOST_BUTTON, ADVANCED_FLEET_SERVER_GENERATE_SERVICE_TOKEN_BUTTON, AGENT_POLICIES_TAB, - AGENT_POLICIES_CREATE_AGENT_POLICY_BUTTON, - AGENT_POLICIES_CREATE_AGENT_POLICY_FLYOUT_TITLE, + AGENT_POLICIES_CREATE_AGENT_POLICY_FLYOUT, AGENT_POLICY_CREATE_AGENT_POLICY_NAME_FIELD, AGENT_POLICIES_FLYOUT_ADVANCED_DEFAULT_NAMESPACE_HEADER, AGENT_POLICY_FLYOUT_CREATE_BUTTON, ENROLLMENT_TOKENS_TAB, - ENROLLMENT_TOKENS_CREATE_TOKEN_BUTTON, - ENROLLMENT_TOKENS_CREATE_TOKEN_NAME_FIELD, + ENROLLMENT_TOKENS, DATA_STREAMS_TAB, SETTINGS_TAB, SETTINGS_FLEET_SERVER_HOST_HEADING, + FLEET_SERVER_HOST_INPUT, } from '../../screens/fleet'; import { AGENT_POLICY_NAME_LINK } from '../../screens/integrations'; import { cleanupAgentPolicies, unenrollAgent } from '../../tasks/cleanup'; describe('Home page', () => { before(() => { navigateTo(FLEET); - cy.getBySel(AGENTS_QUICK_START_TAB_BUTTON, { timeout: 15000 }).should('be.visible'); + cy.getBySel(AGENT_FLYOUT.QUICK_START_TAB_BUTTON, { timeout: 15000 }).should('be.visible'); }); describe('Agents', () => { const fleetServerHost = 'https://localhost:8220'; + describe('Quick Start', () => { it('Get started with fleet', () => { checkA11y({ skipFailures: false }); }); it('Install Fleet Server', () => { - cy.getBySel('fleetServerHostInput', { timeout: 15000 }).should('be.visible'); - cy.getBySel('fleetServerHostInput').getBySel('comboBoxSearchInput').type(fleetServerHost); + cy.getBySel(FLEET_SERVER_HOST_INPUT, { timeout: 15000 }).should('be.visible'); + cy.getBySel(FLEET_SERVER_HOST_INPUT).getBySel('comboBoxSearchInput').type(fleetServerHost); cy.getBySel(GENERATE_FLEET_SERVER_POLICY_BUTTON).click(); cy.getBySel(PLATFORM_TYPE_LINUX_BUTTON, { timeout: 15000 }).should('be.visible'); checkA11y({ skipFailures: false }); }); }); + describe('Advanced', () => { before(() => { - cy.getBySel(AGENTS_ADVANCED_TAB_BUTTON).click(); + cy.getBySel(AGENT_FLYOUT.ADVANCED_TAB_BUTTON).click(); }); it('Select policy for fleet', () => { checkA11y({ skipFailures: false }); @@ -69,19 +69,20 @@ describe('Home page', () => { }); }); }); + describe('Agent Policies', () => { before(() => { cy.getBySel(AGENT_POLICIES_TAB).click(); - cy.getBySel(AGENT_POLICIES_CREATE_AGENT_POLICY_BUTTON, { timeout: 15000 }).should( - 'be.visible' - ); + cy.getBySel(AGENT_POLICIES_CREATE_AGENT_POLICY_FLYOUT.CREATE_BUTTON, { + timeout: 15000, + }).should('be.visible'); }); it('Agent Table', () => { checkA11y({ skipFailures: false }); }); it('Create Policy Flyout', () => { - cy.getBySel(AGENT_POLICIES_CREATE_AGENT_POLICY_BUTTON).click(); - cy.getBySel(AGENT_POLICIES_CREATE_AGENT_POLICY_FLYOUT_TITLE, { timeout: 15000 }).should( + cy.getBySel(AGENT_POLICIES_CREATE_AGENT_POLICY_FLYOUT.CREATE_BUTTON).click(); + cy.getBySel(AGENT_POLICIES_CREATE_AGENT_POLICY_FLYOUT.TITLE, { timeout: 15000 }).should( 'be.visible' ); cy.getBySel(AGENT_POLICY_CREATE_AGENT_POLICY_NAME_FIELD).type('testName'); @@ -97,6 +98,7 @@ describe('Home page', () => { checkA11y({ skipFailures: true }); }); }); + describe('Enrollment Tokens', () => { before(() => { cy.getBySel(ENROLLMENT_TOKENS_TAB).click(); @@ -106,13 +108,14 @@ describe('Home page', () => { checkA11y({ skipFailures: false }); }); it('Create Enrollment Token Modal', () => { - cy.getBySel(ENROLLMENT_TOKENS_CREATE_TOKEN_BUTTON).click(); - cy.getBySel(ENROLLMENT_TOKENS_CREATE_TOKEN_NAME_FIELD, { timeout: 15000 }).should( + cy.getBySel(ENROLLMENT_TOKENS.CREATE_TOKEN_BUTTON).click(); + cy.getBySel(ENROLLMENT_TOKENS.CREATE_TOKEN_MODAL_NAME_FIELD, { timeout: 15000 }).should( 'be.visible' ); checkA11y({ skipFailures: false }); }); }); + describe('Data Streams', () => { before(() => { cy.getBySel('confirmModalCancelButton').click(); diff --git a/x-pack/plugins/fleet/cypress/integration/agent_binary_download_source.spec.ts b/x-pack/plugins/fleet/cypress/integration/agent_binary_download_source.spec.ts index c695939248826..095a87a28e130 100644 --- a/x-pack/plugins/fleet/cypress/integration/agent_binary_download_source.spec.ts +++ b/x-pack/plugins/fleet/cypress/integration/agent_binary_download_source.spec.ts @@ -10,10 +10,10 @@ import { AGENT_BINARY_SOURCES_TABLE_ACTIONS, AGENT_BINARY_SOURCES_FLYOUT, AGENT_POLICY_FORM, - CONFIRM_MODAL_CONFIRM_BUTTON, } from '../screens/fleet'; import { cleanupDownloadSources } from '../tasks/cleanup'; import { FLEET, navigateTo } from '../tasks/navigation'; +import { CONFIRM_MODAL } from '../screens/navigation'; describe('Agent binary download source section', () => { beforeEach(() => { @@ -35,7 +35,7 @@ describe('Agent binary download source section', () => { .clear() .type('https://edited-default-host.co'); cy.getBySel(AGENT_BINARY_SOURCES_FLYOUT.SUBMIT_BUTTON).click(); - cy.getBySel(CONFIRM_MODAL_CONFIRM_BUTTON).click(); + cy.getBySel(CONFIRM_MODAL.CONFIRM_BUTTON).click(); cy.intercept('api/fleet/agent_download_sources/fleet-default-download-source', { host: 'https://edited-default-host.co', diff --git a/x-pack/plugins/fleet/cypress/integration/agent.spec.ts b/x-pack/plugins/fleet/cypress/integration/agent_list.spec.ts similarity index 54% rename from x-pack/plugins/fleet/cypress/integration/agent.spec.ts rename to x-pack/plugins/fleet/cypress/integration/agent_list.spec.ts index 084ba548ff6c6..bc3cf5c2f6ed3 100644 --- a/x-pack/plugins/fleet/cypress/integration/agent.spec.ts +++ b/x-pack/plugins/fleet/cypress/integration/agent_list.spec.ts @@ -5,7 +5,11 @@ * 2.0. */ +import { FLEET_AGENT_LIST_PAGE } from '../screens/fleet'; + import { createAgentDoc } from '../tasks/agents'; +import { setupFleetServer } from '../tasks/fleet_server'; +import { deleteFleetServerDocs, deleteAgentDocs } from '../tasks/cleanup'; const createAgentDocs = (kibanaVersion: string) => [ createAgentDoc('agent-1', 'policy-1'), // this agent will have upgrade available @@ -14,29 +18,39 @@ const createAgentDocs = (kibanaVersion: string) => [ ]; let docs: any[] = []; -// TODO: create fleet server, fix version of agent to upgrade to an allowed version (>= fleet server's, < kibana) -// https://github.com/elastic/kibana/issues/138121 -describe.skip('View agents', () => { + +describe('View agents list', () => { before(() => { - cy.task('deleteDocsByQuery', { - index: '.fleet-agents', - query: { match_all: {} }, - ignoreUnavailable: true, - }); + deleteFleetServerDocs(true); + deleteAgentDocs(true); + setupFleetServer(); + cy.getKibanaVersion().then((version) => { docs = createAgentDocs(version); cy.task('insertDocs', { index: '.fleet-agents', docs }); }); }); after(() => { - cy.task('deleteDocsByQuery', { - index: '.fleet-agents', - query: { match_all: {} }, - }); + deleteFleetServerDocs(); + deleteAgentDocs(); }); beforeEach(() => { - cy.intercept('/api/fleet/agents/setup', { isReady: true }); + cy.intercept('/api/fleet/agents/setup', { + isReady: true, + missing_optional_features: [], + missing_requirements: [], + }); cy.intercept('/api/fleet/setup', { isInitialized: true, nonFatalErrors: [] }); + cy.intercept('/api/fleet/agents_status', { + total: 18, + inactive: 0, + online: 18, + error: 0, + offline: 0, + updating: 0, + other: 0, + events: 0, + }); cy.intercept(/\/api\/fleet\/agent_policies(\?.*)?$/, { items: [ { @@ -78,10 +92,10 @@ describe.skip('View agents', () => { describe('Agent filter suggestions', () => { it('should filter based on agent id', () => { cy.visit('/app/fleet/agents'); - cy.getBySel('agentList.queryInput').type('agent.id: "agent-1"{enter}'); - cy.getBySel('fleetAgentListTable'); - cy.getBySel('fleetAgentListTable').find('tr').should('have.length', 2); - cy.getBySel('fleetAgentListTable').contains('agent-1'); + cy.getBySel(FLEET_AGENT_LIST_PAGE.QUERY_INPUT).type('agent.id: "agent-1"{enter}'); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).find('tr').should('have.length', 2); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).contains('agent-1'); }); }); @@ -89,19 +103,19 @@ describe.skip('View agents', () => { it('should only show agents with upgrade available after click', () => { cy.visit('/app/fleet/agents'); - cy.getBySel('agentList.showUpgradeable').click(); - cy.getBySel('fleetAgentListTable').find('tr').should('have.length', 17); - cy.getBySel('fleetAgentListTable').contains('agent-1'); + cy.getBySel(FLEET_AGENT_LIST_PAGE.SHOW_UPGRADEABLE).click(); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).find('tr').should('have.length', 17); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).contains('agent-1'); }); it('should clear filter on second click', () => { cy.visit('/app/fleet/agents'); - cy.getBySel('agentList.showUpgradeable').click(); - cy.getBySel('agentList.showUpgradeable').click(); - cy.getBySel('fleetAgentListTable').find('tr').should('have.length', 18); - cy.getBySel('fleetAgentListTable').contains('agent-1'); - cy.getBySel('fleetAgentListTable').contains('agent-2'); + cy.getBySel(FLEET_AGENT_LIST_PAGE.SHOW_UPGRADEABLE).click(); + cy.getBySel(FLEET_AGENT_LIST_PAGE.SHOW_UPGRADEABLE).click(); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).find('tr').should('have.length', 19); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).contains('agent-1'); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).contains('agent-2'); }); }); @@ -109,85 +123,92 @@ describe.skip('View agents', () => { it('should should show all policies as options', () => { cy.visit('/app/fleet/agents'); - cy.getBySel('agentList.policyFilter').click(); + cy.getBySel(FLEET_AGENT_LIST_PAGE.POLICY_FILTER).click(); cy.get('button').contains('Agent policy 1'); cy.get('button').contains('Agent policy 2'); cy.get('button').contains('Agent policy 3'); }); + it('should filter on single policy (no results)', () => { cy.visit('/app/fleet/agents'); - cy.getBySel('agentList.policyFilter').click(); + cy.getBySel(FLEET_AGENT_LIST_PAGE.POLICY_FILTER).click(); cy.get('button').contains('Agent policy 4').click(); - cy.getBySel('fleetAgentListTable').contains('No agents found'); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).contains('No agents found'); }); + it('should filter on single policy', () => { cy.visit('/app/fleet/agents'); - cy.getBySel('agentList.policyFilter').click(); + cy.getBySel(FLEET_AGENT_LIST_PAGE.POLICY_FILTER).click(); cy.get('button').contains('Agent policy 1').click(); - cy.getBySel('fleetAgentListTable').find('tr').should('have.length', 2); - cy.getBySel('fleetAgentListTable').contains('agent-1'); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).find('tr').should('have.length', 2); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).contains('agent-1'); }); + it('should filter on multiple policies', () => { cy.visit('/app/fleet/agents'); - cy.getBySel('agentList.policyFilter').click(); + cy.getBySel(FLEET_AGENT_LIST_PAGE.POLICY_FILTER).click(); cy.get('button').contains('Agent policy 1').click(); cy.get('button').contains('Agent policy 2').click(); - cy.getBySel('fleetAgentListTable').find('tr').should('have.length', 3); - cy.getBySel('fleetAgentListTable').contains('agent-1'); - cy.getBySel('fleetAgentListTable').contains('agent-2'); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).find('tr').should('have.length', 3); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).contains('agent-1'); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).contains('agent-2'); }); }); + describe('Agent status filter', () => { it('should filter on healthy (16 result)', () => { cy.visit('/app/fleet/agents'); - cy.getBySel('agentList.statusFilter').click(); + cy.getBySel(FLEET_AGENT_LIST_PAGE.STATUS_FILTER).click(); cy.get('button').contains('Healthy').click(); - cy.getBySel('fleetAgentListTable').find('tr').should('have.length', 17); - cy.getBySel('fleetAgentListTable').contains('agent-1'); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).find('tr').should('have.length', 18); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).contains('agent-1'); }); + it('should filter on unhealthy (1 result)', () => { cy.visit('/app/fleet/agents'); - cy.getBySel('agentList.statusFilter').click(); + cy.getBySel(FLEET_AGENT_LIST_PAGE.STATUS_FILTER).click(); cy.get('button').contains('Unhealthy').click(); - cy.getBySel('fleetAgentListTable').find('tr').should('have.length', 2); - cy.getBySel('fleetAgentListTable').contains('agent-2'); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).find('tr').should('have.length', 2); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).contains('agent-2'); }); + it('should filter on inactive (0 result)', () => { cy.visit('/app/fleet/agents'); - cy.getBySel('agentList.statusFilter').click(); + cy.getBySel(FLEET_AGENT_LIST_PAGE.STATUS_FILTER).click(); cy.get('button').contains('Inactive').click(); - cy.getBySel('fleetAgentListTable').contains('No agents found'); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).contains('No agents found'); }); + it('should filter on healthy and unhealthy', () => { cy.visit('/app/fleet/agents'); - cy.getBySel('agentList.statusFilter').click(); + cy.getBySel(FLEET_AGENT_LIST_PAGE.STATUS_FILTER).click(); cy.get('button').contains('healthy').click(); cy.get('button').contains('Unhealthy').click(); - cy.getBySel('fleetAgentListTable').find('tr').should('have.length', 18); - cy.getBySel('fleetAgentListTable').contains('agent-1'); - cy.getBySel('fleetAgentListTable').contains('agent-2'); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).find('tr').should('have.length', 19); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).contains('agent-1'); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).contains('agent-2'); }); }); @@ -195,19 +216,19 @@ describe.skip('View agents', () => { it('should allow to bulk upgrade agents', () => { cy.visit('/app/fleet/agents'); - cy.getBySel('agentList.policyFilter').click(); + cy.getBySel(FLEET_AGENT_LIST_PAGE.POLICY_FILTER).click(); cy.get('button').contains('Agent policy 3').click(); - cy.getBySel('fleetAgentListTable').find('tr').should('have.length', 16); + cy.getBySel(FLEET_AGENT_LIST_PAGE.TABLE).find('tr').should('have.length', 16); - cy.getBySel('checkboxSelectAll').click(); + cy.getBySel(FLEET_AGENT_LIST_PAGE.CHECKBOX_SELECT_ALL).click(); // Trigger a bulk upgrade - cy.getBySel('agentBulkActionsButton').click(); + cy.getBySel(FLEET_AGENT_LIST_PAGE.BULK_ACTIONS_BUTTON).click(); cy.get('button').contains('Upgrade 15 agents').click(); cy.get('.euiModalFooter button').contains('Upgrade 15 agents').click(); - // Cancel upgrade - cy.getBySel('abortUpgradeBtn').click(); - cy.get('button').contains('Confirm').click(); + // Cancel upgrade - this assertion is currently flaky + // cy.getBySel(CURRENT_BULK_UPGRADES_CALLOUT.ABORT_BTN).click(); + // cy.get('button').contains('Confirm').click(); }); }); }); diff --git a/x-pack/plugins/fleet/cypress/integration/agent_policy.spec.ts b/x-pack/plugins/fleet/cypress/integration/agent_policy.spec.ts index 694cf6c1527ae..63da2cbbfa389 100644 --- a/x-pack/plugins/fleet/cypress/integration/agent_policy.spec.ts +++ b/x-pack/plugins/fleet/cypress/integration/agent_policy.spec.ts @@ -4,6 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import { TOAST_CLOSE_BTN } from '../screens/navigation'; describe('Edit agent policy', () => { beforeEach(() => { @@ -33,7 +34,7 @@ describe('Edit agent policy', () => { it('should edit agent policy', () => { cy.visit('/app/fleet/policies/policy-1/settings'); - cy.getBySel('toastCloseButton').click(); + cy.getBySel(TOAST_CLOSE_BTN).click(); cy.get('[placeholder="Optional description"').clear().type('desc'); cy.intercept('/api/fleet/agent_policies/policy-1', { diff --git a/x-pack/plugins/fleet/cypress/integration/enrollment_token.spec.ts b/x-pack/plugins/fleet/cypress/integration/enrollment_token.spec.ts new file mode 100644 index 0000000000000..e60842a299267 --- /dev/null +++ b/x-pack/plugins/fleet/cypress/integration/enrollment_token.spec.ts @@ -0,0 +1,52 @@ +/* + * 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. + */ + +import { FLEET, navigateTo } from '../tasks/navigation'; +import { cleanupAgentPolicies } from '../tasks/cleanup'; +import { ENROLLMENT_TOKENS_TAB, ENROLLMENT_TOKENS } from '../screens/fleet'; + +describe('Enrollment token page', () => { + before(() => { + navigateTo(FLEET); + cy.request({ + method: 'POST', + url: '/api/fleet/agent_policies', + body: { + name: 'Agent policy 1', + namespace: 'default', + description: '', + monitoring_enabled: ['logs', 'metrics'], + id: 'agent-policy-1', + }, + headers: { 'kbn-xsrf': 'cypress' }, + }); + cy.getBySel(ENROLLMENT_TOKENS_TAB).click(); + }); + + after(() => { + cleanupAgentPolicies(); + }); + + it('Create new Token', () => { + cy.getBySel(ENROLLMENT_TOKENS.CREATE_TOKEN_BUTTON).click(); + cy.getBySel(ENROLLMENT_TOKENS.CREATE_TOKEN_MODAL_NAME_FIELD).clear().type('New Token'); + cy.getBySel(ENROLLMENT_TOKENS.CREATE_TOKEN_MODAL_SELECT_FIELD).contains('Agent policy 1'); + cy.get('.euiButton').contains('Create enrollment token').click({ force: true }); + + cy.getBySel(ENROLLMENT_TOKENS.LIST_TABLE, { timeout: 15000 }).contains('Agent policy 1'); + }); + + it('Delete Token - inactivates the token', () => { + cy.visit('app/fleet/enrollment-tokens'); + cy.getBySel(ENROLLMENT_TOKENS.LIST_TABLE).find('tr').should('have.length', 2); + cy.getBySel(ENROLLMENT_TOKENS.TABLE_REVOKE_BTN).first().click(); + cy.get('.euiPanel').contains('Are you sure you want to revoke'); + cy.get('.euiButton').contains('Revoke enrollment token').click({ force: true }); + + cy.getBySel(ENROLLMENT_TOKENS.TABLE_REVOKE_BTN).first().should('not.exist'); + }); +}); diff --git a/x-pack/plugins/fleet/cypress/integration/fleet_agent_flyout.spec.ts b/x-pack/plugins/fleet/cypress/integration/fleet_agent_flyout.spec.ts index 626fa1427f8f1..b907fb8ef4c79 100644 --- a/x-pack/plugins/fleet/cypress/integration/fleet_agent_flyout.spec.ts +++ b/x-pack/plugins/fleet/cypress/integration/fleet_agent_flyout.spec.ts @@ -5,25 +5,17 @@ * 2.0. */ -import { ADD_AGENT_BUTTON, ADD_AGENT_FLYOUT } from '../screens/fleet'; -import { cleanupAgentPolicies } from '../tasks/cleanup'; +import { ADD_AGENT_BUTTON, AGENT_FLYOUT } from '../screens/fleet'; +import { cleanupAgentPolicies, deleteFleetServerDocs, deleteAgentDocs } from '../tasks/cleanup'; import { createAgentDoc } from '../tasks/agents'; -import { setFleetServerHost } from '../tasks/fleet'; +import { setFleetServerHost } from '../tasks/fleet_server'; import { FLEET, navigateTo } from '../tasks/navigation'; const FLEET_SERVER_POLICY_ID = 'fleet-server-policy'; function cleanUp() { - cy.task('deleteDocsByQuery', { - index: '.fleet-agents', - query: { match_all: {} }, - ignoreUnavailable: true, - }); - cy.task('deleteDocsByQuery', { - index: '.fleet-servers', - query: { match_all: {} }, - ignoreUnavailable: true, - }); + deleteFleetServerDocs(true); + deleteAgentDocs(true); cleanupAgentPolicies(); } let kibanaVersion: string; @@ -80,7 +72,7 @@ describe('Fleet add agent flyout', () => { cy.getBySel(ADD_AGENT_BUTTON).click(); cy.intercept('POST', '/api/fleet/agent_policies?sys_monitoring=true').as('createAgentPolicy'); - cy.getBySel('createPolicyBtn').click(); + cy.getBySel(AGENT_FLYOUT.CREATE_POLICY_BUTTON).click(); let agentPolicyId: string; const startTime = Date.now(); @@ -89,7 +81,7 @@ describe('Fleet add agent flyout', () => { agentPolicyId = xhr.response.body.item.id; }); // verify create button changed to dropdown - cy.getBySel('agentPolicyDropdown'); + cy.getBySel(AGENT_FLYOUT.POLICY_DROPDOWN); cy.wrap(null).then(() => { cy.task('insertDoc', { @@ -99,7 +91,7 @@ describe('Fleet add agent flyout', () => { }); }); - cy.getBySel(ADD_AGENT_FLYOUT.CONFIRM_AGENT_ENROLLMENT_BUTTON); + cy.getBySel(AGENT_FLYOUT.CONFIRM_AGENT_ENROLLMENT_BUTTON); cy.wrap(null).then(() => { cy.task('insertDoc', { @@ -113,7 +105,7 @@ describe('Fleet add agent flyout', () => { }); }); - cy.getBySel(ADD_AGENT_FLYOUT.INCOMING_DATA_CONFIRMED_CALL_OUT); + cy.getBySel(AGENT_FLYOUT.INCOMING_DATA_CONFIRMED_CALL_OUT); }); }); }); diff --git a/x-pack/plugins/fleet/cypress/integration/fleet_settings.spec.ts b/x-pack/plugins/fleet/cypress/integration/fleet_settings.spec.ts index 338030e91f3da..a1c4eef06bdb5 100644 --- a/x-pack/plugins/fleet/cypress/integration/fleet_settings.spec.ts +++ b/x-pack/plugins/fleet/cypress/integration/fleet_settings.spec.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { CONFIRM_MODAL_BTN } from '../screens/integrations'; +import { TOAST_CLOSE_BTN, CONFIRM_MODAL } from '../screens/navigation'; +import { SETTINGS_SAVE_BTN, SETTINGS_OUTPUTS } from '../screens/fleet'; describe('Edit settings', () => { beforeEach(() => { @@ -25,11 +26,11 @@ describe('Edit settings', () => { }); cy.visit('/app/fleet/settings'); - cy.getBySel('toastCloseButton').click(); + cy.getBySel(TOAST_CLOSE_BTN).click(); }); it('should update Fleet server hosts', () => { - cy.getBySel('editHostsBtn').click(); + cy.getBySel(SETTINGS_OUTPUTS.EDIT_HOSTS_BTN).click(); cy.get('[placeholder="Specify host URL"').type('https://localhost:8220'); cy.intercept('/api/fleet/settings', { @@ -39,8 +40,8 @@ describe('Edit settings', () => { fleet_server_hosts: ['https://localhost:8220'], }).as('updateSettings'); - cy.getBySel('saveApplySettingsBtn').click(); - cy.getBySel(CONFIRM_MODAL_BTN).click(); + cy.getBySel(SETTINGS_SAVE_BTN).click(); + cy.getBySel(CONFIRM_MODAL.CONFIRM_BUTTON).click(); cy.wait('@updateSettings').then((interception) => { expect(interception.request.body.fleet_server_hosts[0]).to.equal('https://localhost:8220'); @@ -48,8 +49,8 @@ describe('Edit settings', () => { }); it('should update outputs', () => { - cy.getBySel('editOutputBtn').click(); - cy.get('[placeholder="Specify name"').clear().type('output-1'); + cy.getBySel(SETTINGS_OUTPUTS.EDIT_BTN).click(); + cy.getBySel(SETTINGS_OUTPUTS.NAME_INPUT).clear().type('output-1'); cy.get('[placeholder="Specify host URL"').clear().type('http://elasticsearch:9200'); cy.intercept('/api/fleet/outputs', { @@ -71,8 +72,8 @@ describe('Edit settings', () => { is_default_monitoring: true, }).as('updateOutputs'); - cy.getBySel('saveApplySettingsBtn').click(); - cy.getBySel(CONFIRM_MODAL_BTN).click(); + cy.getBySel(SETTINGS_SAVE_BTN).click(); + cy.getBySel(CONFIRM_MODAL.CONFIRM_BUTTON).click(); cy.wait('@updateOutputs').then((interception) => { expect(interception.request.body.name).to.equal('output-1'); @@ -80,9 +81,9 @@ describe('Edit settings', () => { }); it('should allow to create a logstash output', () => { - cy.getBySel('addOutputBtn').click(); - cy.get('[placeholder="Specify name"]').clear().type('output-logstash-1'); - cy.get('[placeholder="Specify type"]').select('logstash'); + cy.getBySel(SETTINGS_OUTPUTS.ADD_BTN).click(); + cy.getBySel(SETTINGS_OUTPUTS.NAME_INPUT).clear().type('output-logstash-1'); + cy.getBySel(SETTINGS_OUTPUTS.TYPE_INPUT).select('logstash'); cy.get('[placeholder="Specify host"').clear().type('logstash:5044'); cy.get('[placeholder="Specify ssl certificate"]').clear().type('SSL CERTIFICATE'); cy.get('[placeholder="Specify certificate key"]').clear().type('SSL KEY'); @@ -110,7 +111,7 @@ describe('Edit settings', () => { }, }).as('postLogstashOutput'); - cy.getBySel('saveApplySettingsBtn').click(); + cy.getBySel(SETTINGS_SAVE_BTN).click(); cy.wait('@postLogstashOutput').then((interception) => { expect(interception.request.body.name).to.equal('output-logstash-1'); diff --git a/x-pack/plugins/fleet/cypress/integration/fleet_startup.spec.ts b/x-pack/plugins/fleet/cypress/integration/fleet_startup.spec.ts index 7d7f0d1c5119c..befa2074ac865 100644 --- a/x-pack/plugins/fleet/cypress/integration/fleet_startup.spec.ts +++ b/x-pack/plugins/fleet/cypress/integration/fleet_startup.spec.ts @@ -8,9 +8,12 @@ import { AGENTS_TAB, ADD_AGENT_BUTTON_TOP, - AGENT_FLYOUT_CLOSE_BUTTON, - STANDALONE_TAB, - AGENT_POLICY_CODE_BLOCK, + AGENT_FLYOUT, + CREATE_FLEET_SERVER_POLICY_BTN, + AGENT_POLICY_CREATE_STATUS_CALLOUT, + FLEET_SERVER_HOST_INPUT, + ADVANCED_FLEET_SERVER_ADD_HOST_BUTTON, + ADVANCED_FLEET_SERVER_GENERATE_SERVICE_TOKEN_BUTTON, } from '../screens/fleet'; import { cleanupAgentPolicies, unenrollAgent } from '../tasks/cleanup'; import { verifyPolicy, verifyAgentPackage, navigateToTab } from '../tasks/fleet'; @@ -49,11 +52,11 @@ describe('Fleet startup', () => { it('should create agent policy', () => { cy.getBySel(ADD_AGENT_BUTTON_TOP).click(); - cy.getBySel(STANDALONE_TAB).click(); + cy.getBySel(AGENT_FLYOUT.STANDALONE_TAB).click(); cy.intercept('POST', '/api/fleet/agent_policies?sys_monitoring=true').as('createAgentPolicy'); - cy.getBySel('createPolicyBtn').click(); + cy.getBySel(AGENT_FLYOUT.CREATE_POLICY_BUTTON, { timeout: 10000 }).click(); let agentPolicyId: string; const startTime = Date.now(); @@ -62,12 +65,12 @@ describe('Fleet startup', () => { agentPolicyId = xhr.response.body.item.id; // verify create button changed to dropdown - cy.getBySel('agentPolicyDropdown'); + cy.getBySel(AGENT_FLYOUT.POLICY_DROPDOWN); // verify agent.yml code block has new policy id - cy.getBySel(AGENT_POLICY_CODE_BLOCK).contains(`id: ${agentPolicyId}`); + cy.getBySel(AGENT_FLYOUT.AGENT_POLICY_CODE_BLOCK).contains(`id: ${agentPolicyId}`); - cy.getBySel(AGENT_FLYOUT_CLOSE_BUTTON).click(); + cy.getBySel(AGENT_FLYOUT.CLOSE_BUTTON).click(); // verify policy is created and has system package verifyPolicy('Agent policy 1', ['System']); @@ -77,11 +80,11 @@ describe('Fleet startup', () => { }); it('should create Fleet Server policy', () => { - cy.getBySel('fleetServerFlyoutTab-advanced').click(); - cy.getBySel('createFleetServerPolicyBtn').click(); + cy.getBySel(AGENT_FLYOUT.ADVANCED_TAB_BUTTON).click(); + cy.getBySel(CREATE_FLEET_SERVER_POLICY_BTN).click(); // Wait until the success callout is shown before navigating away - cy.getBySel('agentPolicyCreateStatusCallOut') + cy.getBySel(AGENT_POLICY_CREATE_STATUS_CALLOUT) .should('exist') .and('have.class', 'euiCallOut--success'); @@ -89,18 +92,18 @@ describe('Fleet startup', () => { verifyPolicy('Fleet Server policy 1', ['Fleet Server', 'System']); navigateToTab(AGENTS_TAB); - cy.getBySel('fleetServerFlyoutTab-advanced').click(); + cy.getBySel(AGENT_FLYOUT.ADVANCED_TAB_BUTTON).click(); // verify create button changed to dropdown - cy.getBySel('agentPolicyDropdown'); + cy.getBySel(AGENT_FLYOUT.POLICY_DROPDOWN); // verify fleet server enroll command contains created policy id - cy.getBySel('fleetServerHostInput') + cy.getBySel(FLEET_SERVER_HOST_INPUT) .getBySel('comboBoxSearchInput') .type('https://localhost:8220'); - cy.getBySel('fleetServerAddHostBtn').click(); - cy.getBySel('fleetServerGenerateServiceTokenBtn').click(); + cy.getBySel(ADVANCED_FLEET_SERVER_ADD_HOST_BUTTON).click(); + cy.getBySel(ADVANCED_FLEET_SERVER_GENERATE_SERVICE_TOKEN_BUTTON).click(); cy.get('.euiCodeBlock__code').contains('--fleet-server-policy=fleet-server-policy'); }); }); diff --git a/x-pack/plugins/fleet/cypress/integration/install_assets.spec.ts b/x-pack/plugins/fleet/cypress/integration/install_assets.spec.ts index 1c6268d2cf66a..81ef56a4b1f52 100644 --- a/x-pack/plugins/fleet/cypress/integration/install_assets.spec.ts +++ b/x-pack/plugins/fleet/cypress/integration/install_assets.spec.ts @@ -7,6 +7,9 @@ import type { Interception } from 'cypress/types/net-stubbing'; +import { CONFIRM_MODAL } from '../screens/navigation'; +import { SETTINGS } from '../screens/integrations'; + describe('Install unverified package assets', () => { beforeEach(() => { cy.intercept('POST', '/api/fleet/epm/packages/fleet_server/*', (req) => { @@ -46,13 +49,13 @@ describe('Install unverified package assets', () => { it('should show force install modal if package is unverified', () => { cy.visit('app/integrations/detail/fleet_server/settings'); - cy.getBySel('installAssetsButton').click(); + cy.getBySel(SETTINGS.INSTALL_ASSETS_BTN).click(); // this action will install x assets modal - const confirmInstall = cy.getBySel('confirmModalConfirmButton'); + const confirmInstall = cy.getBySel(CONFIRM_MODAL.CONFIRM_BUTTON); confirmInstall.click(); // unverified integration force install modal - const installAnyway = cy.getBySel('confirmModalConfirmButton').contains('Install anyway'); + const installAnyway = cy.getBySel(CONFIRM_MODAL.CONFIRM_BUTTON).contains('Install anyway'); installAnyway.click(); // cypress 'hack' to get all requests made to an intercepted request diff --git a/x-pack/plugins/fleet/cypress/integration/integrations_mock.spec.ts b/x-pack/plugins/fleet/cypress/integration/integrations_mock.spec.ts index 1b969e1a8ca2e..ce207cd3598e2 100644 --- a/x-pack/plugins/fleet/cypress/integration/integrations_mock.spec.ts +++ b/x-pack/plugins/fleet/cypress/integration/integrations_mock.spec.ts @@ -7,7 +7,9 @@ import { navigateTo } from '../tasks/navigation'; import { UPDATE_PACKAGE_BTN } from '../screens/integrations'; +import { LOADING_SPINNER, TOAST_CLOSE_BTN } from '../screens/navigation'; import { AGENT_POLICY_SAVE_INTEGRATION } from '../screens/fleet'; +import { INSTALLED_VERSION, INTEGRATION_POLICIES_UPGRADE_CHECKBOX } from '../screens/integrations'; describe('Add Integration - Mock API', () => { describe('upgrade package and upgrade package policy', () => { @@ -92,10 +94,10 @@ describe('Add Integration - Mock API', () => { it('should upgrade policies without integration update', () => { navigateTo(`app/integrations/detail/apache-${oldVersion}/settings`); - cy.get('.euiLoadingSpinner').should('not.exist'); - cy.getBySel('installedVersion').contains(oldVersion); + cy.getBySel(LOADING_SPINNER).should('not.exist'); + cy.getBySel(INSTALLED_VERSION).contains(oldVersion); - cy.get('#upgradePoliciesCheckbox').uncheck({ force: true }); + cy.getBySel(INTEGRATION_POLICIES_UPGRADE_CHECKBOX).uncheck({ force: true }); cy.intercept(`/api/fleet/epm/packages/apache/${newVersion}`, { item: { @@ -109,8 +111,8 @@ describe('Add Integration - Mock API', () => { }).as('updatePackage'); cy.getBySel(UPDATE_PACKAGE_BTN).click(); cy.wait('@updatePackage'); - cy.get('#upgradePoliciesCheckbox').should('not.exist'); - cy.getBySel('installedVersion').contains(newVersion); + cy.getBySel(INTEGRATION_POLICIES_UPGRADE_CHECKBOX).should('not.exist'); + cy.getBySel(INSTALLED_VERSION).contains(newVersion); }); it('should upgrade integration policy', () => { @@ -141,7 +143,7 @@ describe('Add Integration - Mock API', () => { '/app/fleet/policies/package-1/upgrade-package-policy/apache-2?from=integrations-policy-list' ); - cy.getBySel('toastCloseButton').click(); + cy.getBySel(TOAST_CLOSE_BTN).click(); cy.getBySel(AGENT_POLICY_SAVE_INTEGRATION).click(); cy.wait('@updateApachePolicy').then((interception) => { diff --git a/x-pack/plugins/fleet/cypress/integration/integrations_real.spec.ts b/x-pack/plugins/fleet/cypress/integration/integrations_real.spec.ts index 1caa90ba1b785..34fa5b7af55ca 100644 --- a/x-pack/plugins/fleet/cypress/integration/integrations_real.spec.ts +++ b/x-pack/plugins/fleet/cypress/integration/integrations_real.spec.ts @@ -14,9 +14,8 @@ import { } from '../tasks/integrations'; import { AGENT_POLICY_NAME_LINK, - CONFIRM_MODAL_BTN, FLYOUT_CLOSE_BTN_SEL, - INTEGRATIONS_CARD, + getIntegrationCard, INTEGRATION_NAME_LINK, LATEST_VERSION, PACKAGE_VERSION, @@ -24,30 +23,22 @@ import { SETTINGS_TAB, UPDATE_PACKAGE_BTN, INTEGRATIONS_SEARCHBAR_INPUT, + SETTINGS, + INTEGRATION_POLICIES_UPGRADE_CHECKBOX, } from '../screens/integrations'; +import { LOADING_SPINNER, CONFIRM_MODAL } from '../screens/navigation'; import { ADD_PACKAGE_POLICY_BTN } from '../screens/fleet'; import { cleanupAgentPolicies } from '../tasks/cleanup'; -describe.skip('Add Integration - Real API', () => { - const integration = 'Apache'; +describe('Add Integration - Real API', () => { + const integration = 'apache'; after(() => { - cleanupAgentPolicies(); + deleteIntegrations(); }); - it('should install integration without policy', () => { - cy.visit('/app/integrations/detail/tomcat/settings'); - - cy.get('.euiButton').contains('Install Apache Tomcat assets').click(); - cy.get('.euiCallOut').contains('This action will install 1 assets'); - cy.getBySel(CONFIRM_MODAL_BTN).click(); - - cy.get('.euiLoadingSpinner').should('not.exist'); - - cy.get('.euiButton').contains('Uninstall Apache Tomcat').click(); - cy.getBySel(CONFIRM_MODAL_BTN).click(); - cy.get('.euiLoadingSpinner').should('not.exist'); - cy.get('.euiButton').contains('Install Apache Tomcat assets'); + afterEach(() => { + cleanupAgentPolicies(); }); function addAndVerifyIntegration() { @@ -66,27 +57,49 @@ describe.skip('Add Integration - Real API', () => { navigateTo(INTEGRATIONS); cy.wait('@packages'); - cy.get('.euiLoadingSpinner').should('not.exist'); - cy.get(INTEGRATIONS_SEARCHBAR_INPUT).type('Apache'); - cy.get(INTEGRATIONS_CARD).contains(integration).click(); + cy.getBySel(LOADING_SPINNER).should('not.exist'); + cy.getBySel(INTEGRATIONS_SEARCHBAR_INPUT).type('Apache'); + cy.getBySel(getIntegrationCard(integration)).click(); addIntegration(); cy.getBySel(INTEGRATION_NAME_LINK).contains('apache-1'); } - afterEach(() => { - deleteIntegrations(integration); + it('should install integration without policy', () => { + cy.visit('/app/integrations/detail/tomcat/settings'); + + cy.getBySel(SETTINGS.INSTALL_ASSETS_BTN).click(); + cy.get('.euiCallOut').contains('This action will install 1 assets'); + cy.getBySel(CONFIRM_MODAL.CONFIRM_BUTTON).click(); + + cy.getBySel(LOADING_SPINNER).should('not.exist'); + + cy.getBySel(SETTINGS.UNINSTALL_ASSETS_BTN).click(); + cy.getBySel(CONFIRM_MODAL.CONFIRM_BUTTON).click(); + cy.getBySel(LOADING_SPINNER).should('not.exist'); + cy.getBySel(SETTINGS.INSTALL_ASSETS_BTN).should('exist'); }); + it('should display Apache integration in the Policies list once installed ', () => { addAndVerifyIntegration(); cy.getBySel(AGENT_POLICY_NAME_LINK).contains('Agent policy 1'); }); it('should add integration to policy', () => { - cy.request('/api/fleet/agent_policies').then((response: any) => { - const agentPolicyId = response.body.items - .filter((policy: any) => policy.name === 'Agent policy 1') - .map((policy: any) => policy.id); + const agentPolicyId = 'policy_1'; + cy.request({ + method: 'POST', + url: `/api/fleet/agent_policies`, + body: { + id: `${agentPolicyId}`, + name: 'Agent policy 1', + description: 'desc', + namespace: 'default', + monitoring_enabled: ['logs', 'metrics'], + }, + headers: { 'kbn-xsrf': 'cypress' }, + }); + cy.request('/api/fleet/agent_policies').then((response: any) => { cy.visit(`/app/fleet/policies/${agentPolicyId}`); cy.intercept( @@ -104,9 +117,9 @@ describe.skip('Add Integration - Real API', () => { cy.getBySel(ADD_PACKAGE_POLICY_BTN).click(); cy.wait('@packages'); - cy.get('.euiLoadingSpinner').should('not.exist'); - cy.get(INTEGRATIONS_SEARCHBAR_INPUT).type('Apache'); - cy.get(INTEGRATIONS_CARD).contains(integration).click(); + cy.getBySel(LOADING_SPINNER).should('not.exist'); + cy.getBySel(INTEGRATIONS_SEARCHBAR_INPUT).type('Apache'); + cy.getBySel(getIntegrationCard(integration)).click(); addIntegration({ useExistingPolicy: true }); cy.get('.euiBasicTable-loading').should('not.exist'); cy.get('.euiTitle').contains('Agent policy 1'); @@ -120,7 +133,7 @@ describe.skip('Add Integration - Real API', () => { installPackageWithVersion('apache', oldVersion); navigateTo(`app/integrations/detail/apache-${oldVersion}/policies`); - addIntegration({ useExistingPolicy: true }); + addIntegration(); cy.getBySel(INTEGRATION_NAME_LINK).contains('apache-'); cy.getBySel(PACKAGE_VERSION).contains(oldVersion); @@ -129,11 +142,11 @@ describe.skip('Add Integration - Real API', () => { cy.getBySel(SETTINGS_TAB).click(); cy.getBySel(UPDATE_PACKAGE_BTN).click(); - cy.getBySel(CONFIRM_MODAL_BTN).click(); + cy.getBySel(CONFIRM_MODAL.CONFIRM_BUTTON).click(); cy.getBySel(LATEST_VERSION).then(($title) => { const newVersion = $title.text(); - cy.get('#upgradePoliciesCheckbox').should('not.exist'); + cy.getBySel(INTEGRATION_POLICIES_UPGRADE_CHECKBOX).should('not.exist'); cy.getBySel(POLICIES_TAB).click(); cy.getBySel(PACKAGE_VERSION).contains(oldVersion).should('not.exist'); cy.getBySel(PACKAGE_VERSION).contains(newVersion); diff --git a/x-pack/plugins/fleet/cypress/integration/package_policy.spec.ts b/x-pack/plugins/fleet/cypress/integration/package_policy.spec.ts index b2fa21371539d..8b1569574c4e7 100644 --- a/x-pack/plugins/fleet/cypress/integration/package_policy.spec.ts +++ b/x-pack/plugins/fleet/cypress/integration/package_policy.spec.ts @@ -4,6 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ +import { TOAST_CLOSE_BTN } from '../screens/navigation'; describe('Edit package policy', () => { const policyConfig = { @@ -109,7 +110,7 @@ describe('Edit package policy', () => { it('should edit package policy', () => { cy.visit('/app/fleet/policies/fleet-server-policy/edit-integration/policy-1'); - cy.getBySel('toastCloseButton').click(); + cy.getBySel(TOAST_CLOSE_BTN).click(); cy.getBySel('packagePolicyDescriptionInput').clear().type('desc'); cy.intercept('PUT', '/api/fleet/package_policies/policy-1', { diff --git a/x-pack/plugins/fleet/cypress/integration/privileges_fleet_all_integrations_read.spec.ts b/x-pack/plugins/fleet/cypress/integration/privileges_fleet_all_integrations_read.spec.ts index 327ba39e65377..517687a0bcd19 100644 --- a/x-pack/plugins/fleet/cypress/integration/privileges_fleet_all_integrations_read.spec.ts +++ b/x-pack/plugins/fleet/cypress/integration/privileges_fleet_all_integrations_read.spec.ts @@ -15,6 +15,7 @@ import { import { loginWithUserAndWaitForPage, logout } from '../tasks/login'; import { navigateToTab, createAgentPolicy } from '../tasks/fleet'; import { cleanupAgentPolicies, unenrollAgent } from '../tasks/cleanup'; +import { getIntegrationCard } from '../screens/integrations'; import { FLEET_SERVER_MISSING_PRIVILEGES_TITLE, @@ -24,7 +25,7 @@ import { AGENT_POLICY_SAVE_INTEGRATION, ADD_PACKAGE_POLICY_BTN, } from '../screens/fleet'; -import { ADD_POLICY_BTN, AGENT_POLICY_NAME_LINK } from '../screens/integrations'; +import { ADD_INTEGRATION_POLICY_BTN, AGENT_POLICY_NAME_LINK } from '../screens/integrations'; const rolesToCreate = [FleetAllIntegrReadRole]; const usersToCreate = [FleetAllIntegrReadUser]; @@ -81,8 +82,8 @@ describe('When the user has All privilege for Fleet but Read for integrations', describe('Integrations', () => { it('are visible but cannot be added', () => { loginWithUserAndWaitForPage(INTEGRATIONS, FleetAllIntegrReadUser); - cy.getBySel('integration-card:epr:apache').click(); - cy.getBySel(ADD_POLICY_BTN).should('be.disabled'); + cy.getBySel(getIntegrationCard('apache')).click(); + cy.getBySel(ADD_INTEGRATION_POLICY_BTN).should('be.disabled'); }); }); }); diff --git a/x-pack/plugins/fleet/cypress/integration/privileges_fleet_none_integrations_all.spec.ts b/x-pack/plugins/fleet/cypress/integration/privileges_fleet_none_integrations_all.spec.ts index 68fcecb76de21..71e7d948f928a 100644 --- a/x-pack/plugins/fleet/cypress/integration/privileges_fleet_none_integrations_all.spec.ts +++ b/x-pack/plugins/fleet/cypress/integration/privileges_fleet_none_integrations_all.spec.ts @@ -14,7 +14,7 @@ import { } from '../tasks/privileges'; import { loginWithUserAndWaitForPage, logout } from '../tasks/login'; -import { ADD_POLICY_BTN } from '../screens/integrations'; +import { ADD_INTEGRATION_POLICY_BTN, getIntegrationCard } from '../screens/integrations'; const rolesToCreate = [FleetNoneIntegrAllRole]; const usersToCreate = [FleetNoneIntegrAllUser]; @@ -34,7 +34,7 @@ describe('When the user has All privileges for Integrations but None for for Fle it('Integrations are visible but cannot be added', () => { loginWithUserAndWaitForPage(INTEGRATIONS, FleetNoneIntegrAllUser); - cy.getBySel('integration-card:epr:apache').click(); - cy.getBySel(ADD_POLICY_BTN).should('be.disabled'); + cy.getBySel(getIntegrationCard('apache')).click(); + cy.getBySel(ADD_INTEGRATION_POLICY_BTN).should('be.disabled'); }); }); diff --git a/x-pack/plugins/fleet/cypress/screens/fleet.ts b/x-pack/plugins/fleet/cypress/screens/fleet.ts index 72dd6486c6843..a9df1dc4d8ef1 100644 --- a/x-pack/plugins/fleet/cypress/screens/fleet.ts +++ b/x-pack/plugins/fleet/cypress/screens/fleet.ts @@ -7,16 +7,13 @@ export const ADD_AGENT_BUTTON = 'addAgentButton'; export const ADD_AGENT_BUTTON_TOP = 'addAgentBtnTop'; -export const CREATE_POLICY_BUTTON = 'createPolicyBtn'; -export const AGENT_FLYOUT_CLOSE_BUTTON = 'euiFlyoutCloseButton'; -export const AGENT_POLICY_CODE_BLOCK = 'agentPolicyCodeBlock'; export const AGENTS_TAB = 'fleet-agents-tab'; export const AGENT_POLICIES_TAB = 'fleet-agent-policies-tab'; export const ENROLLMENT_TOKENS_TAB = 'fleet-enrollment-tokens-tab'; export const DATA_STREAMS_TAB = 'fleet-datastreams-tab'; export const SETTINGS_TAB = 'fleet-settings-tab'; -export const STANDALONE_TAB = 'standaloneTab'; + export const MISSING_PRIVILEGES_TITLE = 'missingPrivilegesPromptTitle'; export const MISSING_PRIVILEGES_MESSAGE = 'missingPrivilegesPromptMessage'; export const FLEET_SERVER_MISSING_PRIVILEGES_MESSAGE = 'fleetServerMissingPrivilegesMessage'; @@ -26,20 +23,57 @@ export const PACKAGE_POLICY_TABLE_LINK = 'PackagePoliciesTableLink'; export const ADD_PACKAGE_POLICY_BTN = 'addPackagePolicyButton'; export const GENERATE_FLEET_SERVER_POLICY_BUTTON = 'generateFleetServerPolicyButton'; export const ADD_FLEET_SERVER_HEADER = 'addFleetServerHeader'; -export const AGENTS_QUICK_START_TAB_BUTTON = 'fleetServerFlyoutTab-quickStart'; -export const AGENTS_ADVANCED_TAB_BUTTON = 'fleetServerFlyoutTab-advanced'; + export const PLATFORM_TYPE_LINUX_BUTTON = 'platformTypeLinux'; export const ADVANCED_FLEET_SERVER_ADD_HOST_BUTTON = 'fleetServerAddHostBtn'; export const ADVANCED_FLEET_SERVER_GENERATE_SERVICE_TOKEN_BUTTON = 'fleetServerGenerateServiceTokenBtn'; -export const AGENT_POLICIES_CREATE_AGENT_POLICY_BUTTON = 'createAgentPolicyButton'; -export const AGENT_POLICIES_CREATE_AGENT_POLICY_FLYOUT_TITLE = 'createAgentPolicyFlyoutTitle'; + +export const CREATE_FLEET_SERVER_POLICY_BTN = 'createFleetServerPolicyBtn'; + export const AGENT_POLICY_CREATE_AGENT_POLICY_NAME_FIELD = 'createAgentPolicyNameField'; export const AGENT_POLICIES_FLYOUT_ADVANCED_DEFAULT_NAMESPACE_HEADER = 'defaultNamespaceHeader'; export const AGENT_POLICY_FLYOUT_CREATE_BUTTON = 'createAgentPolicyFlyoutBtn'; -export const ENROLLMENT_TOKENS_CREATE_TOKEN_BUTTON = 'createEnrollmentTokenButton'; -export const ENROLLMENT_TOKENS_CREATE_TOKEN_NAME_FIELD = 'createEnrollmentTokenNameField'; + +export const ENROLLMENT_TOKENS = { + CREATE_TOKEN_BUTTON: 'createEnrollmentTokenButton', + CREATE_TOKEN_MODAL_NAME_FIELD: 'createEnrollmentTokenNameField', + CREATE_TOKEN_MODAL_SELECT_FIELD: 'createEnrollmentTokenSelectField', + LIST_TABLE: 'enrollmentTokenListTable', + TABLE_REVOKE_BTN: 'enrollmentTokenTable.revokeBtn', +}; export const SETTINGS_FLEET_SERVER_HOST_HEADING = 'fleetServerHostHeader'; +export const SETTINGS_SAVE_BTN = 'saveApplySettingsBtn'; + +export const AGENT_POLICY_SYSTEM_MONITORING_CHECKBOX = 'agentPolicyFormSystemMonitoringCheckbox'; +export const INSTALL_INTEGRATIONS_ADVANCE_OPTIONS_BTN = 'AgentPolicyAdvancedOptions.AccordionBtn'; +export const AGENT_POLICY_CREATE_STATUS_CALLOUT = 'agentPolicyCreateStatusCallOut'; +export const FLEET_SERVER_HOST_INPUT = 'fleetServerHostInput'; +export const EXISTING_HOSTS_TAB = 'existingHostsTab'; +export const NEW_HOSTS_TAB = 'newHostsTab'; + +export const CURRENT_BULK_UPGRADES_CALLOUT = { + ABORT_BTN: 'currentBulkUpgrade.abortBtn', +}; + +export const AGENT_FLYOUT = { + CREATE_POLICY_BUTTON: 'createPolicyBtn', + CLOSE_BUTTON: 'euiFlyoutCloseButton', + POLICY_DROPDOWN: 'agentPolicyDropdown', + QUICK_START_TAB_BUTTON: 'fleetServerFlyoutTab-quickStart', + ADVANCED_TAB_BUTTON: 'fleetServerFlyoutTab-advanced', + AGENT_POLICY_CODE_BLOCK: 'agentPolicyCodeBlock', + STANDALONE_TAB: 'standaloneTab', + CONFIRM_AGENT_ENROLLMENT_BUTTON: 'ConfirmAgentEnrollmentButton', + INCOMING_DATA_CONFIRMED_CALL_OUT: 'IncomingDataConfirmedCallOut', +}; + +export const AGENT_POLICIES_CREATE_AGENT_POLICY_FLYOUT = { + TITLE: 'createAgentPolicyFlyoutTitle', + CREATE_BUTTON: 'createAgentPolicyButton', + COLLECT_LOGS_CHECKBOX: 'collectLogsCheckbox', + COLLECT_METRICS_CHECKBOX: 'collectMetricsCheckbox', +}; export const AGENT_BINARY_SOURCES_TABLE = 'AgentDownloadSourcesTable'; export const AGENT_BINARY_SOURCES_TABLE_ACTIONS = { @@ -59,13 +93,24 @@ export const AGENT_BINARY_SOURCES_FLYOUT = { CANCEL_BUTTON: 'editDownloadSourcesFlyout.cancelBtn', }; -export const ADD_AGENT_FLYOUT = { - CONFIRM_AGENT_ENROLLMENT_BUTTON: 'ConfirmAgentEnrollmentButton', - INCOMING_DATA_CONFIRMED_CALL_OUT: 'IncomingDataConfirmedCallOut', +export const SETTINGS_OUTPUTS = { + EDIT_BTN: 'editOutputBtn', + ADD_BTN: 'addOutputBtn', + EDIT_HOSTS_BTN: 'editHostsBtn', + NAME_INPUT: 'settingsOutputsFlyout.nameInput', + TYPE_INPUT: 'settingsOutputsFlyout.typeInput', }; -export const CONFIRM_MODAL_CONFIRM_BUTTON = 'confirmModalConfirmButton'; -export const CONFIRM_MODAL_CANCEL_BUTTON = 'confirmModalCancelButton'; export const AGENT_POLICY_FORM = { DOWNLOAD_SOURCE_SELECT: 'agentPolicyForm.downloadSource.select', }; + +export const FLEET_AGENT_LIST_PAGE = { + TABLE: 'fleetAgentListTable', + STATUS_FILTER: 'agentList.statusFilter', + POLICY_FILTER: 'agentList.policyFilter', + QUERY_INPUT: 'agentList.queryInput', + SHOW_UPGRADEABLE: 'agentList.showUpgradeable', + CHECKBOX_SELECT_ALL: 'checkboxSelectAll', + BULK_ACTIONS_BUTTON: 'agentBulkActionsButton', +}; diff --git a/x-pack/plugins/fleet/cypress/screens/integrations.ts b/x-pack/plugins/fleet/cypress/screens/integrations.ts index 929e36d191230..3915c6600baaa 100644 --- a/x-pack/plugins/fleet/cypress/screens/integrations.ts +++ b/x-pack/plugins/fleet/cypress/screens/integrations.ts @@ -5,17 +5,13 @@ * 2.0. */ -export const ADD_POLICY_BTN = 'addIntegrationPolicyButton'; +export const ADD_INTEGRATION_POLICY_BTN = 'addIntegrationPolicyButton'; export const CREATE_PACKAGE_POLICY_SAVE_BTN = 'createPackagePolicySaveButton'; -export const INTEGRATIONS_CARD = '.euiCard__titleButton'; export const INTEGRATION_NAME_LINK = 'integrationNameLink'; export const AGENT_POLICY_NAME_LINK = 'agentPolicyNameLink'; export const AGENT_ACTIONS_BTN = 'agentActionsBtn'; -export const CONFIRM_MODAL_BTN = 'confirmModalConfirmButton'; -export const CONFIRM_MODAL_BTN_SEL = `[data-test-subj=${CONFIRM_MODAL_BTN}]`; - export const FLYOUT_CLOSE_BTN_SEL = '[data-test-subj="euiFlyoutCloseButton"]'; export const SETTINGS_TAB = 'tab-settings'; @@ -23,7 +19,17 @@ export const POLICIES_TAB = 'tab-policies'; export const ADVANCED_TAB = 'tab-custom'; export const UPDATE_PACKAGE_BTN = 'updatePackageBtn'; -export const LATEST_VERSION = 'latestVersion'; +export const LATEST_VERSION = 'epmSettings.latestVersionTitle'; +export const INSTALLED_VERSION = 'epmSettings.installedVersionTitle'; export const PACKAGE_VERSION = 'packageVersionText'; export const INTEGRATIONS_SEARCHBAR_INPUT = 'epmList.searchBar'; + +export const SETTINGS = { + INSTALL_ASSETS_BTN: 'installAssetsButton', + UNINSTALL_ASSETS_BTN: 'uninstallAssetsButton', +}; + +export const INTEGRATION_POLICIES_UPGRADE_CHECKBOX = 'epmDetails.upgradePoliciesCheckbox'; + +export const getIntegrationCard = (integration: string) => `integration-card:epr:${integration}`; diff --git a/x-pack/plugins/fleet/cypress/screens/navigation.ts b/x-pack/plugins/fleet/cypress/screens/navigation.ts index 76b73711db495..b8f6bea719e8a 100644 --- a/x-pack/plugins/fleet/cypress/screens/navigation.ts +++ b/x-pack/plugins/fleet/cypress/screens/navigation.ts @@ -7,3 +7,13 @@ export const TOGGLE_NAVIGATION_BTN = 'toggleNavButton'; export const NAV_APP_LINK = 'collapsibleNavAppLink'; +export const LOADING_SPINNER = '.euiLoadingSpinner'; +export const TOAST_CLOSE_BTN = 'toastCloseButton'; + +// these selectors are part of a common component and so are used everywhere +export const CONFIRM_MODAL = { + CONFIRM_BUTTON: 'confirmModalConfirmButton', + CANCEL_BUTTON: 'confirmModalCancelButton', +}; + +export const CONFIRM_MODAL_BTN_SEL = `[data-test-subj=${CONFIRM_MODAL.CONFIRM_BUTTON}]`; diff --git a/x-pack/plugins/fleet/cypress/tasks/cleanup.ts b/x-pack/plugins/fleet/cypress/tasks/cleanup.ts index b0d18fa9cdceb..2a1e57271f08a 100644 --- a/x-pack/plugins/fleet/cypress/tasks/cleanup.ts +++ b/x-pack/plugins/fleet/cypress/tasks/cleanup.ts @@ -48,3 +48,18 @@ export function cleanupDownloadSources() { }); }); } + +export function deleteFleetServerDocs(ignoreUnavailable: boolean = false) { + cy.task('deleteDocsByQuery', { + index: '.fleet-servers', + query: { match_all: {} }, + ignoreUnavailable, + }); +} +export function deleteAgentDocs(ignoreUnavailable: boolean = false) { + cy.task('deleteDocsByQuery', { + index: '.fleet-agents', + query: { match_all: {} }, + ignoreUnavailable, + }); +} diff --git a/x-pack/plugins/fleet/cypress/tasks/fleet.ts b/x-pack/plugins/fleet/cypress/tasks/fleet.ts index 4a23daf7a8380..35d6c5cf5dd79 100644 --- a/x-pack/plugins/fleet/cypress/tasks/fleet.ts +++ b/x-pack/plugins/fleet/cypress/tasks/fleet.ts @@ -6,13 +6,14 @@ */ import { + AGENT_FLYOUT, AGENT_POLICIES_TAB, ENROLLMENT_TOKENS_TAB, ADD_AGENT_BUTTON_TOP, - CREATE_POLICY_BUTTON, - AGENT_FLYOUT_CLOSE_BUTTON, - STANDALONE_TAB, + PACKAGE_POLICY_TABLE_LINK, } from '../screens/fleet'; +import { LOADING_SPINNER } from '../screens/navigation'; +import { getIntegrationCard } from '../screens/integrations'; export function createAgentPolicy() { cy.intercept({ @@ -20,11 +21,11 @@ export function createAgentPolicy() { method: 'POST', }).as('postAgentPolicy'); cy.getBySel(ADD_AGENT_BUTTON_TOP).click(); - cy.getBySel(STANDALONE_TAB).click(); - cy.getBySel(CREATE_POLICY_BUTTON).click(); + cy.getBySel(AGENT_FLYOUT.STANDALONE_TAB).click(); + cy.getBySel(AGENT_FLYOUT.CREATE_POLICY_BUTTON).click(); cy.wait('@postAgentPolicy'); - cy.getBySel(AGENT_FLYOUT_CLOSE_BUTTON).click(); + cy.getBySel(AGENT_FLYOUT.CLOSE_BUTTON).click(); } export function navigateToTab(tab: string) { @@ -34,7 +35,7 @@ export function navigateToTab(tab: string) { export function navigateToAgentPolicy(name: string) { cy.get('.euiLink').contains(name).click(); - cy.get('.euiLoadingSpinner').should('not.exist'); + cy.getBySel(LOADING_SPINNER).should('not.exist'); } export function navigateToEnrollmentTokens() { @@ -48,7 +49,7 @@ export function verifyPolicy(name: string, integrations: string[]) { navigateToAgentPolicy(name); integrations.forEach((integration) => { - cy.get('.euiLink').contains(integration); + cy.getBySel(PACKAGE_POLICY_TABLE_LINK).contains(integration); }); cy.get('.euiButtonEmpty').contains('View all agent policies').click(); @@ -60,16 +61,5 @@ export function verifyPolicy(name: string, integrations: string[]) { export function verifyAgentPackage() { cy.visit('/app/integrations/installed'); - cy.getBySel('integration-card:epr:elastic_agent'); -} - -export function setFleetServerHost(host = 'https://fleetserver:8220') { - cy.request({ - method: 'PUT', - url: '/api/fleet/settings', - headers: { 'kbn-xsrf': 'xx' }, - body: { - fleet_server_hosts: [host], - }, - }); + cy.getBySel(getIntegrationCard('elastic_agent')); } diff --git a/x-pack/plugins/fleet/cypress/tasks/fleet_server.ts b/x-pack/plugins/fleet/cypress/tasks/fleet_server.ts new file mode 100644 index 0000000000000..946ded57e738f --- /dev/null +++ b/x-pack/plugins/fleet/cypress/tasks/fleet_server.ts @@ -0,0 +1,61 @@ +/* + * 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. + */ +import { createAgentDoc } from './agents'; + +const FLEET_SERVER_POLICY_ID = 'fleet-server-policy'; + +// Create a Fleet server policy +export function setupFleetServer() { + let policyId: string; + let kibanaVersion: string; + + cy.request({ + method: 'POST', + url: '/api/fleet/agent_policies', + headers: { 'kbn-xsrf': 'xx' }, + body: { + id: FLEET_SERVER_POLICY_ID, + name: 'Fleet Server policy', + namespace: 'default', + has_fleet_server: true, + }, + }).then((response: any) => { + policyId = response.body.item.id; + }); + + cy.getKibanaVersion().then((version) => { + kibanaVersion = version; + }); + + // setup Fleet server + cy.wrap(null).then(() => { + cy.task('insertDocs', { + index: '.fleet-agents', + docs: [createAgentDoc('fleet-server', policyId, 'online', kibanaVersion)], + }); + cy.task('insertDocs', { + index: '.fleet-servers', + docs: [ + { + '@timestamp': new Date().toISOString(), + }, + ], + }); + setFleetServerHost(); + }); +} + +export function setFleetServerHost(host = 'https://fleetserver:8220') { + cy.request({ + method: 'PUT', + url: '/api/fleet/settings', + headers: { 'kbn-xsrf': 'xx' }, + body: { + fleet_server_hosts: [host], + }, + }); +} diff --git a/x-pack/plugins/fleet/cypress/tasks/integrations.ts b/x-pack/plugins/fleet/cypress/tasks/integrations.ts index 7e266dce523d5..71a8c3cd2f9a7 100644 --- a/x-pack/plugins/fleet/cypress/tasks/integrations.ts +++ b/x-pack/plugins/fleet/cypress/tasks/integrations.ts @@ -6,27 +6,34 @@ */ import { - ADD_POLICY_BTN, - CONFIRM_MODAL_BTN, + ADD_INTEGRATION_POLICY_BTN, CREATE_PACKAGE_POLICY_SAVE_BTN, FLYOUT_CLOSE_BTN_SEL, } from '../screens/integrations'; +import { AGENT_POLICY_SYSTEM_MONITORING_CHECKBOX, EXISTING_HOSTS_TAB } from '../screens/fleet'; +import { TOAST_CLOSE_BTN, CONFIRM_MODAL } from '../screens/navigation'; + export const addIntegration = ({ useExistingPolicy } = { useExistingPolicy: false }) => { - cy.getBySel(ADD_POLICY_BTN).click(); + cy.getBySel(ADD_INTEGRATION_POLICY_BTN).click(); if (useExistingPolicy) { - cy.get('#existing').click(); + cy.getBySel(EXISTING_HOSTS_TAB).click(); } else { // speeding up creating with unchecking system and agent integration - cy.getBySel('agentPolicyFormSystemMonitoringCheckbox').uncheck({ force: true }); - cy.getBySel('advancedOptionsBtn').find('.euiAccordion__button').click(); - cy.get('*[id^="logs_"]').uncheck({ force: true }); - cy.get('*[id^="metrics_"]').uncheck({ force: true }); + cy.getBySel(AGENT_POLICY_SYSTEM_MONITORING_CHECKBOX).uncheck({ force: true }); + cy.get('.euiAccordion__button').click(); + + cy.get('*[id^="logs_"]').uncheck({ + force: true, + }); + cy.get('*[id^="metrics_"]').uncheck({ + force: true, + }); } - cy.getBySel('toastCloseButton').click(); + cy.getBySel(TOAST_CLOSE_BTN).click(); cy.getBySel(CREATE_PACKAGE_POLICY_SAVE_BTN).click(); // sometimes agent is assigned to default policy, sometimes not - cy.getBySel(CONFIRM_MODAL_BTN).click(); + cy.getBySel(CONFIRM_MODAL.CONFIRM_BUTTON).click(); cy.getBySel(CREATE_PACKAGE_POLICY_SAVE_BTN).should('not.exist'); clickIfVisible(FLYOUT_CLOSE_BTN_SEL); @@ -40,14 +47,14 @@ export function clickIfVisible(selector: string) { }); } -export const deleteIntegrations = async (integration: string) => { +export const deleteIntegrations = async () => { const ids: string[] = []; cy.request('/api/fleet/package_policies').then((response: any) => { response.body.items.forEach((policy: any) => ids.push(policy.id)); cy.request({ url: `/api/fleet/package_policies/delete`, headers: { 'kbn-xsrf': 'cypress' }, - body: `{ "packagePolicyIds": ${JSON.stringify(ids)} }`, + body: `{ "packagePolicyIds": ${JSON.stringify(ids)}, "force": true }`, method: 'POST', }); }); diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx index d9e44c6207fc4..f8eab1fe8513e 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/components/agent_policy_advanced_fields/index.tsx @@ -182,6 +182,7 @@ export const AgentPolicyAdvancedOptionsContent: React.FunctionComponent = options={[ { id: `${dataTypes.Logs}_${monitoringCheckboxIdSuffix}`, + 'data-test-subj': 'collectLogsCheckbox', label: ( <> = }, { id: `${dataTypes.Metrics}_${monitoringCheckboxIdSuffix}`, + 'data-test-subj': 'collectMetricsCheckbox', label: ( <> = ({ const tabs = [ { id: SelectedPolicyTab.NEW, + 'data-test-subj': 'newHostsTab', name: 'New hosts', content: ( = ({ }, { id: SelectedPolicyTab.EXISTING, + 'data-test-subj': 'existingHostsTab', name: 'Existing hosts', content: ( { = () => { + data-test-subj="enrollmentTokenListTable" loading={isLoading} hasActions={true} noItemsMessage={ diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.tsx index 3d0e9b2801394..02e476ce1ed3d 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/settings/components/edit_output_flyout/index.tsx @@ -116,6 +116,7 @@ export const EditOutputFlyout: React.FunctionComponent = {...inputs.nameInput.formRowProps} > = > = )} {isESOutput && ( = memo(({ packageInfo, theme$ }: Prop /> - + {installedVersion} @@ -267,7 +267,7 @@ export const SettingsPage: React.FC = memo(({ packageInfo, theme$ }: Prop /> - + {latestVersion} diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/uninstall_button.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/uninstall_button.tsx index 73780e23a1a7e..df472c765c09a 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/uninstall_button.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/uninstall_button.tsx @@ -58,6 +58,7 @@ export const UninstallButton: React.FunctionComponent = ({ return canRemovePackages ? ( <> setIsUninstallModalVisible(true)} diff --git a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/update_button.tsx b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/update_button.tsx index cc11dd6819695..526c50aca1b96 100644 --- a/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/update_button.tsx +++ b/x-pack/plugins/fleet/public/applications/integrations/sections/epm/screens/detail/settings/update_button.tsx @@ -326,6 +326,7 @@ export const UpdateButton: React.FunctionComponent = ({ }, }} id="upgradePoliciesCheckbox" + data-test-subj="epmDetails.upgradePoliciesCheckbox" disabled={!canUpgradePackages} checked={upgradePackagePolicies} onChange={handleUpgradePackagePoliciesChange} diff --git a/x-pack/plugins/fleet/public/components/new_enrollment_key_modal.tsx b/x-pack/plugins/fleet/public/components/new_enrollment_key_modal.tsx index c611c9a543d73..8689e920d2a0f 100644 --- a/x-pack/plugins/fleet/public/components/new_enrollment_key_modal.tsx +++ b/x-pack/plugins/fleet/public/components/new_enrollment_key_modal.tsx @@ -131,7 +131,12 @@ export const NewEnrollmentTokenModal: React.FunctionComponent = ({ })} {...form.policyIdInput.formRowProps} > - +