src: Remove unused data-testids

This removes unused `data-testid`s from the code base.
This commit is contained in:
regexowl 2025-05-07 13:46:53 +02:00 committed by Simon Steinbeiß
parent 2ec85661c4
commit aedbbdc53a
24 changed files with 76 additions and 143 deletions

View file

@ -114,14 +114,7 @@ const BlueprintsSidebar = () => {
return ( return (
<EmptyBlueprintState <EmptyBlueprintState
icon={PlusCircleIcon} icon={PlusCircleIcon}
action={ action={<Link to={resolveRelPath('imagewizard')}>Add blueprint</Link>}
<Link
to={resolveRelPath('imagewizard')}
data-testid="create-blueprint-action-emptystate"
>
Add blueprint
</Link>
}
titleText="No blueprints yet" titleText="No blueprints yet"
bodyText="Add a blueprint and optionally build related images." bodyText="Add a blueprint and optionally build related images."
/> />
@ -224,7 +217,6 @@ const BlueprintSearch = ({ blueprintsTotal }: blueprintSearchProps) => {
onChange={(_event, value) => onChange(value)} onChange={(_event, value) => onChange(value)}
onClear={() => onChange('')} onClear={() => onChange('')}
resultsCount={`${blueprintsTotal} blueprints`} resultsCount={`${blueprintsTotal} blueprints`}
data-testid="blueprints-search-input"
/> />
); );
}; };

View file

@ -155,7 +155,6 @@ export const BuildImagesButton = ({ children }: BuildImagesButtonPropTypes) => {
<MenuList> <MenuList>
{blueprintImageType?.map((imageType, index) => ( {blueprintImageType?.map((imageType, index) => (
<MenuItem <MenuItem
data-testid="blueprint-menu-items"
key={imageType} key={imageType}
hasCheckbox hasCheckbox
itemId={index} itemId={index}

View file

@ -258,7 +258,6 @@ export const ImportBlueprintModal: React.FunctionComponent<
aria-label="Import Custom Repositories checkbox" aria-label="Import Custom Repositories checkbox"
id="checkbox-import-custom-repositories" id="checkbox-import-custom-repositories"
name="Import Repositories" name="Import Repositories"
data-testid="checkbox-import-custom-repositories"
/> />
</FormGroup> </FormGroup>
<FormGroup fieldId="import-blueprint-file-upload"> <FormGroup fieldId="import-blueprint-file-upload">

View file

@ -81,7 +81,6 @@ const FileSystemConfiguration = () => {
<FileSystemTable /> <FileSystemTable />
<TextContent> <TextContent>
<Button <Button
data-testid="file-system-add-partition"
className="pf-v5-u-text-align-left" className="pf-v5-u-text-align-left"
variant="link" variant="link"
icon={<PlusCircleIcon />} icon={<PlusCircleIcon />}

View file

@ -87,10 +87,8 @@ const FirstBootStep = () => {
}} }}
code={selectedScript} code={selectedScript}
height="35vh" height="35vh"
emptyStateButton={<span data-testid="firstboot_browse">Browse</span>} emptyStateButton="Browse"
emptyStateLink={ emptyStateLink="Start from scratch"
<span data-testid="firstboot_write_manual">Start from scratch</span>
}
/> />
{errors.script && ( {errors.script && (
<FormHelperText> <FormHelperText>

View file

@ -94,7 +94,6 @@ const TargetEnvironment = () => {
> >
<FormGroup <FormGroup
label={<Text component={TextVariants.small}>Public cloud</Text>} label={<Text component={TextVariants.small}>Public cloud</Text>}
data-testid="target-public"
> >
<div className="tiles"> <div className="tiles">
{supportedEnvironments?.includes('aws') && ( {supportedEnvironments?.includes('aws') && (
@ -170,7 +169,6 @@ const TargetEnvironment = () => {
{supportedEnvironments?.includes('oci') && ( {supportedEnvironments?.includes('oci') && (
<Tile <Tile
className="tile pf-v5-u-mr-sm" className="tile pf-v5-u-mr-sm"
data-testid="upload-oci"
title="Oracle Cloud Infrastructure" title="Oracle Cloud Infrastructure"
icon={ icon={
<img <img
@ -195,7 +193,6 @@ const TargetEnvironment = () => {
<FormGroup <FormGroup
label={<Text component={TextVariants.small}>Private cloud</Text>} label={<Text component={TextVariants.small}>Private cloud</Text>}
className="pf-v5-u-mt-sm" className="pf-v5-u-mt-sm"
data-testid="target-private"
> >
<Checkbox <Checkbox
label="VMware vSphere" label="VMware vSphere"
@ -319,10 +316,7 @@ const TargetEnvironment = () => {
</FormGroup> </FormGroup>
</> </>
)} )}
<FormGroup <FormGroup label={<Text component={TextVariants.small}>Other</Text>}>
label={<Text component={TextVariants.small}>Other</Text>}
data-testid="target-other"
>
{supportedEnvironments?.includes('guest-image') && ( {supportedEnvironments?.includes('guest-image') && (
<Checkbox <Checkbox
label="Virtualization - Guest image (.qcow2)" label="Virtualization - Guest image (.qcow2)"

View file

@ -292,7 +292,7 @@ const PolicySelector = () => {
); );
return ( return (
<FormGroup data-testid="profiles-form-group" label="Policy"> <FormGroup label="Policy">
<Select <Select
isScrollable isScrollable
isOpen={isOpen} isOpen={isOpen}

View file

@ -353,7 +353,7 @@ const ProfileSelector = () => {
); );
return ( return (
<FormGroup data-testid="profiles-form-group" label="Profile"> <FormGroup label="Profile">
<Select <Select
isScrollable isScrollable
isOpen={isOpen} isOpen={isOpen}
@ -368,10 +368,7 @@ const ProfileSelector = () => {
> >
<SelectList> <SelectList>
{isFetching && ( {isFetching && (
<SelectOption <SelectOption value="loader">
value="loader"
data-testid="openscap-profiles-fetching"
>
<Spinner size="lg" /> <Spinner size="lg" />
</SelectOption> </SelectOption>
)} )}

View file

@ -227,7 +227,6 @@ const PackageRecommendations = () => {
component="a" component="a"
onClick={() => addAllPackages()} onClick={() => addAllPackages()}
isInline isInline
data-testid="add-all-recommendations-button"
> >
Add all packages Add all packages
</Button> </Button>
@ -272,7 +271,6 @@ const PackageRecommendations = () => {
}} }}
isInline isInline
isDisabled={isRecommendedPackageSelected(pkg)} isDisabled={isRecommendedPackageSelected(pkg)}
data-testid="add-recommendation-button"
> >
Add package Add package
</Button> </Button>

View file

@ -1467,7 +1467,6 @@ const Packages = () => {
<ToggleGroupItem <ToggleGroupItem
text="Available" text="Available"
buttonId="toggle-available" buttonId="toggle-available"
data-testid="packages-available-toggle"
isSelected={toggleSelected === 'toggle-available'} isSelected={toggleSelected === 'toggle-available'}
onChange={handleFilterToggleClick} onChange={handleFilterToggleClick}
/> />
@ -1480,7 +1479,6 @@ const Packages = () => {
: ' (100+)' : ' (100+)'
}`} }`}
buttonId="toggle-selected" buttonId="toggle-selected"
data-testid="packages-selected-toggle"
isSelected={toggleSelected === 'toggle-selected'} isSelected={toggleSelected === 'toggle-selected'}
onChange={handleFilterToggleClick} onChange={handleFilterToggleClick}
/> />

View file

@ -109,7 +109,7 @@ const ActivationKeyInformation = (): JSX.Element => {
<Th>Name</Th> <Th>Name</Th>
</Tr> </Tr>
</Thead> </Thead>
<Tbody data-testid="additional-repositories-table"> <Tbody>
{activationKeyInfo.body?.additionalRepositories?.map( {activationKeyInfo.body?.additionalRepositories?.map(
(repo, index) => ( (repo, index) => (
<Tr key={index}> <Tr key={index}>
@ -123,7 +123,6 @@ const ActivationKeyInformation = (): JSX.Element => {
} }
> >
<Button <Button
data-testid="repositories-popover-button"
variant="link" variant="link"
aria-label="Show additional repositories" aria-label="Show additional repositories"
className="pf-v5-u-pl-0 pf-v5-u-pt-0 pf-v5-u-pb-0" className="pf-v5-u-pl-0 pf-v5-u-pt-0 pf-v5-u-pb-0"

View file

@ -191,11 +191,7 @@ const ActivationKeysList = () => {
if (!isSuccessActivationKeys && isFetchingActivationKeys) { if (!isSuccessActivationKeys && isFetchingActivationKeys) {
selectOptionsElement.push( selectOptionsElement.push(
<SelectOption <SelectOption key="Fetching" value="loader">
key="Fetching"
value="loader"
data-testid="activation-keys-loading"
>
<Spinner size="md" /> <Spinner size="md" />
</SelectOption> </SelectOption>
); );
@ -250,7 +246,6 @@ const ActivationKeysList = () => {
Activation key to use for this image <PopoverActivation /> Activation key to use for this image <PopoverActivation />
</> </>
} }
data-testid="subscription-activation-key"
> >
<Select <Select
isScrollable isScrollable

View file

@ -143,7 +143,6 @@ const Registration = () => {
description={ description={
<Button <Button
component="a" component="a"
data-testid="registration-additional-options"
variant="link" variant="link"
isDisabled={!registrationType.startsWith('register-now')} isDisabled={!registrationType.startsWith('register-now')}
isInline isInline
@ -162,7 +161,6 @@ const Registration = () => {
<InsightsPopover /> <InsightsPopover />
</> </>
} }
data-testid="registration-checkbox-insights"
isChecked={ isChecked={
registrationType === 'register-now-insights' || registrationType === 'register-now-insights' ||
registrationType === 'register-now-rhc' registrationType === 'register-now-rhc'
@ -185,7 +183,6 @@ const Registration = () => {
<RhcPopover /> <RhcPopover />
</> </>
} }
data-testid="registration-checkbox-rhc"
isChecked={registrationType === 'register-now-rhc'} isChecked={registrationType === 'register-now-rhc'}
onChange={(_event, checked) => { onChange={(_event, checked) => {
if (checked) { if (checked) {
@ -218,7 +215,6 @@ const Registration = () => {
{isSatelliteRegistrationEnabled && ( {isSatelliteRegistrationEnabled && (
<Radio <Radio
label="Register with Satellite" label="Register with Satellite"
data-testid="register-satellite-radio"
isChecked={registrationType === 'register-satellite'} isChecked={registrationType === 'register-satellite'}
onChange={() => { onChange={() => {
dispatch(changeRegistrationType('register-satellite')); dispatch(changeRegistrationType('register-satellite'));

View file

@ -47,7 +47,6 @@ const PopoverActivation = () => {
<Button <Button
variant="plain" variant="plain"
aria-label="Activation key popover" aria-label="Activation key popover"
aria-describedby="subscription-activation-key"
className="pf-v5-u-pl-sm pf-v5-u-pt-0 pf-v5-u-pb-0 pf-v5-u-pr-0" className="pf-v5-u-pl-sm pf-v5-u-pt-0 pf-v5-u-pb-0 pf-v5-u-pr-0"
> >
<HelpIcon /> <HelpIcon />

View file

@ -575,7 +575,7 @@ const Repositories = () => {
refetch={refresh} refetch={refresh}
/> />
) : ( ) : (
<Table variant="compact" data-testid="repositories-table"> <Table variant="compact">
<Thead> <Thead>
<Tr> <Tr>
<Th aria-label="Selected" /> <Th aria-label="Selected" />
@ -607,10 +607,7 @@ const Repositories = () => {
); );
return ( return (
<Tr <Tr key={`${uuid}-${rowIndex}`}>
key={`${uuid}-${rowIndex}`}
data-testid="repositories-row"
>
<Td <Td
select={{ select={{
isSelected: selected.has(uuid), isSelected: selected.has(uuid),
@ -704,7 +701,7 @@ const Repositories = () => {
<Grid> <Grid>
<Panel> <Panel>
<PanelMain> <PanelMain>
<Table variant="compact" data-testid="repositories-table"> <Table variant="compact">
<Thead> <Thead>
<Tr> <Tr>
<Th aria-label="Selected" /> <Th aria-label="Selected" />
@ -731,10 +728,7 @@ const Repositories = () => {
} = repo; } = repo;
return ( return (
<Tr <Tr key={`${uuid}-${rowIndex}`}>
key={`${uuid}-${rowIndex}`}
data-testid="repositories-row"
>
<Td <Td
select={{ select={{
isSelected: true, isSelected: true,

View file

@ -66,58 +66,56 @@ const ReviewWizardFooter = () => {
return ( return (
<WizardFooterWrapper> <WizardFooterWrapper>
<div data-testid="wizard-save-button-div"> <Dropdown
<Dropdown isOpen={isOpen}
isOpen={isOpen} onOpenChange={(isOpen: boolean) => setIsOpen(isOpen)}
onOpenChange={(isOpen: boolean) => setIsOpen(isOpen)} toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
toggle={(toggleRef: React.Ref<MenuToggleElement>) => ( <MenuToggle
<MenuToggle variant="primary"
variant="primary" ref={toggleRef}
ref={toggleRef} onClick={onToggleClick}
onClick={onToggleClick} isExpanded={isOpen}
isExpanded={isOpen} isDisabled={!isValid}
isDisabled={!isValid} splitButtonOptions={{
splitButtonOptions={{ variant: 'action',
variant: 'action', items: composeId
items: composeId ? [
? [ <EditSaveButton
<EditSaveButton key="wizard-edit-save-btn"
key="wizard-edit-save-btn" getBlueprintPayload={getBlueprintPayload}
getBlueprintPayload={getBlueprintPayload} setIsOpen={setIsOpen}
setIsOpen={setIsOpen} blueprintId={composeId}
blueprintId={composeId} isDisabled={!isValid}
isDisabled={!isValid} />,
/>, ]
] : [
: [ <CreateSaveButton
<CreateSaveButton key="wizard-create-save-btn"
key="wizard-create-save-btn" getBlueprintPayload={getBlueprintPayload}
getBlueprintPayload={getBlueprintPayload} setIsOpen={setIsOpen}
setIsOpen={setIsOpen} isDisabled={!isValid}
isDisabled={!isValid} />,
/>, ],
], }}
}} />
/> )}
)} shouldFocusToggleOnSelect
shouldFocusToggleOnSelect >
> {composeId ? (
{composeId ? ( <EditSaveAndBuildBtn
<EditSaveAndBuildBtn getBlueprintPayload={getBlueprintPayload}
getBlueprintPayload={getBlueprintPayload} setIsOpen={setIsOpen}
setIsOpen={setIsOpen} blueprintId={composeId}
blueprintId={composeId} isDisabled={!isValid}
isDisabled={!isValid} />
/> ) : (
) : ( <CreateSaveAndBuildBtn
<CreateSaveAndBuildBtn getBlueprintPayload={getBlueprintPayload}
getBlueprintPayload={getBlueprintPayload} setIsOpen={setIsOpen}
setIsOpen={setIsOpen} isDisabled={!isValid}
isDisabled={!isValid} />
/> )}
)} </Dropdown>
</Dropdown>
</div>
<Button variant="secondary" onClick={goToPrevStep}> <Button variant="secondary" onClick={goToPrevStep}>
Back Back
</Button> </Button>

View file

@ -87,7 +87,7 @@ export const FSReviewTable = () => {
<Th>Minimum size</Th> <Th>Minimum size</Th>
</Tr> </Tr>
</Thead> </Thead>
<Tbody data-testid="file-system-configuration-tbody-review"> <Tbody>
{partitions.map((partition, partitionIndex) => ( {partitions.map((partition, partitionIndex) => (
<Tr key={partitionIndex}> <Tr key={partitionIndex}>
<Td className="pf-m-width-30">{partition.mountpoint}</Td> <Td className="pf-m-width-30">{partition.mountpoint}</Td>
@ -175,7 +175,7 @@ export const SnapshotTable = ({
<Th>Last snapshot date</Th> <Th>Last snapshot date</Th>
</Tr> </Tr>
</Thead> </Thead>
<Tbody data-testid="packages-tbody-review"> <Tbody>
{data?.data?.map(({ uuid, name, last_snapshot }, pkgIndex) => ( {data?.data?.map(({ uuid, name, last_snapshot }, pkgIndex) => (
<Tr key={pkgIndex}> <Tr key={pkgIndex}>
<Td>{name}</Td> <Td>{name}</Td>
@ -224,7 +224,7 @@ export const PackagesTable = () => {
<Th>Package repository</Th> <Th>Package repository</Th>
</Tr> </Tr>
</Thead> </Thead>
<Tbody data-testid="packages-tbody-review"> <Tbody>
{packages.map((pkg, pkgIndex) => ( {packages.map((pkg, pkgIndex) => (
<Tr key={pkgIndex}> <Tr key={pkgIndex}>
<Td className="pf-m-width-30">{pkg.name}</Td> <Td className="pf-m-width-30">{pkg.name}</Td>
@ -277,7 +277,7 @@ export const RepositoriesTable = () => {
<Th>Name</Th> <Th>Name</Th>
</Tr> </Tr>
</Thead> </Thead>
<Tbody data-testid="repositories-tbody-review"> <Tbody>
{repositoriesList.map((repo, repoIndex) => ( {repositoriesList.map((repo, repoIndex) => (
<Tr key={repoIndex + 1}> <Tr key={repoIndex + 1}>
<Td className="pf-m-width-60"> <Td className="pf-m-width-60">

View file

@ -160,10 +160,7 @@ export const FSCList = () => {
> >
Configuration type Configuration type
</TextListItem> </TextListItem>
<TextListItem <TextListItem component={TextListItemVariants.dd}>
component={TextListItemVariants.dd}
data-testid="partitioning-auto-manual"
>
{fileSystemConfigurationType === 'manual' ? 'Manual' : 'Automatic'} {fileSystemConfigurationType === 'manual' ? 'Manual' : 'Automatic'}
{fileSystemConfigurationType === 'manual' && ( {fileSystemConfigurationType === 'manual' && (
<> <>
@ -176,7 +173,6 @@ export const FSCList = () => {
bodyContent={<FSReviewTable />} bodyContent={<FSReviewTable />}
> >
<Button <Button
data-testid="file-system-configuration-popover"
variant="link" variant="link"
aria-label="File system configuration info" aria-label="File system configuration info"
aria-describedby="file-system-configuration-info" aria-describedby="file-system-configuration-info"
@ -526,10 +522,7 @@ export const ContentList = () => {
> >
Repeatable build Repeatable build
</TextListItem> </TextListItem>
<TextListItem <TextListItem component={TextListItemVariants.dd}>
component={TextListItemVariants.dd}
data-testid="snapshot-method"
>
<Popover <Popover
position="bottom" position="bottom"
headerContent={ headerContent={
@ -572,10 +565,7 @@ export const ContentList = () => {
<TextListItem component={TextListItemVariants.dt}> <TextListItem component={TextListItemVariants.dt}>
Custom repositories Custom repositories
</TextListItem> </TextListItem>
<TextListItem <TextListItem component={TextListItemVariants.dd}>
component={TextListItemVariants.dd}
data-testid="custom-repositories-count"
>
{customRepositories?.length + recommendedRepositories.length > 0 ? ( {customRepositories?.length + recommendedRepositories.length > 0 ? (
<Popover <Popover
position="bottom" position="bottom"
@ -603,10 +593,7 @@ export const ContentList = () => {
> >
Additional packages Additional packages
</TextListItem> </TextListItem>
<TextListItem <TextListItem component={TextListItemVariants.dd}>
component={TextListItemVariants.dd}
data-testid="chosen-packages-count"
>
{packages?.length > 0 || groups?.length > 0 ? ( {packages?.length > 0 || groups?.length > 0 ? (
<Popover <Popover
position="bottom" position="bottom"

View file

@ -102,7 +102,7 @@ const Templates = () => {
onPerPageSelect={handlePerPageSelect} onPerPageSelect={handlePerPageSelect}
isCompact isCompact
/> />
<Table variant="compact" data-testid="templates-table"> <Table variant="compact">
<Thead> <Thead>
<Tr> <Tr>
<Th aria-label="Selected" /> <Th aria-label="Selected" />

View file

@ -134,11 +134,7 @@ export const AzureResourceGroups = () => {
); );
return ( return (
<FormGroup <FormGroup isRequired label={'Resource group'}>
isRequired
label={'Resource group'}
data-testid="azure-resource-groups"
>
<Select <Select
isScrollable isScrollable
isOpen={isOpen} isOpen={isOpen}
@ -151,10 +147,7 @@ export const AzureResourceGroups = () => {
> >
<SelectList> <SelectList>
{isFetching && ( {isFetching && (
<SelectOption <SelectOption value="loader">
value="loader"
data-testid="azure-resource-groups-loading"
>
<Spinner size="lg" /> <Spinner size="lg" />
</SelectOption> </SelectOption>
)} )}

View file

@ -183,7 +183,7 @@ export const AzureSourcesSelect = () => {
return ( return (
<> <>
<FormGroup isRequired label={'Source name'} data-testid="azure-sources"> <FormGroup isRequired label={'Source name'}>
<Select <Select
isScrollable isScrollable
isOpen={isOpen} isOpen={isOpen}

View file

@ -41,7 +41,6 @@ const Gcp = () => {
<FormGroup label="Select image sharing" isRequired> <FormGroup label="Select image sharing" isRequired>
<Radio <Radio
id="share-with-google" id="share-with-google"
data-testid="share-with-google"
label="Share image with a Google account" label="Share image with a Google account"
name="radio-1" name="radio-1"
description={ description={

View file

@ -34,7 +34,6 @@ const EmptyBlueprintsImagesTable = () => (
<EmptyStateHeader <EmptyStateHeader
icon={<EmptyStateIcon icon={PlusCircleIcon} />} icon={<EmptyStateIcon icon={PlusCircleIcon} />}
titleText="No images" titleText="No images"
data-testid="empty-state-header"
/> />
<EmptyStateBody> <EmptyStateBody>
<Text> <Text>

View file

@ -112,7 +112,7 @@ export const ImageBuilderHeader = ({
isOpen={showImportModal} isOpen={showImportModal}
/> />
)} )}
<PageHeader data-testid="image-builder-header"> <PageHeader>
<Flex> <Flex>
<FlexItem> <FlexItem>
<PageHeaderTitle <PageHeaderTitle