Wizard: Basic Timezone step

This adds bare bones Timezone step with appropriate file structure and basic unit tests.
This commit is contained in:
regexowl 2024-11-11 14:12:56 +01:00 committed by Lucas Garfield
parent b8c852c836
commit b526ad3c60
18 changed files with 121 additions and 4 deletions

View file

@ -0,0 +1,62 @@
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 goToTimezoneStep = 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
};
describe('Step Timezone', () => {
beforeEach(() => {
vi.clearAllMocks();
router = undefined;
});
test('clicking Next loads First Boot', async () => {
await renderCreateMode();
await goToTimezoneStep();
await clickNext();
await screen.findByRole('heading', {
name: 'First boot configuration',
});
});
test('clicking Back loads Users', async () => {
await renderCreateMode();
await goToTimezoneStep();
await clickBack();
await screen.findByRole('heading', { name: 'Users' });
});
test('clicking Cancel loads landing page', async () => {
await renderCreateMode();
await goToTimezoneStep();
await verifyCancelButton(router);
});
});
// TO DO 'Step Timezone' -> 'revisit step button on Review works'
// TO DO 'Timezone request generated correctly'
// TO DO 'Timezone edit mode'