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
|
|
@ -22,14 +22,16 @@ test.describe.serial('test', () => {
|
||||||
await frame.getByTestId('blueprints-create-button').click();
|
await frame.getByTestId('blueprints-create-button').click();
|
||||||
|
|
||||||
frame.getByRole('heading', { name: 'Image output' });
|
frame.getByRole('heading', { name: 'Image output' });
|
||||||
await frame.getByTestId('checkbox-guest-image').click();
|
await frame
|
||||||
|
.getByRole('checkbox', { name: /Virtualization guest image/i })
|
||||||
|
.click();
|
||||||
await frame.getByRole('button', { name: 'Next', exact: true }).click();
|
await frame.getByRole('button', { name: 'Next', exact: true }).click();
|
||||||
|
|
||||||
if (isHosted()) {
|
if (isHosted()) {
|
||||||
frame.getByRole('heading', {
|
frame.getByRole('heading', {
|
||||||
name: 'Register systems using this image',
|
name: 'Register systems using this image',
|
||||||
});
|
});
|
||||||
await page.getByTestId('register-later-radio').click();
|
await page.getByRole('radio', { name: /Register later/i }).click();
|
||||||
await frame.getByRole('button', { name: 'Next', exact: true }).click();
|
await frame.getByRole('button', { name: 'Next', exact: true }).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -164,7 +166,7 @@ test.describe.serial('test', () => {
|
||||||
// the clickable blueprint cards are a bit awkward, so use the
|
// the clickable blueprint cards are a bit awkward, so use the
|
||||||
// button's id instead
|
// button's id instead
|
||||||
await frame.locator(`button[id="${blueprintName}"]`).click();
|
await frame.locator(`button[id="${blueprintName}"]`).click();
|
||||||
await frame.getByTestId('blueprint-action-menu-toggle').click();
|
await frame.getByRole('button', { name: /blueprint menu toggle/i }).click();
|
||||||
await frame.getByRole('menuitem', { name: 'Delete blueprint' }).click();
|
await frame.getByRole('menuitem', { name: 'Delete blueprint' }).click();
|
||||||
await frame.getByRole('button', { name: 'Delete' }).click();
|
await frame.getByRole('button', { name: 'Delete' }).click();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,6 @@ export const BlueprintActionsMenu: React.FunctionComponent<
|
||||||
onClick={() => setShowBlueprintActionsMenu(!showBlueprintActionsMenu)}
|
onClick={() => setShowBlueprintActionsMenu(!showBlueprintActionsMenu)}
|
||||||
variant="plain"
|
variant="plain"
|
||||||
aria-label="blueprint menu toggle"
|
aria-label="blueprint menu toggle"
|
||||||
data-testid="blueprint-action-menu-toggle"
|
|
||||||
>
|
>
|
||||||
<EllipsisVIcon aria-hidden="true" />
|
<EllipsisVIcon aria-hidden="true" />
|
||||||
</MenuToggle>
|
</MenuToggle>
|
||||||
|
|
|
||||||
|
|
@ -327,7 +327,6 @@ export const ImportBlueprintModal: React.FunctionComponent<
|
||||||
state: { blueprint: importedBlueprint },
|
state: { blueprint: importedBlueprint },
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
data-testid="import-blueprint-finish"
|
|
||||||
>
|
>
|
||||||
Review and finish
|
Review and finish
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,6 @@ const MountpointPrefix = ({ partition }: MountpointPrefixPropTypes) => {
|
||||||
onClick={onToggleClick}
|
onClick={onToggleClick}
|
||||||
isExpanded={isOpen}
|
isExpanded={isOpen}
|
||||||
isDisabled={prefix === '/'}
|
isDisabled={prefix === '/'}
|
||||||
data-testid="prefix-select"
|
|
||||||
isFullWidth
|
isFullWidth
|
||||||
>
|
>
|
||||||
{prefix}
|
{prefix}
|
||||||
|
|
@ -332,12 +331,7 @@ const SizeUnit = ({ partition }: SizeUnitPropTypes) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const toggle = (toggleRef: React.Ref<MenuToggleElement>) => (
|
const toggle = (toggleRef: React.Ref<MenuToggleElement>) => (
|
||||||
<MenuToggle
|
<MenuToggle ref={toggleRef} onClick={onToggleClick} isExpanded={isOpen}>
|
||||||
ref={toggleRef}
|
|
||||||
onClick={onToggleClick}
|
|
||||||
isExpanded={isOpen}
|
|
||||||
data-testid="unit-select"
|
|
||||||
>
|
|
||||||
{partition.unit}
|
{partition.unit}
|
||||||
</MenuToggle>
|
</MenuToggle>
|
||||||
);
|
);
|
||||||
|
|
@ -505,7 +499,6 @@ const FileSystemTable = () => {
|
||||||
className={isDragging ? styles.modifiers.dragOver : ''}
|
className={isDragging ? styles.modifiers.dragOver : ''}
|
||||||
aria-label="File system table"
|
aria-label="File system table"
|
||||||
variant="compact"
|
variant="compact"
|
||||||
data-testid="fsc-table"
|
|
||||||
>
|
>
|
||||||
<Thead>
|
<Thead>
|
||||||
<Tr>
|
<Tr>
|
||||||
|
|
@ -526,7 +519,6 @@ const FileSystemTable = () => {
|
||||||
onDrop={onDragOver}
|
onDrop={onDragOver}
|
||||||
onDragLeave={onDragLeave}
|
onDragLeave={onDragLeave}
|
||||||
ref={bodyRef}
|
ref={bodyRef}
|
||||||
data-testid="file-system-configuration-tbody"
|
|
||||||
>
|
>
|
||||||
{partitions &&
|
{partitions &&
|
||||||
partitions.map((partition) => (
|
partitions.map((partition) => (
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,6 @@ export const MajorReleasesLifecyclesChart = () => {
|
||||||
<Panel>
|
<Panel>
|
||||||
<PanelMain maxHeight="10rem">
|
<PanelMain maxHeight="10rem">
|
||||||
<Bar
|
<Bar
|
||||||
data-testid="release-lifecycle-chart"
|
|
||||||
options={chartMajorVersionCfg.options}
|
options={chartMajorVersionCfg.options}
|
||||||
data={chartMajorVersionCfg.data}
|
data={chartMajorVersionCfg.data}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ type TargetEnvironmentCardProps = {
|
||||||
imageAlt: string;
|
imageAlt: string;
|
||||||
isClicked: boolean;
|
isClicked: boolean;
|
||||||
isDisabled?: boolean;
|
isDisabled?: boolean;
|
||||||
testId: string;
|
|
||||||
handleOnClick: () => void;
|
handleOnClick: () => void;
|
||||||
onMouseEnter?: MouseEventHandler<HTMLElement>;
|
onMouseEnter?: MouseEventHandler<HTMLElement>;
|
||||||
};
|
};
|
||||||
|
|
@ -50,11 +49,9 @@ const TargetEnvironmentCard = ({
|
||||||
onMouseEnter,
|
onMouseEnter,
|
||||||
isClicked,
|
isClicked,
|
||||||
isDisabled = false,
|
isDisabled = false,
|
||||||
testId,
|
|
||||||
}: TargetEnvironmentCardProps) => {
|
}: TargetEnvironmentCardProps) => {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
data-testid={testId}
|
|
||||||
style={{ textAlign: 'center' } as React.CSSProperties}
|
style={{ textAlign: 'center' } as React.CSSProperties}
|
||||||
onMouseUp={onMouseEnter}
|
onMouseUp={onMouseEnter}
|
||||||
isClicked={isClicked}
|
isClicked={isClicked}
|
||||||
|
|
@ -147,7 +144,6 @@ const TargetEnvironment = () => {
|
||||||
<Gallery hasGutter>
|
<Gallery hasGutter>
|
||||||
{supportedEnvironments?.includes('aws') && (
|
{supportedEnvironments?.includes('aws') && (
|
||||||
<TargetEnvironmentCard
|
<TargetEnvironmentCard
|
||||||
testId="upload-aws"
|
|
||||||
title="Amazon Web Services"
|
title="Amazon Web Services"
|
||||||
imageSrc={'/apps/frontend-assets/partners-icons/aws.svg'}
|
imageSrc={'/apps/frontend-assets/partners-icons/aws.svg'}
|
||||||
imageAlt="Amazon Web Services logo"
|
imageAlt="Amazon Web Services logo"
|
||||||
|
|
@ -158,7 +154,6 @@ const TargetEnvironment = () => {
|
||||||
)}
|
)}
|
||||||
{supportedEnvironments?.includes('gcp') && (
|
{supportedEnvironments?.includes('gcp') && (
|
||||||
<TargetEnvironmentCard
|
<TargetEnvironmentCard
|
||||||
testId="upload-google"
|
|
||||||
title="Google Cloud Platform"
|
title="Google Cloud Platform"
|
||||||
imageSrc={
|
imageSrc={
|
||||||
'/apps/frontend-assets/partners-icons/google-cloud-short.svg'
|
'/apps/frontend-assets/partners-icons/google-cloud-short.svg'
|
||||||
|
|
@ -171,7 +166,6 @@ const TargetEnvironment = () => {
|
||||||
)}
|
)}
|
||||||
{supportedEnvironments?.includes('azure') && (
|
{supportedEnvironments?.includes('azure') && (
|
||||||
<TargetEnvironmentCard
|
<TargetEnvironmentCard
|
||||||
testId="upload-azure"
|
|
||||||
title="Microsoft Azure"
|
title="Microsoft Azure"
|
||||||
imageSrc={
|
imageSrc={
|
||||||
'/apps/frontend-assets/partners-icons/microsoft-azure-short.svg'
|
'/apps/frontend-assets/partners-icons/microsoft-azure-short.svg'
|
||||||
|
|
@ -184,7 +178,6 @@ const TargetEnvironment = () => {
|
||||||
)}
|
)}
|
||||||
{supportedEnvironments?.includes('oci') && (
|
{supportedEnvironments?.includes('oci') && (
|
||||||
<TargetEnvironmentCard
|
<TargetEnvironmentCard
|
||||||
testId="upload-oci"
|
|
||||||
title="Oracle Cloud Infrastructure"
|
title="Oracle Cloud Infrastructure"
|
||||||
imageSrc={
|
imageSrc={
|
||||||
'/apps/frontend-assets/partners-icons/oracle-short.svg'
|
'/apps/frontend-assets/partners-icons/oracle-short.svg'
|
||||||
|
|
@ -208,7 +201,6 @@ const TargetEnvironment = () => {
|
||||||
name="vsphere-checkbox-ova"
|
name="vsphere-checkbox-ova"
|
||||||
aria-label="VMware vSphere checkbox OVA"
|
aria-label="VMware vSphere checkbox OVA"
|
||||||
id="vsphere-checkbox-ova"
|
id="vsphere-checkbox-ova"
|
||||||
data-testid="checkbox-vsphere-ova"
|
|
||||||
label={
|
label={
|
||||||
<>
|
<>
|
||||||
VMware vSphere - Open virtualization format (.ova)
|
VMware vSphere - Open virtualization format (.ova)
|
||||||
|
|
@ -249,7 +241,6 @@ const TargetEnvironment = () => {
|
||||||
name="vsphere-checkbox-vmdk"
|
name="vsphere-checkbox-vmdk"
|
||||||
aria-label="VMware vSphere checkbox VMDK"
|
aria-label="VMware vSphere checkbox VMDK"
|
||||||
id="vsphere-checkbox-vmdk"
|
id="vsphere-checkbox-vmdk"
|
||||||
data-testid="checkbox-vsphere-vmdk"
|
|
||||||
label={
|
label={
|
||||||
<>
|
<>
|
||||||
VMware vSphere - Virtual disk (.vmdk)
|
VMware vSphere - Virtual disk (.vmdk)
|
||||||
|
|
@ -296,7 +287,6 @@ const TargetEnvironment = () => {
|
||||||
aria-label="Virtualization guest image checkbox"
|
aria-label="Virtualization guest image checkbox"
|
||||||
id="checkbox-guest-image"
|
id="checkbox-guest-image"
|
||||||
name="Virtualization guest image"
|
name="Virtualization guest image"
|
||||||
data-testid="checkbox-guest-image"
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{supportedEnvironments?.includes('image-installer') && (
|
{supportedEnvironments?.includes('image-installer') && (
|
||||||
|
|
@ -309,7 +299,6 @@ const TargetEnvironment = () => {
|
||||||
aria-label="Bare metal installer checkbox"
|
aria-label="Bare metal installer checkbox"
|
||||||
id="checkbox-image-installer"
|
id="checkbox-image-installer"
|
||||||
name="Bare metal installer"
|
name="Bare metal installer"
|
||||||
data-testid="checkbox-image-installer"
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{supportedEnvironments?.includes('wsl') && (
|
{supportedEnvironments?.includes('wsl') && (
|
||||||
|
|
@ -369,7 +358,6 @@ const TargetEnvironment = () => {
|
||||||
aria-label="windows subsystem for linux checkbox"
|
aria-label="windows subsystem for linux checkbox"
|
||||||
id="checkbox-wsl"
|
id="checkbox-wsl"
|
||||||
name="WSL"
|
name="WSL"
|
||||||
data-testid="checkbox-wsl"
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,6 @@ const Registration = () => {
|
||||||
<FormGroup label="Registration method">
|
<FormGroup label="Registration method">
|
||||||
<Radio
|
<Radio
|
||||||
label="Automatically register and enable advanced capabilities"
|
label="Automatically register and enable advanced capabilities"
|
||||||
data-testid="automatically-register-radio"
|
|
||||||
isChecked={
|
isChecked={
|
||||||
registrationType === 'register-now' ||
|
registrationType === 'register-now' ||
|
||||||
registrationType === 'register-now-insights' ||
|
registrationType === 'register-now-insights' ||
|
||||||
|
|
@ -200,7 +199,6 @@ const Registration = () => {
|
||||||
/>
|
/>
|
||||||
<Radio
|
<Radio
|
||||||
label="Register later"
|
label="Register later"
|
||||||
data-testid="register-later-radio"
|
|
||||||
isChecked={registrationType === 'register-later'}
|
isChecked={registrationType === 'register-later'}
|
||||||
onChange={() => {
|
onChange={() => {
|
||||||
dispatch(changeRegistrationType('register-later'));
|
dispatch(changeRegistrationType('register-later'));
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ const Empty = ({ hasFilterValue, refetch }: EmptyProps) => {
|
||||||
: 'No custom repositories'
|
: 'No custom repositories'
|
||||||
}
|
}
|
||||||
variant={EmptyStateVariant.lg}
|
variant={EmptyStateVariant.lg}
|
||||||
data-testid="empty-state"
|
|
||||||
>
|
>
|
||||||
<EmptyStateBody>
|
<EmptyStateBody>
|
||||||
{hasFilterValue
|
{hasFilterValue
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ const TemplatesEmpty = ({ refetch }: TemplatesEmptyProps) => {
|
||||||
headingLevel="h4"
|
headingLevel="h4"
|
||||||
titleText={'No content templates'}
|
titleText={'No content templates'}
|
||||||
variant={EmptyStateVariant.lg}
|
variant={EmptyStateVariant.lg}
|
||||||
data-testid="empty-state"
|
|
||||||
>
|
>
|
||||||
<EmptyStateBody>
|
<EmptyStateBody>
|
||||||
{`Content templates can be added in the "Templates" area of the
|
{`Content templates can be added in the "Templates" area of the
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,6 @@ export const AzureHyperVSelect = () => {
|
||||||
const toggle = (toggleRef: React.Ref<MenuToggleElement>) => (
|
const toggle = (toggleRef: React.Ref<MenuToggleElement>) => (
|
||||||
<MenuToggle
|
<MenuToggle
|
||||||
ref={toggleRef}
|
ref={toggleRef}
|
||||||
data-testid="azure-hyper-v-generation-select"
|
|
||||||
onClick={() => setIsOpen(!isOpen)}
|
onClick={() => setIsOpen(!isOpen)}
|
||||||
isExpanded={isOpen}
|
isExpanded={isOpen}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,6 @@ const Gcp = () => {
|
||||||
/>
|
/>
|
||||||
<Radio
|
<Radio
|
||||||
id="share-with-insights"
|
id="share-with-insights"
|
||||||
data-testid="share-with-insights"
|
|
||||||
label="Share image with Red Hat Insights only"
|
label="Share image with Red Hat Insights only"
|
||||||
name="radio-2"
|
name="radio-2"
|
||||||
description={
|
description={
|
||||||
|
|
@ -88,7 +87,6 @@ const Gcp = () => {
|
||||||
<FormGroup label="Account type" isRequired>
|
<FormGroup label="Account type" isRequired>
|
||||||
<Radio
|
<Radio
|
||||||
id="google-account"
|
id="google-account"
|
||||||
data-testid="google-account"
|
|
||||||
label="Google account"
|
label="Google account"
|
||||||
name="radio-3"
|
name="radio-3"
|
||||||
isChecked={accountType === 'user'}
|
isChecked={accountType === 'user'}
|
||||||
|
|
@ -98,7 +96,6 @@ const Gcp = () => {
|
||||||
/>
|
/>
|
||||||
<Radio
|
<Radio
|
||||||
id="service-account"
|
id="service-account"
|
||||||
data-testid="service-account"
|
|
||||||
label="Service account"
|
label="Service account"
|
||||||
name="radio-4"
|
name="radio-4"
|
||||||
isChecked={accountType === 'serviceAccount'}
|
isChecked={accountType === 'serviceAccount'}
|
||||||
|
|
@ -108,7 +105,6 @@ const Gcp = () => {
|
||||||
/>
|
/>
|
||||||
<Radio
|
<Radio
|
||||||
id="google-group"
|
id="google-group"
|
||||||
data-testid="google-group"
|
|
||||||
label="Google group"
|
label="Google group"
|
||||||
name="radio-5"
|
name="radio-5"
|
||||||
isChecked={accountType === 'group'}
|
isChecked={accountType === 'group'}
|
||||||
|
|
@ -118,7 +114,6 @@ const Gcp = () => {
|
||||||
/>
|
/>
|
||||||
<Radio
|
<Radio
|
||||||
id="google-domain"
|
id="google-domain"
|
||||||
data-testid="google-domain"
|
|
||||||
label="Google Workspace domain or Cloud Identity domain"
|
label="Google Workspace domain or Cloud Identity domain"
|
||||||
name="radio-6"
|
name="radio-6"
|
||||||
isChecked={accountType === 'domain'}
|
isChecked={accountType === 'domain'}
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,6 @@ const EmptyImagesTable = () => {
|
||||||
<Bullseye>
|
<Bullseye>
|
||||||
<EmptyState
|
<EmptyState
|
||||||
variant={EmptyStateVariant.lg}
|
variant={EmptyStateVariant.lg}
|
||||||
data-testid="empty-state"
|
|
||||||
titleText="No images"
|
titleText="No images"
|
||||||
headingLevel="h4"
|
headingLevel="h4"
|
||||||
icon={SearchIcon}
|
icon={SearchIcon}
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,6 @@ export const ImageBuilderHeader = ({
|
||||||
</Button>
|
</Button>
|
||||||
{importExportFlag && (
|
{importExportFlag && (
|
||||||
<Button
|
<Button
|
||||||
data-testid="import-blueprint-button"
|
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
onClick={() => setShowImportModal(true)}
|
onClick={() => setShowImportModal(true)}
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -356,9 +356,9 @@ describe('Blueprints', () => {
|
||||||
renderCustomRoutesWithReduxRouter();
|
renderCustomRoutesWithReduxRouter();
|
||||||
|
|
||||||
await selectBlueprintById(blueprintIdWithComposes);
|
await selectBlueprintById(blueprintIdWithComposes);
|
||||||
const toggleButton = await screen.findByTestId(
|
const toggleButton = await screen.findByRole('button', {
|
||||||
'blueprint-action-menu-toggle'
|
name: /blueprint menu toggle/i,
|
||||||
);
|
});
|
||||||
await waitFor(() => user.click(toggleButton));
|
await waitFor(() => user.click(toggleButton));
|
||||||
|
|
||||||
const downloadButton = screen.getByRole('menuitem', {
|
const downloadButton = screen.getByRole('menuitem', {
|
||||||
|
|
|
||||||
|
|
@ -293,15 +293,15 @@ describe('Import modal', () => {
|
||||||
|
|
||||||
test('renders import component', async () => {
|
test('renders import component', async () => {
|
||||||
renderCustomRoutesWithReduxRouter();
|
renderCustomRoutesWithReduxRouter();
|
||||||
const importButton = await screen.findByTestId('import-blueprint-button');
|
const importButton = await screen.findByRole('button', { name: /Import/i });
|
||||||
await waitFor(() => expect(importButton).toBeInTheDocument());
|
await waitFor(() => expect(importButton).toBeInTheDocument());
|
||||||
});
|
});
|
||||||
|
|
||||||
const setUp = async () => {
|
const setUp = async () => {
|
||||||
renderCustomRoutesWithReduxRouter();
|
renderCustomRoutesWithReduxRouter();
|
||||||
const importBlueprintBtn = await screen.findByTestId(
|
const importBlueprintBtn = await screen.findByRole('button', {
|
||||||
'import-blueprint-button'
|
name: /Import/i,
|
||||||
);
|
});
|
||||||
await waitFor(() => user.click(importBlueprintBtn));
|
await waitFor(() => user.click(importBlueprintBtn));
|
||||||
const reviewButton = await screen.findByRole('button', {
|
const reviewButton = await screen.findByRole('button', {
|
||||||
name: /review and finish/i,
|
name: /review and finish/i,
|
||||||
|
|
@ -312,7 +312,9 @@ describe('Import modal', () => {
|
||||||
test('should show alert on invalid blueprint', async () => {
|
test('should show alert on invalid blueprint', async () => {
|
||||||
await setUp();
|
await setUp();
|
||||||
await uploadFile(`blueprints.json`, INVALID_JSON);
|
await uploadFile(`blueprints.json`, INVALID_JSON);
|
||||||
const reviewButton = screen.getByTestId('import-blueprint-finish');
|
const reviewButton = screen.getByRole('button', {
|
||||||
|
name: /Review and finish/i,
|
||||||
|
});
|
||||||
expect(reviewButton).toBeDisabled();
|
expect(reviewButton).toBeDisabled();
|
||||||
const helperText = await screen.findByText(
|
const helperText = await screen.findByText(
|
||||||
/not compatible with the blueprints format\./i
|
/not compatible with the blueprints format\./i
|
||||||
|
|
@ -323,7 +325,9 @@ describe('Import modal', () => {
|
||||||
test('should show alert on invalid blueprint incorrect architecture', async () => {
|
test('should show alert on invalid blueprint incorrect architecture', async () => {
|
||||||
await setUp();
|
await setUp();
|
||||||
await uploadFile(`blueprints.json`, INVALID_ARCHITECTURE_JSON);
|
await uploadFile(`blueprints.json`, INVALID_ARCHITECTURE_JSON);
|
||||||
const reviewButton = screen.getByTestId('import-blueprint-finish');
|
const reviewButton = screen.getByRole('button', {
|
||||||
|
name: /Review and finish/i,
|
||||||
|
});
|
||||||
expect(reviewButton).toBeDisabled();
|
expect(reviewButton).toBeDisabled();
|
||||||
const helperText = await screen.findByText(
|
const helperText = await screen.findByText(
|
||||||
/not compatible with the blueprints format\./i
|
/not compatible with the blueprints format\./i
|
||||||
|
|
@ -334,7 +338,9 @@ describe('Import modal', () => {
|
||||||
test('should enable button and ignore subscription in blueprint file', async () => {
|
test('should enable button and ignore subscription in blueprint file', async () => {
|
||||||
await setUp();
|
await setUp();
|
||||||
await uploadFile(`blueprints.json`, IGNORE_SUBSCRIPTION_BLUEPRINT);
|
await uploadFile(`blueprints.json`, IGNORE_SUBSCRIPTION_BLUEPRINT);
|
||||||
const reviewButton = screen.getByTestId('import-blueprint-finish');
|
const reviewButton = screen.getByRole('button', {
|
||||||
|
name: /Review and finish/i,
|
||||||
|
});
|
||||||
await waitFor(() => expect(reviewButton).toBeEnabled());
|
await waitFor(() => expect(reviewButton).toBeEnabled());
|
||||||
user.click(reviewButton);
|
user.click(reviewButton);
|
||||||
|
|
||||||
|
|
@ -348,7 +354,9 @@ describe('Import modal', () => {
|
||||||
test('should enable button on correct blueprint and go to wizard', async () => {
|
test('should enable button on correct blueprint and go to wizard', async () => {
|
||||||
await setUp();
|
await setUp();
|
||||||
await uploadFile(`blueprints.json`, BLUEPRINT_JSON);
|
await uploadFile(`blueprints.json`, BLUEPRINT_JSON);
|
||||||
const reviewButton = screen.getByTestId('import-blueprint-finish');
|
const reviewButton = screen.getByRole('button', {
|
||||||
|
name: /Review and finish/i,
|
||||||
|
});
|
||||||
await waitFor(() => expect(reviewButton).toBeEnabled());
|
await waitFor(() => expect(reviewButton).toBeEnabled());
|
||||||
user.click(reviewButton);
|
user.click(reviewButton);
|
||||||
|
|
||||||
|
|
@ -369,7 +377,9 @@ describe('Import modal', () => {
|
||||||
test('should enable button on toml blueprint and go to wizard', async () => {
|
test('should enable button on toml blueprint and go to wizard', async () => {
|
||||||
await setUp();
|
await setUp();
|
||||||
await uploadFile(`blueprints.toml`, ONPREM_BLUEPRINT_TOML);
|
await uploadFile(`blueprints.toml`, ONPREM_BLUEPRINT_TOML);
|
||||||
const reviewButton = screen.getByTestId('import-blueprint-finish');
|
const reviewButton = screen.getByRole('button', {
|
||||||
|
name: /Review and finish/i,
|
||||||
|
});
|
||||||
await waitFor(() => expect(reviewButton).toBeEnabled());
|
await waitFor(() => expect(reviewButton).toBeEnabled());
|
||||||
user.click(reviewButton);
|
user.click(reviewButton);
|
||||||
|
|
||||||
|
|
@ -381,7 +391,10 @@ describe('Import modal', () => {
|
||||||
|
|
||||||
// Image output
|
// Image output
|
||||||
await waitFor(
|
await waitFor(
|
||||||
async () => await user.click(await screen.findByTestId('upload-aws'))
|
async () =>
|
||||||
|
await user.click(
|
||||||
|
await screen.findByRole('button', { name: /Amazon Web Services/i })
|
||||||
|
)
|
||||||
);
|
);
|
||||||
await clickNext();
|
await clickNext();
|
||||||
|
|
||||||
|
|
@ -404,9 +417,9 @@ describe('Import modal', () => {
|
||||||
await screen.findByText(
|
await screen.findByText(
|
||||||
'Automatically register and enable advanced capabilities'
|
'Automatically register and enable advanced capabilities'
|
||||||
);
|
);
|
||||||
//const registrationCheckbox = await screen.findByTestId(
|
//const registrationCheckbox = await screen.findByRole('radio', {
|
||||||
// 'automatically-register-radio'
|
// name: /Automatically register and enable advanced capabilities/i,
|
||||||
//);
|
//});
|
||||||
//expect(registrationCheckbox).toHaveFocus();
|
//expect(registrationCheckbox).toHaveFocus();
|
||||||
await screen.findByPlaceholderText('Select activation key');
|
await screen.findByPlaceholderText('Select activation key');
|
||||||
|
|
||||||
|
|
@ -514,7 +527,9 @@ describe('Import modal', () => {
|
||||||
`blueprints.toml`,
|
`blueprints.toml`,
|
||||||
ONPREM_BLUEPRINT_TOML_WITH_INVALID_VALUES
|
ONPREM_BLUEPRINT_TOML_WITH_INVALID_VALUES
|
||||||
);
|
);
|
||||||
const reviewButton = screen.getByTestId('import-blueprint-finish');
|
const reviewButton = screen.getByRole('button', {
|
||||||
|
name: /Review and finish/i,
|
||||||
|
});
|
||||||
await waitFor(() => expect(reviewButton).toBeEnabled());
|
await waitFor(() => expect(reviewButton).toBeEnabled());
|
||||||
user.click(reviewButton);
|
user.click(reviewButton);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,20 @@ const getSourceDropdown = async () => {
|
||||||
const selectAllEnvironments = async () => {
|
const selectAllEnvironments = async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
|
|
||||||
await waitFor(() => user.click(screen.getByTestId('upload-aws')));
|
await waitFor(() =>
|
||||||
await waitFor(() => user.click(screen.getByTestId('upload-google')));
|
user.click(screen.getByRole('button', { name: /Amazon Web Services/i }))
|
||||||
await waitFor(() => user.click(screen.getByTestId('upload-azure')));
|
);
|
||||||
await waitFor(() => user.click(screen.getByTestId('checkbox-guest-image')));
|
await waitFor(() =>
|
||||||
|
user.click(screen.getByRole('button', { name: /Google Cloud Platform/i }))
|
||||||
|
);
|
||||||
|
await waitFor(() =>
|
||||||
|
user.click(screen.getByRole('button', { name: /Microsoft Azure/i }))
|
||||||
|
);
|
||||||
|
await waitFor(() =>
|
||||||
|
user.click(
|
||||||
|
screen.getByRole('checkbox', { name: /Virtualization guest image/i })
|
||||||
|
)
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const testTile = async (tile: HTMLElement) => {
|
const testTile = async (tile: HTMLElement) => {
|
||||||
|
|
@ -24,7 +34,7 @@ const testTile = async (tile: HTMLElement) => {
|
||||||
|
|
||||||
tile.focus();
|
tile.focus();
|
||||||
await waitFor(() => user.keyboard(' '));
|
await waitFor(() => user.keyboard(' '));
|
||||||
expect(tile).toHaveClass('pf-m-clickable');
|
expect(tile).toHaveClass('pf-v6-c-card__clickable-action');
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('Create Image Wizard', () => {
|
describe('Create Image Wizard', () => {
|
||||||
|
|
@ -135,9 +145,9 @@ describe('Keyboard accessibility', () => {
|
||||||
await screen.findByText(
|
await screen.findByText(
|
||||||
'Automatically register and enable advanced capabilities'
|
'Automatically register and enable advanced capabilities'
|
||||||
);
|
);
|
||||||
//const registrationCheckbox = await screen.findByTestId(
|
//const registrationCheckbox = await screen.findByRole('radio', {
|
||||||
// 'automatically-register-radio'
|
// name: /Automatically register and enable advanced capabilities/i,
|
||||||
//);
|
//});
|
||||||
//expect(registrationCheckbox).toHaveFocus();
|
//expect(registrationCheckbox).toHaveFocus();
|
||||||
await screen.findByPlaceholderText('Select activation key');
|
await screen.findByPlaceholderText('Select activation key');
|
||||||
await clickNext();
|
await clickNext();
|
||||||
|
|
@ -160,7 +170,9 @@ describe('Keyboard accessibility', () => {
|
||||||
|
|
||||||
test('pressing Enter does not advance the wizard', async () => {
|
test('pressing Enter does not advance the wizard', async () => {
|
||||||
await renderCreateMode();
|
await renderCreateMode();
|
||||||
user.click(await screen.findByTestId('upload-aws'));
|
user.click(
|
||||||
|
await screen.findByRole('button', { name: /Amazon Web Services/i })
|
||||||
|
);
|
||||||
user.keyboard('{enter}');
|
user.keyboard('{enter}');
|
||||||
await screen.findByRole('heading', {
|
await screen.findByRole('heading', {
|
||||||
name: /image output/i,
|
name: /image output/i,
|
||||||
|
|
@ -170,8 +182,14 @@ describe('Keyboard accessibility', () => {
|
||||||
test('target environment tiles are keyboard selectable', async () => {
|
test('target environment tiles are keyboard selectable', async () => {
|
||||||
await renderCreateMode();
|
await renderCreateMode();
|
||||||
|
|
||||||
await testTile(await screen.findByTestId('upload-aws'));
|
await testTile(
|
||||||
await testTile(await screen.findByTestId('upload-google'));
|
await screen.findByRole('button', { name: /Amazon Web Services/i })
|
||||||
await testTile(await screen.findByTestId('upload-azure'));
|
);
|
||||||
|
await testTile(
|
||||||
|
await screen.findByRole('button', { name: /Google Cloud Platform/i })
|
||||||
|
);
|
||||||
|
await testTile(
|
||||||
|
await screen.findByRole('button', { name: /Microsoft Azure/i })
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,9 @@ const selectGuestImage = async () => {
|
||||||
|
|
||||||
const selectImageInstaller = async () => {
|
const selectImageInstaller = async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const imageInstallerCheckbox = await screen.findByTestId(
|
const imageInstallerCheckbox = await screen.findByRole('checkbox', {
|
||||||
'checkbox-image-installer'
|
name: /Bare metal installer/i,
|
||||||
);
|
});
|
||||||
await waitFor(() => user.click(imageInstallerCheckbox));
|
await waitFor(() => user.click(imageInstallerCheckbox));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -71,8 +71,7 @@ const customizePartition = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getRow = async (row: number) => {
|
const getRow = async (row: number) => {
|
||||||
const table = await screen.findByTestId('fsc-table');
|
const rows = await screen.findAllByRole('row');
|
||||||
const rows = await within(table).findAllByRole('row');
|
|
||||||
return rows[row];
|
return rows[row];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -88,7 +87,7 @@ const changePartitionSize = async () => {
|
||||||
const changePartitionUnitsToKiB = async () => {
|
const changePartitionUnitsToKiB = async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const row = await getRow(1);
|
const row = await getRow(1);
|
||||||
const units = await within(row).findByTestId('unit-select');
|
const units = await within(row).findByText('GiB');
|
||||||
await waitFor(() => user.click(units));
|
await waitFor(() => user.click(units));
|
||||||
const kibOption = await screen.findByRole('option', { name: 'KiB' });
|
const kibOption = await screen.findByRole('option', { name: 'KiB' });
|
||||||
await waitFor(() => user.click(kibOption));
|
await waitFor(() => user.click(kibOption));
|
||||||
|
|
@ -97,7 +96,7 @@ const changePartitionUnitsToKiB = async () => {
|
||||||
const changePartitionUnitsToMiB = async () => {
|
const changePartitionUnitsToMiB = async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const row = await getRow(1);
|
const row = await getRow(1);
|
||||||
const units = await within(row).findByTestId('unit-select');
|
const units = await within(row).findByText('GiB');
|
||||||
await waitFor(() => user.click(units));
|
await waitFor(() => user.click(units));
|
||||||
const mibOption = await screen.findByRole('option', { name: 'MiB' });
|
const mibOption = await screen.findByRole('option', { name: 'MiB' });
|
||||||
await waitFor(() => user.click(mibOption));
|
await waitFor(() => user.click(mibOption));
|
||||||
|
|
@ -180,16 +179,12 @@ describe('Step File system configuration', () => {
|
||||||
const mountPointAlerts = screen.getAllByRole('heading', {
|
const mountPointAlerts = screen.getAllByRole('heading', {
|
||||||
name: /danger alert: duplicate mount point/i,
|
name: /danger alert: duplicate mount point/i,
|
||||||
});
|
});
|
||||||
const fscTable = await screen.findByTestId(
|
const rows = await screen.findAllByRole('row');
|
||||||
'file-system-configuration-tbody'
|
rows.shift(); // remove table header
|
||||||
);
|
|
||||||
const rows = within(fscTable).getAllByRole('row');
|
|
||||||
expect(rows).toHaveLength(3);
|
expect(rows).toHaveLength(3);
|
||||||
|
|
||||||
//Change mountpoint of final row to /var, resolving errors
|
//Change mountpoint of final row to /var, resolving errors
|
||||||
const mountPointOptions = await within(rows[2]).findByTestId(
|
const mountPointOptions = await within(rows[2]).findByText('/home');
|
||||||
'prefix-select'
|
|
||||||
);
|
|
||||||
await waitFor(() => user.click(mountPointOptions));
|
await waitFor(() => user.click(mountPointOptions));
|
||||||
const varButton = await screen.findByRole('option', {
|
const varButton = await screen.findByRole('option', {
|
||||||
name: /\/var/i,
|
name: /\/var/i,
|
||||||
|
|
|
||||||
|
|
@ -174,23 +174,29 @@ describe('Step Image output', () => {
|
||||||
expect(destination).toContainElement(required);
|
expect(destination).toContainElement(required);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('selecting and deselecting a tile disables the next button', async () => {
|
test('selecting and deselecting a card disables the next button', async () => {
|
||||||
await renderCreateMode();
|
await renderCreateMode();
|
||||||
const nextButton = await getNextButton();
|
const nextButton = await getNextButton();
|
||||||
|
|
||||||
const awsTile = await screen.findByTestId('upload-aws');
|
const awsTile = await screen.findByRole('button', {
|
||||||
|
name: /Amazon Web Services/i,
|
||||||
|
});
|
||||||
user.click(awsTile); // select
|
user.click(awsTile); // select
|
||||||
await waitFor(() => expect(nextButton).toBeEnabled());
|
await waitFor(() => expect(nextButton).toBeEnabled());
|
||||||
user.click(awsTile); // deselect
|
user.click(awsTile); // deselect
|
||||||
await waitFor(() => expect(nextButton).toBeDisabled());
|
await waitFor(() => expect(nextButton).toBeDisabled());
|
||||||
|
|
||||||
const googleTile = await screen.findByTestId('upload-google');
|
const googleTile = await screen.findByRole('button', {
|
||||||
|
name: /Google Cloud Platform/i,
|
||||||
|
});
|
||||||
user.click(googleTile); // select
|
user.click(googleTile); // select
|
||||||
await waitFor(() => expect(nextButton).toBeEnabled());
|
await waitFor(() => expect(nextButton).toBeEnabled());
|
||||||
user.click(googleTile); // deselect
|
user.click(googleTile); // deselect
|
||||||
await waitFor(() => expect(nextButton).toBeDisabled());
|
await waitFor(() => expect(nextButton).toBeDisabled());
|
||||||
|
|
||||||
const azureTile = await screen.findByTestId('upload-azure');
|
const azureTile = await screen.findByRole('button', {
|
||||||
|
name: /Microsoft Azure/i,
|
||||||
|
});
|
||||||
user.click(azureTile); // select
|
user.click(azureTile); // select
|
||||||
await waitFor(() => expect(nextButton).toBeEnabled());
|
await waitFor(() => expect(nextButton).toBeEnabled());
|
||||||
user.click(azureTile); // deselect
|
user.click(azureTile); // deselect
|
||||||
|
|
@ -238,15 +244,21 @@ describe('Step Image output', () => {
|
||||||
await renderCreateMode();
|
await renderCreateMode();
|
||||||
|
|
||||||
await selectRhel8();
|
await selectRhel8();
|
||||||
await screen.findByTestId('release-lifecycle-chart');
|
await screen.findByRole('region', {
|
||||||
|
name: /hide information about release lifecycle/i,
|
||||||
|
});
|
||||||
|
|
||||||
await selectRhel9();
|
await selectRhel9();
|
||||||
await screen.findByTestId('release-lifecycle-chart');
|
await screen.findByRole('region', {
|
||||||
|
name: /hide information about release lifecycle/i,
|
||||||
|
});
|
||||||
|
|
||||||
await selectRhel10();
|
await selectRhel10();
|
||||||
await waitFor(() =>
|
await waitFor(() =>
|
||||||
expect(
|
expect(
|
||||||
screen.queryByTestId('release-lifecycle-chart')
|
screen.queryByRole('region', {
|
||||||
|
name: /hide information about release lifecycle/i,
|
||||||
|
})
|
||||||
).not.toBeInTheDocument()
|
).not.toBeInTheDocument()
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
@ -328,12 +340,18 @@ describe('Check that the target filtering is in accordance to mock content', ()
|
||||||
expect(images_types).toContain('wsl');
|
expect(images_types).toContain('wsl');
|
||||||
|
|
||||||
// make sure the UX conforms to the mocks
|
// make sure the UX conforms to the mocks
|
||||||
await screen.findByTestId('upload-aws');
|
await screen.findByRole('button', { name: /Amazon Web Services/i });
|
||||||
await screen.findByTestId('upload-google');
|
await screen.findByRole('button', { name: /Google Cloud Platform/i });
|
||||||
await screen.findByTestId('upload-azure');
|
await screen.findByRole('button', { name: /Microsoft Azure/i });
|
||||||
await screen.findByTestId('upload-oci');
|
await screen.findByRole('button', {
|
||||||
await screen.findByTestId('checkbox-guest-image');
|
name: /Oracle Cloud Infrastructure/i,
|
||||||
await screen.findByTestId('checkbox-image-installer');
|
});
|
||||||
|
await screen.findByRole('checkbox', {
|
||||||
|
name: /Virtualization guest image/i,
|
||||||
|
});
|
||||||
|
await screen.findByRole('checkbox', {
|
||||||
|
name: /Bare metal installer/i,
|
||||||
|
});
|
||||||
await screen.findByText(/wsl - windows subsystem for linux \(\.wsl\)/i);
|
await screen.findByText(/wsl - windows subsystem for linux \(\.wsl\)/i);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -361,12 +379,18 @@ describe('Check that the target filtering is in accordance to mock content', ()
|
||||||
expect(images_types).not.toContain('wsl');
|
expect(images_types).not.toContain('wsl');
|
||||||
|
|
||||||
// make sure the UX conforms to the mocks
|
// make sure the UX conforms to the mocks
|
||||||
await screen.findByTestId('upload-aws');
|
await screen.findByRole('button', { name: /Amazon Web Services/i });
|
||||||
await screen.findByTestId('upload-google');
|
await screen.findByRole('button', { name: /Google Cloud Platform/i });
|
||||||
await screen.findByTestId('upload-azure');
|
await screen.findByRole('button', { name: /Microsoft Azure/i });
|
||||||
await screen.findByTestId('upload-oci');
|
await screen.findByRole('button', {
|
||||||
await screen.findByTestId('checkbox-guest-image');
|
name: /Oracle Cloud Infrastructure/i,
|
||||||
await screen.findByTestId('checkbox-image-installer');
|
});
|
||||||
|
await screen.findByRole('checkbox', {
|
||||||
|
name: /Virtualization guest image/i,
|
||||||
|
});
|
||||||
|
await screen.findByRole('checkbox', {
|
||||||
|
name: /Bare metal installer/i,
|
||||||
|
});
|
||||||
await screen.findByText(
|
await screen.findByText(
|
||||||
/VMware vSphere - Open virtualization format \(\.ova\)/
|
/VMware vSphere - Open virtualization format \(\.ova\)/
|
||||||
);
|
);
|
||||||
|
|
@ -400,12 +424,18 @@ describe('Check that the target filtering is in accordance to mock content', ()
|
||||||
expect(images_types).toContain('wsl');
|
expect(images_types).toContain('wsl');
|
||||||
|
|
||||||
// make sure the UX conforms to the mocks
|
// make sure the UX conforms to the mocks
|
||||||
await screen.findByTestId('upload-aws');
|
await screen.findByRole('button', { name: /Amazon Web Services/i });
|
||||||
await screen.findByTestId('upload-google');
|
await screen.findByRole('button', { name: /Google Cloud Platform/i });
|
||||||
await screen.findByTestId('upload-azure');
|
await screen.findByRole('button', { name: /Microsoft Azure/i });
|
||||||
await screen.findByTestId('upload-oci');
|
await screen.findByRole('button', {
|
||||||
await screen.findByTestId('checkbox-guest-image');
|
name: /Oracle Cloud Infrastructure/i,
|
||||||
await screen.findByTestId('checkbox-image-installer');
|
});
|
||||||
|
await screen.findByRole('checkbox', {
|
||||||
|
name: /Virtualization guest image/i,
|
||||||
|
});
|
||||||
|
await screen.findByRole('checkbox', {
|
||||||
|
name: /Bare metal installer/i,
|
||||||
|
});
|
||||||
await screen.findByText(
|
await screen.findByText(
|
||||||
/VMware vSphere - Open virtualization format \(\.ova\)/
|
/VMware vSphere - Open virtualization format \(\.ova\)/
|
||||||
);
|
);
|
||||||
|
|
@ -436,14 +466,24 @@ describe('Check that the target filtering is in accordance to mock content', ()
|
||||||
expect(images_types).not.toContain('wsl');
|
expect(images_types).not.toContain('wsl');
|
||||||
|
|
||||||
// make sure the UX conforms to the mocks
|
// make sure the UX conforms to the mocks
|
||||||
await screen.findByTestId('upload-aws');
|
await screen.findByRole('button', { name: /Amazon Web Services/i });
|
||||||
await waitFor(() =>
|
await waitFor(() =>
|
||||||
expect(screen.queryByTestId('upload-google')).not.toBeInTheDocument()
|
expect(
|
||||||
|
screen.queryByRole('button', { name: /Google Cloud Platform/i })
|
||||||
|
).not.toBeInTheDocument()
|
||||||
);
|
);
|
||||||
expect(screen.queryByTestId('upload-azure')).not.toBeInTheDocument();
|
expect(
|
||||||
expect(screen.queryByTestId('upload-oci')).not.toBeInTheDocument();
|
screen.queryByRole('button', { name: /Microsoft Azure/i })
|
||||||
await screen.findByTestId('checkbox-guest-image');
|
).not.toBeInTheDocument();
|
||||||
await screen.findByTestId('checkbox-image-installer');
|
expect(
|
||||||
|
screen.queryByRole('button', { name: /Oracle Cloud Infrastructure/i })
|
||||||
|
).not.toBeInTheDocument();
|
||||||
|
await screen.findByRole('checkbox', {
|
||||||
|
name: /Virtualization guest image/i,
|
||||||
|
});
|
||||||
|
await screen.findByRole('checkbox', {
|
||||||
|
name: /Bare metal installer/i,
|
||||||
|
});
|
||||||
expect(
|
expect(
|
||||||
screen.queryByText(
|
screen.queryByText(
|
||||||
/VMware vSphere - Open virtualization format \(\.ova\)/
|
/VMware vSphere - Open virtualization format \(\.ova\)/
|
||||||
|
|
@ -481,14 +521,24 @@ describe('Check that the target filtering is in accordance to mock content', ()
|
||||||
expect(images_types).not.toContain('wsl');
|
expect(images_types).not.toContain('wsl');
|
||||||
|
|
||||||
// make sure the UX conforms to the mocks
|
// make sure the UX conforms to the mocks
|
||||||
await screen.findByTestId('upload-aws');
|
await screen.findByRole('button', { name: /Amazon Web Services/i });
|
||||||
await waitFor(() =>
|
await waitFor(() =>
|
||||||
expect(screen.queryByTestId('upload-google')).not.toBeInTheDocument()
|
expect(
|
||||||
|
screen.queryByRole('button', { name: /Google Cloud Platform/i })
|
||||||
|
).not.toBeInTheDocument()
|
||||||
);
|
);
|
||||||
expect(screen.queryByTestId('upload-azure')).not.toBeInTheDocument();
|
expect(
|
||||||
expect(screen.queryByTestId('upload-oci')).not.toBeInTheDocument();
|
screen.queryByRole('button', { name: /Microsoft Azure/i })
|
||||||
await screen.findByTestId('checkbox-guest-image');
|
).not.toBeInTheDocument();
|
||||||
await screen.findByTestId('checkbox-image-installer');
|
expect(
|
||||||
|
screen.queryByRole('button', { name: /Oracle Cloud Infrastructure/i })
|
||||||
|
).not.toBeInTheDocument();
|
||||||
|
await screen.findByRole('checkbox', {
|
||||||
|
name: /Virtualization guest image/i,
|
||||||
|
});
|
||||||
|
await screen.findByRole('checkbox', {
|
||||||
|
name: /Bare metal installer/i,
|
||||||
|
});
|
||||||
expect(
|
expect(
|
||||||
screen.queryByText(
|
screen.queryByText(
|
||||||
/VMware vSphere - Open virtualization format \(\.ova\)/
|
/VMware vSphere - Open virtualization format \(\.ova\)/
|
||||||
|
|
@ -526,12 +576,22 @@ describe('Check that the target filtering is in accordance to mock content', ()
|
||||||
expect(images_types).not.toContain('wsl');
|
expect(images_types).not.toContain('wsl');
|
||||||
|
|
||||||
// make sure the UX conforms to the mocks
|
// make sure the UX conforms to the mocks
|
||||||
await screen.findByTestId('upload-aws');
|
await screen.findByRole('button', { name: /Amazon Web Services/i });
|
||||||
expect(screen.queryByTestId('upload-google')).not.toBeInTheDocument();
|
expect(
|
||||||
expect(screen.queryByTestId('upload-azure')).not.toBeInTheDocument();
|
screen.queryByRole('button', { name: /Google Cloud Platform/i })
|
||||||
expect(screen.queryByTestId('upload-oci')).not.toBeInTheDocument();
|
).not.toBeInTheDocument();
|
||||||
await screen.findByTestId('checkbox-guest-image');
|
expect(
|
||||||
await screen.findByTestId('checkbox-image-installer');
|
screen.queryByRole('button', { name: /Microsoft Azure/i })
|
||||||
|
).not.toBeInTheDocument();
|
||||||
|
expect(
|
||||||
|
screen.queryByRole('button', { name: /Oracle Cloud Infrastructure/i })
|
||||||
|
).not.toBeInTheDocument();
|
||||||
|
await screen.findByRole('checkbox', {
|
||||||
|
name: /Virtualization guest image/i,
|
||||||
|
});
|
||||||
|
await screen.findByRole('checkbox', {
|
||||||
|
name: /Bare metal installer/i,
|
||||||
|
});
|
||||||
expect(
|
expect(
|
||||||
screen.queryByText(
|
screen.queryByText(
|
||||||
/VMware vSphere - Open virtualization format \(\.ova\)/
|
/VMware vSphere - Open virtualization format \(\.ova\)/
|
||||||
|
|
@ -559,7 +619,9 @@ describe('Check step consistency', () => {
|
||||||
const next = await screen.findByRole('button', { name: /Next/ });
|
const next = await screen.findByRole('button', { name: /Next/ });
|
||||||
|
|
||||||
// select GCP, it's available for x86_64
|
// select GCP, it's available for x86_64
|
||||||
const uploadGcpBtn = await screen.findByTestId('upload-google');
|
const uploadGcpBtn = await screen.findByRole('button', {
|
||||||
|
name: /Google Cloud Platform/i,
|
||||||
|
});
|
||||||
user.click(uploadGcpBtn);
|
user.click(uploadGcpBtn);
|
||||||
await waitFor(() => expect(next).toBeEnabled());
|
await waitFor(() => expect(next).toBeEnabled());
|
||||||
|
|
||||||
|
|
@ -568,7 +630,9 @@ describe('Check step consistency', () => {
|
||||||
await waitFor(() => expect(next).toBeDisabled());
|
await waitFor(() => expect(next).toBeDisabled());
|
||||||
|
|
||||||
// clicking on AWS enables the Next button
|
// clicking on AWS enables the Next button
|
||||||
const uploadAwsBtn = await screen.findByTestId('upload-aws');
|
const uploadAwsBtn = await screen.findByRole('button', {
|
||||||
|
name: /Amazon Web Services/i,
|
||||||
|
});
|
||||||
user.click(uploadAwsBtn);
|
user.click(uploadAwsBtn);
|
||||||
await waitFor(() => expect(next).toBeEnabled());
|
await waitFor(() => expect(next).toBeEnabled());
|
||||||
|
|
||||||
|
|
@ -655,7 +719,11 @@ describe('Set target using query parameter', () => {
|
||||||
|
|
||||||
test('image-installer (query parameter provided)', async () => {
|
test('image-installer (query parameter provided)', async () => {
|
||||||
await renderCreateMode({ target: 'iso' });
|
await renderCreateMode({ target: 'iso' });
|
||||||
expect(await screen.findByTestId('checkbox-image-installer')).toBeChecked();
|
expect(
|
||||||
|
await screen.findByRole('checkbox', {
|
||||||
|
name: /Bare metal installer/i,
|
||||||
|
})
|
||||||
|
).toBeChecked();
|
||||||
await handleRegistration();
|
await handleRegistration();
|
||||||
await goToDetailsStep();
|
await goToDetailsStep();
|
||||||
await enterNameAndGoToReviewStep();
|
await enterNameAndGoToReviewStep();
|
||||||
|
|
@ -668,7 +736,11 @@ describe('Set target using query parameter', () => {
|
||||||
|
|
||||||
test('guest-image (query parameter provided)', async () => {
|
test('guest-image (query parameter provided)', async () => {
|
||||||
await renderCreateMode({ target: 'qcow2' });
|
await renderCreateMode({ target: 'qcow2' });
|
||||||
expect(await screen.findByTestId('checkbox-guest-image')).toBeChecked();
|
expect(
|
||||||
|
await screen.findByRole('checkbox', {
|
||||||
|
name: /Virtualization guest image/i,
|
||||||
|
})
|
||||||
|
).toBeChecked();
|
||||||
await handleRegistration();
|
await handleRegistration();
|
||||||
await goToDetailsStep();
|
await goToDetailsStep();
|
||||||
await enterNameAndGoToReviewStep();
|
await enterNameAndGoToReviewStep();
|
||||||
|
|
|
||||||
|
|
@ -40,15 +40,17 @@ const selectRhel8 = async () => {
|
||||||
|
|
||||||
const selectImageInstallerTarget = async () => {
|
const selectImageInstallerTarget = async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const imageInstallerCheckbox = await screen.findByTestId(
|
const imageInstallerCheckbox = await screen.findByRole('checkbox', {
|
||||||
'checkbox-image-installer'
|
name: /Bare metal installer/i,
|
||||||
);
|
});
|
||||||
await waitFor(() => user.click(imageInstallerCheckbox));
|
await waitFor(() => user.click(imageInstallerCheckbox));
|
||||||
};
|
};
|
||||||
|
|
||||||
const selectWslTarget = async () => {
|
const selectWslTarget = async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const wslCheckBox = await screen.findByTestId('checkbox-wsl');
|
const wslCheckBox = await screen.findByRole('checkbox', {
|
||||||
|
name: /windows subsystem for linux/i,
|
||||||
|
});
|
||||||
await waitFor(() => user.click(wslCheckBox));
|
await waitFor(() => user.click(wslCheckBox));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,15 +70,19 @@ const clickRevisitButton = async () => {
|
||||||
|
|
||||||
const selectAwsTarget = async () => {
|
const selectAwsTarget = async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const awsCard = await screen.findByTestId('upload-aws');
|
const awsCard = await screen.findByRole('button', {
|
||||||
|
name: /Amazon Web Services/i,
|
||||||
|
});
|
||||||
await waitFor(() => user.click(awsCard));
|
await waitFor(() => user.click(awsCard));
|
||||||
await clickNext();
|
await clickNext();
|
||||||
};
|
};
|
||||||
|
|
||||||
const deselectAwsAndSelectGuestImage = async () => {
|
const deselectAwsAndSelectGuestImage = async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const awsCard = await screen.findByTestId('upload-aws');
|
const awsCard = await screen.findAllByRole('button', {
|
||||||
await waitFor(() => user.click(awsCard));
|
name: /Amazon Web Services/i,
|
||||||
|
});
|
||||||
|
await waitFor(() => user.click(awsCard[1]));
|
||||||
const guestImageCheckbox = await screen.findByRole('checkbox', {
|
const guestImageCheckbox = await screen.findByRole('checkbox', {
|
||||||
name: /virtualization guest image checkbox/i,
|
name: /virtualization guest image checkbox/i,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -70,14 +70,18 @@ const clickRevisitButton = async () => {
|
||||||
|
|
||||||
const selectAzureTarget = async () => {
|
const selectAzureTarget = async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const azureCard = await screen.findByTestId('upload-azure');
|
const azureCard = await screen.findByRole('button', {
|
||||||
|
name: /Microsoft Azure/i,
|
||||||
|
});
|
||||||
await waitFor(() => user.click(azureCard));
|
await waitFor(() => user.click(azureCard));
|
||||||
await clickNext();
|
await clickNext();
|
||||||
};
|
};
|
||||||
|
|
||||||
const deselectAzureAndSelectGuestImage = async () => {
|
const deselectAzureAndSelectGuestImage = async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const azureCard = await screen.findByTestId('upload-azure');
|
const azureCard = await screen.findByRole('button', {
|
||||||
|
name: /Microsoft Azure/i,
|
||||||
|
});
|
||||||
await waitFor(() => user.click(azureCard));
|
await waitFor(() => user.click(azureCard));
|
||||||
const guestImageCheckbox = await screen.findByRole('checkbox', {
|
const guestImageCheckbox = await screen.findByRole('checkbox', {
|
||||||
name: /virtualization guest image checkbox/i,
|
name: /virtualization guest image checkbox/i,
|
||||||
|
|
@ -157,7 +161,7 @@ const enterSubscriptionId = async () => {
|
||||||
|
|
||||||
const selectV1 = async () => {
|
const selectV1 = async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const hypervMenu = screen.getByTestId('azure-hyper-v-generation-select');
|
const hypervMenu = screen.getByRole('button', { name: /Generation 2/i });
|
||||||
|
|
||||||
await waitFor(() => user.click(hypervMenu));
|
await waitFor(() => user.click(hypervMenu));
|
||||||
const v1 = await screen.findByRole('option', {
|
const v1 = await screen.findByRole('option', {
|
||||||
|
|
|
||||||
|
|
@ -79,15 +79,19 @@ const createGCPCloudImage = (
|
||||||
|
|
||||||
const clickGCPTarget = async () => {
|
const clickGCPTarget = async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const googleOption = await screen.findByTestId('upload-google');
|
const googleOption = await screen.findByRole('button', {
|
||||||
|
name: /Google Cloud Platform/i,
|
||||||
|
});
|
||||||
await waitFor(() => user.click(googleOption));
|
await waitFor(() => user.click(googleOption));
|
||||||
await clickNext();
|
await clickNext();
|
||||||
};
|
};
|
||||||
|
|
||||||
const deselectGcpAndSelectGuestImage = async () => {
|
const deselectGcpAndSelectGuestImage = async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const googleCard = await screen.findByTestId('upload-google');
|
const googleCard = await screen.findAllByRole('button', {
|
||||||
await waitFor(() => user.click(googleCard));
|
name: /Google Cloud Platform/i,
|
||||||
|
});
|
||||||
|
await waitFor(() => user.click(googleCard[1]));
|
||||||
const guestImageCheckbox = await screen.findByRole('checkbox', {
|
const guestImageCheckbox = await screen.findByRole('checkbox', {
|
||||||
name: /virtualization guest image checkbox/i,
|
name: /virtualization guest image checkbox/i,
|
||||||
});
|
});
|
||||||
|
|
@ -96,7 +100,9 @@ const deselectGcpAndSelectGuestImage = async () => {
|
||||||
|
|
||||||
const selectGoogleAccount = async (optionId: string) => {
|
const selectGoogleAccount = async (optionId: string) => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const googleAccountOption = await screen.findByTestId(optionId);
|
const googleAccountOption = await screen.findByRole('radio', {
|
||||||
|
name: optionId,
|
||||||
|
});
|
||||||
await waitFor(() => user.click(googleAccountOption));
|
await waitFor(() => user.click(googleAccountOption));
|
||||||
const principalInput = await screen.findByTestId('principal');
|
const principalInput = await screen.findByTestId('principal');
|
||||||
await waitFor(() => user.type(principalInput, GCP_ACCOUNT));
|
await waitFor(() => user.type(principalInput, GCP_ACCOUNT));
|
||||||
|
|
@ -115,7 +121,7 @@ describe('Step Upload to Google', () => {
|
||||||
test('clicking Next loads Registration', async () => {
|
test('clicking Next loads Registration', async () => {
|
||||||
await renderCreateMode();
|
await renderCreateMode();
|
||||||
await clickGCPTarget();
|
await clickGCPTarget();
|
||||||
await selectGoogleAccount('google-account');
|
await selectGoogleAccount('Google account');
|
||||||
await clickNext();
|
await clickNext();
|
||||||
await screen.findByRole('heading', {
|
await screen.findByRole('heading', {
|
||||||
name: 'Register systems using this image',
|
name: 'Register systems using this image',
|
||||||
|
|
@ -161,7 +167,7 @@ describe('Step Upload to Google', () => {
|
||||||
test('revisit step button on Review works', async () => {
|
test('revisit step button on Review works', async () => {
|
||||||
await renderCreateMode();
|
await renderCreateMode();
|
||||||
await clickGCPTarget();
|
await clickGCPTarget();
|
||||||
await selectGoogleAccount('google-account');
|
await selectGoogleAccount('Google account');
|
||||||
await goToReview();
|
await goToReview();
|
||||||
await clickRevisitButton();
|
await clickRevisitButton();
|
||||||
await screen.findByRole('heading', { name: /Image output/ });
|
await screen.findByRole('heading', { name: /Image output/ });
|
||||||
|
|
@ -176,7 +182,7 @@ describe('GCP image type request generated correctly', () => {
|
||||||
test('share image with google account', async () => {
|
test('share image with google account', async () => {
|
||||||
await renderCreateMode();
|
await renderCreateMode();
|
||||||
await clickGCPTarget();
|
await clickGCPTarget();
|
||||||
await selectGoogleAccount('google-account');
|
await selectGoogleAccount('Google account');
|
||||||
await goToReview();
|
await goToReview();
|
||||||
// informational modal pops up in the first test only as it's tied
|
// informational modal pops up in the first test only as it's tied
|
||||||
// to a 'imageBuilder.saveAndBuildModalSeen' variable in localStorage
|
// to a 'imageBuilder.saveAndBuildModalSeen' variable in localStorage
|
||||||
|
|
@ -196,7 +202,7 @@ describe('GCP image type request generated correctly', () => {
|
||||||
test('share image with service account', async () => {
|
test('share image with service account', async () => {
|
||||||
await renderCreateMode();
|
await renderCreateMode();
|
||||||
await clickGCPTarget();
|
await clickGCPTarget();
|
||||||
await selectGoogleAccount('service-account');
|
await selectGoogleAccount('Service account');
|
||||||
await goToReview();
|
await goToReview();
|
||||||
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
|
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
|
||||||
const expectedImageRequest = createGCPCloudImage('gcp', {
|
const expectedImageRequest = createGCPCloudImage('gcp', {
|
||||||
|
|
@ -212,7 +218,7 @@ describe('GCP image type request generated correctly', () => {
|
||||||
test('share image with google group', async () => {
|
test('share image with google group', async () => {
|
||||||
await renderCreateMode();
|
await renderCreateMode();
|
||||||
await clickGCPTarget();
|
await clickGCPTarget();
|
||||||
await selectGoogleAccount('google-group');
|
await selectGoogleAccount('Google group');
|
||||||
await goToReview();
|
await goToReview();
|
||||||
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
|
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
|
||||||
const expectedImageRequest = createGCPCloudImage('gcp', {
|
const expectedImageRequest = createGCPCloudImage('gcp', {
|
||||||
|
|
@ -228,7 +234,9 @@ describe('GCP image type request generated correctly', () => {
|
||||||
test('share image with domain', async () => {
|
test('share image with domain', async () => {
|
||||||
await renderCreateMode();
|
await renderCreateMode();
|
||||||
await clickGCPTarget();
|
await clickGCPTarget();
|
||||||
await selectGoogleAccount('google-domain');
|
await selectGoogleAccount(
|
||||||
|
'Google Workspace domain or Cloud Identity domain'
|
||||||
|
);
|
||||||
await goToReview();
|
await goToReview();
|
||||||
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
|
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
|
||||||
const expectedImageRequest = createGCPCloudImage('gcp', {
|
const expectedImageRequest = createGCPCloudImage('gcp', {
|
||||||
|
|
@ -245,9 +253,9 @@ describe('GCP image type request generated correctly', () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
await renderCreateMode();
|
await renderCreateMode();
|
||||||
await clickGCPTarget();
|
await clickGCPTarget();
|
||||||
const shareWithInsightOption = await screen.findByTestId(
|
const shareWithInsightOption = await screen.findByRole('radio', {
|
||||||
'share-with-insights'
|
name: /Share image with Red Hat Insights only/i,
|
||||||
);
|
});
|
||||||
|
|
||||||
user.click(shareWithInsightOption);
|
user.click(shareWithInsightOption);
|
||||||
await goToReview();
|
await goToReview();
|
||||||
|
|
@ -263,7 +271,9 @@ describe('GCP image type request generated correctly', () => {
|
||||||
test('after selecting and deselecting gcp', async () => {
|
test('after selecting and deselecting gcp', async () => {
|
||||||
await renderCreateMode();
|
await renderCreateMode();
|
||||||
await clickGCPTarget();
|
await clickGCPTarget();
|
||||||
await selectGoogleAccount('google-domain');
|
await selectGoogleAccount(
|
||||||
|
'Google Workspace domain or Cloud Identity domain'
|
||||||
|
);
|
||||||
await clickBack();
|
await clickBack();
|
||||||
await deselectGcpAndSelectGuestImage();
|
await deselectGcpAndSelectGuestImage();
|
||||||
await goToReview();
|
await goToReview();
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,9 @@ const goToReviewStep = async () => {
|
||||||
|
|
||||||
const addAzureTarget = async () => {
|
const addAzureTarget = async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
await waitFor(() => user.click(screen.getByTestId('upload-azure')));
|
await waitFor(() =>
|
||||||
|
user.click(screen.getByRole('button', { name: /Microsoft Azure/i }))
|
||||||
|
);
|
||||||
await clickNext();
|
await clickNext();
|
||||||
|
|
||||||
const azureSourceDropdown = await screen.findByPlaceholderText(
|
const azureSourceDropdown = await screen.findByPlaceholderText(
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,9 @@ export const selectRhel9 = async () => {
|
||||||
|
|
||||||
export const selectGuestImageTarget = async () => {
|
export const selectGuestImageTarget = async () => {
|
||||||
const user = userEvent.setup();
|
const user = userEvent.setup();
|
||||||
const guestImageCheckBox = await screen.findByTestId('checkbox-guest-image');
|
const guestImageCheckBox = await screen.findByRole('checkbox', {
|
||||||
|
name: /Virtualization guest image/i,
|
||||||
|
});
|
||||||
await waitFor(() => user.click(guestImageCheckBox));
|
await waitFor(() => user.click(guestImageCheckBox));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,10 @@ describe('Images Table', () => {
|
||||||
|
|
||||||
const table = await screen.findByTestId('images-table');
|
const table = await screen.findByTestId('images-table');
|
||||||
|
|
||||||
// make sure the empty-state message isn't present
|
// make sure the empty state message isn't present
|
||||||
const emptyState = screen.queryByTestId('empty-state');
|
const emptyState = screen.queryByText(
|
||||||
|
/Image builder is a tool for creating deployment-ready customized system images/i
|
||||||
|
);
|
||||||
expect(emptyState).not.toBeInTheDocument();
|
expect(emptyState).not.toBeInTheDocument();
|
||||||
|
|
||||||
// check table
|
// check table
|
||||||
|
|
@ -228,8 +230,10 @@ describe('Clones table', () => {
|
||||||
|
|
||||||
const table = await screen.findByTestId('images-table');
|
const table = await screen.findByTestId('images-table');
|
||||||
|
|
||||||
// make sure the empty-state message isn't present
|
// make sure the empty state message isn't present
|
||||||
const emptyState = screen.queryByTestId('empty-state');
|
const emptyState = screen.queryByText(
|
||||||
|
/Image builder is a tool for creating deployment-ready customized system images/i
|
||||||
|
);
|
||||||
expect(emptyState).not.toBeInTheDocument();
|
expect(emptyState).not.toBeInTheDocument();
|
||||||
|
|
||||||
// get rows
|
// get rows
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,8 @@ describe('Landing Page', () => {
|
||||||
|
|
||||||
renderCustomRoutesWithReduxRouter();
|
renderCustomRoutesWithReduxRouter();
|
||||||
// check table loads
|
// check table loads
|
||||||
await screen.findByTestId('empty-state');
|
await screen.findByText(
|
||||||
|
/Image builder is a tool for creating deployment-ready customized system images/i
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue