Skip to content

Commit 1392463

Browse files
Pedro-S-AbreuPedro Abreu
andauthored
MTV-3062 / MTV-3529- Include VM folder test automation (#2098)
* Include VM folder test automation Resolves: MTV-3062 Signed-off-by: Pedro Abreu <[email protected]> * Enhance VM Tree Row component with data-testid attributes for improved testing. Resolves: MTV-3062 Signed-off-by: Pedro Abreu <[email protected]> * Refactor VM count retrieval in FolderNameCell Resolves: MTV-3062 Signed-off-by: Pedro Abreu <[email protected]> * Enhance Virtual Machines step to handle critical issues action during plan creation. Update fillAndComplete method to accept criticalIssuesAction parameter. Refactor VM count retrieval for improved clarity. Resolves: MTV-3062 Signed-off-by: Pedro Abreu <[email protected]> * Fix prettier formatting in ManageColumnsModal Resolves: MTV-3062 Signed-off-by: Pedro Abreu <[email protected]> * remove uneeded timeout parameters Resolves: MTV-3062 Signed-off-by: Pedro Abreu <[email protected]> * Refactor column item selection in VirtualMachinesTable Resolves: MTV-3062 Signed-off-by: Pedro Abreu <[email protected]> * Remove unused concernCount variable from VirtualMachinesTable class to streamline code. Resolves: MTV-3062 Signed-off-by: Pedro Abreu <[email protected]> --------- Signed-off-by: Pedro Abreu <[email protected]> Co-authored-by: Pedro Abreu <[email protected]>
1 parent ff6c8a9 commit 1392463

File tree

34 files changed

+1045
-136
lines changed

34 files changed

+1045
-136
lines changed

src/components/Concerns/components/ConcernsPopover.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const ConcernPopover: FC<{
2323
headerContent={getCategoryTitle(category)}
2424
bodyContent={<ConcernList concerns={concerns} />}
2525
footerContent={t('Total: {{length}}', { length: concerns.length })}
26+
data-testid="concerns-popover"
2627
>
2728
<Button isInline variant={ButtonVariant.link}>
2829
<Label status={getCategoryStatus(category)}>{concerns.length}</Label>

src/components/FieldBuilderTable/FieldBuilderTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const FieldBuilderTable: FC<FieldBuilderTableProps<FormData>> = ({
7575
);
7676

7777
acc.push(
78-
<Tr key={fieldRow.id}>
78+
<Tr key={fieldRow.id} data-testid={`field-row-${rowIndex}`}>
7979
{fieldRow.inputs.map((fieldInput) => (
8080
<Td key={fieldInput.key}>{fieldInput}</Td>
8181
))}

src/components/VsphereFoldersTable/components/FolderTreeRow/FolderNameCell.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ const FolderNameCell: FC<FolderNameCellProps> = ({ row, vmCount }) => {
1010
<Split hasGutter>
1111
<SplitItem>{row.folderName}</SplitItem>
1212
<SplitItem>
13-
<Label isCompact>{vmCount} VMs</Label>
13+
<Label isCompact data-testid={`folder-${row.folderName}-vm-count`}>
14+
{vmCount} VMs
15+
</Label>
1416
</SplitItem>
1517
</Split>
1618
);

src/components/VsphereFoldersTable/components/FolderTreeRow/FolderTreeRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type FolderTreeRowProps = {
1414
const FolderTreeRow: FC<FolderTreeRowProps> = ({ groupVMCountByFolder, row }) => {
1515
return (
1616
<TreeRowWrapper data-testid={row.key} key={row.key} row={{ props: row?.treeRow?.props }}>
17-
<Td treeRow={row.treeRow} dataLabel={nameColumn.label}>
17+
<Td treeRow={row.treeRow} dataLabel={nameColumn.label} data-testid={`${row.key}-expand-cell`}>
1818
<FolderNameCell row={row} vmCount={groupVMCountByFolder.get(row.folderName) ?? 0} />
1919
</Td>
2020
</TreeRowWrapper>

src/components/VsphereFoldersTable/components/VmTreeRow/VmTreeRow.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,18 @@ const VmCells: Record<string, FC<{ row: VmRow }>> = {
2424
const VmTreeRow: FC<VmTreeRowProps> = ({ columns, row }) => {
2525
return (
2626
<TreeRowWrapper data-testid={row.key} key={row.key} row={{ props: row?.treeRow?.props }}>
27-
<Td treeRow={row.treeRow} dataLabel={nameColumn.label}>
27+
<Td treeRow={row.treeRow} dataLabel={nameColumn.label} data-testid={`${row.key}-name-cell`}>
2828
{row.vmData.name}
2929
</Td>
3030
{columns.map((col) => {
3131
if (!col.isVisible) return null;
3232
const Component = VmCells[col.resourceFieldId!];
3333
return (
34-
<Td key={col.resourceFieldId} dataLabel={col.label ?? ''}>
34+
<Td
35+
key={col.resourceFieldId}
36+
dataLabel={col.label ?? ''}
37+
data-testid={`${row.key}-${col.resourceFieldId}-cell`}
38+
>
3539
<Component row={row} />
3640
</Td>
3741
);

src/components/common/TableView/ManageColumnsModal.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,12 @@ export const ManageColumnsModal = ({
131131
return (
132132
<>
133133
<div id="root" />
134-
<Modal isOpen={showModal} variant="small" onClose={onClose}>
134+
<Modal
135+
isOpen={showModal}
136+
variant="small"
137+
onClose={onClose}
138+
data-testid="manage-columns-modal"
139+
>
135140
<ModalHeader
136141
title={title}
137142
description={
@@ -183,7 +188,7 @@ export const ManageColumnsModal = ({
183188
onDrop={onDrop}
184189
overlayProps={{ isCompact: true }}
185190
>
186-
<DataList aria-label={title} isCompact />
191+
<DataList aria-label={title} isCompact data-testid="manage-columns-list" />
187192
</DragDropSort>
188193
</ModalBody>
189194
<ModalFooter>
@@ -192,10 +197,16 @@ export const ManageColumnsModal = ({
192197
variant={ButtonVariant.primary}
193198
isDisabled={resourceFields === editedColumns}
194199
onClick={onSave}
200+
data-testid="manage-columns-save-button"
195201
>
196202
{saveLabel}
197203
</Button>
198-
<Button key="cancel" variant={ButtonVariant.secondary} onClick={onClose}>
204+
<Button
205+
key="cancel"
206+
variant={ButtonVariant.secondary}
207+
onClick={onClose}
208+
data-testid="manage-columns-cancel-button"
209+
>
199210
{cancelLabel}
200211
</Button>
201212
<Button key="restore" variant={ButtonVariant.link} onClick={restoreDefaults}>

src/components/common/TableView/ManageColumnsToolbarItem.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const ManageColumnsToolbarItem = ({
5050
variant={ButtonVariant.plain}
5151
onClick={showDialog}
5252
aria-label={ariaLabel ?? manageColumnsText}
53+
data-testid="manage-columns-button"
5354
/>
5455
</Tooltip>
5556
{children}

src/onlineHelp/learningExperience/HelpTopicSection.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ const HelpTopicSection: FC<HelpTopicSectionProps> = ({ index, listStyleType, top
5353

5454
return (
5555
<ExpandableSection
56+
data-testid="help-topic-section"
5657
className={css(
5758
'forklift--learning__help-section',
5859
isEmpty(topic.subTopics) && 'm-non-expandable',

src/plans/create/steps/network-map/SourceNetworkField.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const SourceNetworkField: FC<SourceNetworkFieldProps> = ({
3838
<Select
3939
ref={field.ref}
4040
id={fieldId}
41+
testId={`source-network-${fieldId}`}
4142
value={(field.value as MappingValue).name}
4243
onSelect={async (_event, value) => {
4344
field.onChange(value);

src/plans/create/steps/network-map/TargetNetworkField.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const TargetNetworkField: FC<TargetNetworkFieldProps> = ({ fieldId, targetNetwor
2828
<Select
2929
ref={field.ref}
3030
id={fieldId}
31+
testId={`target-network-${fieldId}`}
3132
value={(field.value as MappingValue).name}
3233
onSelect={async (_event, value) => {
3334
field.onChange(value);

0 commit comments

Comments
 (0)