HMS-3796: Add snapshot date selection to wizard
This commit is contained in:
parent
a97b4d082d
commit
3231b324f0
42 changed files with 1958 additions and 257 deletions
|
|
@ -106,6 +106,7 @@ describe('Step Compliance', () => {
|
|||
})
|
||||
).not.toBeInTheDocument();
|
||||
|
||||
await clickNext(); // skip RepositorySnapshot
|
||||
await clickNext(); // skip Repositories
|
||||
|
||||
// check that there are no Packages contained when selecting the "None" profile option
|
||||
|
|
@ -172,6 +173,7 @@ describe('Step Compliance', () => {
|
|||
await screen.findByRole('heading', { name: /File system configuration/i });
|
||||
await screen.findByText(/tmp/i);
|
||||
|
||||
await clickNext(); // skip RepositorySnapshots
|
||||
await clickNext(); // skip Repositories
|
||||
|
||||
// check that the Packages contains correct packages
|
||||
|
|
|
|||
|
|
@ -155,6 +155,8 @@ describe('Step Packages', () => {
|
|||
await clickNext();
|
||||
// skip OpenSCAP
|
||||
await clickNext();
|
||||
// skip snapshots
|
||||
await clickNext();
|
||||
// skip Repositories
|
||||
await clickNext();
|
||||
// skip fsc
|
||||
|
|
@ -431,6 +433,8 @@ describe('Step Custom repositories', () => {
|
|||
await clickNext();
|
||||
// skip fsc
|
||||
await clickNext();
|
||||
// skip snapshots
|
||||
await clickNext();
|
||||
};
|
||||
|
||||
test('selected repositories stored in and retrieved from form state', async () => {
|
||||
|
|
|
|||
|
|
@ -410,6 +410,7 @@ describe('Step Upload to AWS', () => {
|
|||
await clickNext();
|
||||
await clickNext();
|
||||
await clickNext();
|
||||
await clickNext();
|
||||
await enterBlueprintName();
|
||||
await clickNext();
|
||||
|
||||
|
|
@ -602,6 +603,7 @@ describe('Step Registration', () => {
|
|||
await clickNext();
|
||||
await clickNext();
|
||||
await clickNext();
|
||||
await clickNext();
|
||||
await enterBlueprintName();
|
||||
await clickNext();
|
||||
const review = await screen.findByTestId('review-registration');
|
||||
|
|
@ -648,6 +650,7 @@ describe('Step Registration', () => {
|
|||
await clickNext();
|
||||
await clickNext();
|
||||
await clickNext();
|
||||
await clickNext();
|
||||
await enterBlueprintName();
|
||||
await clickNext();
|
||||
const review = await screen.findByTestId('review-registration');
|
||||
|
|
@ -695,6 +698,7 @@ describe('Step Registration', () => {
|
|||
await clickNext();
|
||||
await clickNext();
|
||||
await clickNext();
|
||||
await clickNext();
|
||||
await enterBlueprintName();
|
||||
await clickNext();
|
||||
const review = await screen.findByTestId('review-registration');
|
||||
|
|
@ -725,6 +729,7 @@ describe('Step Registration', () => {
|
|||
await clickNext();
|
||||
await clickNext();
|
||||
await clickNext();
|
||||
await clickNext();
|
||||
await enterBlueprintName();
|
||||
await clickNext();
|
||||
await screen.findByText('Register the system later');
|
||||
|
|
@ -858,6 +863,8 @@ describe('Step Details', () => {
|
|||
await clickNext();
|
||||
// skip fsc
|
||||
await clickNext();
|
||||
// skip snapshots
|
||||
await clickNext();
|
||||
};
|
||||
|
||||
test('image name invalid for more than 63 chars', async () => {
|
||||
|
|
@ -932,6 +939,8 @@ describe('Step Review', () => {
|
|||
await clickNext();
|
||||
// skip OpenScap
|
||||
await clickNext();
|
||||
// skip snpashotstep
|
||||
await clickNext();
|
||||
// skip repositories
|
||||
await clickNext();
|
||||
// skip packages
|
||||
|
|
@ -993,7 +1002,8 @@ describe('Step Review', () => {
|
|||
|
||||
// skip Oscap
|
||||
await clickNext();
|
||||
|
||||
// skip snpashotstep
|
||||
await clickNext();
|
||||
// skip packages
|
||||
await clickNext();
|
||||
// skip repositories
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ const goToDetailsStep = async () => {
|
|||
await clickNext();
|
||||
await clickNext();
|
||||
await clickNext();
|
||||
await clickNext();
|
||||
};
|
||||
|
||||
const enterBlueprintDescription = async () => {
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ const goToReviewStep = async () => {
|
|||
await clickNext();
|
||||
await clickNext();
|
||||
await clickNext();
|
||||
await clickNext();
|
||||
await enterBlueprintName();
|
||||
await clickNext();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ const clickToReview = async () => {
|
|||
await clickNext(); // skip Registration
|
||||
await clickNext(); // skip OSCAP
|
||||
await clickNext(); // skip FSC
|
||||
await clickNext(); // skip SnapshotRepositories
|
||||
await clickNext(); // skip Repositories
|
||||
await clickNext(); // skip Packages
|
||||
const nameInput = await screen.findByRole('textbox', {
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ const selectNone = async () => {
|
|||
|
||||
const goToReviewStep = async () => {
|
||||
await clickNext(); // File system configuration
|
||||
await clickNext(); // Snapshot repositories
|
||||
await clickNext(); // Custom repositories
|
||||
await clickNext(); // Additional packages
|
||||
await clickNext(); // Details
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ const goToPackagesStep = async () => {
|
|||
await clickRegisterLater();
|
||||
await clickNext(); // OpenSCAP
|
||||
await clickNext(); // File System
|
||||
await clickNext(); // Snapshots
|
||||
await clickNext(); // Custom repositories
|
||||
await clickNext(); // Additional packages
|
||||
};
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ const goToReviewStep = async () => {
|
|||
await clickNext();
|
||||
await clickNext();
|
||||
await clickNext();
|
||||
await clickNext();
|
||||
await enterBlueprintName();
|
||||
await clickNext();
|
||||
};
|
||||
|
|
@ -78,6 +79,7 @@ describe('registration request generated correctly', () => {
|
|||
const imageRequest: ImageRequest = {
|
||||
architecture: 'x86_64',
|
||||
image_type: 'image-installer',
|
||||
snapshot_date: '',
|
||||
upload_request: {
|
||||
options: {},
|
||||
type: 'aws.s3',
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ const goToRepositoriesStep = async () => {
|
|||
await clickRegisterLater();
|
||||
await clickNext(); // OpenSCAP
|
||||
await clickNext(); // File System
|
||||
await clickNext(); // Snapshot
|
||||
await clickNext(); // Custom repositories
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,160 @@
|
|||
import { screen } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
|
||||
import { CREATE_BLUEPRINT } from '../../../../../constants';
|
||||
import {
|
||||
CreateBlueprintRequest,
|
||||
CustomRepository,
|
||||
Repository,
|
||||
} from '../../../../../store/imageBuilderApi';
|
||||
import { clickNext } from '../../../../testUtils';
|
||||
import {
|
||||
blueprintRequest,
|
||||
clickRegisterLater,
|
||||
enterBlueprintName,
|
||||
interceptBlueprintRequest,
|
||||
render,
|
||||
} from '../../wizardTestUtils';
|
||||
|
||||
jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
||||
useChrome: () => ({
|
||||
auth: {
|
||||
getUser: () => {
|
||||
return {
|
||||
identity: {
|
||||
internal: {
|
||||
org_id: 5,
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
isBeta: () => true,
|
||||
isProd: () => true,
|
||||
getEnvironment: () => 'prod',
|
||||
}),
|
||||
}));
|
||||
|
||||
const goToSnapshotStep = async () => {
|
||||
const bareMetalCheckBox = await screen.findByRole('checkbox', {
|
||||
name: /bare metal installer checkbox/i,
|
||||
});
|
||||
await userEvent.click(bareMetalCheckBox);
|
||||
await clickNext(); // Registration
|
||||
await clickRegisterLater();
|
||||
await clickNext(); // OpenSCAP
|
||||
await clickNext(); // File System
|
||||
await clickNext();
|
||||
};
|
||||
|
||||
const goToReviewStep = async () => {
|
||||
await clickNext(); // Repositories step
|
||||
await clickNext(); // Additional packages
|
||||
await clickNext();
|
||||
await clickNext(); // Details
|
||||
await enterBlueprintName();
|
||||
await clickNext();
|
||||
};
|
||||
|
||||
const selectFirstRepository = async () => {
|
||||
await userEvent.click(
|
||||
await screen.findByRole('checkbox', { name: /select row 0/i })
|
||||
);
|
||||
};
|
||||
|
||||
const selectUseSnapshot = async () => {
|
||||
await userEvent.click(
|
||||
await screen.findByRole('radio', { name: /Use a snapshot/i })
|
||||
);
|
||||
};
|
||||
|
||||
const updateDatePickerWithValue = async (date: string) => {
|
||||
await userEvent.type(
|
||||
await screen.findByRole('textbox', { name: /Date picker/i }),
|
||||
date
|
||||
);
|
||||
};
|
||||
|
||||
const clickContentDropdown = async () => {
|
||||
await userEvent.click(
|
||||
(
|
||||
await screen.findAllByRole('button', { name: /Content/i })
|
||||
)[1]
|
||||
);
|
||||
};
|
||||
|
||||
const getSnapshotMethodElement = async () =>
|
||||
await screen.findByRole('button', { name: /Snapshot method/i });
|
||||
|
||||
describe('repository snapshot tab - ', () => {
|
||||
const expectedPayloadRepositories: Repository[] = [
|
||||
{
|
||||
baseurl: 'http://valid.link.to.repo.org/x86_64/',
|
||||
check_gpg: true,
|
||||
check_repo_gpg: false,
|
||||
gpgkey:
|
||||
'-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQINBGN9300BEAC1FLODu0cL6saMMHa7yJY1JZUc+jQUI/HdECQrrsTaPXlcc7nM\nykYMMv6amPqbnhH/R5BW2Ano+OMse+PXtUr0NXU4OcvxbnnXkrVBVUf8mXI9DzLZ\njw8KoD+4/s0BuzO78zAJF5uhuyHMAK0ll9v0r92kK45Fas9iZTfRFcqFAzvgjScf\n5jeBnbRs5U3UTz9mtDy802mk357o1A8BD0qlu3kANDpjLbORGWdAj21A6sMJDYXy\nHS9FBNV54daNcr+weky2L9gaF2yFjeu2rSEHCSfkbWfpSiVUx/bDTj7XS6XDOuJT\nJqvGS8jHqjHAIFBirhCA4cY/jLKxWyMr5N6IbXpPAYgt8/YYz2aOYVvdyB8tZ1u1\nkVsMYSGcvTBexZCn1cDkbO6I+waIlsc0uxGqUGBKF83AVYCQqOkBjF1uNnu9qefE\nkEc9obr4JZsAgnisboU25ss5ZJddKlmFMKSi66g4S5ChLEPFq7MB06PhLFioaD3L\nEXza7XitoW5VBwr0BSVKAHMC0T2xbm70zY06a6gQRlvr9a10lPmv4Tptc7xgQReg\nu1TlFPbrkGJ0d8O6vHQRAd3zdsNaVr4gX0Tg7UYiqT9ZUkP7hOc8PYXQ28hHrHTB\nA63MTq0aiPlJ/ivTuX8M6+Bi25dIV6N6IOUi/NQKIYxgovJCDSdCAAM0fQARAQAB\ntCFMdWNhcyBHYXJmaWVsZCA8bHVjYXNAcmVkaGF0LmNvbT6JAlcEEwEIAEEWIQTO\nQZeiHnXqdjmfUURc6PeuecS2PAUCY33fTQIbAwUJA8JnAAULCQgHAgIiAgYVCgkI\nCwIEFgIDAQIeBwIXgAAKCRBc6PeuecS2PCk3D/9jW7xrBB/2MQFKd5l+mNMFyKwc\nL9M/M5RFI9GaQRo55CwnPb0nnxOJR1V5GzZ/YGii53H2ose65CfBOE2L/F/RvKF0\nH9S9MInixlahzzKtV3TpDoZGk5oZIHEMuPmPS4XaHggolrzExY0ib0mQuBBE/uEV\n/HlyHEunBKPhTkAe+6Q+2dl22SUuVfWr4Uzlp65+DkdN3M37WI1a3Suhnef3rOSM\nV6puUzWRR7qcYs5C2In87AcYPn92P5ur1y/C32r8Ftg3fRWnEzI9QfRG52ojNOLK\nyGQ8ZC9PGe0q7VFcF7ridT/uzRU+NVKldbJg+rvBnszb1MjNuR7rUQHyvGmbsUVQ\nRCsgdovkee3lP4gfZHzk2SSLVSo0+NJRNaM90EmPk14Pgi/yfRSDGBVvLBbEanYI\nv1ZtdIPRyKi+/IaMOu/l7nayM/8RzghdU+0f1FAif5qf9nXuI13P8fqcqfu67gNd\nkh0UUF1XyR5UHHEZQQDqCuKEkZJ/+27jYlsG1ZiLb1odlIWoR44RP6k5OJl0raZb\nyLXbAfpITsXiJJBpCam9P9+XR5VSfgkqp5hIa7J8piN3DoMpoExg4PPQr6PbLAJy\nOUCOnuB7yYVbj0wYuMXTuyrcBHh/UymQnS8AMpQoEkCLWS/A/Hze/pD23LgiBoLY\nXIn5A2EOAf7t2IMSlA==\n=OanT\n-----END PGP PUBLIC KEY BLOCK-----',
|
||||
rhsm: false,
|
||||
},
|
||||
];
|
||||
|
||||
const expectedCustomRepositories: CustomRepository[] = [
|
||||
{
|
||||
baseurl: ['http://valid.link.to.repo.org/x86_64/'],
|
||||
check_gpg: true,
|
||||
check_repo_gpg: false,
|
||||
gpgkey: [
|
||||
'-----BEGIN PGP PUBLIC K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hTkAe+6Q+2dl22SUuVfWr4Uzlp65+DkdN3M37WI1a3Suhnef3rOSM\nV6puUzWRR7qcYs5C2In87AcYPn92P5ur1y/C32r8Ftg3fRWnEzI9QfRG52ojNOLK\nyGQ8ZC9PGe0q7VFcF7ridT/uzRU+NVKldbJg+rvBnszb1MjNuR7rUQHyvGmbsUVQ\nRCsgdovkee3lP4gfZHzk2SSLVSo0+NJRNaM90EmPk14Pgi/yfRSDGBVvLBbEanYI\nv1ZtdIPRyKi+/IaMOu/l7nayM/8RzghdU+0f1FAif5qf9nXuI13P8fqcqfu67gNd\nkh0UUF1XyR5UHHEZQQDqCuKEkZJ/+27jYlsG1ZiLb1odlIWoR44RP6k5OJl0raZb\nyLXbAfpITsXiJJBpCam9P9+XR5VSfgkqp5hIa7J8piN3DoMpoExg4PPQr6PbLAJy\nOUCOnuB7yYVbj0wYuMXTuyrcBHh/UymQnS8AMpQoEkCLWS/A/Hze/pD23LgiBoLY\nXIn5A2EOAf7t2IMSlA==\n=OanT\n-----END PGP PUBLIC KEY BLOCK-----',
|
||||
],
|
||||
id: 'ae39f556-6986-478a-95d1-f9c7e33d066c',
|
||||
name: '01-test-valid-repo',
|
||||
},
|
||||
];
|
||||
|
||||
test('select use a snapshot with 1 repo selected', async () => {
|
||||
await render();
|
||||
await goToSnapshotStep();
|
||||
await selectUseSnapshot();
|
||||
await updateDatePickerWithValue('04/22/2024');
|
||||
await clickNext(); // To repositories step
|
||||
await selectFirstRepository();
|
||||
await goToReviewStep();
|
||||
await clickContentDropdown();
|
||||
|
||||
const snapshotMethodElement = await getSnapshotMethodElement();
|
||||
// Check date was recorded correctly
|
||||
expect(snapshotMethodElement).toHaveTextContent('State as of 04/22/2024');
|
||||
// Check that the button is clickable (has 1 repo selected)
|
||||
expect(snapshotMethodElement).toHaveAttribute('aria-disabled', 'false');
|
||||
|
||||
// Check the date was passed correctly to the blueprint
|
||||
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
|
||||
blueprintRequest.image_requests[0].snapshot_date = '2024-04-22';
|
||||
|
||||
const expectedRequest: CreateBlueprintRequest = {
|
||||
...blueprintRequest,
|
||||
customizations: {
|
||||
custom_repositories: expectedCustomRepositories,
|
||||
payload_repositories: expectedPayloadRepositories,
|
||||
},
|
||||
};
|
||||
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
|
||||
test('select use a snapshot with no repos selected', async () => {
|
||||
await render();
|
||||
await goToSnapshotStep();
|
||||
await selectUseSnapshot();
|
||||
await updateDatePickerWithValue('04/22/2024');
|
||||
await clickNext(); // To repositories step
|
||||
await goToReviewStep();
|
||||
await clickContentDropdown();
|
||||
|
||||
const snapshotMethodElement = await getSnapshotMethodElement();
|
||||
// Check date was recorded correctly
|
||||
expect(snapshotMethodElement).toHaveTextContent('No repositories selected');
|
||||
// Check that the button is clickable (has 1 repo selected)
|
||||
expect(snapshotMethodElement).toHaveAttribute('aria-disabled', 'true');
|
||||
});
|
||||
});
|
||||
|
|
@ -43,6 +43,7 @@ const goToReview = async () => {
|
|||
await clickRegisterLater();
|
||||
await clickNext(); // OpenSCAP
|
||||
await clickNext(); // File system customization
|
||||
await clickNext(); // Snapshot repositories
|
||||
await clickNext(); // Custom repositories
|
||||
await clickNext(); // Additional packages
|
||||
await clickNext(); // Details
|
||||
|
|
@ -93,6 +94,7 @@ describe('aws image type request generated correctly', () => {
|
|||
const expectedImageRequest: ImageRequest = {
|
||||
architecture: 'x86_64',
|
||||
image_type: 'aws',
|
||||
snapshot_date: '',
|
||||
upload_request: {
|
||||
options: {
|
||||
share_with_sources: ['123'],
|
||||
|
|
@ -119,6 +121,7 @@ describe('aws image type request generated correctly', () => {
|
|||
const expectedImageRequest: ImageRequest = {
|
||||
architecture: 'x86_64',
|
||||
image_type: 'aws',
|
||||
snapshot_date: '',
|
||||
upload_request: {
|
||||
options: {
|
||||
share_with_accounts: ['123123123123'],
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ const goToReview = async () => {
|
|||
await clickRegisterLater();
|
||||
await clickNext(); // OpenSCAP
|
||||
await clickNext(); // File system customization
|
||||
await clickNext(); // Snapshot repositories
|
||||
await clickNext(); // Custom repositories
|
||||
await clickNext(); // Additional packages
|
||||
await clickNext(); // Details
|
||||
|
|
@ -120,6 +121,7 @@ describe('azure image type request generated correctly', () => {
|
|||
const expectedImageRequest: ImageRequest = {
|
||||
architecture: 'x86_64',
|
||||
image_type: 'azure',
|
||||
snapshot_date: '',
|
||||
upload_request: {
|
||||
options: {
|
||||
source_id: '666',
|
||||
|
|
@ -150,6 +152,7 @@ describe('azure image type request generated correctly', () => {
|
|||
const expectedImageRequest: ImageRequest = {
|
||||
architecture: 'x86_64',
|
||||
image_type: 'azure',
|
||||
snapshot_date: '',
|
||||
upload_request: {
|
||||
type: 'azure',
|
||||
options: {
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ const goToReview = async () => {
|
|||
await clickRegisterLater();
|
||||
await clickNext(); // OpenSCAP
|
||||
await clickNext(); // File system customization
|
||||
await clickNext(); // Snapshot repositories
|
||||
await clickNext(); // Custom repositories
|
||||
await clickNext(); // Additional packages
|
||||
await clickNext(); // Details
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ const goToReviewStep = async () => {
|
|||
await clickRegisterLater();
|
||||
await clickNext(); // OpenSCAP
|
||||
await clickNext(); // File system customization
|
||||
await clickNext(); // Snapshots
|
||||
await clickNext(); // Custom repositories
|
||||
await clickNext(); // Additional packages
|
||||
await clickNext(); // Details
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ const routes = [
|
|||
export const imageRequest: ImageRequest = {
|
||||
architecture: 'x86_64',
|
||||
image_type: 'image-installer',
|
||||
snapshot_date: '',
|
||||
upload_request: {
|
||||
options: {},
|
||||
type: 'aws.s3',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue