test: Move compliance On Recreate test to On Edit
This migrates a test from previously used On Recreate to current On Edit.
This commit is contained in:
parent
2f54d2b1f8
commit
802525edbc
3 changed files with 53 additions and 58 deletions
|
|
@ -242,40 +242,3 @@ describe('Step Compliance', () => {
|
|||
).toBeEnabled();
|
||||
});
|
||||
});
|
||||
|
||||
//
|
||||
// TO DO - check if the correct version of Wizard is tested
|
||||
//
|
||||
//describe('On Recreate', () => {
|
||||
// const setup = async () => {
|
||||
// renderWithReduxRouter('imagewizard/1679d95b-8f1d-4982-8c53-8c2afa4ab04c');
|
||||
// };
|
||||
// test('with oscap profile', async () => {
|
||||
// const user = userEvent.setup();
|
||||
// await setup();
|
||||
// await screen.findByRole('button', {
|
||||
// name: /review/i,
|
||||
// });
|
||||
// const createImageButton = await screen.findByRole('button', {
|
||||
// name: /create image/i,
|
||||
// });
|
||||
// await waitFor(() => expect(createImageButton).toBeEnabled());
|
||||
|
||||
// check that the FSC contains a /tmp partition
|
||||
// There are two buttons with the same name but cannot easily select the DDF rendered sidenav.
|
||||
// The sidenav will be the first node found out of all buttons.
|
||||
// const buttonsFSC = await screen.findAllByRole('button', {
|
||||
// name: /file system configuration/i,
|
||||
// });
|
||||
// await user.click(buttonsFSC[0]);
|
||||
// await screen.findByRole('heading', { name: /file system configuration/i });
|
||||
// await screen.findByText('/tmp');
|
||||
|
||||
// check that the Packages contain a nftable package
|
||||
// await clickNext();
|
||||
// await screen.findByRole('heading', {
|
||||
// name: /Additional Red Hat packages/i,
|
||||
// });
|
||||
// await screen.findByText('nftables');
|
||||
// });
|
||||
//});
|
||||
|
|
|
|||
|
|
@ -6,6 +6,11 @@ import { CreateBlueprintRequest } from '../../../../../store/imageBuilderApi';
|
|||
import { mockBlueprintIds } from '../../../../fixtures/blueprints';
|
||||
import {
|
||||
baseCreateBlueprintRequest,
|
||||
expectedFilesystemCisL2,
|
||||
expectedKernelCisL2,
|
||||
expectedOpenscapCisL2,
|
||||
expectedPackagesCisL2,
|
||||
expectedServicesCisL2,
|
||||
oscapCreateBlueprintRequest,
|
||||
} from '../../../../fixtures/editMode';
|
||||
import { clickNext } from '../../../../testUtils';
|
||||
|
|
@ -101,27 +106,6 @@ const goToReviewStep = async () => {
|
|||
await clickNext(); // Review
|
||||
};
|
||||
|
||||
const expectedOpenscapCisL2 = {
|
||||
profile_id: 'xccdf_org.ssgproject.content_profile_cis_workstation_l2',
|
||||
};
|
||||
|
||||
const expectedPackagesCisL2 = ['aide', 'emacs'];
|
||||
|
||||
const expectedServicesCisL2 = {
|
||||
enabled: ['crond', 'emacs-service'],
|
||||
masked: ['nfs-server', 'neovim-service'],
|
||||
};
|
||||
|
||||
const expectedKernelCisL2 = {
|
||||
append: 'audit_backlog_limit=8192 audit=2',
|
||||
};
|
||||
|
||||
const expectedFilesystemCisL2 = [
|
||||
{ min_size: 10737418240, mountpoint: '/' },
|
||||
{ min_size: 1073741824, mountpoint: '/tmp' },
|
||||
{ min_size: 1073741824, mountpoint: '/app' },
|
||||
];
|
||||
|
||||
describe('oscap', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
|
|
@ -195,6 +179,7 @@ describe('OpenSCAP edit mode', () => {
|
|||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
const user = userEvent.setup();
|
||||
test('edit mode works', async () => {
|
||||
const id = mockBlueprintIds['oscap'];
|
||||
await renderEditMode(id);
|
||||
|
|
@ -206,4 +191,30 @@ describe('OpenSCAP edit mode', () => {
|
|||
const expectedRequest = oscapCreateBlueprintRequest;
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
|
||||
test('fsc and packages get populated on edit', async () => {
|
||||
const id = mockBlueprintIds['oscap'];
|
||||
await renderEditMode(id);
|
||||
|
||||
// check that the FSC contains a /tmp partition
|
||||
const fscBtns = await screen.findAllByRole('button', {
|
||||
name: /file system configuration/i,
|
||||
});
|
||||
user.click(fscBtns[0]);
|
||||
await screen.findByRole('heading', { name: /file system configuration/i });
|
||||
await screen.findByText('/tmp');
|
||||
// check that the Packages contain neovim package
|
||||
const packagesNavBtn = await screen.findByRole('button', {
|
||||
name: /additional packages/i,
|
||||
});
|
||||
user.click(packagesNavBtn);
|
||||
await screen.findByRole('heading', {
|
||||
name: /Additional packages/i,
|
||||
});
|
||||
const selectedBtn = await screen.findByRole('button', {
|
||||
name: /Selected/i,
|
||||
});
|
||||
user.click(selectedBtn);
|
||||
await screen.findByText('neovim');
|
||||
});
|
||||
});
|
||||
|
|
|
|||
21
src/test/fixtures/editMode.ts
vendored
21
src/test/fixtures/editMode.ts
vendored
|
|
@ -60,6 +60,27 @@ export const expectedFilesystemCisL1 = [
|
|||
{ min_size: 1073741824, mountpoint: '/home' },
|
||||
];
|
||||
|
||||
export const expectedOpenscapCisL2 = {
|
||||
profile_id: 'xccdf_org.ssgproject.content_profile_cis_workstation_l2',
|
||||
};
|
||||
|
||||
export const expectedPackagesCisL2 = ['aide', 'emacs'];
|
||||
|
||||
export const expectedServicesCisL2 = {
|
||||
enabled: ['crond', 'emacs-service'],
|
||||
masked: ['nfs-server', 'neovim-service'],
|
||||
};
|
||||
|
||||
export const expectedKernelCisL2 = {
|
||||
append: 'audit_backlog_limit=8192 audit=2',
|
||||
};
|
||||
|
||||
export const expectedFilesystemCisL2 = [
|
||||
{ min_size: 10737418240, mountpoint: '/' },
|
||||
{ min_size: 1073741824, mountpoint: '/tmp' },
|
||||
{ min_size: 1073741824, mountpoint: '/app' },
|
||||
];
|
||||
|
||||
// FSC
|
||||
export const expectedFsc = [
|
||||
{ min_size: 10 * UNIT_GIB, mountpoint: '/' },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue