CreateImageWizard: add package step

The additional package selection step is added to the create image
wizard. Users can now query for packages and select them from a list.
These packages are not yet passed into the blueprint customizations and
are just for display. Tests have been updated and added.
This commit is contained in:
Jacob Kozol 2021-02-01 21:21:26 +01:00 committed by Tom Gundersen
parent 36f2970419
commit 6b575c5478
4 changed files with 193 additions and 7 deletions

View file

@ -186,11 +186,11 @@ describe('Step Registration', () => {
anchor.click();
});
test('clicking Next loads Review', () => {
test('clicking Next loads Packages', () => {
const [ next, , ] = verifyButtons();
next.click();
screen.getByText('Review the information and click Create image to create the image using the following criteria.');
screen.getByText('Optionally add additional packages to your image');
});
test('clicking Back loads Upload to AWS', () => {
@ -242,6 +242,50 @@ describe('Step Registration', () => {
});
});
describe('Step Packages', () => {
beforeEach(() => {
const { _component, history } = renderWithReduxRouter(<CreateImageWizard />);
historySpy = jest.spyOn(history, 'push');
// left sidebar navigation
const sidebar = screen.getByRole('navigation');
const anchor = getByText(sidebar, 'Packages');
// load from sidebar
anchor.click();
});
test('clicking Next loads Review', () => {
const [ next, , ] = verifyButtons();
next.click();
screen.getByText('Review the information and click Create image to create the image using the following criteria.');
});
test('clicking Back loads Register', () => {
const back = screen.getByRole('button', { name: /Back/ });
back.click();
screen.getByText('Register the system');
});
test('clicking Cancel loads landing page', () => {
const [ , , cancel ] = verifyButtons();
verifyCancelButton(cancel, historySpy);
});
test('should display search bar and button', () => {
const search = screen.getByRole('searchbox', { name: 'Available search input' });
search.click();
userEvent.type(search, 'test');
screen.getByRole('button', {
name: 'Search button for available packages'
});
});
});
describe('Step Review', () => {
beforeEach(() => {
const { _component, history } = renderWithReduxRouter(<CreateImageWizard />);
@ -265,11 +309,11 @@ describe('Step Review', () => {
screen.getByRole('button', { name: /Cancel/ });
});
test('clicking Back loads Register', () => {
test('clicking Back loads Packages', () => {
const back = screen.getByRole('button', { name: /Back/ });
back.click();
screen.getByText('Register the system');
screen.getByText('Optionally add additional packages to your image');
});
test('clicking Cancel loads landing page', () => {
@ -304,6 +348,10 @@ describe('Click through all steps', () => {
userEvent.type(screen.getByTestId('subscription-activation'), '1234567890');
next.click();
// packages
screen.getByText('Optionally add additional packages to your image');
next.click();
// review
const imageOutput = screen.getByTestId('review-image-output');
await screen.
@ -346,9 +394,13 @@ describe('Click through all steps', () => {
userEvent.clear(screen.getByTestId('subscription-activation'));
next.click();
const imageOutput = screen.getByTestId('review-image-output');
// packages
screen.getByText('Optionally add additional packages to your image');
next.click();
await screen.
findByText('Review the information and click Create image to create the image using the following criteria.');
const imageOutput = screen.getByTestId('review-image-output');
await within(imageOutput).findByText('Amazon Web Services');
await screen.findByText('Register the system on first boot');
@ -379,9 +431,13 @@ describe('Click through all steps', () => {
userEvent.clear(screen.getByTestId('subscription-activation'));
next.click();
const imageOutput = screen.getByTestId('review-image-output');
// packages
screen.getByText('Optionally add additional packages to your image');
next.click();
await screen.
findByText('Review the information and click Create image to create the image using the following criteria.');
const imageOutput = screen.getByTestId('review-image-output');
await within(imageOutput).findByText('Amazon Web Services');
await screen.findByText('Register the system on first boot');