CreateImageWizard: Fix review step
The wizard crashed in the review step when registering the system later was selected.
This commit is contained in:
parent
971399aaeb
commit
6adab8bd3b
2 changed files with 29 additions and 16 deletions
|
|
@ -32,6 +32,23 @@ const WizardStepReview = (props) => {
|
|||
</>
|
||||
);
|
||||
|
||||
let subscriptionReview = <TextListItem component={ TextListItemVariants.dd }>Register the system later</TextListItem>;
|
||||
if (props.subscribeNow) {
|
||||
subscriptionReview = (<>
|
||||
<TextListItem component={ TextListItemVariants.dd }>Register the system on first boot</TextListItem>
|
||||
<TextListItem component={ TextListItemVariants.dt }>Activation key</TextListItem>
|
||||
{ props.subscriptionErrors['subscription-activation'] ? (
|
||||
<TextListItem component={ TextListItemVariants.dd }>
|
||||
<ExclamationCircleIcon className="error" /> { props.subscriptionErrors['subscription-activation'].value }
|
||||
</TextListItem>
|
||||
) : (
|
||||
<TextListItem component={ TextListItemVariants.dd } type="password">
|
||||
{'*'.repeat(props.subscription['activation-key'].length)}
|
||||
</TextListItem>
|
||||
)}
|
||||
</>);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{ (Object.keys(props.uploadAWSErrors).length > 0 ||
|
||||
|
|
@ -53,21 +70,7 @@ const WizardStepReview = (props) => {
|
|||
<Text component={ TextVariants.h3 }>Registration</Text>
|
||||
<TextList component={ TextListVariants.dl } data-testid='review-image-registration'>
|
||||
<TextListItem component={ TextListItemVariants.dt }>Subscription</TextListItem>
|
||||
{ props.subscribeNow ? (
|
||||
<TextListItem component={ TextListItemVariants.dd }>Register the system on first boot</TextListItem>
|
||||
) : (
|
||||
<TextListItem component={ TextListItemVariants.dd }>Register the system later</TextListItem>
|
||||
)}
|
||||
<TextListItem component={ TextListItemVariants.dt }>Activation key</TextListItem>
|
||||
{ props.subscriptionErrors['subscription-activation'] ? (
|
||||
<TextListItem component={ TextListItemVariants.dd }>
|
||||
<ExclamationCircleIcon className="error" /> { props.subscriptionErrors['subscription-activation'].value }
|
||||
</TextListItem>
|
||||
) : (
|
||||
<TextListItem component={ TextListItemVariants.dd } type="password">
|
||||
{'*'.repeat(props.subscription['activation-key'].length)}
|
||||
</TextListItem>
|
||||
)}
|
||||
{ subscriptionReview }
|
||||
</TextList>
|
||||
</TextContent>
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ describe('Step Registration', () => {
|
|||
verifyCancelButton(cancel, historySpy);
|
||||
});
|
||||
|
||||
test('should allow choosing activation keys', () => {
|
||||
test('should allow choosing activation keys', async () => {
|
||||
screen
|
||||
.getByLabelText('Embed an activation key and register systems on first boot')
|
||||
.click();
|
||||
|
|
@ -220,6 +220,11 @@ describe('Step Registration', () => {
|
|||
expect(activationKey).toHaveValue('');
|
||||
expect(activationKey).toBeEnabled();
|
||||
expect(activationKey).toBeRequired();
|
||||
|
||||
const sidebar = screen.getByRole('navigation');
|
||||
const anchor = getByText(sidebar, 'Review');
|
||||
anchor.click();
|
||||
await screen.findByText('Register the system on first boot');
|
||||
});
|
||||
|
||||
test('should hide input fields when clicking Register the system later', async () => {
|
||||
|
|
@ -239,6 +244,11 @@ describe('Step Registration', () => {
|
|||
.click();
|
||||
|
||||
await p1;
|
||||
|
||||
const sidebar = screen.getByRole('navigation');
|
||||
const anchor = getByText(sidebar, 'Review');
|
||||
anchor.click();
|
||||
await screen.findByText('Register the system later');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue