diff --git a/src/fireedge/src/client/components/FormControl/SubmitButton.js b/src/fireedge/src/client/components/FormControl/SubmitButton.js index 38d5acef4e..c92ba1b22e 100644 --- a/src/fireedge/src/client/components/FormControl/SubmitButton.js +++ b/src/fireedge/src/client/components/FormControl/SubmitButton.js @@ -42,9 +42,12 @@ const useStyles = makeStyles((theme) => ({ })) const ButtonComponent = forwardRef( - ({ icon, endicon, children, size, variant = 'contained', ...props }, ref) => + ( + { icon, endicon, children, size, variant = 'contained', value, ...props }, + ref + ) => icon && !endicon ? ( - + {children} ) : ( @@ -122,6 +125,7 @@ export const SubmitButtonPropTypes = { color: PropTypes.string, size: PropTypes.string, variant: PropTypes.string, + value: PropTypes.string, } TooltipComponent.propTypes = SubmitButtonPropTypes diff --git a/src/fireedge/src/client/components/Forms/VmTemplate/InstantiateForm/Steps/BasicConfiguration/index.js b/src/fireedge/src/client/components/Forms/VmTemplate/InstantiateForm/Steps/BasicConfiguration/index.js index 036ab7faa4..2fa4591e7e 100644 --- a/src/fireedge/src/client/components/Forms/VmTemplate/InstantiateForm/Steps/BasicConfiguration/index.js +++ b/src/fireedge/src/client/components/Forms/VmTemplate/InstantiateForm/Steps/BasicConfiguration/index.js @@ -50,7 +50,7 @@ const Content = () => { { }, [title]) return ( - +
{ const more = tags.length - limitTags - const Tags = tags - .splice(0, limitTags) - .map((tag, idx) => ( - - )) + const Tags = tags.splice(0, limitTags).map((tag, idx) => { + const text = tag.text ?? tag + + return ( + + ) + }) return ( <> @@ -39,15 +46,20 @@ const MultipleTags = ({ tags, limitTags = 1, clipboard }) => { {more > 0 && ( ( - - {tag} - - ))} + title={tags.map((tag, idx) => { + const text = tag.text ?? tag + + return ( + + {text} + + ) + })} > {`+${more} more`} diff --git a/src/fireedge/src/client/components/Status/Chip.js b/src/fireedge/src/client/components/Status/Chip.js index 3796e6b65b..ee173b69d2 100644 --- a/src/fireedge/src/client/components/Status/Chip.js +++ b/src/fireedge/src/client/components/Status/Chip.js @@ -68,7 +68,14 @@ const callAll = fns.forEach((fn) => fn && fn?.(...args)) const StatusChip = memo( - ({ stateColor, text = '', clipboard = false, onClick, ...props }) => { + ({ + stateColor, + text = '', + dataCy = '', + clipboard = false, + onClick, + ...props + }) => { const { copy, isCopied } = useClipboard() const textToCopy = typeof clipboard === 'string' ? clipboard : text const classes = useStyles({ stateColor, clipboard }) @@ -93,6 +100,7 @@ const StatusChip = memo( component="span" className={classes.text} onClick={callAll(onClick, clipboard && handleCopy)} + data-cy={dataCy} {...props} > {text} @@ -113,6 +121,7 @@ StatusChip.propTypes = { stateColor: PropTypes.string, text: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), clipboard: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]), + dataCy: PropTypes.string, onClick: PropTypes.func, } diff --git a/src/fireedge/src/client/components/Tables/Enhanced/Utils/GlobalActions/Action.js b/src/fireedge/src/client/components/Tables/Enhanced/Utils/GlobalActions/Action.js index a7975c5745..e0c3994d20 100644 --- a/src/fireedge/src/client/components/Tables/Enhanced/Utils/GlobalActions/Action.js +++ b/src/fireedge/src/client/components/Tables/Enhanced/Utils/GlobalActions/Action.js @@ -62,6 +62,7 @@ const ActionItem = memo( ({ item, selectedRows }) => { const { accessor, + dataCy, tooltip, label, color, @@ -75,7 +76,8 @@ const ActionItem = memo( const buttonProps = { color, variant, - 'data-cy': accessor && `action.${accessor}`, + 'data-cy': + (dataCy && `action-${dataCy}`) ?? (accessor && `action-${accessor}`), disabled: typeof disabled === 'function' ? disabled(selectedRows) : disabled, icon: Icon && , @@ -141,6 +143,7 @@ const ActionItem = memo( export const ActionPropTypes = PropTypes.shape({ accessor: PropTypes.string, + dataCy: PropTypes.string, variant: PropTypes.string, color: PropTypes.string, size: PropTypes.string, diff --git a/src/fireedge/src/client/components/Tables/Enhanced/index.js b/src/fireedge/src/client/components/Tables/Enhanced/index.js index 470cbcdccf..c449679396 100644 --- a/src/fireedge/src/client/components/Tables/Enhanced/index.js +++ b/src/fireedge/src/client/components/Tables/Enhanced/index.js @@ -58,6 +58,7 @@ const EnhancedTable = ({ showPageCount, singleSelect = false, classes = {}, + rootProps = {}, }) => { const styles = EnhancedTableStyles() @@ -140,7 +141,11 @@ const EnhancedTable = ({ } return ( - +
{/* TOOLBAR */} {!isFetching && ( @@ -236,6 +241,9 @@ export const EnhancedTableProps = { root: PropTypes.string, body: PropTypes.string, }), + rootProps: PropTypes.shape({ + 'data-cy': PropTypes.string, + }), isLoading: PropTypes.bool, onlyGlobalSearch: PropTypes.bool, onlyGlobalSelectedRows: PropTypes.bool, diff --git a/src/fireedge/src/client/components/Tables/VmTemplates/row.js b/src/fireedge/src/client/components/Tables/VmTemplates/row.js index 3e6d0c8cf6..d7b4394f7a 100644 --- a/src/fireedge/src/client/components/Tables/VmTemplates/row.js +++ b/src/fireedge/src/client/components/Tables/VmTemplates/row.js @@ -44,7 +44,7 @@ const Row = ({ original, value, ...props }) => { const timeAgo = `registered ${time.toRelative()}` return ( -
+
diff --git a/src/fireedge/src/client/components/Tables/Vms/actions.js b/src/fireedge/src/client/components/Tables/Vms/actions.js index 9b0165907c..62970ccfc5 100644 --- a/src/fireedge/src/client/components/Tables/Vms/actions.js +++ b/src/fireedge/src/client/components/Tables/Vms/actions.js @@ -135,6 +135,7 @@ const Actions = () => { }, { accessor: VM_ACTIONS.CREATE_DIALOG, + dataCy: `vm_${VM_ACTIONS.CREATE_DIALOG}`, tooltip: T.Create, icon: AddSquare, action: () => { diff --git a/src/fireedge/src/client/components/Tables/Vms/row.js b/src/fireedge/src/client/components/Tables/Vms/row.js index 4c1dbed067..070486434d 100644 --- a/src/fireedge/src/client/components/Tables/Vms/row.js +++ b/src/fireedge/src/client/components/Tables/Vms/row.js @@ -47,7 +47,7 @@ const Row = ({ original, value, ...props }) => { VirtualMachineModel.getState(original) return ( -
+
diff --git a/src/fireedge/src/client/components/Tabs/Common/Attribute/Attribute.js b/src/fireedge/src/client/components/Tabs/Common/Attribute/Attribute.js index 306c096025..05547d81a3 100644 --- a/src/fireedge/src/client/components/Tabs/Common/Attribute/Attribute.js +++ b/src/fireedge/src/client/components/Tabs/Common/Attribute/Attribute.js @@ -53,6 +53,7 @@ const Attribute = memo( showActionsOnHover = false, value, valueInOptionList, + dataCy, }) => { const numberOfParents = useMemo(() => path.split('.').length - 1, [path]) @@ -131,6 +132,7 @@ const Attribute = memo( variant="body2" flexGrow={1} title={typeof value === 'string' ? value : undefined} + data-cy={dataCy} > {link ? ( @@ -183,6 +185,7 @@ export const AttributePropTypes = { showActionsOnHover: PropTypes.bool, value: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), valueInOptionList: PropTypes.string, + dataCy: PropTypes.string, } Attribute.propTypes = AttributePropTypes diff --git a/src/fireedge/src/client/components/Tabs/Common/Ownership.js b/src/fireedge/src/client/components/Tabs/Common/Ownership.js index 3f767a3290..129afcfd17 100644 --- a/src/fireedge/src/client/components/Tabs/Common/Ownership.js +++ b/src/fireedge/src/client/components/Tabs/Common/Ownership.js @@ -53,6 +53,7 @@ const Ownership = memo( canEdit: actions?.includes?.(ACTIONS.CHANGE_OWNER), handleGetOptionList: getUserOptions, handleEdit: (_, user) => handleEdit?.({ user }), + dataCy: 'owner', }, { name: T.Group, @@ -62,6 +63,7 @@ const Ownership = memo( canEdit: actions?.includes?.(ACTIONS.CHANGE_GROUP), handleGetOptionList: getGroupOptions, handleEdit: (_, group) => handleEdit?.({ group }), + dataCy: 'group', }, ] diff --git a/src/fireedge/src/client/components/Tabs/Common/Permissions.js b/src/fireedge/src/client/components/Tabs/Common/Permissions.js index 38f39ac2ff..21eac902fc 100644 --- a/src/fireedge/src/client/components/Tabs/Common/Permissions.js +++ b/src/fireedge/src/client/components/Tabs/Common/Permissions.js @@ -83,6 +83,7 @@ const Permissions = memo(({ handleEdit, actions, ...permissions }) => { cy={`permission-${key}`} disabled={permission === undefined} icon={getIcon(permission)} + value={permission} handleClick={() => handleChange(key, permission)} /> ) : ( diff --git a/src/fireedge/src/client/components/Tabs/Vm/Capacity/information.js b/src/fireedge/src/client/components/Tabs/Vm/Capacity/information.js index c67edb3b65..f8d11a938d 100644 --- a/src/fireedge/src/client/components/Tabs/Vm/Capacity/information.js +++ b/src/fireedge/src/client/components/Tabs/Vm/Capacity/information.js @@ -36,10 +36,12 @@ const InformationPanel = ({ actions, vm = {}, handleResizeCapacity }) => { { name: T.PhysicalCpu, value: TEMPLATE?.CPU, + dataCy: 'cpu', }, { name: T.VirtualCpu, value: TEMPLATE?.VCPU ?? '-', + dataCy: 'virtualcpu', }, isVCenter && { name: T.VirtualCores, @@ -49,18 +51,22 @@ const InformationPanel = ({ actions, vm = {}, handleResizeCapacity }) => { ${Tr(T.Sockets)} ${TEMPLATE?.TOPOLOGY?.SOCKETS || '-'}`} ), + dataCy: 'virtualcores', }, { name: T.Memory, value: prettyBytes(+TEMPLATE?.MEMORY, 'MB'), + dataCy: 'memory', }, { name: T.CostCpu, value: TEMPLATE?.CPU_COST || 0, + dataCy: 'cpucost', }, { name: T.CostMByte, value: TEMPLATE?.MEMORY_COST || 0, + dataCy: 'memorycost', }, ].filter(Boolean) @@ -85,12 +91,12 @@ const InformationPanel = ({ actions, vm = {}, handleResizeCapacity }) => { /> )}
- {capacity.map(({ name, value }) => ( + {capacity.map(({ name, value, dataCy }) => (
{name} - + {value}
diff --git a/src/fireedge/src/client/components/Tabs/Vm/Info/information.js b/src/fireedge/src/client/components/Tabs/Vm/Info/information.js index 2715337a70..b14f4c654b 100644 --- a/src/fireedge/src/client/components/Tabs/Vm/Info/information.js +++ b/src/fireedge/src/client/components/Tabs/Vm/Info/information.js @@ -57,36 +57,48 @@ const InformationPanel = ({ vm = {}, handleRename, actions }) => { }, []) const info = [ - { name: T.ID, value: ID }, + { + name: T.ID, + value: ID, + dataCy: 'id', + }, { name: T.Name, value: NAME, canEdit: actions?.includes?.(VM_ACTIONS.RENAME), handleEdit: handleRename, + dataCy: 'name', }, { name: T.State, - value: , + value: ( + + ), }, { name: T.Reschedule, value: Helper.booleanToString(+RESCHED), + dataCy: 'reschedule', }, { name: T.Locked, value: Helper.levelLockToString(LOCK?.LOCKED), + dataCy: 'locked', }, { name: T.IP, value: ips?.length ? : '--', + dataCy: 'ips', }, { name: T.StartTime, value: Helper.timeToString(STIME), + dataCy: 'starttime', }, { name: T.EndTime, value: Helper.timeToString(ETIME), + dataCy: 'endtime', }, hostId && { name: T.Host, @@ -94,6 +106,7 @@ const InformationPanel = ({ vm = {}, handleRename, actions }) => { link: !Number.isNaN(+hostId) && generatePath(PATH.INFRASTRUCTURE.HOSTS.DETAIL, { id: hostId }), + dataCy: 'hostid', }, clusterId && { name: T.Cluster, @@ -101,10 +114,12 @@ const InformationPanel = ({ vm = {}, handleRename, actions }) => { link: !Number.isNaN(+clusterId) && generatePath(PATH.INFRASTRUCTURE.CLUSTERS.DETAIL, { id: clusterId }), + dataCy: 'clusterid', }, { name: T.DeployID, value: DEPLOY_ID, + dataCy: 'deployid', }, ].filter(Boolean) diff --git a/src/fireedge/src/client/components/Tabs/Vm/Network/Item.js b/src/fireedge/src/client/components/Tabs/Vm/Network/Item.js index d56193dc39..079cf664bf 100644 --- a/src/fireedge/src/client/components/Tabs/Vm/Network/Item.js +++ b/src/fireedge/src/client/components/Tabs/Vm/Network/Item.js @@ -37,6 +37,10 @@ import MultipleTags from 'client/components/MultipleTags' import { Translate } from 'client/components/HOC' import { T, VM_ACTIONS } from 'client/constants' +const DATACYSECURITY = 'securitygroup-' +const DATACYNETWORK = 'network-' +const DATACYALIAS = 'alias-' + const Accordion = styled((props) => ( ))(({ theme }) => ({ @@ -126,17 +130,34 @@ const NetworkItem = ({ nic = {}, actions }) => { /> ) + const tags = [ + { + text: IP, + dataCy: `${DATACYNETWORK}ip`, + }, + { + text: MAC, + dataCy: `${DATACYNETWORK}mac`, + }, + { + text: ADDRESS, + dataCy: `${DATACYNETWORK}address`, + }, + ].filter(({ text } = {}) => Boolean(text)) + return ( <> - + })}> - {`${NIC_ID} | ${NETWORK}`} + + {`${NIC_ID} | ${NETWORK}`} + {!isMobile && !isPciDevice && detachAction(NIC_ID)} @@ -144,24 +165,43 @@ const NetworkItem = ({ nic = {}, actions }) => { {hasDetails && (
- {ALIAS?.map(({ NIC_ID, NETWORK = '-', BRIDGE, IP, MAC }) => ( - - - - {`${NIC_ID} | ${NETWORK}`} - - - - - {!isMobile && !isPciDevice && detachAction(NIC_ID, true)} - - ))} + {ALIAS?.map(({ NIC_ID, NETWORK = '-', BRIDGE, IP, MAC }) => { + const tags = [ + { + text: IP, + dataCy: `${DATACYALIAS}ip`, + }, + { + text: MAC, + dataCy: `${DATACYALIAS}mac`, + }, + { + text: BRIDGE && `BRIDGE - ${BRIDGE}`, + dataCy: `${DATACYALIAS}bridge`, + }, + ].filter(({ text } = {}) => Boolean(text)) + + return ( + + + + {`${NIC_ID} | ${NETWORK}`} + + + + + {!isMobile && !isPciDevice && detachAction(NIC_ID, true)} + + ) + })} {!!SECURITY_GROUPS?.length && ( @@ -172,6 +212,7 @@ const NetworkItem = ({ nic = {}, actions }) => { ( { ID, + SECURITY_GROUP_ID, NAME, PROTOCOL, RULE_TYPE, @@ -180,25 +221,51 @@ const NetworkItem = ({ nic = {}, actions }) => { NETWORK_ID, }, idx - ) => ( - - - {`${ID} | ${NAME}`} - - - - - - ) + ) => { + const tags = [ + { + text: PROTOCOL, + dataCy: `${DATACYSECURITY}protocol`, + }, + { + text: RULE_TYPE, + dataCy: `${DATACYSECURITY}ruletype`, + }, + { + text: RANGE, + dataCy: `${DATACYSECURITY}range`, + }, + { + text: NETWORK_ID, + dataCy: `${DATACYSECURITY}networkid`, + }, + { + text: ICMP_TYPE, + dataCy: `${DATACYSECURITY}icmp_type`, + }, + ].filter(({ text } = {}) => Boolean(text)) + + return ( + + + {`${ID} | ${NAME}`} + + + + + + ) + } )} )} diff --git a/src/fireedge/src/client/components/Tabs/Vm/Storage/Item.js b/src/fireedge/src/client/components/Tabs/Vm/Storage/Item.js index bea7ab6718..875d2cc467 100644 --- a/src/fireedge/src/client/components/Tabs/Vm/Storage/Item.js +++ b/src/fireedge/src/client/components/Tabs/Vm/Storage/Item.js @@ -63,23 +63,42 @@ const StorageItem = ({ disk, actions = [] }) => { }[type] const labels = [ - ...new Set([ - TYPE, - Helper.stringToBoolean(PERSISTENT) && 'PERSISTENT', - Helper.stringToBoolean(READONLY) && 'READONLY', - Helper.stringToBoolean(SAVE) && 'SAVE', - Helper.stringToBoolean(CLONE) && 'CLONE', - ]), - ].filter(Boolean) + { + label: TYPE, + dataCy: 'type', + }, + { + label: Helper.stringToBoolean(PERSISTENT) && 'PERSISTENT', + dataCy: 'persistent', + }, + { + label: Helper.stringToBoolean(READONLY) && 'READONLY', + dataCy: 'readonly', + }, + { + label: Helper.stringToBoolean(SAVE) && 'SAVE', + dataCy: 'save', + }, + { + label: Helper.stringToBoolean(CLONE) && 'CLONE', + dataCy: 'clone', + }, + ].filter(({ label } = {}) => Boolean(label)) return ( - +
- {image} + + {image} + - {labels.map((label) => ( - + {labels.map(({ label, dataCy }) => ( + ))}
@@ -88,18 +107,18 @@ const StorageItem = ({ disk, actions = [] }) => { {TARGET && ( - {` ${TARGET}`} + {` ${TARGET}`} )} {DATASTORE && ( - {` ${DATASTORE}`} + {` ${DATASTORE}`} )} - {` ${monitorSize}/${size}`} + {` ${monitorSize}/${size}`}
diff --git a/src/fireedge/src/client/components/Tabs/index.js b/src/fireedge/src/client/components/Tabs/index.js index 33fe044eb3..62cf781aaa 100644 --- a/src/fireedge/src/client/components/Tabs/index.js +++ b/src/fireedge/src/client/components/Tabs/index.js @@ -81,6 +81,7 @@ const Tabs = ({ icon={error ? : Icon && } value={value ?? idx} label={label ?? name} + data-cy={`tab-${name}`} /> ) })} diff --git a/src/fireedge/src/client/containers/VirtualMachines/index.js b/src/fireedge/src/client/containers/VirtualMachines/index.js index 2618ce171c..817e688cbf 100644 --- a/src/fireedge/src/client/containers/VirtualMachines/index.js +++ b/src/fireedge/src/client/containers/VirtualMachines/index.js @@ -33,10 +33,11 @@ function VirtualMachines() { {selectedRows?.length > 0 && ( - + {selectedRows?.length === 1 ? ( ) : (