src: Remove more data-testids
As using `data-testid`s in tests is an anti-pattern, this removes more of them and replaces them with appropriate locators in the tests.
This commit is contained in:
parent
0ea874abc6
commit
a0fe3644c3
26 changed files with 257 additions and 160 deletions
|
|
@ -194,7 +194,6 @@ const MountpointPrefix = ({ partition }: MountpointPrefixPropTypes) => {
|
|||
onClick={onToggleClick}
|
||||
isExpanded={isOpen}
|
||||
isDisabled={prefix === '/'}
|
||||
data-testid="prefix-select"
|
||||
isFullWidth
|
||||
>
|
||||
{prefix}
|
||||
|
|
@ -332,12 +331,7 @@ const SizeUnit = ({ partition }: SizeUnitPropTypes) => {
|
|||
};
|
||||
|
||||
const toggle = (toggleRef: React.Ref<MenuToggleElement>) => (
|
||||
<MenuToggle
|
||||
ref={toggleRef}
|
||||
onClick={onToggleClick}
|
||||
isExpanded={isOpen}
|
||||
data-testid="unit-select"
|
||||
>
|
||||
<MenuToggle ref={toggleRef} onClick={onToggleClick} isExpanded={isOpen}>
|
||||
{partition.unit}
|
||||
</MenuToggle>
|
||||
);
|
||||
|
|
@ -505,7 +499,6 @@ const FileSystemTable = () => {
|
|||
className={isDragging ? styles.modifiers.dragOver : ''}
|
||||
aria-label="File system table"
|
||||
variant="compact"
|
||||
data-testid="fsc-table"
|
||||
>
|
||||
<Thead>
|
||||
<Tr>
|
||||
|
|
@ -526,7 +519,6 @@ const FileSystemTable = () => {
|
|||
onDrop={onDragOver}
|
||||
onDragLeave={onDragLeave}
|
||||
ref={bodyRef}
|
||||
data-testid="file-system-configuration-tbody"
|
||||
>
|
||||
{partitions &&
|
||||
partitions.map((partition) => (
|
||||
|
|
|
|||
|
|
@ -119,7 +119,6 @@ export const MajorReleasesLifecyclesChart = () => {
|
|||
<Panel>
|
||||
<PanelMain maxHeight="10rem">
|
||||
<Bar
|
||||
data-testid="release-lifecycle-chart"
|
||||
options={chartMajorVersionCfg.options}
|
||||
data={chartMajorVersionCfg.data}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ type TargetEnvironmentCardProps = {
|
|||
imageAlt: string;
|
||||
isClicked: boolean;
|
||||
isDisabled?: boolean;
|
||||
testId: string;
|
||||
handleOnClick: () => void;
|
||||
onMouseEnter?: MouseEventHandler<HTMLElement>;
|
||||
};
|
||||
|
|
@ -50,11 +49,9 @@ const TargetEnvironmentCard = ({
|
|||
onMouseEnter,
|
||||
isClicked,
|
||||
isDisabled = false,
|
||||
testId,
|
||||
}: TargetEnvironmentCardProps) => {
|
||||
return (
|
||||
<Card
|
||||
data-testid={testId}
|
||||
style={{ textAlign: 'center' } as React.CSSProperties}
|
||||
onMouseUp={onMouseEnter}
|
||||
isClicked={isClicked}
|
||||
|
|
@ -147,7 +144,6 @@ const TargetEnvironment = () => {
|
|||
<Gallery hasGutter>
|
||||
{supportedEnvironments?.includes('aws') && (
|
||||
<TargetEnvironmentCard
|
||||
testId="upload-aws"
|
||||
title="Amazon Web Services"
|
||||
imageSrc={'/apps/frontend-assets/partners-icons/aws.svg'}
|
||||
imageAlt="Amazon Web Services logo"
|
||||
|
|
@ -158,7 +154,6 @@ const TargetEnvironment = () => {
|
|||
)}
|
||||
{supportedEnvironments?.includes('gcp') && (
|
||||
<TargetEnvironmentCard
|
||||
testId="upload-google"
|
||||
title="Google Cloud Platform"
|
||||
imageSrc={
|
||||
'/apps/frontend-assets/partners-icons/google-cloud-short.svg'
|
||||
|
|
@ -171,7 +166,6 @@ const TargetEnvironment = () => {
|
|||
)}
|
||||
{supportedEnvironments?.includes('azure') && (
|
||||
<TargetEnvironmentCard
|
||||
testId="upload-azure"
|
||||
title="Microsoft Azure"
|
||||
imageSrc={
|
||||
'/apps/frontend-assets/partners-icons/microsoft-azure-short.svg'
|
||||
|
|
@ -184,7 +178,6 @@ const TargetEnvironment = () => {
|
|||
)}
|
||||
{supportedEnvironments?.includes('oci') && (
|
||||
<TargetEnvironmentCard
|
||||
testId="upload-oci"
|
||||
title="Oracle Cloud Infrastructure"
|
||||
imageSrc={
|
||||
'/apps/frontend-assets/partners-icons/oracle-short.svg'
|
||||
|
|
@ -208,7 +201,6 @@ const TargetEnvironment = () => {
|
|||
name="vsphere-checkbox-ova"
|
||||
aria-label="VMware vSphere checkbox OVA"
|
||||
id="vsphere-checkbox-ova"
|
||||
data-testid="checkbox-vsphere-ova"
|
||||
label={
|
||||
<>
|
||||
VMware vSphere - Open virtualization format (.ova)
|
||||
|
|
@ -249,7 +241,6 @@ const TargetEnvironment = () => {
|
|||
name="vsphere-checkbox-vmdk"
|
||||
aria-label="VMware vSphere checkbox VMDK"
|
||||
id="vsphere-checkbox-vmdk"
|
||||
data-testid="checkbox-vsphere-vmdk"
|
||||
label={
|
||||
<>
|
||||
VMware vSphere - Virtual disk (.vmdk)
|
||||
|
|
@ -296,7 +287,6 @@ const TargetEnvironment = () => {
|
|||
aria-label="Virtualization guest image checkbox"
|
||||
id="checkbox-guest-image"
|
||||
name="Virtualization guest image"
|
||||
data-testid="checkbox-guest-image"
|
||||
/>
|
||||
)}
|
||||
{supportedEnvironments?.includes('image-installer') && (
|
||||
|
|
@ -309,7 +299,6 @@ const TargetEnvironment = () => {
|
|||
aria-label="Bare metal installer checkbox"
|
||||
id="checkbox-image-installer"
|
||||
name="Bare metal installer"
|
||||
data-testid="checkbox-image-installer"
|
||||
/>
|
||||
)}
|
||||
{supportedEnvironments?.includes('wsl') && (
|
||||
|
|
@ -369,7 +358,6 @@ const TargetEnvironment = () => {
|
|||
aria-label="windows subsystem for linux checkbox"
|
||||
id="checkbox-wsl"
|
||||
name="WSL"
|
||||
data-testid="checkbox-wsl"
|
||||
/>
|
||||
)}
|
||||
</FormGroup>
|
||||
|
|
|
|||
|
|
@ -120,7 +120,6 @@ const Registration = () => {
|
|||
<FormGroup label="Registration method">
|
||||
<Radio
|
||||
label="Automatically register and enable advanced capabilities"
|
||||
data-testid="automatically-register-radio"
|
||||
isChecked={
|
||||
registrationType === 'register-now' ||
|
||||
registrationType === 'register-now-insights' ||
|
||||
|
|
@ -200,7 +199,6 @@ const Registration = () => {
|
|||
/>
|
||||
<Radio
|
||||
label="Register later"
|
||||
data-testid="register-later-radio"
|
||||
isChecked={registrationType === 'register-later'}
|
||||
onChange={() => {
|
||||
dispatch(changeRegistrationType('register-later'));
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ const Empty = ({ hasFilterValue, refetch }: EmptyProps) => {
|
|||
: 'No custom repositories'
|
||||
}
|
||||
variant={EmptyStateVariant.lg}
|
||||
data-testid="empty-state"
|
||||
>
|
||||
<EmptyStateBody>
|
||||
{hasFilterValue
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ const TemplatesEmpty = ({ refetch }: TemplatesEmptyProps) => {
|
|||
headingLevel="h4"
|
||||
titleText={'No content templates'}
|
||||
variant={EmptyStateVariant.lg}
|
||||
data-testid="empty-state"
|
||||
>
|
||||
<EmptyStateBody>
|
||||
{`Content templates can be added in the "Templates" area of the
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ export const AzureHyperVSelect = () => {
|
|||
const toggle = (toggleRef: React.Ref<MenuToggleElement>) => (
|
||||
<MenuToggle
|
||||
ref={toggleRef}
|
||||
data-testid="azure-hyper-v-generation-select"
|
||||
onClick={() => setIsOpen(!isOpen)}
|
||||
isExpanded={isOpen}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -66,7 +66,6 @@ const Gcp = () => {
|
|||
/>
|
||||
<Radio
|
||||
id="share-with-insights"
|
||||
data-testid="share-with-insights"
|
||||
label="Share image with Red Hat Insights only"
|
||||
name="radio-2"
|
||||
description={
|
||||
|
|
@ -88,7 +87,6 @@ const Gcp = () => {
|
|||
<FormGroup label="Account type" isRequired>
|
||||
<Radio
|
||||
id="google-account"
|
||||
data-testid="google-account"
|
||||
label="Google account"
|
||||
name="radio-3"
|
||||
isChecked={accountType === 'user'}
|
||||
|
|
@ -98,7 +96,6 @@ const Gcp = () => {
|
|||
/>
|
||||
<Radio
|
||||
id="service-account"
|
||||
data-testid="service-account"
|
||||
label="Service account"
|
||||
name="radio-4"
|
||||
isChecked={accountType === 'serviceAccount'}
|
||||
|
|
@ -108,7 +105,6 @@ const Gcp = () => {
|
|||
/>
|
||||
<Radio
|
||||
id="google-group"
|
||||
data-testid="google-group"
|
||||
label="Google group"
|
||||
name="radio-5"
|
||||
isChecked={accountType === 'group'}
|
||||
|
|
@ -118,7 +114,6 @@ const Gcp = () => {
|
|||
/>
|
||||
<Radio
|
||||
id="google-domain"
|
||||
data-testid="google-domain"
|
||||
label="Google Workspace domain or Cloud Identity domain"
|
||||
name="radio-6"
|
||||
isChecked={accountType === 'domain'}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue