this commit add validation to name field in Users step
This commit is contained in:
parent
5a7ce1efee
commit
30d77faeb5
5 changed files with 78 additions and 5 deletions
|
|
@ -72,6 +72,24 @@ const addValidUser = async () => {
|
|||
await waitFor(() => expect(nextButton).toBeEnabled());
|
||||
};
|
||||
|
||||
const addInvalidUser = async () => {
|
||||
const user = userEvent.setup();
|
||||
const addUser = await screen.findByRole('button', { name: /add a user/i });
|
||||
expect(addUser).toBeEnabled();
|
||||
await waitFor(() => user.click(addUser));
|
||||
const enterUserName = screen.getByRole('textbox', {
|
||||
name: /blueprint user name/i,
|
||||
});
|
||||
const nextButton = await getNextButton();
|
||||
await waitFor(() => user.type(enterUserName, '..'));
|
||||
await waitFor(() => expect(enterUserName).toHaveValue('..'));
|
||||
const enterSshKey = await screen.findByRole('textbox', {
|
||||
name: /public SSH key/i,
|
||||
});
|
||||
await waitFor(() => user.type(enterSshKey, 'ssh-rsa d'));
|
||||
await waitFor(() => expect(nextButton).toBeDisabled());
|
||||
};
|
||||
|
||||
describe('Step Users', () => {
|
||||
beforeEach(async () => {
|
||||
vi.clearAllMocks();
|
||||
|
|
@ -145,6 +163,16 @@ describe('Step Users', () => {
|
|||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
});
|
||||
|
||||
test('with invalid name', async () => {
|
||||
await renderCreateMode();
|
||||
await goToRegistrationStep();
|
||||
await clickRegisterLater();
|
||||
await goToUsersStep();
|
||||
await addInvalidUser();
|
||||
const invalidUserMessage = screen.getByText(/invalid user name/i);
|
||||
await waitFor(() => expect(invalidUserMessage));
|
||||
});
|
||||
});
|
||||
|
||||
describe('Users edit mode', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue