Skip to content

Commit

Permalink
New attributes added for integration testing (#3331)
Browse files Browse the repository at this point in the history
* New attributes added for integration testing

* New constants added for integration testing

* Added new constants files for cypress

* updated selectors and atributes
  • Loading branch information
matiasmoreno876 authored Jun 9, 2021
1 parent c73c3dc commit 5c9d117
Show file tree
Hide file tree
Showing 12 changed files with 419 additions and 61 deletions.
44 changes: 42 additions & 2 deletions common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export enum WAZUH_AGENTS_OS_TYPE{
OTHERS = ''
}

export enum WAZUH_MODULES_ID{
export enum WAZUH_MODULES_ID {
SECURITY_EVENTS = 'general',
INTEGRITY_MONITORING = 'fim',
AMAZON_WEB_SERVICES = 'aws',
Expand All @@ -204,7 +204,47 @@ export enum WAZUH_MODULES_ID{
TSC = 'tsc',
CIS_CAT = 'ciscat',
VIRUSTOTAL = 'virustotal',
GDPR = 'gdpr'
GDPR = 'gdpr',
}

export enum WAZUH_MENU_MANAGEMENT_SECTIONS_ID {
MANAGEMENT = 'management',
ADMINISTRATION = 'administration',
RULESET = 'ruleset',
RULES = 'rules',
DECODERS = 'decoders',
CDB_LISTS = 'lists',
GROUPS = 'groups',
CONFIGURATION = 'configuration',
STATUS_AND_REPORTS = 'statusReports',
STATUS = 'status',
CLUSTER = 'monitoring',
LOGS = 'logs',
REPORTING = 'reporting',
STATISTICS = 'statistics',
}

export enum WAZUH_MENU_TOOLS_SECTIONS_ID {
API_CONSOLE = 'devTools',
RULESET_TEST = 'logtest',
}

export enum WAZUH_MENU_SECURITY_SECTIONS_ID {
USERS = 'users',
ROLES = 'roles',
POLICIES = 'policies',
ROLES_MAPPING = 'roleMapping',
}

export enum WAZUH_MENU_SETTINGS_SECTIONS_ID {
SETTINGS = 'settings',
API_CONFIGURATION = 'api',
MODULES = 'modules',
SAMPLE_DATA = 'sample_data',
CONFIGURATION = 'configuration',
LOGS = 'logs',
MISCELLANEOUS = 'miscellaneous',
ABOUT = 'about',
}

export const AUTHORIZED_AGENTS = 'authorized-agents';
Expand Down
28 changes: 28 additions & 0 deletions common/wazu-menu/wz-menu-management.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Wazuh app - Wazuh Constants file for Cypress
* Copyright (C) 2015-2021 Wazuh, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Find more information about this on the LICENSE file.
*/

export enum WAZUH_MENU_MANAGEMENT_SECTIONS_CY_TEST_ID {
MANAGEMENT = 'menuManagementManagementLink',
ADMINISTRATION = 'menuManagementAdministrationLink',
RULESET = 'menuManagementRulesetLink',
RULES = 'menuManagementRulesLink',
DECODERS = 'menuManagementDecodersLink',
CDB_LISTS = 'menuManagementCdbListsLink',
GROUPS = 'menuManagementGroupsLink',
CONFIGURATION = 'menuManagementConfigurationLink',
STATUS_AND_REPORTS = 'menuManagementStatusReportsLink',
STATUS = 'menuManagementStatusLink',
CLUSTER = 'menuManagementMonitoringLink',
LOGS = 'menuManagementLogsLink',
REPORTING = 'menuManagementReportingLink',
STATISTICS = 'menuManagementStatisticsLink',
}
33 changes: 33 additions & 0 deletions common/wazu-menu/wz-menu-overview.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Wazuh app - Wazuh Constants file for Cypress
* Copyright (C) 2015-2021 Wazuh, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Find more information about this on the LICENSE file.
*/

export enum WAZUH_MENU_MODULES_SECTIONS_CY_TEST_ID {
SECURITY_EVENTS = 'menuModulesSecurityEventsLink',
INTEGRITY_MONITORING = 'menuModulesFimLink',
AMAZON_WEB_SERVICES = 'menuModulesAwsLink',
GOOGLE_CLOUD_PLATFORM = 'menuModulesGcpLink',
POLICY_MONITORING = 'menuModulesPolicyMonitoringLink',
SECURITY_CONFIGURATION_ASSESSMENT = 'menuModulesScaLink',
AUDITING = 'menuModulesAuditLink',
OPEN_SCAP = 'menuModulesOpenScapLink',
VULNERABILITIES = 'menuModulesVulsLink',
OSQUERY = 'menuModulesOsqueryLink',
DOCKER = 'menuModulesDockerLink',
MITRE_ATTACK = 'menuModulesMitreLink',
PCI_DSS = 'menuModulesPciLink',
HIPAA = 'menuModulesHipaaLink',
NIST_800_53 = 'menuModulesNistLink',
TSC = 'menuModulesTscLink',
CIS_CAT = 'menuModulesCiscatLink',
VIRUSTOTAL = 'menuModulesVirustotalLink',
GDPR = 'menuModulesGdprLink',
}
18 changes: 18 additions & 0 deletions common/wazu-menu/wz-menu-security.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Wazuh app - Wazuh Constants file for Cypress
* Copyright (C) 2015-2021 Wazuh, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Find more information about this on the LICENSE file.
*/

export enum WAZUH_MENU_SECURITY_SECTIONS_CY_TEST_ID {
USERS = 'menuSecurityUsersLink',
ROLES = 'menuSecurityRolesLink',
POLICIES = 'menuSecurityPoliciesLink',
ROLES_MAPPING = 'menuSecurityRoleMappingLink',
}
22 changes: 22 additions & 0 deletions common/wazu-menu/wz-menu-settings.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Wazuh app - Wazuh Constants file for Cypress
* Copyright (C) 2015-2021 Wazuh, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Find more information about this on the LICENSE file.
*/

export enum WAZUH_MENU_SETTINGS_SECTIONS_CY_TEST_ID {
SETTINGS = 'menuSettingsSettingsLink',
API_CONFIGURATION = 'menuSettingsApiLink',
MODULES = 'menuSettingsModulesLink',
SAMPLE_DATA = 'menuSettingsSampleDataLink',
CONFIGURATION = 'menuSettingsConfigurationLink',
LOGS = 'menuSettingsLogsLink',
MISCELLANEOUS = 'menuSettingsMiscellaneousLink',
ABOUT = 'menuSettingsAboutLink',
}
16 changes: 16 additions & 0 deletions common/wazu-menu/wz-menu-tools.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Wazuh app - Wazuh Constants file for Cypress
* Copyright (C) 2015-2021 Wazuh, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Find more information about this on the LICENSE file.
*/

export enum WAZUH_MENU_TOOLS_SECTIONS_CY_TEST_ID {
API_CONSOLE = 'menuToolsDevToolsLink',
RULESET_TEST = 'menuToolsLogtestLink',
}
87 changes: 73 additions & 14 deletions public/components/wz-menu/wz-menu-management.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { EuiFlexItem, EuiFlexGroup, EuiSideNav, EuiIcon, EuiButtonEmpty, EuiTool
import { WzRequest } from '../../react-services/wz-request';
import { connect } from 'react-redux';
import { AppNavigate } from '../../react-services/app-navigate'
import { WAZUH_MENU_MANAGEMENT_SECTIONS_ID } from '../../../common/constants';
import { WAZUH_MENU_MANAGEMENT_SECTIONS_CY_TEST_ID } from '../../../common/wazu-menu/wz-menu-management.cy';

class WzMenuManagement extends Component {
constructor(props) {
Expand All @@ -24,20 +26,76 @@ class WzMenuManagement extends Component {
};

this.managementSections = {
management: { id: 'management', text: 'Management' },
administration: { id: 'administration', text: 'Administration' },
ruleset: { id: 'ruleset', text: 'Ruleset' },
rules: { id: 'rules', text: 'Rules' },
decoders: { id: 'decoders', text: 'Decoders' },
lists: { id: 'lists', text: 'CDB lists' },
groups: { id: 'groups', text: 'Groups' },
configuration: { id: 'configuration', text: 'Configuration' },
statusReports: { id: 'statusReports', text: 'Status and reports' },
status: { id: 'status', text: 'Status' },
cluster: { id: 'monitoring', text: 'Cluster' },
logs: { id: 'logs', text: 'Logs' },
reporting: { id: 'reporting', text: 'Reporting' },
statistics: { id: 'statistics', text: 'Statistics' },
management: {
id: WAZUH_MENU_MANAGEMENT_SECTIONS_ID.MANAGEMENT,
cyTestId: WAZUH_MENU_MANAGEMENT_SECTIONS_CY_TEST_ID.MANAGEMENT,
text: 'Management',
},
administration: {
id: WAZUH_MENU_MANAGEMENT_SECTIONS_ID.ADMINISTRATION,
cyTestId: WAZUH_MENU_MANAGEMENT_SECTIONS_CY_TEST_ID.ADMINISTRATION,
text: 'Administration',
},
ruleset: {
id: WAZUH_MENU_MANAGEMENT_SECTIONS_ID.RULESET,
cyTestId: WAZUH_MENU_MANAGEMENT_SECTIONS_CY_TEST_ID.RULESET,
text: 'Ruleset',
},
rules: {
id: WAZUH_MENU_MANAGEMENT_SECTIONS_ID.RULES,
cyTestId: WAZUH_MENU_MANAGEMENT_SECTIONS_CY_TEST_ID.RULES,
text: 'Rules',
},
decoders: {
id: WAZUH_MENU_MANAGEMENT_SECTIONS_ID.DECODERS,
cyTestId: WAZUH_MENU_MANAGEMENT_SECTIONS_CY_TEST_ID.DECODERS,
text: 'Decoders',
},
lists: {
id: WAZUH_MENU_MANAGEMENT_SECTIONS_ID.CDB_LISTS,
cyTestId: WAZUH_MENU_MANAGEMENT_SECTIONS_CY_TEST_ID.CDB_LISTS,
text: 'CDB lists',
},
groups: {
id: WAZUH_MENU_MANAGEMENT_SECTIONS_ID.GROUPS,
cyTestId: WAZUH_MENU_MANAGEMENT_SECTIONS_CY_TEST_ID.GROUPS,
text: 'Groups',
},
configuration: {
id: WAZUH_MENU_MANAGEMENT_SECTIONS_ID.CONFIGURATION,
cyTestId: WAZUH_MENU_MANAGEMENT_SECTIONS_CY_TEST_ID.CONFIGURATION,
text: 'Configuration',
},
statusReports: {
id: WAZUH_MENU_MANAGEMENT_SECTIONS_ID.STATUS_AND_REPORTS,
cyTestId: WAZUH_MENU_MANAGEMENT_SECTIONS_CY_TEST_ID.STATUS_AND_REPORTS,
text: 'Status and reports',
},
status: {
id: WAZUH_MENU_MANAGEMENT_SECTIONS_ID.STATUS,
cyTestId: WAZUH_MENU_MANAGEMENT_SECTIONS_CY_TEST_ID.STATUS,
text: 'Status',
},
cluster: {
id: WAZUH_MENU_MANAGEMENT_SECTIONS_ID.CLUSTER,
cyTestId: WAZUH_MENU_MANAGEMENT_SECTIONS_CY_TEST_ID.CLUSTER,
text: 'Cluster',
},
logs: {
id: WAZUH_MENU_MANAGEMENT_SECTIONS_ID.LOGS,
cyTestId: WAZUH_MENU_MANAGEMENT_SECTIONS_CY_TEST_ID.LOGS,
text: 'Logs',
},
reporting: {
id: WAZUH_MENU_MANAGEMENT_SECTIONS_ID.REPORTING,
cyTestId: WAZUH_MENU_MANAGEMENT_SECTIONS_CY_TEST_ID.REPORTING,
text: 'Reporting',
},
statistics: {
id: WAZUH_MENU_MANAGEMENT_SECTIONS_ID.STATISTICS,
cyTestId: WAZUH_MENU_MANAGEMENT_SECTIONS_CY_TEST_ID.STATISTICS,
text: 'Statistics',
},
};

this.paths = {
Expand Down Expand Up @@ -67,6 +125,7 @@ class WzMenuManagement extends Component {
...data,
id: item.id,
name: item.text,
'data-test-subj': item.cyTestId,
isSelected: this.props.state.section === item.id,
onClick: () => { },
onMouseDown: (ev) => this.clickMenuItem(ev, item.id)
Expand Down
Loading

0 comments on commit 5c9d117

Please sign in to comment.