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

@ -26,6 +26,7 @@ const goToDetailsStep = async () => {
await clickNext();
await clickNext();
await clickNext();
await clickNext();
};
const enterBlueprintDescription = async (

View file

@ -114,6 +114,7 @@ const goToReviewStep = async () => {
await clickNext();
await clickNext();
await clickNext();
await clickNext();
await enterBlueprintName();
await clickNext();
};

View file

@ -45,6 +45,7 @@ const goToFirstBootStep = async (): Promise<void> => {
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Snapshot
await clickNext(); // First Boot
};
@ -67,6 +68,7 @@ const goFromOscapToFirstBoot = async () => {
await clickNext();
await clickNext();
await clickNext();
await clickNext();
};
const openCodeEditor = async (): Promise<void> => {

View file

@ -136,6 +136,7 @@ const goToReviewStep = async () => {
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // First boot
await clickNext(); // Details
await enterBlueprintName();

View file

@ -99,6 +99,7 @@ const goToReviewStep = async () => {
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // FirstBoot
await clickNext(); // Details
await enterBlueprintName('Oscap test');

View file

@ -53,6 +53,7 @@ const goToPackagesStep = async () => {
const goToReviewStep = async () => {
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // First Boot
await clickNext(); // Details
await enterBlueprintName();
@ -174,13 +175,12 @@ describe('Step Packages', () => {
const user = userEvent.setup();
test('clicking Next loads First boot', async () => {
test('clicking Next loads Users', async () => {
await renderCreateMode();
await goToPackagesStep();
await clickNext();
await clickNext();
await screen.findByRole('heading', {
name: 'First boot configuration',
name: 'Users',
});
});

View file

@ -97,6 +97,7 @@ const goToReviewStep = async () => {
await clickNext();
await clickNext();
await clickNext();
await clickNext();
await enterBlueprintName();
await clickNext();
};

View file

@ -47,6 +47,7 @@ const goToReviewStep = async () => {
await clickNext(); // Additional packages
await clickNext();
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // First Boot
await enterBlueprintName();
await clickNext(); // Review

View file

@ -57,6 +57,7 @@ const goToReviewStep = async () => {
await clickNext();
await clickNext();
await clickNext();
await clickNext();
};
describe('Step Review', () => {

View file

@ -39,6 +39,7 @@ const goToReviewStep = async () => {
await clickNext(); // Additional packages
await clickNext();
await clickNext(); // Users
await clickNext(); // Timezone
await enterBlueprintName();
await clickNext();
};

View file

@ -45,6 +45,7 @@ const goToReview = async () => {
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Details
await clickNext(); // FirstBoot
await enterBlueprintName();

View file

@ -45,6 +45,7 @@ const goToReview = async () => {
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // FirstBoot
await clickNext(); // Details
await enterBlueprintName();

View file

@ -40,6 +40,7 @@ const goToReview = async () => {
await clickNext(); // Custom repositories
await clickNext(); // Additional packages
await clickNext(); // Users
await clickNext(); // Timezone
await clickNext(); // Details
await clickNext(); // FirstBoot
await enterBlueprintName();

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'