test: Add revisit step button checks

This adds tests to check that the revisit buttons on the Review step are working correctly.

Also some minor cleanup, namely making case used in the names of describe and test more consistent and moving render functions outside of functions selecting targets to make the structure easier to go through.
This commit is contained in:
regexowl 2024-08-28 09:55:40 +02:00 committed by Lucas Garfield
parent 4a15b25ceb
commit 558bb50c34
14 changed files with 324 additions and 36 deletions

View file

@ -113,15 +113,15 @@ const goToReviewStep = async () => {
await clickNext();
};
const clickFromImageOutputToFsc = async () => {
const clickRevisitButton = async () => {
const user = userEvent.setup();
await clickNext();
const registerLaterCheckbox = await screen.findByTestId(
'automatically-register-checkbox'
const expandable = await screen.findByTestId(
'file-system-configuration-expandable'
);
await waitFor(async () => user.click(registerLaterCheckbox));
await clickNext();
await clickNext(); // skip OSCAP
const revisitButton = await within(expandable).findByTestId(
'revisit-file-system'
);
await waitFor(() => user.click(revisitButton));
};
describe('Step File system configuration', () => {
@ -130,7 +130,7 @@ describe('Step File system configuration', () => {
});
const user = userEvent.setup();
test('Error validation occurs upon clicking next button', async () => {
test('error validation occurs upon clicking next button', async () => {
await renderCreateMode();
await selectGuestImage();
await goToFileSystemConfigurationStep();
@ -166,24 +166,33 @@ describe('Step File system configuration', () => {
expect(await getNextButton()).toBeEnabled();
});
test('Manual partitioning is hidden for ISO targets only', async () => {
test('manual partitioning is hidden for ISO targets only', async () => {
await renderCreateMode();
await selectImageInstaller();
await clickFromImageOutputToFsc();
await goToFileSystemConfigurationStep();
expect(
screen.queryByText(/manually configure partitions/i)
).not.toBeInTheDocument();
});
test('Manual partitioning is shown for ISO target and other target', async () => {
test('manual partitioning is shown for ISO target and other target', async () => {
await renderCreateMode();
await selectImageInstaller();
await selectGuestImage();
await clickFromImageOutputToFsc();
await goToFileSystemConfigurationStep();
await clickManuallyConfigurePartitions();
await screen.findByText('Configure partitions');
});
test('revisit step button on Review works', async () => {
await renderCreateMode();
await selectGuestImage();
await goToFileSystemConfigurationStep();
await goToReviewStep();
await clickRevisitButton();
await screen.findByRole('heading', { name: /File system configuration/ });
});
});
describe('File system configuration request generated correctly', () => {