Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions playwright/Basic/imageMode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ test('Image mode blueprint create, edit, export, import', async ({
).toBeHidden();
// but the guest image is
await expect(
frame.getByRole('radio', { name: 'Virtualization' }),
frame.getByRole('radio', { name: /^Virtualization/ }),
).toBeVisible();

imageSourceDropdown = frame.getByRole('button', {
Expand Down Expand Up @@ -119,7 +119,7 @@ test('Image mode blueprint create, edit, export, import', async ({
frame.getByRole('radio', { name: 'Microsoft Azure' }),
).toBeVisible();

await frame.getByRole('radio', { name: 'Virtualization' }).click();
await frame.getByRole('radio', { name: /^Virtualization/ }).click();
});

await test.step('Create blueprint', async () => {
Expand All @@ -146,10 +146,10 @@ test('Image mode blueprint create, edit, export, import', async ({
).toBeVisible();

await expect(
frame.getByRole('radio', { name: 'Virtualization' }),
frame.getByRole('radio', { name: /^Virtualization/ }),
).toBeVisible();
await expect(
frame.getByRole('radio', { name: 'Virtualization' }),
frame.getByRole('radio', { name: /^Virtualization/ }),
).toBeChecked();
});

Expand Down Expand Up @@ -187,7 +187,7 @@ test('Image mode blueprint create, edit, export, import', async ({
await expect(importedImageMode).toHaveAttribute('aria-pressed', 'true');

// Export doesn't include image_requests, so image types must be re-selected
await frame.getByRole('radio', { name: 'Virtualization' }).click();
await frame.getByRole('radio', { name: /^Virtualization/ }).click();

// Change the name to avoid "name already exists" conflict
await frame
Expand Down
2 changes: 1 addition & 1 deletion playwright/BootTests/ImageMode/ImageMode.boot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ test('Image mode boot integration test', async ({ page, cleanup }) => {
await rhelSourceOption.click();

// In image mode, arch is determined by the image source, so we only select the target
await frame.getByRole('radio', { name: 'Virtualization' }).click();
await frame.getByRole('radio', { name: /^Virtualization/ }).click();
});

await test.step('Create blueprint', async () => {
Expand Down
2 changes: 1 addition & 1 deletion playwright/Cockpit/cockpit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ test('Cockpit AWS cloud upload', async ({ page, cleanup }) => {
await expect(
frame.getByRole('heading', { name: 'Base settings' }),
).toBeVisible();
await frame.getByRole('checkbox', { name: /amazon web services/i }).click();
await frame.getByRole('radio', { name: /amazon web services/i }).click();
await registerLater(frame);
await frame.getByRole('button', { name: 'Review image' }).click();
await frame.getByRole('button', { name: 'Back', exact: true }).click();
Expand Down
58 changes: 1 addition & 57 deletions playwright/Customizations/Filesystem.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,18 +261,7 @@ test('Filesystem configuration is hidden for ISO target only', async ({
await fillInDetails(frame, blueprintName);

await test.step('Select only ISO target', async () => {
await fillInImageOutput(frame);
const imageInstallerCheckbox = frame.getByRole('checkbox', {
name: /bare metal installer/i,
});
await imageInstallerCheckbox.click();

const guestImageCheckbox = frame.getByRole('checkbox', {
name: /virtualization guest image/i,
});
if (await guestImageCheckbox.isChecked()) {
await guestImageCheckbox.click();
}
await fillInImageOutput(frame, 'iso');
});

await test.step('Verify filesystem configuration is not available', async () => {
Expand All @@ -284,48 +273,3 @@ test('Filesystem configuration is hidden for ISO target only', async ({
).toBeHidden();
});
});

test('Filesystem configuration is available for ISO and other target', async ({
page,
cleanup,
}) => {
const blueprintName = 'test-' + crypto.randomUUID();
cleanup.add(() => deleteBlueprint(page, blueprintName));

await ensureAuthenticated(page);
await navigateToLandingPage(page);
const frame = ibFrame(page);
await openWizard(frame);
await fillInDetails(frame, blueprintName);

await test.step('Select ISO and guest image targets', async () => {
await fillInImageOutput(frame);
const imageInstallerCheckbox = frame.getByRole('checkbox', {
name: /bare metal installer/i,
});
await imageInstallerCheckbox.click();

const guestImageCheckbox = frame.getByRole('checkbox', {
name: /virtualization guest image/i,
});
if (!(await guestImageCheckbox.isChecked())) {
await guestImageCheckbox.click();
}
});

await test.step('Verify manual partitioning is available', async () => {
await registerLater(frame);
await frame.getByRole('button', { name: /Advanced settings/ }).click();

await frame
.getByRole('button', { name: /Automatic partitioning/i })
.click();
await frame
.getByRole('option', { name: /Basic filesystem partitioning/i })
.click();

await expect(
frame.getByRole('button', { name: /Basic filesystem partitioning/i }),
).toBeVisible();
});
});
9 changes: 2 additions & 7 deletions playwright/Customizations/OpenSCAP.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,9 @@ test('Create a blueprint with OpenSCAP customization', async ({
await fillInDetails(frame, blueprintName);
});

await test.step('WSL + Installer shows WSL is not supported', async () => {
await fillInImageOutput(frame, 'wsl', 'rhel9');
await frame.getByRole('checkbox', { name: 'Bare metal installer' }).click();
await test.step('Select target and register later', async () => {
await fillInImageOutput(frame, 'qcow2', 'rhel9');
await registerLater(frame);

await expect(
frame.getByText('WSL: customization is not supported'),
).toBeVisible();
});

await test.step('Select a CIS profile then switch to None', async () => {
Expand Down
10 changes: 3 additions & 7 deletions playwright/Customizations/TargetEnvironments/Azure.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,20 +164,16 @@ test('Deselecting Azure removes its config from the blueprint', async ({
.fill(RESOURCE_GROUP);
});

await test.step('Go back and deselect Azure', async () => {
await test.step('Go back and select a different target', async () => {
await frame.getByRole('button', { name: 'Base settings' }).click();

await selectTarget(frame, 'azure');
await frame.getByRole('radio', { name: /^Virtualization/i }).click();

await expect(
frame.getByRole('checkbox', { name: 'Microsoft Azure' }),
frame.getByRole('radio', { name: 'Microsoft Azure' }),
).not.toBeChecked();
});

await test.step('Select Guest Image and continue', async () => {
await frame.getByRole('checkbox', { name: /Virtualization/i }).click();
});

await test.step('Navigate to review and verify no Azure details', async () => {
await registerLater(frame);
await frame.getByRole('button', { name: 'Review image' }).click();
Expand Down
2 changes: 1 addition & 1 deletion playwright/Import/Import.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ test('Import a blueprint with invalid customization', async ({
});

await test.step('Select Virtualization and register later', async () => {
await frame.getByRole('checkbox', { name: 'Virtualization' }).click();
await frame.getByRole('radio', { name: /^Virtualization/ }).click();
await registerLater(frame);
});

Expand Down
2 changes: 1 addition & 1 deletion playwright/helpers/navHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const fillInImageOutput = async (
if (target) {
await selectTarget(page, target);
} else {
await page.getByRole('checkbox', { name: 'Virtualization' }).click();
await page.getByRole('radio', { name: /^Virtualization/ }).click();
}
};

Expand Down
12 changes: 6 additions & 6 deletions playwright/helpers/targetChooser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,30 @@ export const selectTarget = async (
*/
switch (target) {
case 'qcow2':
await page.getByRole('checkbox', { name: 'Virtualization' }).click();
await page.getByRole('radio', { name: /^Virtualization/ }).click();
break;
case 'iso':
await page.getByRole('checkbox', { name: 'Bare metal' }).click();
await page.getByRole('radio', { name: 'Bare metal' }).click();
break;
case 'wsl':
await page
.getByRole('checkbox', { name: 'Windows Subsystem for Linux' })
.getByRole('radio', { name: 'Windows Subsystem for Linux' })
.click();
break;
case 'ova':
await page
.getByRole('checkbox', {
.getByRole('radio', {
name: 'VMware vSphere - Open virtualization format',
})
.click();
break;
case 'vmdk':
await page
.getByRole('checkbox', { name: 'VMware vSphere - Virtual disk' })
.getByRole('radio', { name: 'VMware vSphere - Virtual disk' })
.click();
break;
case 'azure':
await page.getByRole('checkbox', { name: /Microsoft Azure/ }).click();
await page.getByRole('radio', { name: /Microsoft Azure/ }).click();
break;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
selectIsOnlyNetworkInstallerSelected,
selectIsoPayloadReference,
selectIsOtherEnvironmentSelected,
selectUseSingleTarget,
} from '@/store/slices/wizard';

import Aws from './Aws';
Expand Down Expand Up @@ -75,6 +76,7 @@ const TargetEnvironment = () => {
const isOtherEnvironmentSelected = useAppSelector(
selectIsOtherEnvironmentSelected,
);
const useSingleTarget = useAppSelector(selectUseSingleTarget);
const forceShowErrors = useAppSelector(selectForceShowErrors);

const { restrictions } = useCustomizationRestrictions({
Expand Down Expand Up @@ -196,7 +198,7 @@ const TargetEnvironment = () => {
fieldId='target-environments'
>
<Content component='small'>
{isImageMode
{isImageMode || useSingleTarget
? 'Select a target environment.'
: 'Select one or more target environments.'}
</Content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
removeImageType,
selectImageTypes,
selectIsImageMode,
selectUseSingleTarget,
type SupportedImageTypes,
} from '@/store/slices/wizard';

Expand All @@ -33,32 +34,43 @@ const TargetEnvironmentOption = ({
const dispatch = useAppDispatch();
const environments = useAppSelector(selectImageTypes);
const isImageMode = useAppSelector(selectIsImageMode);
const useSingleTarget = useAppSelector(selectUseSingleTarget);

const isChecked = environments.includes(environment);

const reinitializeCloudProvider = (env: SupportedImageTypes) => {
switch (env) {
case 'aws':
dispatch(reinitializeAws());
break;
case 'azure':
dispatch(reinitializeAzure());
break;
case 'gcp':
dispatch(reinitializeGcp());
break;
}
};

const handleToggle = () => {
if (isChecked) {
switch (environment) {
case 'aws':
dispatch(reinitializeAws());
break;
case 'azure':
dispatch(reinitializeAzure());
break;
case 'gcp':
dispatch(reinitializeGcp());
}
reinitializeCloudProvider(environment);
dispatch(removeImageType(environment));
} else {
dispatch(addImageType(environment));
}
};

const handleSelect = () => {
for (const prev of environments) {
if (prev !== environment) {
reinitializeCloudProvider(prev);
}
}
dispatch(changeImageTypes([environment]));
};

if (isImageMode) {
if (isImageMode || useSingleTarget) {
return (
<Radio
className='pf-v6-u-mb-sm pf-v6-u-ml-lg'
Expand Down
Loading
Loading