debian-image-builder-frontend/src/test/Components/CreateImageWizard/steps/Kernel/Kernel.test.tsx
regexowl 3167effa1b Wizard: Add unleash flag and update tests
This gates the step behind an unleash flag and updates the existing tests so they pass with the new step added.
2025-01-14 14:11:22 -06:00

65 lines
1.9 KiB
TypeScript

import type { Router as RemixRouter } from '@remix-run/router';
import { screen, waitFor } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import {
clickBack,
clickNext,
verifyCancelButton,
} from '../../wizardTestUtils';
import { clickRegisterLater, renderCreateMode } from '../../wizardTestUtils';
let router: RemixRouter | undefined = undefined;
const goToKernelStep = async () => {
const user = userEvent.setup();
const guestImageCheckBox = await screen.findByRole('checkbox', {
name: /virtualization guest image checkbox/i,
});
await waitFor(() => user.click(guestImageCheckBox));
await clickNext(); // Registration
await clickRegisterLater();
await clickNext(); // OpenSCAP
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
};
describe('Step Kernel', () => {
beforeEach(() => {
vi.clearAllMocks();
router = undefined;
});
test('clicking Next loads Firewall', async () => {
await renderCreateMode();
await goToKernelStep();
await clickNext();
await screen.findByRole('heading', {
name: 'Firewall',
});
});
test('clicking Back loads Hostname', async () => {
await renderCreateMode();
await goToKernelStep();
await clickBack();
await screen.findByRole('heading', { name: 'Hostname' });
});
test('clicking Cancel loads landing page', async () => {
await renderCreateMode();
await goToKernelStep();
await verifyCancelButton(router);
});
});
// TO DO 'Kernel step' -> 'revisit step button on Review works'
// TO DO 'Kernel request generated correctly'
// TO DO 'Kernel edit mode'