src: Run lint autofix
This commit is contained in:
parent
4c098db796
commit
e9025e460c
35 changed files with 177 additions and 176 deletions
|
|
@ -87,7 +87,7 @@ test.describe.serial('test', () => {
|
|||
await frame.getByRole('button', { name: 'Create blueprint' }).click();
|
||||
|
||||
await expect(
|
||||
frame.locator('.pf-v6-c-card__title-text').getByText(blueprintName),
|
||||
frame.locator('.pf-v6-c-card__title-text').getByText(blueprintName)
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
|
|
@ -205,7 +205,7 @@ test.describe.serial('test', () => {
|
|||
if (await switchInput.isChecked()) {
|
||||
await frame.getByRole('button', { name: 'Cancel' }).click();
|
||||
await expect(
|
||||
frame.getByRole('heading', { name: 'All images' }),
|
||||
frame.getByRole('heading', { name: 'All images' })
|
||||
).toBeVisible();
|
||||
} else {
|
||||
const switchToggle = frame.locator('.pf-v6-c-switch');
|
||||
|
|
@ -219,7 +219,7 @@ test.describe.serial('test', () => {
|
|||
await frame.getByPlaceholder('Path to AWS credentials').fill(credentials);
|
||||
await frame.getByRole('button', { name: 'Submit' }).click();
|
||||
await expect(
|
||||
frame.getByRole('heading', { name: 'All images' }),
|
||||
frame.getByRole('heading', { name: 'All images' })
|
||||
).toBeVisible();
|
||||
}
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ test.describe.serial('test', () => {
|
|||
|
||||
await expect(frame.getByPlaceholder('AWS bucket')).toHaveValue(bucket);
|
||||
await expect(frame.getByPlaceholder('Path to AWS credentials')).toHaveValue(
|
||||
credentials,
|
||||
credentials
|
||||
);
|
||||
await frame.getByRole('button', { name: 'Cancel' }).click();
|
||||
|
||||
|
|
@ -276,7 +276,7 @@ test.describe.serial('test', () => {
|
|||
frame.getByRole('heading', { name: 'Details' });
|
||||
await frame.getByTestId('blueprint').fill(cockpitBlueprintname);
|
||||
await expect(frame.getByTestId('blueprint')).toHaveValue(
|
||||
cockpitBlueprintname,
|
||||
cockpitBlueprintname
|
||||
);
|
||||
await frame.getByRole('button', { name: 'Next', exact: true }).click();
|
||||
|
||||
|
|
|
|||
|
|
@ -155,9 +155,8 @@ export const ImportBlueprintModal: React.FunctionComponent<
|
|||
blueprintFromFile.content_sources &&
|
||||
blueprintFromFile.content_sources.length > 0
|
||||
) {
|
||||
const imported = await handleRepositoryImport(
|
||||
blueprintFromFile
|
||||
);
|
||||
const imported =
|
||||
await handleRepositoryImport(blueprintFromFile);
|
||||
customRepos = imported ?? [];
|
||||
}
|
||||
|
||||
|
|
@ -308,10 +307,10 @@ export const ImportBlueprintModal: React.FunctionComponent<
|
|||
{isRejected
|
||||
? 'Must be a valid Blueprint JSON/TOML file no larger than 512 KB'
|
||||
: isInvalidFormat
|
||||
? 'Not compatible with the blueprints format.'
|
||||
: isOnPrem
|
||||
? 'Importing on-premises blueprints is currently in beta. Results may vary.'
|
||||
: 'Upload your blueprint file. Supported formats: JSON, TOML.'}
|
||||
? 'Not compatible with the blueprints format.'
|
||||
: isOnPrem
|
||||
? 'Importing on-premises blueprints is currently in beta. Results may vary.'
|
||||
: 'Upload your blueprint file. Supported formats: JSON, TOML.'}
|
||||
</HelperTextItem>
|
||||
</HelperText>
|
||||
</FormHelperText>
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ type ToggleGroupProps = Omit<FormGroupProps<boolean>, 'isDisabled'>;
|
|||
const AWSConfigToggle = ({ value, onChange }: ToggleGroupProps) => {
|
||||
const handleChange = (
|
||||
_event: React.FormEvent<HTMLInputElement>,
|
||||
checked: boolean,
|
||||
checked: boolean
|
||||
) => {
|
||||
onChange(checked);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ export const CloudProviderConfig = () => {
|
|||
dispatch(changeAWSCredsPath(credentials));
|
||||
}
|
||||
},
|
||||
[dispatch, setEnabled],
|
||||
[dispatch, setEnabled]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
|
|
|
|||
|
|
@ -442,10 +442,10 @@ const CreateImageWizard = ({ isEdit }: CreateImageWizardProps) => {
|
|||
!isAzureSubscriptionIdValid(azureSubscriptionId) ||
|
||||
!isAzureResourceGroupValid(azureResourceGroup)
|
||||
: azureShareMethod === 'sources'
|
||||
? !isAzureTenantGUIDValid(azureTenantId) ||
|
||||
!isAzureSubscriptionIdValid(azureSubscriptionId) ||
|
||||
!isAzureResourceGroupValid(azureResourceGroup)
|
||||
: azureSource === undefined
|
||||
? !isAzureTenantGUIDValid(azureTenantId) ||
|
||||
!isAzureSubscriptionIdValid(azureSubscriptionId) ||
|
||||
!isAzureResourceGroupValid(azureResourceGroup)
|
||||
: azureSource === undefined
|
||||
}
|
||||
/>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,8 +116,8 @@ const getValidationState = (
|
|||
const validated = isPristine
|
||||
? 'default'
|
||||
: (isRequired && errorMessage) || errorMessage
|
||||
? 'error'
|
||||
: 'success';
|
||||
? 'error'
|
||||
: 'success';
|
||||
|
||||
return validated;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -142,8 +142,14 @@ const TargetEnvironment = () => {
|
|||
};
|
||||
|
||||
if (isFetching) {
|
||||
return <EmptyState titleText="Loading target environments" headingLevel="h6" icon={Spinner} />
|
||||
};
|
||||
return (
|
||||
<EmptyState
|
||||
titleText="Loading target environments"
|
||||
headingLevel="h6"
|
||||
icon={Spinner}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
if (isError) {
|
||||
return (
|
||||
|
|
@ -152,10 +158,11 @@ const TargetEnvironment = () => {
|
|||
variant="danger"
|
||||
isInline
|
||||
>
|
||||
Target environments couldn't be loaded, please refresh the page or try again later.
|
||||
Target environments couldn't be loaded, please refresh the page or
|
||||
try again later.
|
||||
</Alert>
|
||||
)
|
||||
};
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<FormGroup
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ const ProfileSelector = () => {
|
|||
const onKeyDown = (event: React.KeyboardEvent) => {
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault();
|
||||
|
||||
|
||||
if (!isOpen) {
|
||||
setIsOpen(true);
|
||||
} else if (selectOptions.length === 1) {
|
||||
|
|
@ -220,7 +220,7 @@ const ProfileSelector = () => {
|
|||
profileID: singleProfile.id,
|
||||
toString: () => singleProfile.name || '',
|
||||
};
|
||||
|
||||
|
||||
setInputValue(singleProfile.name || '');
|
||||
setFilterValue('');
|
||||
applyChanges(selection);
|
||||
|
|
|
|||
|
|
@ -1485,8 +1485,8 @@ const Packages = () => {
|
|||
packages.length + groups.length === 0
|
||||
? ''
|
||||
: packages.length + groups.length <= 100
|
||||
? ` (${packages.length + groups.length})`
|
||||
: ' (100+)'
|
||||
? ` (${packages.length + groups.length})`
|
||||
: ' (100+)'
|
||||
}`}
|
||||
buttonId="toggle-selected"
|
||||
isSelected={toggleSelected === 'toggle-selected'}
|
||||
|
|
@ -1501,10 +1501,10 @@ const Packages = () => {
|
|||
searchTerm === '' && toggleSelected === 'toggle-available'
|
||||
? 0
|
||||
: showPackages && showGroups
|
||||
? transformedPackages.length + transformedGroups.length
|
||||
: showPackages
|
||||
? transformedPackages.length
|
||||
: transformedGroups.length
|
||||
? transformedPackages.length + transformedGroups.length
|
||||
: showPackages
|
||||
? transformedPackages.length
|
||||
: transformedGroups.length
|
||||
}
|
||||
perPage={perPage}
|
||||
page={page}
|
||||
|
|
@ -1550,10 +1550,10 @@ const Packages = () => {
|
|||
searchTerm === '' && toggleSelected === 'toggle-available'
|
||||
? 0
|
||||
: showPackages && showGroups
|
||||
? transformedPackages.length + transformedGroups.length
|
||||
: showPackages
|
||||
? transformedPackages.length
|
||||
: transformedGroups.length
|
||||
? transformedPackages.length + transformedGroups.length
|
||||
: showPackages
|
||||
? transformedPackages.length
|
||||
: transformedGroups.length
|
||||
}
|
||||
perPage={perPage}
|
||||
page={page}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ const SatelliteRegistration = () => {
|
|||
const validated = stepValidation.errors['certificate']
|
||||
? 'error'
|
||||
: stepValidation.errors['certificate'] === undefined && caCertificate
|
||||
? 'success'
|
||||
: 'default';
|
||||
? 'success'
|
||||
: 'default';
|
||||
const handleClear = () => {
|
||||
dispatch(changeSatelliteCaCertificate(''));
|
||||
};
|
||||
|
|
@ -79,17 +79,17 @@ const SatelliteRegistration = () => {
|
|||
isRejected || validated === 'error'
|
||||
? 'error'
|
||||
: validated === 'success'
|
||||
? 'success'
|
||||
: 'default'
|
||||
? 'success'
|
||||
: 'default'
|
||||
}
|
||||
>
|
||||
{isRejected
|
||||
? 'Must be a .PEM/.CER/.CRT file no larger than 512 KB'
|
||||
: validated === 'error'
|
||||
? stepValidation.errors['certificate']
|
||||
: validated === 'success'
|
||||
? 'Certificate was uploaded'
|
||||
: 'Drag and drop a valid certificate file or upload one'}
|
||||
? stepValidation.errors['certificate']
|
||||
: validated === 'success'
|
||||
? 'Certificate was uploaded'
|
||||
: 'Drag and drop a valid certificate file or upload one'}
|
||||
</HelperTextItem>
|
||||
{(isRejected || validated !== 'success') && (
|
||||
<HelperTextItem>
|
||||
|
|
|
|||
|
|
@ -140,8 +140,8 @@ export const SnapshotTable = ({
|
|||
snapshotForDate.length > 0
|
||||
? snapshotForDate.map(({ repository_uuid }) => repository_uuid).join()
|
||||
: template && templateData && templateData.repository_uuids
|
||||
? templateData.repository_uuids.join(',')
|
||||
: '',
|
||||
? templateData.repository_uuids.join(',')
|
||||
: '',
|
||||
origin: ContentOrigin.REDHAT + ',' + ContentOrigin.CUSTOM, // Make sure to show both redhat and external
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -313,10 +313,10 @@ export const TargetEnvGCPList = () => {
|
|||
{accountType === 'group'
|
||||
? 'Google group'
|
||||
: accountType === 'serviceAccount'
|
||||
? 'Service account'
|
||||
: accountType === 'user'
|
||||
? 'Google account'
|
||||
: 'Domain'}
|
||||
? 'Service account'
|
||||
: accountType === 'user'
|
||||
? 'Google account'
|
||||
: 'Domain'}
|
||||
</Content>
|
||||
<Content
|
||||
component={ContentVariants.dt}
|
||||
|
|
@ -520,10 +520,10 @@ export const ContentList = () => {
|
|||
useLatest
|
||||
? 'Use the latest repository content'
|
||||
: template
|
||||
? 'Use content from the content template'
|
||||
: `Repositories as of ${yyyyMMddFormat(
|
||||
new Date(snapshotDate)
|
||||
)}`
|
||||
? 'Use content from the content template'
|
||||
: `Repositories as of ${yyyyMMddFormat(
|
||||
new Date(snapshotDate)
|
||||
)}`
|
||||
}
|
||||
hasAutoWidth
|
||||
minWidth="60rem"
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ export const AwsAccountId = () => {
|
|||
readOnlyVariant="default"
|
||||
isRequired
|
||||
id="aws-account-id"
|
||||
value={sourceId && data ? data.aws?.account_id ?? '' : ''}
|
||||
value={sourceId && data ? (data.aws?.account_id ?? '') : ''}
|
||||
aria-label="aws account id"
|
||||
/>
|
||||
</FormGroup>
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ const AWSRegion = ({ value, onChange }: FormGroupProps<string>) => {
|
|||
|
||||
const onSelect = (
|
||||
_event: React.MouseEvent<Element, MouseEvent> | undefined,
|
||||
value: string | number | undefined,
|
||||
value: string | number | undefined
|
||||
) => {
|
||||
onChange(value as string);
|
||||
setIsOpen(false);
|
||||
|
|
|
|||
|
|
@ -51,14 +51,14 @@ export const PasswordValidatedInput = ({
|
|||
|
||||
const PasswordToggleButton = () => {
|
||||
return (
|
||||
<Button
|
||||
variant="control"
|
||||
onClick={togglePasswordVisibility}
|
||||
aria-label={isPasswordVisible ? 'Hide password' : 'Show password'}
|
||||
isDisabled={isEditingWithoutValue}
|
||||
>
|
||||
{isPasswordVisible ? <EyeSlashIcon /> : <EyeIcon />}
|
||||
</Button>
|
||||
<Button
|
||||
variant="control"
|
||||
onClick={togglePasswordVisibility}
|
||||
aria-label={isPasswordVisible ? 'Hide password' : 'Show password'}
|
||||
isDisabled={isEditingWithoutValue}
|
||||
>
|
||||
{isPasswordVisible ? <EyeSlashIcon /> : <EyeIcon />}
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
||||
|
|
@ -78,13 +78,13 @@ export const PasswordValidatedInput = ({
|
|||
</InputGroupItem>
|
||||
<InputGroupItem>
|
||||
{isEditingWithoutValue ? (
|
||||
<Tooltip content="Passwords cannot be viewed when editing a blueprint for security reasons">
|
||||
<Tooltip content="Passwords cannot be viewed when editing a blueprint for security reasons">
|
||||
<span>
|
||||
<PasswordToggleButton/>
|
||||
<PasswordToggleButton />
|
||||
</span>
|
||||
</Tooltip>
|
||||
</Tooltip>
|
||||
) : (
|
||||
<PasswordToggleButton/>
|
||||
<PasswordToggleButton />
|
||||
)}
|
||||
</InputGroupItem>
|
||||
</InputGroup>
|
||||
|
|
|
|||
|
|
@ -165,12 +165,12 @@ const getLatestRelease = (distribution: Distributions) => {
|
|||
return distribution.startsWith('rhel-10')
|
||||
? RHEL_10
|
||||
: distribution.startsWith('rhel-9')
|
||||
? RHEL_9
|
||||
: distribution.startsWith('rhel-8')
|
||||
? RHEL_8
|
||||
: distribution === ('centos-8' as Distributions)
|
||||
? CENTOS_9
|
||||
: distribution;
|
||||
? RHEL_9
|
||||
: distribution.startsWith('rhel-8')
|
||||
? RHEL_8
|
||||
: distribution === ('centos-8' as Distributions)
|
||||
? CENTOS_9
|
||||
: distribution;
|
||||
};
|
||||
|
||||
function commonRequestToState(
|
||||
|
|
@ -256,13 +256,13 @@ function commonRequestToState(
|
|||
policyTitle: undefined,
|
||||
}
|
||||
: oscapProfile !== undefined
|
||||
? {
|
||||
complianceType: 'openscap' as ComplianceType,
|
||||
profileID: oscapProfile,
|
||||
policyID: undefined,
|
||||
policyTitle: undefined,
|
||||
}
|
||||
: initialState.compliance,
|
||||
? {
|
||||
complianceType: 'openscap' as ComplianceType,
|
||||
profileID: oscapProfile,
|
||||
policyID: undefined,
|
||||
policyTitle: undefined,
|
||||
}
|
||||
: initialState.compliance,
|
||||
firstBoot: request.customizations
|
||||
? {
|
||||
script: getFirstBootScript(request.customizations.files),
|
||||
|
|
@ -393,8 +393,8 @@ export const mapRequestToState = (request: BlueprintResponse): wizardState => {
|
|||
? 'register-now-rhc'
|
||||
: 'register-now-insights'
|
||||
: getSatelliteCommand(request.customizations.files)
|
||||
? 'register-satellite'
|
||||
: 'register-later',
|
||||
? 'register-satellite'
|
||||
: 'register-later',
|
||||
activationKey: isRhel(request.distribution)
|
||||
? request.customizations.subscription?.['activation-key']
|
||||
: undefined,
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ const ProvisioningLink = ({
|
|||
scope: 'provisioning',
|
||||
module: './ProvisioningWizard',
|
||||
},
|
||||
{},
|
||||
{}
|
||||
);
|
||||
|
||||
const { permissions, isLoading: isLoadingPermission } =
|
||||
|
|
@ -126,7 +126,7 @@ const ProvisioningLink = ({
|
|||
// Recomputing this value on every render made the modal crash. Using a state
|
||||
// helps avoiding this situation as the value is only set the first time.
|
||||
const [appendTo] = useState(
|
||||
document.querySelector(MODAL_ANCHOR) as HTMLElement,
|
||||
document.querySelector(MODAL_ANCHOR) as HTMLElement
|
||||
);
|
||||
|
||||
const selectedBlueprintId = useAppSelector(selectSelectedBlueprintId);
|
||||
|
|
@ -137,10 +137,10 @@ const ProvisioningLink = ({
|
|||
{
|
||||
selectFromResult: ({ data }) => ({
|
||||
selectedBlueprintVersion: data?.data.find(
|
||||
(blueprint: BlueprintItem) => blueprint.id === selectedBlueprintId,
|
||||
(blueprint: BlueprintItem) => blueprint.id === selectedBlueprintId
|
||||
)?.version,
|
||||
}),
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
if (
|
||||
|
|
@ -270,7 +270,7 @@ export const OciInstance = ({ compose, isExpired }: OciInstancePropTypes) => {
|
|||
|
||||
if (options && !isOciUploadStatus(options)) {
|
||||
throw TypeError(
|
||||
`Error: options must be of type OciUploadStatus, not ${typeof options}.`,
|
||||
`Error: options must be of type OciUploadStatus, not ${typeof options}.`
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -404,7 +404,7 @@ export const AwsS3Instance = ({
|
|||
|
||||
if (options && !isAwss3UploadStatus(options)) {
|
||||
throw TypeError(
|
||||
`Error: options must be of type Awss3UploadStatus, not ${typeof options}.`,
|
||||
`Error: options must be of type Awss3UploadStatus, not ${typeof options}.`
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,10 @@ import React from 'react';
|
|||
import { Skeleton } from '@patternfly/react-core';
|
||||
|
||||
import { targetOptions } from '../../constants';
|
||||
import { ComposesResponseItem, useGetComposeClonesQuery } from '../../store/imageBuilderApi';
|
||||
import {
|
||||
ComposesResponseItem,
|
||||
useGetComposeClonesQuery,
|
||||
} from '../../store/imageBuilderApi';
|
||||
|
||||
type TargetPropTypes = {
|
||||
compose: ComposesResponseItem;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export function useMutationWithNotification<
|
|||
isError: boolean;
|
||||
error?: unknown;
|
||||
reset: () => void;
|
||||
}
|
||||
},
|
||||
>(
|
||||
mutationHook: (
|
||||
options?: HookOptions
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import {
|
|||
addListener,
|
||||
createListenerMiddleware,
|
||||
type TypedAddListener,
|
||||
type TypedStartListening
|
||||
type TypedStartListening,
|
||||
} from '@reduxjs/toolkit';
|
||||
|
||||
import type { AppDispatch, RootState } from './index';
|
||||
|
|
|
|||
|
|
@ -469,9 +469,8 @@ describe('Import modal', () => {
|
|||
// Timezone
|
||||
await clickNext();
|
||||
await screen.findByRole('heading', { name: /Timezone/ });
|
||||
const timezoneDropDown = await screen.findByPlaceholderText(
|
||||
/Select a timezone/i
|
||||
);
|
||||
const timezoneDropDown =
|
||||
await screen.findByPlaceholderText(/Select a timezone/i);
|
||||
expect(timezoneDropDown).toHaveValue('US/Eastern');
|
||||
await screen.findByText(/0\.north-america\.pool\.ntp\.org/i);
|
||||
await screen.findByText(/1\.north-america\.pool\.ntp\.org/i);
|
||||
|
|
@ -481,9 +480,8 @@ describe('Import modal', () => {
|
|||
await screen.findByRole('heading', { name: /Locale/ });
|
||||
await screen.findByText('English - United States (en_US.UTF-8)');
|
||||
await screen.findByText('Japanese - Japan (ja_JP.UTF-8)');
|
||||
const keyboardDropDown = await screen.findByPlaceholderText(
|
||||
/Select a keyboard/i
|
||||
);
|
||||
const keyboardDropDown =
|
||||
await screen.findByPlaceholderText(/Select a keyboard/i);
|
||||
expect(keyboardDropDown).toHaveValue('us');
|
||||
|
||||
// Hostname
|
||||
|
|
@ -640,7 +638,9 @@ describe('Import modal', () => {
|
|||
);
|
||||
await waitFor(() =>
|
||||
user.click(
|
||||
screen.getByRole('button', { name: /close invalid\$kernel\$argument/i })
|
||||
screen.getByRole('button', {
|
||||
name: /close invalid\$kernel\$argument/i,
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -55,9 +55,8 @@ const goToReviewStep = async () => {
|
|||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
const expandable = await screen.findByTestId('image-details-expandable');
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-details'
|
||||
);
|
||||
const revisitButton =
|
||||
await within(expandable).findByTestId('revisit-details');
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -58,26 +58,23 @@ const addPort = async (port: string) => {
|
|||
|
||||
const addEnabledFirewallService = async (service: string) => {
|
||||
const user = userEvent.setup();
|
||||
const enabledServicesInput = await screen.findByPlaceholderText(
|
||||
/add enabled service/i
|
||||
);
|
||||
const enabledServicesInput =
|
||||
await screen.findByPlaceholderText(/add enabled service/i);
|
||||
await waitFor(() => user.type(enabledServicesInput, service.concat(' ')));
|
||||
};
|
||||
|
||||
const addDisabledFirewallService = async (service: string) => {
|
||||
const user = userEvent.setup();
|
||||
const disabledServiceInput = await screen.findByPlaceholderText(
|
||||
/add disabled service/i
|
||||
);
|
||||
const disabledServiceInput =
|
||||
await screen.findByPlaceholderText(/add disabled service/i);
|
||||
await waitFor(() => user.type(disabledServiceInput, service.concat(' ')));
|
||||
};
|
||||
|
||||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
const expandable = await screen.findByTestId('firewall-expandable');
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-firewall'
|
||||
);
|
||||
const revisitButton =
|
||||
await within(expandable).findByTestId('revisit-firewall');
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -109,9 +109,8 @@ const goToReviewStep = async (): Promise<void> => {
|
|||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
const expandable = await screen.findByTestId('firstboot-expandable');
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-first-boot'
|
||||
);
|
||||
const revisitButton =
|
||||
await within(expandable).findByTestId('revisit-first-boot');
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -73,9 +73,8 @@ const clearHostname = async () => {
|
|||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
const expandable = await screen.findByTestId('hostname-expandable');
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-hostname'
|
||||
);
|
||||
const revisitButton =
|
||||
await within(expandable).findByTestId('revisit-hostname');
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -52,17 +52,15 @@ const goToReviewStep = async () => {
|
|||
|
||||
const clearLanguageSearch = async () => {
|
||||
const user = userEvent.setup();
|
||||
const languagesDropdown = await screen.findByPlaceholderText(
|
||||
/select a language/i
|
||||
);
|
||||
const languagesDropdown =
|
||||
await screen.findByPlaceholderText(/select a language/i);
|
||||
await waitFor(() => user.clear(languagesDropdown));
|
||||
};
|
||||
|
||||
const searchForLanguage = async (search: string) => {
|
||||
const user = userEvent.setup();
|
||||
const languagesDropdown = await screen.findByPlaceholderText(
|
||||
/select a language/i
|
||||
);
|
||||
const languagesDropdown =
|
||||
await screen.findByPlaceholderText(/select a language/i);
|
||||
await waitFor(() => user.type(languagesDropdown, search));
|
||||
};
|
||||
|
||||
|
|
@ -83,9 +81,8 @@ const selectLanguages = async () => {
|
|||
|
||||
const searchForKeyboard = async (keyboard: string) => {
|
||||
const user = userEvent.setup({ delay: null });
|
||||
const keyboardDropdown = await screen.findByPlaceholderText(
|
||||
/select a keyboard/i
|
||||
);
|
||||
const keyboardDropdown =
|
||||
await screen.findByPlaceholderText(/select a keyboard/i);
|
||||
await waitFor(() => user.type(keyboardDropdown, keyboard));
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -85,9 +85,8 @@ const selectPolicy = async () => {
|
|||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
const expandable = await screen.findByTestId('compliance-detail-expandable');
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-compliance'
|
||||
);
|
||||
const revisitButton =
|
||||
await within(expandable).findByTestId('revisit-compliance');
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -103,9 +103,8 @@ const goToReviewStep = async () => {
|
|||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
const expandable = await screen.findByTestId('oscap-detail-expandable');
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-openscap'
|
||||
);
|
||||
const revisitButton =
|
||||
await within(expandable).findByTestId('revisit-openscap');
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -98,9 +98,8 @@ const selectActivationKey = async (key: string) => {
|
|||
|
||||
const addSatelliteRegistrationCommandViaKeyDown = async (command: string) => {
|
||||
const user = userEvent.setup({ delay: null });
|
||||
const satelliteRegistrationCommand = await screen.findByPlaceholderText(
|
||||
/registration command/i
|
||||
);
|
||||
const satelliteRegistrationCommand =
|
||||
await screen.findByPlaceholderText(/registration command/i);
|
||||
|
||||
await waitFor(() => user.clear(satelliteRegistrationCommand));
|
||||
await waitFor(() => user.type(satelliteRegistrationCommand, command));
|
||||
|
|
@ -108,7 +107,7 @@ const addSatelliteRegistrationCommandViaKeyDown = async (command: string) => {
|
|||
};
|
||||
|
||||
const uploadFile = async (scriptName: string): Promise<void> => {
|
||||
const user = userEvent.setup({ delay: null});
|
||||
const user = userEvent.setup({ delay: null });
|
||||
const fileInput: HTMLElement | null =
|
||||
// eslint-disable-next-line testing-library/no-node-access
|
||||
document.querySelector('input[type="file"]');
|
||||
|
|
|
|||
|
|
@ -90,9 +90,8 @@ const addDisabledService = async (service: string) => {
|
|||
|
||||
const addMaskedService = async (service: string) => {
|
||||
const user = userEvent.setup();
|
||||
const maskedServiceInput = await screen.findByPlaceholderText(
|
||||
'Add masked service'
|
||||
);
|
||||
const maskedServiceInput =
|
||||
await screen.findByPlaceholderText('Add masked service');
|
||||
await waitFor(() => user.type(maskedServiceInput, service.concat(' ')));
|
||||
};
|
||||
|
||||
|
|
@ -126,9 +125,8 @@ const selectProfile = async () => {
|
|||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
const expandable = await screen.findByTestId('services-expandable');
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-services'
|
||||
);
|
||||
const revisitButton =
|
||||
await within(expandable).findByTestId('revisit-services');
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,11 @@ import { screen, waitFor, within } from '@testing-library/react';
|
|||
import { userEvent } from '@testing-library/user-event';
|
||||
import { http, HttpResponse } from 'msw';
|
||||
|
||||
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT, PROVISIONING_API } from '../../../../../constants';
|
||||
import {
|
||||
CREATE_BLUEPRINT,
|
||||
EDIT_BLUEPRINT,
|
||||
PROVISIONING_API,
|
||||
} from '../../../../../constants';
|
||||
import {
|
||||
CreateBlueprintRequest,
|
||||
ImageRequest,
|
||||
|
|
|
|||
|
|
@ -52,9 +52,8 @@ const goToReviewStep = async () => {
|
|||
|
||||
const selectTimezone = async () => {
|
||||
const user = userEvent.setup({ delay: null });
|
||||
const timezoneDropdown = await screen.findByPlaceholderText(
|
||||
/select a timezone/i
|
||||
);
|
||||
const timezoneDropdown =
|
||||
await screen.findByPlaceholderText(/select a timezone/i);
|
||||
await waitFor(() => user.type(timezoneDropdown, 'Europe/Am'));
|
||||
const amsterdamTimezone = await screen.findByText('Europe/Amsterdam');
|
||||
await waitFor(() => user.click(amsterdamTimezone));
|
||||
|
|
@ -62,25 +61,22 @@ const selectTimezone = async () => {
|
|||
|
||||
const searchForUnknownTimezone = async () => {
|
||||
const user = userEvent.setup();
|
||||
const timezoneDropdown = await screen.findByPlaceholderText(
|
||||
/select a timezone/i
|
||||
);
|
||||
const timezoneDropdown =
|
||||
await screen.findByPlaceholderText(/select a timezone/i);
|
||||
await waitFor(() => user.type(timezoneDropdown, 'foo'));
|
||||
};
|
||||
|
||||
const addNtpServerViaKeyDown = async (ntpServer: string) => {
|
||||
const user = userEvent.setup();
|
||||
const ntpServersInput = await screen.findByPlaceholderText(
|
||||
/add ntp servers/i
|
||||
);
|
||||
const ntpServersInput =
|
||||
await screen.findByPlaceholderText(/add ntp servers/i);
|
||||
await waitFor(() => user.type(ntpServersInput, ntpServer.concat(' ')));
|
||||
};
|
||||
|
||||
const addNtpServerViaAddButton = async (ntpServer: string) => {
|
||||
const user = userEvent.setup();
|
||||
const ntpServersInput = await screen.findByPlaceholderText(
|
||||
/add ntp servers/i
|
||||
);
|
||||
const ntpServersInput =
|
||||
await screen.findByPlaceholderText(/add ntp servers/i);
|
||||
const addServerBtn = await screen.findByRole('button', {
|
||||
name: /add ntp server/i,
|
||||
});
|
||||
|
|
@ -99,9 +95,8 @@ const clearInput = async () => {
|
|||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
const expandable = await screen.findByTestId('timezone-expandable');
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-timezone'
|
||||
);
|
||||
const revisitButton =
|
||||
await within(expandable).findByTestId('revisit-timezone');
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -61,9 +61,8 @@ const addAzureTarget = async () => {
|
|||
);
|
||||
await clickNext();
|
||||
|
||||
const azureSourceDropdown = await screen.findByPlaceholderText(
|
||||
/select source/i
|
||||
);
|
||||
const azureSourceDropdown =
|
||||
await screen.findByPlaceholderText(/select source/i);
|
||||
await waitFor(() => user.click(azureSourceDropdown));
|
||||
const azureSource = await screen.findByRole('option', {
|
||||
name: /azureSource1/i,
|
||||
|
|
@ -182,9 +181,8 @@ const checkAdminCheckbox = async () => {
|
|||
|
||||
const addUserGroupByUserIndex = async (group: string, index: number) => {
|
||||
const user = userEvent.setup();
|
||||
const userGroupInputs = await screen.findAllByPlaceholderText(
|
||||
'Add user group'
|
||||
);
|
||||
const userGroupInputs =
|
||||
await screen.findAllByPlaceholderText('Add user group');
|
||||
await waitFor(() => user.click(userGroupInputs[index]));
|
||||
await waitFor(() => user.type(userGroupInputs[index], group));
|
||||
const addGroup = await screen.findByRole('button', {
|
||||
|
|
@ -512,24 +510,32 @@ describe('Users edit mode', () => {
|
|||
const id = mockBlueprintIds['users'];
|
||||
await renderEditMode(id);
|
||||
|
||||
const usersNavButtons = await screen.findAllByRole('button', { name: /Users/ });
|
||||
const usersNavButtons = await screen.findAllByRole('button', {
|
||||
name: /Users/,
|
||||
});
|
||||
await waitFor(() => user.click(usersNavButtons[0]));
|
||||
|
||||
const passwordToggleButton = await screen.findByRole('button', {
|
||||
name: 'Show password'
|
||||
name: 'Show password',
|
||||
});
|
||||
|
||||
expect(passwordToggleButton).toBeDisabled();
|
||||
|
||||
await waitFor(() => user.hover(passwordToggleButton));
|
||||
|
||||
const tooltip = await screen.findByText('Passwords cannot be viewed when editing a blueprint for security reasons');
|
||||
const tooltip = await screen.findByText(
|
||||
'Passwords cannot be viewed when editing a blueprint for security reasons'
|
||||
);
|
||||
expect(tooltip).toBeInTheDocument();
|
||||
|
||||
await waitFor(() => user.unhover(passwordToggleButton));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.queryByText('Passwords cannot be viewed when editing a blueprint for security reasons')).not.toBeInTheDocument();
|
||||
expect(
|
||||
screen.queryByText(
|
||||
'Passwords cannot be viewed when editing a blueprint for security reasons'
|
||||
)
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -83,9 +83,8 @@ describe('Images Table', () => {
|
|||
|
||||
// No actual clicking because downloading is hard to test.
|
||||
// Instead, we just check href and download properties of the <a> element.
|
||||
const downloadLink: HTMLAnchorElement = await within(
|
||||
downloadButton
|
||||
).findByRole('link');
|
||||
const downloadLink: HTMLAnchorElement =
|
||||
await within(downloadButton).findByRole('link');
|
||||
expect(downloadLink.download).toBe(
|
||||
'request-1579d95b-8f1d-4982-8c53-8c2afa4ab04c.json'
|
||||
);
|
||||
|
|
|
|||
|
|
@ -8,10 +8,12 @@ import 'vitest-canvas-mock';
|
|||
window.HTMLElement.prototype.scrollTo = function () {};
|
||||
|
||||
// provide a fallback *only* when window.getComputedStyle is missing
|
||||
// eslint-disable-next-line disable-autofix/@typescript-eslint/no-unnecessary-condition
|
||||
window.getComputedStyle = window.getComputedStyle || (() => ({
|
||||
getPropertyValue: () => '',
|
||||
}));
|
||||
window.getComputedStyle =
|
||||
// eslint-disable-next-line disable-autofix/@typescript-eslint/no-unnecessary-condition
|
||||
window.getComputedStyle ||
|
||||
(() => ({
|
||||
getPropertyValue: () => '',
|
||||
}));
|
||||
|
||||
// ResizeObserver is not defined and needs to be mocked and stubbed
|
||||
const MockResizeObserver = vi.fn(() => ({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue