V2Wizard: Add search parameter for target selection (HMS-3684)
Add an optional search parameter to the wizard like so: `/insights/image-builder/imagewizard?target=iso` or `/insights/image-builder/imagewizard?target=qcow` This results in wizard being opened and iso or qcow target being pre-selected. The Insights assistant chat bot will make use of this feature.
This commit is contained in:
parent
7c5a040ad7
commit
a7cc88af44
2 changed files with 60 additions and 1 deletions
|
|
@ -8,7 +8,10 @@ import CreateImageWizard from '../../../../../Components/CreateImageWizardV2/Cre
|
|||
import { AARCH64, RHEL_8, RHEL_9, X86_64 } from '../../../../../constants';
|
||||
import { mockArchitecturesByDistro } from '../../../../fixtures/architectures';
|
||||
import { server } from '../../../../mocks/server';
|
||||
import { renderCustomRoutesWithReduxRouter } from '../../../../testUtils';
|
||||
import {
|
||||
clickNext,
|
||||
renderCustomRoutesWithReduxRouter,
|
||||
} from '../../../../testUtils';
|
||||
import { render } from '../../wizardTestUtils';
|
||||
|
||||
const routes = [
|
||||
|
|
@ -46,6 +49,23 @@ afterEach(() => {
|
|||
server.resetHandlers();
|
||||
});
|
||||
|
||||
const clickToReview = async () => {
|
||||
await clickNext();
|
||||
await userEvent.click(
|
||||
await screen.findByRole('radio', { name: /Register later/ })
|
||||
);
|
||||
await clickNext(); // skip Registration
|
||||
await clickNext(); // skip OSCAP
|
||||
await clickNext(); // skip FSC
|
||||
await clickNext(); // skip Repositories
|
||||
await clickNext(); // skip Packages
|
||||
const nameInput = await screen.findByRole('textbox', {
|
||||
name: /blueprint name/i,
|
||||
});
|
||||
await userEvent.type(nameInput, 'name');
|
||||
await clickNext(); // skip Details
|
||||
};
|
||||
|
||||
describe('Check that the target filtering is in accordance to mock content', () => {
|
||||
test('rhel9 x86_64', async () => {
|
||||
const user = userEvent.setup();
|
||||
|
|
@ -293,3 +313,37 @@ describe('set architecture using query parameter', () => {
|
|||
await screen.findByText('aarch64');
|
||||
});
|
||||
});
|
||||
|
||||
describe('set target using query parameter', () => {
|
||||
test('no target by default (no query parameter)', async () => {
|
||||
await render();
|
||||
const nextButton = await screen.findByRole('button', { name: /Next/ });
|
||||
expect(nextButton).toBeDisabled();
|
||||
});
|
||||
|
||||
test('no target by default (invalid query parameter)', async () => {
|
||||
await render({ target: 'azure' });
|
||||
const nextButton = await screen.findByRole('button', { name: /Next/ });
|
||||
expect(nextButton).toBeDisabled();
|
||||
});
|
||||
|
||||
test('image-installer (query parameter provided)', async () => {
|
||||
await render({ target: 'iso' });
|
||||
await clickToReview();
|
||||
const targetExpandable = await screen.findByRole('button', {
|
||||
name: /Target environments/,
|
||||
});
|
||||
await userEvent.click(targetExpandable);
|
||||
await screen.findByText('Bare metal - Installer (.iso)');
|
||||
});
|
||||
|
||||
test('guest-installer (query parameter provided)', async () => {
|
||||
await render({ target: 'qcow' });
|
||||
await clickToReview();
|
||||
const targetExpandable = await screen.findByRole('button', {
|
||||
name: /Target environments/,
|
||||
});
|
||||
await userEvent.click(targetExpandable);
|
||||
await screen.findByText('Virtualization - Guest image (.qcow2)');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue