Wizard: clean up unit tests

Did a little cleanup of the goToReviewStep functions, and the infinite clickNext calls.
This commit is contained in:
Katarina Sieklova 2025-08-13 16:39:17 +02:00 committed by Gianluca Zuccarelli
parent cedb4f07bd
commit c930621316
23 changed files with 221 additions and 565 deletions

View file

@ -6,11 +6,11 @@ import { mockBlueprintIds } from '../../../../fixtures/blueprints';
import { detailsCreateBlueprintRequest } from '../../../../fixtures/editMode'; import { detailsCreateBlueprintRequest } from '../../../../fixtures/editMode';
import { import {
blueprintRequest, blueprintRequest,
clickNext,
clickRegisterLater, clickRegisterLater,
enterBlueprintName, enterBlueprintName,
getNextButton, getNextButton,
goToRegistrationStep, goToRegistrationStep,
goToStep,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
openAndDismissSaveAndBuildModal, openAndDismissSaveAndBuildModal,
@ -18,23 +18,6 @@ import {
renderEditMode, renderEditMode,
} from '../../wizardTestUtils'; } from '../../wizardTestUtils';
export const goToDetailsStep = async () => {
await clickNext(); // OpenSCAP
await clickNext(); // File system configuration
await clickNext(); // Repository snapshot/Repeatable builds
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
await clickNext(); // First boot script
await clickNext(); // Details
};
const enterBlueprintDescription = async ( const enterBlueprintDescription = async (
description: string = 'Now with extra carmine!', description: string = 'Now with extra carmine!',
) => { ) => {
@ -48,10 +31,6 @@ const enterBlueprintDescription = async (
await waitFor(() => user.type(blueprintDescription, description)); await waitFor(() => user.type(blueprintDescription, description));
}; };
const goToReviewStep = async () => {
await clickNext(); // Review
};
const clickRevisitButton = async () => { const clickRevisitButton = async () => {
const user = userEvent.setup(); const user = userEvent.setup();
const expandable = await screen.findByTestId('image-details-expandable'); const expandable = await screen.findByTestId('image-details-expandable');
@ -69,7 +48,7 @@ describe('Step Details', () => {
await renderCreateMode(); await renderCreateMode();
await goToRegistrationStep(); await goToRegistrationStep();
await clickRegisterLater(); await clickRegisterLater();
await goToDetailsStep(); await goToStep(/Details/);
const nextButton = await getNextButton(); const nextButton = await getNextButton();
expect(nextButton).toBeEnabled(); expect(nextButton).toBeEnabled();
await enterBlueprintName(' '); await enterBlueprintName(' ');
@ -80,7 +59,7 @@ describe('Step Details', () => {
await renderCreateMode(); await renderCreateMode();
await goToRegistrationStep(); await goToRegistrationStep();
await clickRegisterLater(); await clickRegisterLater();
await goToDetailsStep(); await goToStep(/Details/);
await enterBlueprintName('🤣Red Velvet🤣'); await enterBlueprintName('🤣Red Velvet🤣');
const nextButton = await getNextButton(); const nextButton = await getNextButton();
await waitFor(() => expect(nextButton).toBeEnabled()); await waitFor(() => expect(nextButton).toBeEnabled());
@ -90,7 +69,7 @@ describe('Step Details', () => {
await renderCreateMode(); await renderCreateMode();
await goToRegistrationStep(); await goToRegistrationStep();
await clickRegisterLater(); await clickRegisterLater();
await goToDetailsStep(); await goToStep(/Details/);
await enterBlueprintName('Lemon Pie'); await enterBlueprintName('Lemon Pie');
const nextButton = await getNextButton(); const nextButton = await getNextButton();
await waitFor(() => expect(nextButton).toBeDisabled()); await waitFor(() => expect(nextButton).toBeDisabled());
@ -100,7 +79,7 @@ describe('Step Details', () => {
await renderCreateMode(); await renderCreateMode();
await goToRegistrationStep(); await goToRegistrationStep();
await clickRegisterLater(); await clickRegisterLater();
await goToDetailsStep(); await goToStep(/Details/);
// enter invalid image name // enter invalid image name
const invalidName = 'a'.repeat(101); const invalidName = 'a'.repeat(101);
@ -116,7 +95,7 @@ describe('Step Details', () => {
await renderCreateMode(); await renderCreateMode();
await goToRegistrationStep(); await goToRegistrationStep();
await clickRegisterLater(); await clickRegisterLater();
await goToDetailsStep(); await goToStep(/Details/);
// enter invalid image description // enter invalid image description
const invalidDescription = 'a'.repeat(251); const invalidDescription = 'a'.repeat(251);
@ -132,8 +111,8 @@ describe('Step Details', () => {
await renderCreateMode(); await renderCreateMode();
await goToRegistrationStep(); await goToRegistrationStep();
await clickRegisterLater(); await clickRegisterLater();
await goToDetailsStep(); await goToStep(/Details/);
await goToReviewStep(); await goToStep(/Review/);
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { name: /Details/ }); await screen.findByRole('heading', { name: /Details/ });
}); });
@ -148,9 +127,9 @@ describe('Details request generated correctly', () => {
await renderCreateMode(); await renderCreateMode();
await goToRegistrationStep(); await goToRegistrationStep();
await clickRegisterLater(); await clickRegisterLater();
await goToDetailsStep(); await goToStep(/Details/);
await enterBlueprintName(); await enterBlueprintName();
await goToReviewStep(); await goToStep(/Review/);
// 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
await openAndDismissSaveAndBuildModal(); await openAndDismissSaveAndBuildModal();
@ -165,10 +144,10 @@ describe('Details request generated correctly', () => {
await renderCreateMode(); await renderCreateMode();
await goToRegistrationStep(); await goToRegistrationStep();
await clickRegisterLater(); await clickRegisterLater();
await goToDetailsStep(); await goToStep(/Details/);
await enterBlueprintName(); await enterBlueprintName();
await enterBlueprintDescription(); await enterBlueprintDescription();
await goToReviewStep(); await goToStep(/Review/);
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {

View file

@ -15,8 +15,9 @@ import {
clickNext, clickNext,
clickRegisterLater, clickRegisterLater,
clickReviewAndFinish, clickReviewAndFinish,
enterBlueprintName,
getNextButton, getNextButton,
goToReview,
goToStep,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
openAndDismissSaveAndBuildModal, openAndDismissSaveAndBuildModal,
@ -43,8 +44,7 @@ const selectImageInstaller = async () => {
const goToFileSystemConfigurationStep = async () => { const goToFileSystemConfigurationStep = async () => {
await clickNext(); // Registration await clickNext(); // Registration
await clickRegisterLater(); await clickRegisterLater();
await clickNext(); // OpenSCAP await goToStep(/File system configuration/);
await clickNext(); // File System
}; };
const clickManuallyConfigurePartitions = async () => { const clickManuallyConfigurePartitions = async () => {
@ -100,23 +100,6 @@ const changePartitionUnitsToMiB = async () => {
await waitFor(() => user.click(mibOption)); await waitFor(() => user.click(mibOption));
}; };
const goToReviewStep = async () => {
await clickNext(); // File system configuration
await clickNext(); // Repository snapshot/Repeatable builds
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
await clickNext(); // Details
await enterBlueprintName();
await clickNext(); // Review
};
const clickRevisitButton = async () => { const clickRevisitButton = async () => {
const user = userEvent.setup(); const user = userEvent.setup();
const expandable = await screen.findByTestId( const expandable = await screen.findByTestId(
@ -216,7 +199,7 @@ describe('Step File system configuration', () => {
await renderCreateMode(); await renderCreateMode();
await selectGuestImage(); await selectGuestImage();
await goToFileSystemConfigurationStep(); await goToFileSystemConfigurationStep();
await goToReviewStep(); await goToReview();
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { name: /File system configuration/ }); await screen.findByRole('heading', { name: /File system configuration/ });
}); });
@ -232,7 +215,7 @@ describe('File system configuration request generated correctly', () => {
await selectGuestImage(); await selectGuestImage();
await goToFileSystemConfigurationStep(); await goToFileSystemConfigurationStep();
await clickManuallyConfigurePartitions(); await clickManuallyConfigurePartitions();
await goToReviewStep(); 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
await openAndDismissSaveAndBuildModal(); await openAndDismissSaveAndBuildModal();
@ -259,7 +242,7 @@ describe('File system configuration request generated correctly', () => {
await goToFileSystemConfigurationStep(); await goToFileSystemConfigurationStep();
await clickManuallyConfigurePartitions(); await clickManuallyConfigurePartitions();
await changePartitionSize(); await changePartitionSize();
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {
@ -283,7 +266,7 @@ describe('File system configuration request generated correctly', () => {
await goToFileSystemConfigurationStep(); await goToFileSystemConfigurationStep();
await clickManuallyConfigurePartitions(); await clickManuallyConfigurePartitions();
await changePartitionUnitsToMiB(); await changePartitionUnitsToMiB();
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {
@ -307,7 +290,7 @@ describe('File system configuration request generated correctly', () => {
await goToFileSystemConfigurationStep(); await goToFileSystemConfigurationStep();
await clickManuallyConfigurePartitions(); await clickManuallyConfigurePartitions();
await changePartitionUnitsToKiB(); await changePartitionUnitsToKiB();
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {
@ -331,7 +314,7 @@ describe('File system configuration request generated correctly', () => {
await goToFileSystemConfigurationStep(); await goToFileSystemConfigurationStep();
await clickManuallyConfigurePartitions(); await clickManuallyConfigurePartitions();
await addPartition(); await addPartition();
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {
@ -360,7 +343,7 @@ describe('File system configuration request generated correctly', () => {
await clickManuallyConfigurePartitions(); await clickManuallyConfigurePartitions();
await addPartition(); await addPartition();
await customizePartition(); await customizePartition();
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {

View file

@ -10,7 +10,8 @@ import {
clickBack, clickBack,
clickNext, clickNext,
clickRegisterLater, clickRegisterLater,
enterBlueprintName, goToReview,
goToStep,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
openAndDismissSaveAndBuildModal, openAndDismissSaveAndBuildModal,
@ -29,25 +30,7 @@ const goToFirewallStep = async () => {
await waitFor(() => user.click(guestImageCheckBox)); await waitFor(() => user.click(guestImageCheckBox));
await clickNext(); // Registration await clickNext(); // Registration
await clickRegisterLater(); await clickRegisterLater();
await clickNext(); // OpenSCAP await goToStep(/Firewall/);
await clickNext(); // File system configuration
await clickNext(); // Snapshots
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
};
const goToReviewStep = async () => {
await clickNext(); // Services
await clickNext(); // First boot script
await clickNext(); // Details
await enterBlueprintName();
await clickNext(); // Review
}; };
const addPort = async (port: string) => { const addPort = async (port: string) => {
@ -145,7 +128,7 @@ describe('Step Firewall', () => {
await renderCreateMode(); await renderCreateMode();
await goToFirewallStep(); await goToFirewallStep();
await addPort('22:tcp'); await addPort('22:tcp');
await goToReviewStep(); await goToReview();
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { name: /Firewall/ }); await screen.findByRole('heading', { name: /Firewall/ });
}); });
@ -157,7 +140,7 @@ describe('Firewall request generated correctly', () => {
await goToFirewallStep(); await goToFirewallStep();
await addPort('22:tcp'); await addPort('22:tcp');
await addPort('imap:tcp'); await addPort('imap:tcp');
await goToReviewStep(); 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
await openAndDismissSaveAndBuildModal(); await openAndDismissSaveAndBuildModal();
@ -184,7 +167,7 @@ describe('Firewall request generated correctly', () => {
await addEnabledFirewallService('ntp'); await addEnabledFirewallService('ntp');
await addEnabledFirewallService('dhcp'); await addEnabledFirewallService('dhcp');
await addDisabledFirewallService('telnet'); await addDisabledFirewallService('telnet');
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {
@ -213,7 +196,7 @@ describe('Firewall request generated correctly', () => {
await addEnabledFirewallService('ntp'); await addEnabledFirewallService('ntp');
await addEnabledFirewallService('dhcp'); await addEnabledFirewallService('dhcp');
await addDisabledFirewallService('telnet'); await addDisabledFirewallService('telnet');
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {

View file

@ -21,9 +21,10 @@ import {
clickNext, clickNext,
clickRegisterLater, clickRegisterLater,
clickReviewAndFinish, clickReviewAndFinish,
enterBlueprintName,
getNextButton, getNextButton,
goToOscapStep, goToOscapStep,
goToReview,
goToStep,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
openAndDismissSaveAndBuildModal, openAndDismissSaveAndBuildModal,
@ -41,19 +42,7 @@ const goToFirstBootStep = async (): Promise<void> => {
await waitFor(() => user.click(guestImageCheckBox)); await waitFor(() => user.click(guestImageCheckBox));
await clickNext(); // Registration await clickNext(); // Registration
await clickRegisterLater(); await clickRegisterLater();
await clickNext(); // OpenSCAP await goToStep(/First boot/);
await clickNext(); // File system configuration
await clickNext(); // Repository snapshot/Repeatable builds
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
await clickNext(); // First Boot
}; };
const selectSimplifiedOscapProfile = async () => { const selectSimplifiedOscapProfile = async () => {
@ -65,21 +54,6 @@ const selectSimplifiedOscapProfile = async () => {
await waitFor(() => user.click(simplifiedProfile)); await waitFor(() => user.click(simplifiedProfile));
}; };
const goFromOscapToFirstBoot = async () => {
await clickNext(); // File system configuration
await clickNext(); // Repository snapshot/Repeatable builds
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
await clickNext(); // First boot script
};
const openCodeEditor = async (): Promise<void> => { const openCodeEditor = async (): Promise<void> => {
const user = userEvent.setup(); const user = userEvent.setup();
const startBtn = await screen.findByRole('button', { const startBtn = await screen.findByRole('button', {
@ -100,12 +74,6 @@ const uploadFile = async (scriptName: string): Promise<void> => {
} }
}; };
const goToReviewStep = async (): Promise<void> => {
await clickNext(); // Details
await enterBlueprintName();
await clickNext(); // Review
};
const clickRevisitButton = async () => { const clickRevisitButton = async () => {
const user = userEvent.setup(); const user = userEvent.setup();
const expandable = await screen.findByTestId('firstboot-expandable'); const expandable = await screen.findByTestId('firstboot-expandable');
@ -149,7 +117,7 @@ describe('First Boot step', () => {
test('revisit step button on Review works', async () => { test('revisit step button on Review works', async () => {
await renderCreateMode(); await renderCreateMode();
await goToFirstBootStep(); await goToFirstBootStep();
await goToReviewStep(); await goToReview();
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { name: /First boot/ }); await screen.findByRole('heading', { name: /First boot/ });
}); });
@ -162,7 +130,7 @@ describe('First boot request generated correctly', () => {
await goToFirstBootStep(); await goToFirstBootStep();
await openCodeEditor(); await openCodeEditor();
await uploadFile(SCRIPT); await uploadFile(SCRIPT);
await goToReviewStep(); 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
await openAndDismissSaveAndBuildModal(); await openAndDismissSaveAndBuildModal();
@ -188,10 +156,10 @@ describe('First boot request generated correctly', () => {
await selectGuestImageTarget(); await selectGuestImageTarget();
await goToOscapStep(); await goToOscapStep();
await selectSimplifiedOscapProfile(); await selectSimplifiedOscapProfile();
await goFromOscapToFirstBoot(); await goToStep(/First boot/);
await openCodeEditor(); await openCodeEditor();
await uploadFile(SCRIPT); await uploadFile(SCRIPT);
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
// request created with both OpenSCAP and first boot customization // request created with both OpenSCAP and first boot customization
@ -220,10 +188,10 @@ describe('First boot request generated correctly', () => {
await selectGuestImageTarget(); await selectGuestImageTarget();
await goToOscapStep(); await goToOscapStep();
await selectSimplifiedOscapProfile(); await selectSimplifiedOscapProfile();
await goFromOscapToFirstBoot(); await goToStep(/First boot/);
await openCodeEditor(); await openCodeEditor();
await uploadFile(SCRIPT_DOS); await uploadFile(SCRIPT_DOS);
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
// request created with both OpenSCAP and first boot customization // request created with both OpenSCAP and first boot customization
@ -277,7 +245,7 @@ describe('First Boot edit mode', () => {
// upload empty script file and go to Review // upload empty script file and go to Review
await uploadFile(``); await uploadFile(``);
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptEditBlueprintRequest( const receivedRequest = await interceptEditBlueprintRequest(
`${EDIT_BLUEPRINT}/${id}`, `${EDIT_BLUEPRINT}/${id}`,

View file

@ -10,8 +10,9 @@ import {
clickBack, clickBack,
clickNext, clickNext,
clickRegisterLater, clickRegisterLater,
enterBlueprintName,
getNextButton, getNextButton,
goToReview,
goToStep,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
openAndDismissSaveAndBuildModal, openAndDismissSaveAndBuildModal,
@ -33,29 +34,7 @@ const goToHostnameStep = async () => {
await clickNext(); // Registration await clickNext(); // Registration
await clickRegisterLater(); await clickRegisterLater();
} }
await clickNext(); // OpenSCAP await goToStep(/Hostname/);
await clickNext(); // File system configuration
if (!process.env.IS_ON_PREMISE) {
await clickNext(); // Snapshots
await clickNext(); // Custom repositories
}
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
};
const goToReviewStep = async () => {
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
if (!process.env.IS_ON_PREMISE) {
await clickNext(); // First boot script
}
await clickNext(); // Details
await enterBlueprintName();
await clickNext(); // Review
}; };
const enterHostname = async (hostname: string) => { const enterHostname = async (hostname: string) => {
@ -146,7 +125,7 @@ describe('Step Hostname', () => {
await renderCreateMode(); await renderCreateMode();
await goToHostnameStep(); await goToHostnameStep();
await enterHostname('hostname'); await enterHostname('hostname');
await goToReviewStep(); await goToReview();
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { name: /Hostname/ }); await screen.findByRole('heading', { name: /Hostname/ });
}); });
@ -161,7 +140,7 @@ describe('Hostname request generated correctly', () => {
await renderCreateMode(); await renderCreateMode();
await goToHostnameStep(); await goToHostnameStep();
await enterHostname('hostname'); await enterHostname('hostname');
await goToReviewStep(); 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
await openAndDismissSaveAndBuildModal(); await openAndDismissSaveAndBuildModal();

View file

@ -34,6 +34,7 @@ import {
clickRegisterLater, clickRegisterLater,
enterBlueprintName, enterBlueprintName,
getNextButton, getNextButton,
goToStep,
imageRequest, imageRequest,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
@ -43,7 +44,6 @@ import {
selectRhel9, selectRhel9,
verifyCancelButton, verifyCancelButton,
} from '../../wizardTestUtils'; } from '../../wizardTestUtils';
import { goToDetailsStep } from '../Details/Details.test';
let router: RemixRouter | undefined = undefined; let router: RemixRouter | undefined = undefined;
@ -276,7 +276,7 @@ describe('Step Image output', () => {
await renderCreateMode(); await renderCreateMode();
await selectGuestImageTarget(); await selectGuestImageTarget();
await handleRegistration(); await handleRegistration();
await goToDetailsStep(); await goToStep(/Details/);
await enterNameAndGoToReviewStep(); await enterNameAndGoToReviewStep();
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { name: /Image output/ }); await screen.findByRole('heading', { name: /Image output/ });
@ -286,14 +286,14 @@ describe('Step Image output', () => {
await renderCreateMode(); await renderCreateMode();
await selectGuestImageTarget(); await selectGuestImageTarget();
await handleRegistration(); await handleRegistration();
await goToDetailsStep(); await goToStep(/Details/);
await clickNext(); // Review await clickNext(); // Review
await clickRevisitButton(); await clickRevisitButton();
await selectRhel8(); await selectRhel8();
await selectAarch64(); await selectAarch64();
await selectGuestImageTarget(); await selectGuestImageTarget();
await handleRegistration(); await handleRegistration();
await goToDetailsStep(); await goToStep(/Details/);
await clickNext(); // Review await clickNext(); // Review
await verifyNameInReviewStep('rhel-8-aarch64'); await verifyNameInReviewStep('rhel-8-aarch64');
}); });
@ -302,14 +302,14 @@ describe('Step Image output', () => {
await renderCreateMode(); await renderCreateMode();
await selectGuestImageTarget(); await selectGuestImageTarget();
await handleRegistration(); await handleRegistration();
await goToDetailsStep(); await goToStep(/Details/);
await enterNameAndGoToReviewStep(); await enterNameAndGoToReviewStep();
await clickRevisitButton(); await clickRevisitButton();
await selectRhel8(); await selectRhel8();
await selectAarch64(); await selectAarch64();
await selectGuestImageTarget(); await selectGuestImageTarget();
await handleRegistration(); await handleRegistration();
await goToDetailsStep(); await goToStep(/Details/);
await clickNext(); // Review await clickNext(); // Review
await verifyNameInReviewStep('Red Velvet'); await verifyNameInReviewStep('Red Velvet');
}); });
@ -732,7 +732,7 @@ describe('Set target using query parameter', () => {
}), }),
).toBeChecked(); ).toBeChecked();
await handleRegistration(); await handleRegistration();
await goToDetailsStep(); await goToStep(/Details/);
await enterNameAndGoToReviewStep(); await enterNameAndGoToReviewStep();
const targetExpandable = await screen.findByTestId( const targetExpandable = await screen.findByTestId(
'target-environments-expandable', 'target-environments-expandable',
@ -749,7 +749,7 @@ describe('Set target using query parameter', () => {
}), }),
).toBeChecked(); ).toBeChecked();
await handleRegistration(); await handleRegistration();
await goToDetailsStep(); await goToStep(/Details/);
await enterNameAndGoToReviewStep(); await enterNameAndGoToReviewStep();
const targetExpandable = await screen.findByTestId( const targetExpandable = await screen.findByTestId(
'target-environments-expandable', 'target-environments-expandable',
@ -769,7 +769,7 @@ describe('Distribution request generated correctly', () => {
await selectRhel8(); await selectRhel8();
await selectGuestImageTarget(); await selectGuestImageTarget();
await handleRegistration(); await handleRegistration();
await goToDetailsStep(); await goToStep(/Details/);
await enterNameAndGoToReviewStep(); await enterNameAndGoToReviewStep();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
@ -786,7 +786,7 @@ describe('Distribution request generated correctly', () => {
await selectRhel9(); await selectRhel9();
await selectGuestImageTarget(); await selectGuestImageTarget();
await handleRegistration(); await handleRegistration();
await goToDetailsStep(); await goToStep(/Details/);
await enterNameAndGoToReviewStep(); await enterNameAndGoToReviewStep();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
@ -802,7 +802,7 @@ describe('Distribution request generated correctly', () => {
await renderCreateMode(); await renderCreateMode();
await selectCentos9(); await selectCentos9();
await selectGuestImageTarget(); await selectGuestImageTarget();
await goToDetailsStep(); await goToStep(/Details/);
await enterNameAndGoToReviewStep(); await enterNameAndGoToReviewStep();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
@ -825,7 +825,7 @@ describe('Architecture request generated correctly', () => {
await selectX86_64(); await selectX86_64();
await selectGuestImageTarget(); await selectGuestImageTarget();
await handleRegistration(); await handleRegistration();
await goToDetailsStep(); await goToStep(/Details/);
await enterNameAndGoToReviewStep(); await enterNameAndGoToReviewStep();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
@ -846,7 +846,7 @@ describe('Architecture request generated correctly', () => {
await selectAarch64(); await selectAarch64();
await selectGuestImageTarget(); await selectGuestImageTarget();
await handleRegistration(); await handleRegistration();
await goToDetailsStep(); await goToStep(/Details/);
await enterNameAndGoToReviewStep(); await enterNameAndGoToReviewStep();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);

View file

@ -14,7 +14,8 @@ import {
clickBack, clickBack,
clickNext, clickNext,
clickRegisterLater, clickRegisterLater,
enterBlueprintName, goToReview,
goToStep,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
openAndDismissSaveAndBuildModal, openAndDismissSaveAndBuildModal,
@ -56,28 +57,11 @@ const goToOpenSCAPStep = async () => {
await waitFor(() => user.click(guestImageCheckBox)); await waitFor(() => user.click(guestImageCheckBox));
await clickNext(); // Registration await clickNext(); // Registration
await clickRegisterLater(); await clickRegisterLater();
await clickNext(); // OpenSCAP await goToStep(/OpenSCAP/);
}; };
const goFromOpenSCAPToKernel = async () => { const goFromOpenSCAPToKernel = async () => {
await clickNext(); // File system configuration await goToStep(/Kernel/);
await clickNext(); // Snapshots
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
};
const goToReviewStep = async () => {
await clickNext(); // Firewall
await clickNext(); // Services
await clickNext(); // First boot script
await clickNext(); // Details
await enterBlueprintName();
await clickNext(); // Review
}; };
const getKernelNameOptions = async () => { const getKernelNameOptions = async () => {
@ -240,7 +224,7 @@ describe('Step Kernel', () => {
await renderCreateMode(); await renderCreateMode();
await goToKernelStep(); await goToKernelStep();
await selectKernelName('kernel'); await selectKernelName('kernel');
await goToReviewStep(); await goToReview();
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { name: /Kernel/ }); await screen.findByRole('heading', { name: /Kernel/ });
}); });
@ -255,7 +239,7 @@ describe('Kernel request generated correctly', () => {
await renderCreateMode(); await renderCreateMode();
await goToKernelStep(); await goToKernelStep();
await selectKernelName('kernel-debug'); await selectKernelName('kernel-debug');
await goToReviewStep(); 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
await openAndDismissSaveAndBuildModal(); await openAndDismissSaveAndBuildModal();
@ -280,7 +264,7 @@ describe('Kernel request generated correctly', () => {
await goToKernelStep(); await goToKernelStep();
await selectKernelName('kernel-debug'); await selectKernelName('kernel-debug');
await clearKernelName(); await clearKernelName();
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {
@ -297,7 +281,7 @@ describe('Kernel request generated correctly', () => {
await goToKernelStep(); await goToKernelStep();
await addKernelAppend('nosmt=force'); await addKernelAppend('nosmt=force');
await removeKernelArg('nosmt=force'); await removeKernelArg('nosmt=force');
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {
@ -314,7 +298,7 @@ describe('Kernel request generated correctly', () => {
await renderCreateMode(); await renderCreateMode();
await goToKernelStep(); await goToKernelStep();
await addKernelAppend('nosmt=force'); await addKernelAppend('nosmt=force');
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {
@ -337,7 +321,7 @@ describe('Kernel request generated correctly', () => {
await goToOpenSCAPStep(); await goToOpenSCAPStep();
await selectProfile(); await selectProfile();
await goFromOpenSCAPToKernel(); await goFromOpenSCAPToKernel();
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {

View file

@ -10,7 +10,8 @@ import {
clickBack, clickBack,
clickNext, clickNext,
clickRegisterLater, clickRegisterLater,
enterBlueprintName, goToReview,
goToStep,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
openAndDismissSaveAndBuildModal, openAndDismissSaveAndBuildModal,
@ -29,25 +30,7 @@ const goToLocaleStep = async () => {
await waitFor(() => user.click(guestImageCheckBox)); await waitFor(() => user.click(guestImageCheckBox));
await clickNext(); // Registration await clickNext(); // Registration
await clickRegisterLater(); await clickRegisterLater();
await clickNext(); // OpenSCAP await goToStep(/Locale/);
await clickNext(); // File system configuration
await clickNext(); // Snapshots
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
};
const goToReviewStep = async () => {
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
await clickNext(); // First boot
await clickNext(); // Details
await enterBlueprintName();
await clickNext(); // Review
}; };
const clearLanguageSearch = async () => { const clearLanguageSearch = async () => {
@ -181,7 +164,7 @@ describe('Step Locale', () => {
await goToLocaleStep(); await goToLocaleStep();
await searchForKeyboard('us'); await searchForKeyboard('us');
await selectKeyboard(); await selectKeyboard();
await goToReviewStep(); await goToReview();
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { name: /Locale/ }); await screen.findByRole('heading', { name: /Locale/ });
}); });
@ -192,7 +175,7 @@ describe('Locale request generated correctly', () => {
await renderCreateMode(); await renderCreateMode();
await goToLocaleStep(); await goToLocaleStep();
await selectLanguages(); await selectLanguages();
await goToReviewStep(); 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
await openAndDismissSaveAndBuildModal(); await openAndDismissSaveAndBuildModal();
@ -217,7 +200,7 @@ describe('Locale request generated correctly', () => {
await goToLocaleStep(); await goToLocaleStep();
await searchForKeyboard('us'); await searchForKeyboard('us');
await selectKeyboard(); await selectKeyboard();
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {
@ -240,7 +223,7 @@ describe('Locale request generated correctly', () => {
await selectLanguages(); await selectLanguages();
await searchForKeyboard('us'); await searchForKeyboard('us');
await selectKeyboard(); await selectKeyboard();
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {

View file

@ -8,7 +8,7 @@ import { complianceCreateBlueprintRequest } from '../../../../fixtures/editMode'
import { import {
clickNext, clickNext,
clickRegisterLater, clickRegisterLater,
enterBlueprintName, goToReview,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
openAndDismissSaveAndBuildModal, openAndDismissSaveAndBuildModal,
@ -49,24 +49,6 @@ const goToComplianceStep = async () => {
await screen.findByText('None'); await screen.findByText('None');
}; };
const goToReviewStep = async () => {
await clickNext(); // File system configuration
await clickNext(); // Snapshots
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Systemd services
await clickNext(); // First boot
await clickNext(); // Details
await enterBlueprintName('Compliance test');
await clickNext(); // Review
};
const selectPolicy = async () => { const selectPolicy = async () => {
const user = userEvent.setup(); const user = userEvent.setup();
@ -99,7 +81,7 @@ describe('Compliance', () => {
await renderCreateMode(); await renderCreateMode();
await goToComplianceStep(); await goToComplianceStep();
await selectPolicy(); await selectPolicy();
await goToReviewStep(); await goToReview('Compliance test');
await openAndDismissSaveAndBuildModal(); await openAndDismissSaveAndBuildModal();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
@ -117,7 +99,7 @@ describe('Compliance', () => {
await renderCreateMode(); await renderCreateMode();
await goToComplianceStep(); await goToComplianceStep();
await selectPolicy(); await selectPolicy();
await goToReviewStep(); await goToReview('Compliance test');
await screen.findByRole('heading', { name: /Review/ }); await screen.findByRole('heading', { name: /Review/ });
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { name: /Compliance/ }); await screen.findByRole('heading', { name: /Compliance/ });

View file

@ -7,7 +7,7 @@ import { baseCreateBlueprintRequest } from '../../../../fixtures/editMode';
import { import {
clickNext, clickNext,
clickRegisterLater, clickRegisterLater,
enterBlueprintName, goToReview,
interceptBlueprintRequest, interceptBlueprintRequest,
openAndDismissSaveAndBuildModal, openAndDismissSaveAndBuildModal,
renderCreateMode, renderCreateMode,
@ -72,24 +72,6 @@ const toggleFipsCheckbox = async () => {
return fipsCheckbox; return fipsCheckbox;
}; };
const goToReviewStep = async () => {
await clickNext(); // File system configuration
await clickNext(); // Snapshot repositories
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
await clickNext(); // FirstBoot
await clickNext(); // Details
await enterBlueprintName('FIPS test');
await clickNext(); // Review
};
describe('FIPS Mode Tests', () => { describe('FIPS Mode Tests', () => {
beforeEach(() => { beforeEach(() => {
vi.clearAllMocks(); vi.clearAllMocks();
@ -129,7 +111,7 @@ describe('FIPS Mode Tests', () => {
await goToComplianceStep(); await goToComplianceStep();
await toggleFipsCheckbox(); await toggleFipsCheckbox();
await goToReviewStep(); await goToReview('FIPS test');
await openAndDismissSaveAndBuildModal(); await openAndDismissSaveAndBuildModal();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);

View file

@ -16,8 +16,8 @@ import {
import { import {
clickNext, clickNext,
clickReviewAndFinish, clickReviewAndFinish,
enterBlueprintName,
goToOscapStep, goToOscapStep,
goToReview,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
openAndDismissSaveAndBuildModal, openAndDismissSaveAndBuildModal,
@ -82,24 +82,6 @@ const selectNone = async () => {
await waitFor(async () => user.click(await screen.findByText(/none/i))); await waitFor(async () => user.click(await screen.findByText(/none/i)));
}; };
const goToReviewStep = async () => {
await clickNext(); // File system configuration
await clickNext(); // Snapshot repositories
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
await clickNext(); // FirstBoot
await clickNext(); // Details
await enterBlueprintName('Oscap test');
await clickNext(); // Review
};
const clickRevisitButton = async () => { const clickRevisitButton = async () => {
const user = userEvent.setup(); const user = userEvent.setup();
const expandable = await screen.findByTestId('oscap-detail-expandable'); const expandable = await screen.findByTestId('oscap-detail-expandable');
@ -231,7 +213,7 @@ describe('OpenSCAP request generated correctly', () => {
await selectGuestImageTarget(); await selectGuestImageTarget();
await goToOscapStep(); await goToOscapStep();
await selectProfile(); await selectProfile();
await goToReviewStep(); await goToReview('Oscap test');
// 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
await openAndDismissSaveAndBuildModal(); await openAndDismissSaveAndBuildModal();
@ -254,7 +236,7 @@ describe('OpenSCAP request generated correctly', () => {
await goToOscapStep(); await goToOscapStep();
await selectProfile(); await selectProfile();
await selectNone(); await selectNone();
await goToReviewStep(); await goToReview('Oscap test');
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
@ -274,7 +256,7 @@ describe('OpenSCAP request generated correctly', () => {
await goToOscapStep(); await goToOscapStep();
await selectProfile(); await selectProfile();
await selectDifferentProfile(); await selectDifferentProfile();
await goToReviewStep(); await goToReview('Oscap test');
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
@ -301,7 +283,7 @@ describe('OpenSCAP request generated correctly', () => {
await selectGuestImageTarget(); await selectGuestImageTarget();
await goToOscapStep(); await goToOscapStep();
await selectProfile(); await selectProfile();
await goToReviewStep(); await goToReview('Oscap test');
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { name: /OpenSCAP/ }); await screen.findByRole('heading', { name: /OpenSCAP/ });
}); });

View file

@ -22,7 +22,8 @@ import {
clickNext, clickNext,
clickRegisterLater, clickRegisterLater,
clickReviewAndFinish, clickReviewAndFinish,
enterBlueprintName, goToReview,
goToStep,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
openAndDismissSaveAndBuildModal, openAndDismissSaveAndBuildModal,
@ -47,25 +48,7 @@ const goToPackagesStep = async () => {
await selectGuestImageTarget(); await selectGuestImageTarget();
await clickNext(); // Registration await clickNext(); // Registration
await clickRegisterLater(); await clickRegisterLater();
await clickNext(); // OpenSCAP await goToStep(/Additional packages/);
await clickNext(); // File system configuration
await clickNext(); // Repository snapshot/Repeatable builds
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
};
const goToReviewStep = async () => {
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
await clickNext(); // First Boot
await clickNext(); // Details
await enterBlueprintName();
await clickNext(); // Review
}; };
const typeIntoSearchBox = async (searchTerm: string) => { const typeIntoSearchBox = async (searchTerm: string) => {
@ -415,7 +398,7 @@ describe('Step Packages', () => {
await goToPackagesStep(); await goToPackagesStep();
await typeIntoSearchBox('test'); await typeIntoSearchBox('test');
await clickFirstPackageCheckbox(); await clickFirstPackageCheckbox();
await goToReviewStep(); await goToReview();
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { name: /Custom repositories/ }); await screen.findByRole('heading', { name: /Custom repositories/ });
}); });
@ -544,7 +527,7 @@ describe('Packages request generated correctly', () => {
await goToPackagesStep(); await goToPackagesStep();
await typeIntoSearchBox('test'); // search for 'test' package await typeIntoSearchBox('test'); // search for 'test' package
await clickFirstPackageCheckbox(); // select await clickFirstPackageCheckbox(); // select
await goToReviewStep(); 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
await openAndDismissSaveAndBuildModal(); await openAndDismissSaveAndBuildModal();
@ -566,7 +549,7 @@ describe('Packages request generated correctly', () => {
await typeIntoSearchBox('test'); // search for 'test' package await typeIntoSearchBox('test'); // search for 'test' package
await clickFirstPackageCheckbox(); // select await clickFirstPackageCheckbox(); // select
await clickFirstPackageCheckbox(); // deselect await clickFirstPackageCheckbox(); // deselect
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = blueprintRequest; const expectedRequest = blueprintRequest;
@ -582,7 +565,7 @@ describe('Packages request generated correctly', () => {
name: /select row 0/i, name: /select row 0/i,
}); });
await waitFor(() => user.click(moduleCheckbox)); await waitFor(() => user.click(moduleCheckbox));
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest: CreateBlueprintRequest = { const expectedRequest: CreateBlueprintRequest = {
@ -606,7 +589,7 @@ describe('Packages request generated correctly', () => {
await waitFor(() => user.click(moduleCheckbox)); // select await waitFor(() => user.click(moduleCheckbox)); // select
await toggleSelected(); await toggleSelected();
await clickFirstPackageCheckbox(); // deselect await clickFirstPackageCheckbox(); // deselect
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = blueprintRequest; const expectedRequest = blueprintRequest;
@ -619,7 +602,7 @@ describe('Packages request generated correctly', () => {
await goToPackagesStep(); await goToPackagesStep();
await typeIntoSearchBox('@grouper'); // search for '@grouper' package group await typeIntoSearchBox('@grouper'); // search for '@grouper' package group
await clickFirstPackageCheckbox(); // select await clickFirstPackageCheckbox(); // select
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
@ -639,7 +622,7 @@ describe('Packages request generated correctly', () => {
await clickFirstPackageCheckbox(); // select await clickFirstPackageCheckbox(); // select
await toggleSelected(); await toggleSelected();
await clickFirstPackageCheckbox(); // deselect await clickFirstPackageCheckbox(); // deselect
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = blueprintRequest; const expectedRequest = blueprintRequest;
@ -658,7 +641,7 @@ describe('Packages request generated correctly', () => {
await typeIntoSearchBox('test'); // search for 'test' package await typeIntoSearchBox('test'); // search for 'test' package
await clickFirstPackageCheckbox(); // select await clickFirstPackageCheckbox(); // select
await addSingleRecommendation(); await addSingleRecommendation();
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest: CreateBlueprintRequest = { const expectedRequest: CreateBlueprintRequest = {
@ -679,7 +662,7 @@ describe('Packages request generated correctly', () => {
await typeIntoSearchBox('test'); // search for 'test' package await typeIntoSearchBox('test'); // search for 'test' package
await clickFirstPackageCheckbox(); // select await clickFirstPackageCheckbox(); // select
await addAllRecommendations(); await addAllRecommendations();
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest: CreateBlueprintRequest = { const expectedRequest: CreateBlueprintRequest = {
@ -702,7 +685,7 @@ describe('Packages request generated correctly', () => {
await addSingleRecommendation(); await addSingleRecommendation();
await toggleSelected(); await toggleSelected();
await deselectRecommendation(); await deselectRecommendation();
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest: CreateBlueprintRequest = { const expectedRequest: CreateBlueprintRequest = {

View file

@ -28,9 +28,9 @@ import {
clickRegisterLater, clickRegisterLater,
clickRegisterSatellite, clickRegisterSatellite,
clickReviewAndFinish, clickReviewAndFinish,
enterBlueprintName,
getNextButton, getNextButton,
goToRegistrationStep, goToRegistrationStep,
goToReview,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
openAndDismissSaveAndBuildModal, openAndDismissSaveAndBuildModal,
@ -120,25 +120,6 @@ const uploadFile = async (scriptName: string): Promise<void> => {
} }
}; };
const goToReviewStep = async () => {
await clickNext(); // Registration
await clickNext(); // OpenSCAP
await clickNext(); // File system configuration
await clickNext(); // Repository snapshot/Repeatable builds
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
await clickNext(); // Details
await enterBlueprintName();
await clickNext(); // Review
};
const clickRevisitButton = async () => { const clickRevisitButton = async () => {
const user = userEvent.setup(); const user = userEvent.setup();
const expandable = await screen.findByTestId('registration-expandable'); const expandable = await screen.findByTestId('registration-expandable');
@ -206,7 +187,7 @@ describe('Step Registration', () => {
await goToRegistrationStep(); await goToRegistrationStep();
await openActivationKeyDropdown(); await openActivationKeyDropdown();
await selectActivationKey('name0'); await selectActivationKey('name0');
await goToReviewStep(); await goToReview();
const review = await screen.findByTestId('review-registration'); const review = await screen.findByTestId('review-registration');
expect(review).toHaveTextContent( expect(review).toHaveTextContent(
@ -233,7 +214,7 @@ describe('Step Registration', () => {
'pf-m-disabled', 'pf-m-disabled',
), ),
); );
await goToReviewStep(); await goToReview();
await screen.findByText('Register the system later'); await screen.findByText('Register the system later');
}); });
@ -242,7 +223,7 @@ describe('Step Registration', () => {
await goToRegistrationStep(); await goToRegistrationStep();
await openActivationKeyDropdown(); await openActivationKeyDropdown();
await selectActivationKey('name0'); await selectActivationKey('name0');
await goToReviewStep(); await goToReview();
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { await screen.findByRole('heading', {
name: /Register systems using this image/, name: /Register systems using this image/,
@ -275,7 +256,7 @@ describe('Registration request generated correctly', () => {
test('register + insights + rhc', async () => { test('register + insights + rhc', async () => {
await renderCreateMode(); await renderCreateMode();
await goToRegistrationStep(); await goToRegistrationStep();
await goToReviewStep(); 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
await openAndDismissSaveAndBuildModal(); await openAndDismissSaveAndBuildModal();
@ -302,7 +283,7 @@ describe('Registration request generated correctly', () => {
await goToRegistrationStep(); await goToRegistrationStep();
await clickShowAdditionalConnectionOptions(); await clickShowAdditionalConnectionOptions();
await deselectEnableRemoteRemediations(); await deselectEnableRemoteRemediations();
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedSubscription = { const expectedSubscription = {
@ -326,7 +307,7 @@ describe('Registration request generated correctly', () => {
await goToRegistrationStep(); await goToRegistrationStep();
await clickShowAdditionalConnectionOptions(); await clickShowAdditionalConnectionOptions();
await deselectPredictiveAnalytics(); await deselectPredictiveAnalytics();
await goToReviewStep(); 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
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
@ -353,7 +334,7 @@ describe('Registration request generated correctly', () => {
await renderCreateMode(); await renderCreateMode();
await goToRegistrationStep(); await goToRegistrationStep();
await clickRegisterLater(); await clickRegisterLater();
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {
@ -371,7 +352,7 @@ describe('Registration request generated correctly', () => {
await goToRegistrationStep(); await goToRegistrationStep();
await screen.findByDisplayValue('name0'); await screen.findByDisplayValue('name0');
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedSubscription = { const expectedSubscription = {
@ -398,7 +379,7 @@ describe('Registration request generated correctly', () => {
await goToRegistrationStep(); await goToRegistrationStep();
await screen.findByDisplayValue('name1'); await screen.findByDisplayValue('name1');
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedSubscription = { const expectedSubscription = {

View file

@ -19,7 +19,8 @@ import {
clickNext, clickNext,
clickRegisterLater, clickRegisterLater,
clickReviewAndFinish, clickReviewAndFinish,
enterBlueprintName, goToReview,
goToStep,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
openAndDismissSaveAndBuildModal, openAndDismissSaveAndBuildModal,
@ -35,25 +36,7 @@ const goToRepositoriesStep = async () => {
await waitFor(() => user.click(guestImageCheckBox)); await waitFor(() => user.click(guestImageCheckBox));
await clickNext(); // Registration await clickNext(); // Registration
await clickRegisterLater(); await clickRegisterLater();
await clickNext(); // OpenSCAP await goToStep(/Custom repositories/);
await clickNext(); // File system configuration
await clickNext(); // Repository snapshot/Repeatable builds
await clickNext(); // Custom repositories
};
const goToReviewStep = async () => {
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
await clickNext(); // First Boot
await clickNext(); // Details
await enterBlueprintName();
await clickNext(); // Review
}; };
const clickRevisitButton = async () => { const clickRevisitButton = async () => {
@ -234,7 +217,7 @@ describe('Step Custom repositories', () => {
await renderCreateMode(); await renderCreateMode();
await goToRepositoriesStep(); await goToRepositoriesStep();
await selectFirstRepository(); await selectFirstRepository();
await goToReviewStep(); await goToReview();
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { name: /Custom repositories/ }); await screen.findByRole('heading', { name: /Custom repositories/ });
}); });
@ -249,7 +232,7 @@ describe('Repositories request generated correctly', () => {
await renderCreateMode(); await renderCreateMode();
await goToRepositoriesStep(); await goToRepositoriesStep();
await selectFirstRepository(); await selectFirstRepository();
await goToReviewStep(); 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
await openAndDismissSaveAndBuildModal(); await openAndDismissSaveAndBuildModal();
@ -303,7 +286,7 @@ describe('Repositories request generated correctly', () => {
await renderCreateMode(); await renderCreateMode();
await goToRepositoriesStep(); await goToRepositoriesStep();
await selectNginxRepository(); await selectNginxRepository();
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest: CreateBlueprintRequest = { const expectedRequest: CreateBlueprintRequest = {
@ -322,7 +305,7 @@ describe('Repositories request generated correctly', () => {
await goToRepositoriesStep(); await goToRepositoriesStep();
await selectFirstRepository(); await selectFirstRepository();
await deselectFirstRepository(); await deselectFirstRepository();
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = blueprintRequest; const expectedRequest = blueprintRequest;
@ -336,7 +319,7 @@ describe('Repositories request generated correctly', () => {
await renderCreateMode(); await renderCreateMode();
await goToRepositoriesStep(); await goToRepositoriesStep();
await clickBulkSelect(); await clickBulkSelect();
await goToReviewStep(); await goToReview();
const receivedRequest = (await interceptBlueprintRequest( const receivedRequest = (await interceptBlueprintRequest(
CREATE_BLUEPRINT, CREATE_BLUEPRINT,
)) as CreateBlueprintRequest; )) as CreateBlueprintRequest;

View file

@ -6,6 +6,7 @@ import {
clickBack, clickBack,
clickNext, clickNext,
clickRegisterLater, clickRegisterLater,
goToReview,
renderCreateMode, renderCreateMode,
verifyCancelButton, verifyCancelButton,
} from '../../wizardTestUtils'; } from '../../wizardTestUtils';
@ -48,24 +49,6 @@ const handleRegistration = async () => {
await clickRegisterLater(); await clickRegisterLater();
}; };
const goToReviewStep = async () => {
await clickNext(); // OpenSCAP
await clickNext(); // File system configuration
await clickNext(); // Repository snapshot/Repeatable builds
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
await clickNext(); // First boot script
await clickNext(); // Details
await clickNext(); // Review
};
describe('Step Review', () => { describe('Step Review', () => {
beforeEach(() => { beforeEach(() => {
vi.clearAllMocks(); vi.clearAllMocks();
@ -75,7 +58,7 @@ describe('Step Review', () => {
test('has 3 buttons', async () => { test('has 3 buttons', async () => {
await setupWithRhel(); await setupWithRhel();
await handleRegistration(); await handleRegistration();
await goToReviewStep(); await goToReview();
await screen.findByRole('button', { name: /Create blueprint/ }); await screen.findByRole('button', { name: /Create blueprint/ });
await screen.findByRole('button', { name: /Back/ }); await screen.findByRole('button', { name: /Back/ });
await screen.findByRole('button', { name: /Cancel/ }); await screen.findByRole('button', { name: /Cancel/ });
@ -84,7 +67,7 @@ describe('Step Review', () => {
test('clicking Back loads Image name', async () => { test('clicking Back loads Image name', async () => {
await setupWithRhel(); await setupWithRhel();
await handleRegistration(); await handleRegistration();
await goToReviewStep(); await goToReview();
await clickBack(); await clickBack();
await screen.findByRole('heading', { await screen.findByRole('heading', {
name: 'Details', name: 'Details',
@ -94,14 +77,14 @@ describe('Step Review', () => {
test('clicking Cancel loads landing page', async () => { test('clicking Cancel loads landing page', async () => {
await setupWithRhel(); await setupWithRhel();
await handleRegistration(); await handleRegistration();
await goToReviewStep(); await goToReview();
await verifyCancelButton(router); await verifyCancelButton(router);
}); });
test('has Registration expandable section for rhel', async () => { test('has Registration expandable section for rhel', async () => {
await setupWithRhel(); await setupWithRhel();
await handleRegistration(); await handleRegistration();
await goToReviewStep(); await goToReview();
await screen.findByRole('heading', { name: /Review/ }); await screen.findByRole('heading', { name: /Review/ });
const registrationExpandable = await screen.findByTestId( const registrationExpandable = await screen.findByTestId(
@ -115,7 +98,7 @@ describe('Step Review', () => {
test('has no Registration expandable for centos', async () => { test('has no Registration expandable for centos', async () => {
await setupWithCentos(); await setupWithCentos();
await goToReviewStep(); await goToReview();
await screen.findByRole('heading', { name: /Review/ }); await screen.findByRole('heading', { name: /Review/ });
expect( expect(

View file

@ -14,7 +14,8 @@ import {
clickBack, clickBack,
clickNext, clickNext,
clickRegisterLater, clickRegisterLater,
enterBlueprintName, goToReview,
goToStep,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
openAndDismissSaveAndBuildModal, openAndDismissSaveAndBuildModal,
@ -34,18 +35,7 @@ const goToServicesStep = async () => {
await waitFor(() => user.click(guestImageCheckBox)); await waitFor(() => user.click(guestImageCheckBox));
await clickNext(); // Registration await clickNext(); // Registration
await clickRegisterLater(); await clickRegisterLater();
await clickNext(); // OpenSCAP await goToStep(/Systemd services/i);
await clickNext(); // File system configuration
await clickNext(); // Snapshots
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
}; };
const goToOpenSCAPStep = async () => { const goToOpenSCAPStep = async () => {
@ -60,24 +50,7 @@ const goToOpenSCAPStep = async () => {
}; };
const goFromOpenSCAPToServices = async () => { const goFromOpenSCAPToServices = async () => {
await clickNext(); // File system configuration await goToStep(/Systemd services/i);
await clickNext(); // Snapshots
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
};
const goToReviewStep = async () => {
await clickNext(); // First boot script
await clickNext(); // Details
await enterBlueprintName();
await clickNext(); // Review
}; };
const addDisabledService = async (service: string) => { const addDisabledService = async (service: string) => {
@ -239,7 +212,7 @@ describe('Step Services', () => {
await renderCreateMode(); await renderCreateMode();
await goToServicesStep(); await goToServicesStep();
await addDisabledService('telnet'); await addDisabledService('telnet');
await goToReviewStep(); await goToReview();
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { name: /Systemd services/ }); await screen.findByRole('heading', { name: /Systemd services/ });
}); });
@ -256,7 +229,7 @@ describe('Services request generated correctly', () => {
await addDisabledService('telnet'); await addDisabledService('telnet');
await addMaskedService('nfs-server'); await addMaskedService('nfs-server');
await addEnabledService('httpd'); await addEnabledService('httpd');
await goToReviewStep(); 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
await openAndDismissSaveAndBuildModal(); await openAndDismissSaveAndBuildModal();
@ -287,7 +260,7 @@ describe('Services request generated correctly', () => {
await removeService('telnet'); await removeService('telnet');
await removeService('nfs-server'); await removeService('nfs-server');
await removeService('httpd'); await removeService('httpd');
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {
@ -305,7 +278,7 @@ describe('Services request generated correctly', () => {
await goToOpenSCAPStep(); await goToOpenSCAPStep();
await selectProfile(); await selectProfile();
await goFromOpenSCAPToServices(); await goFromOpenSCAPToServices();
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {

View file

@ -15,8 +15,9 @@ import {
clickNext, clickNext,
clickRegisterLater, clickRegisterLater,
clickReviewAndFinish, clickReviewAndFinish,
enterBlueprintName,
getNextButton, getNextButton,
goToReview,
goToStep,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
openAndDismissSaveAndBuildModal, openAndDismissSaveAndBuildModal,
@ -32,24 +33,7 @@ const goToSnapshotStep = async () => {
await waitFor(async () => user.click(guestImageCheckBox)); await waitFor(async () => user.click(guestImageCheckBox));
await clickNext(); // Registration await clickNext(); // Registration
await clickRegisterLater(); await clickRegisterLater();
await clickNext(); // OpenSCAP await goToStep(/Repeatable build/);
await clickNext(); // File System
await clickNext(); // Repositories snapshot
};
const goToReviewStep = async () => {
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
await clickNext(); // First boot script
await enterBlueprintName();
await clickNext(); // Review
}; };
const clickRevisitButton = async () => { const clickRevisitButton = async () => {
@ -173,7 +157,7 @@ describe('repository snapshot tab - ', () => {
await clickNext(); // To repositories step await clickNext(); // To repositories step
await selectFirstRepository(); await selectFirstRepository();
await goToReviewStep(); await goToReview();
await clickContentDropdown(); await clickContentDropdown();
const snapshotMethodElement = await getSnapshotMethodElement(); const snapshotMethodElement = await getSnapshotMethodElement();
@ -208,7 +192,7 @@ describe('repository snapshot tab - ', () => {
await selectUseSnapshot(); await selectUseSnapshot();
await updateDatePickerWithValue('2024-04-22'); await updateDatePickerWithValue('2024-04-22');
await clickNext(); // To repositories step await clickNext(); // To repositories step
await goToReviewStep(); await goToReview();
await clickContentDropdown(); await clickContentDropdown();
const snapshotMethodElement = await getSnapshotMethodElement(); const snapshotMethodElement = await getSnapshotMethodElement();
@ -282,7 +266,7 @@ describe('repository snapshot tab - ', () => {
}); });
await clickBulkSelect(); await clickBulkSelect();
await goToReviewStep(); await goToReview();
// Check the date was passed correctly to the blueprint // Check the date was passed correctly to the blueprint
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
@ -306,7 +290,7 @@ describe('repository snapshot tab - ', () => {
await selectUseSnapshot(); await selectUseSnapshot();
await updateDatePickerWithValue('2024-04-22'); await updateDatePickerWithValue('2024-04-22');
await clickNext(); await clickNext();
await goToReviewStep(); await goToReview();
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { name: /Custom repositories/i }); await screen.findByRole('heading', { name: /Custom repositories/i });
}); });
@ -324,7 +308,7 @@ describe('repository snapshot tab - ', () => {
expect(nextBtn).toBeEnabled(); expect(nextBtn).toBeEnabled();
}); });
await clickNext(); await clickNext();
await goToReviewStep(); await goToReview();
await screen.findByText(/Use a content template/); await screen.findByText(/Use a content template/);
}); });
}); });

View file

@ -20,8 +20,8 @@ import {
clickBack, clickBack,
clickNext, clickNext,
clickRegisterLater, clickRegisterLater,
enterBlueprintName,
getNextButton, getNextButton,
goToReview,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
openAndDismissSaveAndBuildModal, openAndDismissSaveAndBuildModal,
@ -34,25 +34,10 @@ const goToAwsStep = async () => {
await clickNext(); await clickNext();
}; };
const goToReview = async () => { const goToReviewStep = async () => {
await clickNext(); // Register await clickNext(); // Register
await clickRegisterLater(); await clickRegisterLater();
await clickNext(); // OpenSCAP await goToReview();
await clickNext(); // File system customization
await clickNext(); // Snapshot repositories
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
await clickNext(); // FirstBoot
await clickNext(); // Details
await enterBlueprintName();
await clickNext(); // Review
}; };
const clickRevisitButton = async () => { const clickRevisitButton = async () => {
@ -208,7 +193,7 @@ describe('Step Upload to AWS', () => {
await goToAwsStep(); await goToAwsStep();
await getSourceDropdown(); await getSourceDropdown();
await selectSource(); await selectSource();
await goToReview(); await goToReviewStep();
// 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
@ -225,7 +210,7 @@ describe('Step Upload to AWS', () => {
await goToAwsStep(); await goToAwsStep();
await chooseManualOption(); await chooseManualOption();
await enterAccountId(); await enterAccountId();
await goToReview(); await goToReviewStep();
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { name: /Image output/ }); await screen.findByRole('heading', { name: /Image output/ });
}); });
@ -241,7 +226,7 @@ describe('AWS image type request generated correctly', () => {
await selectAwsTarget(); await selectAwsTarget();
await goToAwsStep(); await goToAwsStep();
await selectSource(); await selectSource();
await goToReview(); await goToReviewStep();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedImageRequest: ImageRequest = { const expectedImageRequest: ImageRequest = {
@ -269,7 +254,7 @@ describe('AWS image type request generated correctly', () => {
await goToAwsStep(); await goToAwsStep();
await chooseManualOption(); await chooseManualOption();
await enterAccountId(); await enterAccountId();
await goToReview(); await goToReviewStep();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedImageRequest: ImageRequest = { const expectedImageRequest: ImageRequest = {
@ -298,7 +283,7 @@ describe('AWS image type request generated correctly', () => {
await selectSource(); await selectSource();
await clickBack(); await clickBack();
await deselectAwsAndSelectGuestImage(); await deselectAwsAndSelectGuestImage();
await goToReview(); await goToReviewStep();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
await waitFor(() => { await waitFor(() => {

View file

@ -20,8 +20,8 @@ import {
clickBack, clickBack,
clickNext, clickNext,
clickRegisterLater, clickRegisterLater,
enterBlueprintName,
getNextButton, getNextButton,
goToReview,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
openAndDismissSaveAndBuildModal, openAndDismissSaveAndBuildModal,
@ -37,25 +37,10 @@ const goToAzureStep = async () => {
await clickNext(); await clickNext();
}; };
const goToReview = async () => { const goToReviewStep = async () => {
await clickNext(); // Register await clickNext(); // Register
await clickRegisterLater(); await clickRegisterLater();
await clickNext(); // OpenSCAP await goToReview();
await clickNext(); // File system customization
await clickNext(); // Snapshot repositories
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
await clickNext(); // FirstBoot
await clickNext(); // Details
await enterBlueprintName();
await clickNext(); // Review
}; };
const clickRevisitButton = async () => { const clickRevisitButton = async () => {
@ -321,7 +306,7 @@ describe('Step Upload to Azure', () => {
await goToAzureStep(); await goToAzureStep();
await selectSource('azureSource1'); await selectSource('azureSource1');
await selectResourceGroup(); await selectResourceGroup();
await goToReview(); await goToReviewStep();
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { name: /Image output/ }); await screen.findByRole('heading', { name: /Image output/ });
}); });
@ -338,7 +323,7 @@ describe('Azure image type request generated correctly', () => {
await goToAzureStep(); await goToAzureStep();
await selectSource('azureSource1'); await selectSource('azureSource1');
await selectResourceGroup(); await selectResourceGroup();
await goToReview(); await goToReviewStep();
// 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
@ -374,7 +359,7 @@ describe('Azure image type request generated correctly', () => {
await enterTenantGuid(); await enterTenantGuid();
await enterSubscriptionId(); await enterSubscriptionId();
await enterResourceGroup(); await enterResourceGroup();
await goToReview(); await goToReviewStep();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedImageRequest: ImageRequest = { const expectedImageRequest: ImageRequest = {
@ -408,7 +393,7 @@ describe('Azure image type request generated correctly', () => {
await enterSubscriptionId(); await enterSubscriptionId();
await enterResourceGroup(); await enterResourceGroup();
await selectV1(); await selectV1();
await goToReview(); await goToReviewStep();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedImageRequest: ImageRequest = { const expectedImageRequest: ImageRequest = {
@ -440,7 +425,7 @@ describe('Azure image type request generated correctly', () => {
await selectSource('azureSource1'); await selectSource('azureSource1');
await clickBack(); await clickBack();
await deselectAzureAndSelectGuestImage(); await deselectAzureAndSelectGuestImage();
await goToReview(); await goToReviewStep();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
await waitFor(() => { await waitFor(() => {

View file

@ -16,8 +16,8 @@ import {
clickBack, clickBack,
clickNext, clickNext,
clickRegisterLater, clickRegisterLater,
enterBlueprintName,
getNextButton, getNextButton,
goToReview,
imageRequest, imageRequest,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
@ -29,25 +29,10 @@ import {
const GCP_ACCOUNT = 'test@gmail.com'; const GCP_ACCOUNT = 'test@gmail.com';
const goToReview = async () => { const goToReviewStep = async () => {
await clickNext(); await clickNext();
await clickRegisterLater(); await clickRegisterLater();
await clickNext(); // OpenSCAP await goToReview();
await clickNext(); // File system customization
await clickNext(); // Snapshot repositories
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
await clickNext(); // FirstBoot
await clickNext(); // Details
await enterBlueprintName();
await clickNext(); // Review
}; };
const clickRevisitButton = async () => { const clickRevisitButton = async () => {
@ -166,7 +151,7 @@ describe('Step Upload to Google', () => {
await renderCreateMode(); await renderCreateMode();
await clickGCPTarget(); await clickGCPTarget();
await selectGoogleAccount('Google account'); await selectGoogleAccount('Google account');
await goToReview(); await goToReviewStep();
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { name: /Image output/ }); await screen.findByRole('heading', { name: /Image output/ });
}); });
@ -181,7 +166,7 @@ describe('GCP image type request generated correctly', () => {
await renderCreateMode(); await renderCreateMode();
await clickGCPTarget(); await clickGCPTarget();
await selectGoogleAccount('Google account'); await selectGoogleAccount('Google account');
await goToReview(); await goToReviewStep();
// 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
await openAndDismissSaveAndBuildModal(); await openAndDismissSaveAndBuildModal();
@ -201,7 +186,7 @@ describe('GCP image type request generated correctly', () => {
await renderCreateMode(); await renderCreateMode();
await clickGCPTarget(); await clickGCPTarget();
await selectGoogleAccount('Service account'); await selectGoogleAccount('Service account');
await goToReview(); await goToReviewStep();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedImageRequest = createGCPCloudImage('gcp', { const expectedImageRequest = createGCPCloudImage('gcp', {
share_with_accounts: [`serviceAccount:${GCP_ACCOUNT}`], share_with_accounts: [`serviceAccount:${GCP_ACCOUNT}`],
@ -217,7 +202,7 @@ describe('GCP image type request generated correctly', () => {
await renderCreateMode(); await renderCreateMode();
await clickGCPTarget(); await clickGCPTarget();
await selectGoogleAccount('Google group'); await selectGoogleAccount('Google group');
await goToReview(); await goToReviewStep();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedImageRequest = createGCPCloudImage('gcp', { const expectedImageRequest = createGCPCloudImage('gcp', {
share_with_accounts: [`group:${GCP_ACCOUNT}`], share_with_accounts: [`group:${GCP_ACCOUNT}`],
@ -235,7 +220,7 @@ describe('GCP image type request generated correctly', () => {
await selectGoogleAccount( await selectGoogleAccount(
'Google Workspace domain or Cloud Identity domain', 'Google Workspace domain or Cloud Identity domain',
); );
await goToReview(); await goToReviewStep();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedImageRequest = createGCPCloudImage('gcp', { const expectedImageRequest = createGCPCloudImage('gcp', {
share_with_accounts: [`domain:${GCP_ACCOUNT}`], share_with_accounts: [`domain:${GCP_ACCOUNT}`],
@ -256,7 +241,7 @@ describe('GCP image type request generated correctly', () => {
}); });
user.click(shareWithInsightOption); user.click(shareWithInsightOption);
await goToReview(); await goToReviewStep();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedImageRequest = createGCPCloudImage('gcp', {}); const expectedImageRequest = createGCPCloudImage('gcp', {});
const expectedRequest: CreateBlueprintRequest = { const expectedRequest: CreateBlueprintRequest = {
@ -274,7 +259,7 @@ describe('GCP image type request generated correctly', () => {
); );
await clickBack(); await clickBack();
await deselectGcpAndSelectGuestImage(); await deselectGcpAndSelectGuestImage();
await goToReview(); await goToReviewStep();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
await waitFor(() => { await waitFor(() => {

View file

@ -10,7 +10,8 @@ import {
clickBack, clickBack,
clickNext, clickNext,
clickRegisterLater, clickRegisterLater,
enterBlueprintName, goToReview,
goToStep,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
openAndDismissSaveAndBuildModal, openAndDismissSaveAndBuildModal,
@ -29,25 +30,7 @@ const goToTimezoneStep = async () => {
await waitFor(() => user.click(guestImageCheckBox)); await waitFor(() => user.click(guestImageCheckBox));
await clickNext(); // Registration await clickNext(); // Registration
await clickRegisterLater(); await clickRegisterLater();
await clickNext(); // OpenSCAP await goToStep(/Timezone/);
await clickNext(); // File system configuration
await clickNext(); // Snapshots
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
};
const goToReviewStep = async () => {
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
await clickNext(); // First boot script
await clickNext(); // Details
await enterBlueprintName();
await clickNext(); // Review
}; };
const selectTimezone = async () => { const selectTimezone = async () => {
@ -173,7 +156,7 @@ describe('Step Timezone', () => {
await renderCreateMode(); await renderCreateMode();
await goToTimezoneStep(); await goToTimezoneStep();
await selectTimezone(); await selectTimezone();
await goToReviewStep(); await goToReview();
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { name: /Timezone/ }); await screen.findByRole('heading', { name: /Timezone/ });
}); });
@ -184,7 +167,7 @@ describe('Timezone request generated correctly', () => {
await renderCreateMode(); await renderCreateMode();
await goToTimezoneStep(); await goToTimezoneStep();
await selectTimezone(); await selectTimezone();
await goToReviewStep(); 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
await openAndDismissSaveAndBuildModal(); await openAndDismissSaveAndBuildModal();
@ -209,7 +192,7 @@ describe('Timezone request generated correctly', () => {
await goToTimezoneStep(); await goToTimezoneStep();
await addNtpServerViaKeyDown('0.nl.pool.ntp.org'); await addNtpServerViaKeyDown('0.nl.pool.ntp.org');
await addNtpServerViaKeyDown('1.nl.pool.ntp.org'); await addNtpServerViaKeyDown('1.nl.pool.ntp.org');
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {
@ -232,7 +215,7 @@ describe('Timezone request generated correctly', () => {
await selectTimezone(); await selectTimezone();
await addNtpServerViaKeyDown('0.nl.pool.ntp.org'); await addNtpServerViaKeyDown('0.nl.pool.ntp.org');
await addNtpServerViaKeyDown('1.nl.pool.ntp.org'); await addNtpServerViaKeyDown('1.nl.pool.ntp.org');
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {

View file

@ -10,8 +10,9 @@ import {
clickBack, clickBack,
clickNext, clickNext,
clickRegisterLater, clickRegisterLater,
enterBlueprintName,
getNextButton, getNextButton,
goToReview,
goToStep,
interceptBlueprintRequest, interceptBlueprintRequest,
interceptEditBlueprintRequest, interceptEditBlueprintRequest,
openAndDismissSaveAndBuildModal, openAndDismissSaveAndBuildModal,
@ -33,25 +34,7 @@ const chandlerPasswd = 'chandlerPass';
const goToUsersStep = async () => { const goToUsersStep = async () => {
await clickNext(); // Registration await clickNext(); // Registration
await clickRegisterLater(); await clickRegisterLater();
await clickNext(); // OpenSCAP await goToStep(/Users/);
await clickNext(); // File system configuration
await clickNext(); // Snapshots
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
};
const goToReviewStep = async () => {
await clickNext(); // Timezone
await clickNext(); // Locale
await clickNext(); // Hostname
await clickNext(); // Kernel
await clickNext(); // Firewall
await clickNext(); // Services
await clickNext(); // First boot
await clickNext(); // Details
await enterBlueprintName();
await clickNext(); // Review
}; };
const addAzureTarget = async () => { const addAzureTarget = async () => {
@ -351,7 +334,7 @@ describe('Step Users', () => {
await goToUsersStep(); await goToUsersStep();
await clickAddUser(); await clickAddUser();
await addUserName(validUserName); await addUserName(validUserName);
await goToReviewStep(); await goToReview();
await clickRevisitButton(); await clickRevisitButton();
await screen.findByRole('heading', { name: /Users/ }); await screen.findByRole('heading', { name: /Users/ });
}); });
@ -373,7 +356,7 @@ describe('User request generated correctly', () => {
await checkAdminCheckbox(); await checkAdminCheckbox();
await addUserGroupByUserIndex('users', 0); await addUserGroupByUserIndex('users', 0);
await addUserGroupByUserIndex('widget', 0); await addUserGroupByUserIndex('widget', 0);
await goToReviewStep(); 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
await openAndDismissSaveAndBuildModal(); await openAndDismissSaveAndBuildModal();
@ -410,7 +393,7 @@ describe('User request generated correctly', () => {
await addUserGroupByUserIndex('widget', 0); await addUserGroupByUserIndex('widget', 0);
await closeNthTab(0); await closeNthTab(0);
await screen.findByText(/add a user to your image/i); await screen.findByText(/add a user to your image/i);
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {
@ -430,7 +413,7 @@ describe('User request generated correctly', () => {
await addAndFillThreeUsers(); await addAndFillThreeUsers();
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {
@ -474,7 +457,7 @@ describe('User request generated correctly', () => {
await closeNthTab(1); await closeNthTab(1);
await closeNthTab(0); await closeNthTab(0);
await goToReviewStep(); await goToReview();
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT); const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
const expectedRequest = { const expectedRequest = {

View file

@ -255,6 +255,49 @@ export const getNextButton = async () => {
return next; return next;
}; };
export const goToReview = async (
blueprintName: string = 'Red Velvet',
maxSteps: number = 25,
) => {
for (let stepIndex = 0; stepIndex < maxSteps; stepIndex++) {
const isOnReview = !!screen.queryByRole('heading', { name: /Review/ });
if (isOnReview) {
return;
}
const blueprintNameInput = screen.queryByRole('textbox', {
name: /blueprint name/i,
});
if (blueprintNameInput) {
await enterBlueprintName(blueprintName);
}
await clickNext();
}
throw new Error(
'goToReview exceeded maxSteps without reaching the Review step',
);
};
export const goToStep = async (
targetHeading: string | RegExp,
maxSteps: number = 25,
) => {
for (let stepIndex = 0; stepIndex < maxSteps; stepIndex++) {
const isOnTarget = !!screen.queryByRole('heading', { name: targetHeading });
if (isOnTarget) {
return;
}
await clickNext();
}
throw new Error(
'goToStep exceeded maxSteps without reaching the target step',
);
};
export const verifyCancelButton = async (router: RemixRouter | undefined) => { export const verifyCancelButton = async (router: RemixRouter | undefined) => {
await clickCancel(); await clickCancel();
if (router) { if (router) {