wizard: add users to review step (HMS-4906)

This commit is contained in:
Michal Gold 2025-01-01 14:42:06 +02:00 committed by Klara Simickova
parent 5e4f20edf1
commit 6a5871bf14
3 changed files with 76 additions and 1 deletions

View file

@ -1,5 +1,5 @@
import type { Router as RemixRouter } from '@remix-run/router';
import { screen, waitFor } from '@testing-library/react';
import { screen, waitFor, within } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT } from '../../../../../constants';
@ -45,6 +45,13 @@ const goToReviewStep = async () => {
await clickNext(); // Review
};
const clickRevisitButton = async () => {
const user = userEvent.setup();
const expandable = await screen.findByTestId('users-expandable');
const revisitButton = await within(expandable).findByTestId('revisit-users');
await waitFor(() => user.click(revisitButton));
};
const addValidUser = async () => {
const user = userEvent.setup();
const addUser = await screen.findByRole('button', { name: /add a user/i });
@ -92,6 +99,17 @@ describe('Step Users', () => {
await verifyCancelButton(router);
});
test('revisit step button on Review works', async () => {
await renderCreateMode();
await goToRegistrationStep();
await clickRegisterLater();
await goToUsersStep();
await addValidUser();
await goToReviewStep();
await clickRevisitButton();
await screen.findByRole('heading', { name: /Users/ });
});
describe('User request generated correctly', () => {
test('with valid name and password', async () => {
await renderCreateMode();