Wizard: validate uniqueness of Blueprint name
This commit is contained in:
parent
ff0b2509cc
commit
facb71ceae
9 changed files with 80 additions and 28 deletions
|
|
@ -914,16 +914,17 @@ describe('Step Details', () => {
|
|||
await setUp();
|
||||
|
||||
// Enter image name
|
||||
|
||||
const invalidName = 'a'.repeat(101);
|
||||
await enterBlueprintName(invalidName);
|
||||
expect(await getNextButton()).toHaveClass('pf-m-disabled');
|
||||
expect(await getNextButton()).toBeDisabled();
|
||||
const nameInput = await screen.findByRole('textbox', {
|
||||
name: /blueprint name/i,
|
||||
});
|
||||
const invalidName = 'a'.repeat(101);
|
||||
await user.type(nameInput, invalidName);
|
||||
expect(await getNextButton()).toHaveClass('pf-m-disabled');
|
||||
expect(await getNextButton()).toBeDisabled();
|
||||
await user.clear(nameInput);
|
||||
|
||||
await user.type(nameInput, 'valid-name');
|
||||
await enterBlueprintName();
|
||||
expect(await getNextButton()).not.toHaveClass('pf-m-disabled');
|
||||
expect(await getNextButton()).toBeEnabled();
|
||||
|
||||
|
|
@ -992,10 +993,7 @@ describe('Step Review', () => {
|
|||
// skip firstboot
|
||||
await clickNext();
|
||||
// skip Details
|
||||
const blueprintName = await screen.findByRole('textbox', {
|
||||
name: /blueprint name/i,
|
||||
});
|
||||
await user.type(blueprintName, 'valid-name');
|
||||
await enterBlueprintName();
|
||||
await clickNext();
|
||||
};
|
||||
|
||||
|
|
@ -1056,10 +1054,7 @@ describe('Step Review', () => {
|
|||
await clickNext();
|
||||
// skip First boot
|
||||
await clickNext();
|
||||
const blueprintName = await screen.findByRole('textbox', {
|
||||
name: /blueprint name/i,
|
||||
});
|
||||
await user.type(blueprintName, 'valid-name');
|
||||
await enterBlueprintName();
|
||||
await clickNext();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -82,6 +82,17 @@ describe('validates name', () => {
|
|||
const nextButton = await getNextButton();
|
||||
expect(nextButton).toBeEnabled();
|
||||
});
|
||||
|
||||
test('with non-unique name', async () => {
|
||||
await renderCreateMode();
|
||||
await goToRegistrationStep();
|
||||
await clickRegisterLater();
|
||||
await goToDetailsStep();
|
||||
await enterBlueprintName('Lemon Pie');
|
||||
|
||||
const nextButton = await getNextButton();
|
||||
expect(nextButton).toBeDisabled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('registration request generated correctly', () => {
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ const goToReviewStep = async () => {
|
|||
await clickNext(); // Additional packages
|
||||
await clickNext(); // FirstBoot
|
||||
await clickNext(); // Details
|
||||
await enterBlueprintName('oscap');
|
||||
await enterBlueprintName('Oscap test');
|
||||
await clickNext(); // Review
|
||||
};
|
||||
|
||||
|
|
@ -130,7 +130,10 @@ describe('oscap', () => {
|
|||
|
||||
const receivedRequest = await interceptBlueprintRequest(CREATE_BLUEPRINT);
|
||||
|
||||
const expectedRequest = oscapCreateBlueprintRequest;
|
||||
const expectedRequest: CreateBlueprintRequest = {
|
||||
...oscapCreateBlueprintRequest,
|
||||
name: 'Oscap test',
|
||||
};
|
||||
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
|
|
@ -146,7 +149,7 @@ describe('oscap', () => {
|
|||
|
||||
const expectedRequest: CreateBlueprintRequest = {
|
||||
...baseCreateBlueprintRequest,
|
||||
name: 'oscap',
|
||||
name: 'Oscap test',
|
||||
};
|
||||
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
|
|
@ -170,7 +173,7 @@ describe('oscap', () => {
|
|||
kernel: expectedKernelCisL2,
|
||||
filesystem: expectedFilesystemCisL2,
|
||||
},
|
||||
name: 'oscap',
|
||||
name: 'Oscap test',
|
||||
};
|
||||
|
||||
await waitFor(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue