Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: u&p FE tests #20289

Merged
merged 2 commits into from
May 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,15 @@ describe('Roles – EditPage', () => {
expect(getByRole('textbox', { name: 'Description' })).toHaveAttribute('aria-invalid', 'true');
});

it("can update a role's name and description", async () => {
it("can update a role's name, description and permissions", async () => {
const { getByRole, user, getByText, findByRole, findByText } = render();

await waitForElementToBeRemoved(() => getByText('Loading content.'));

await user.type(getByRole('textbox', { name: 'Name' }), 'test');
await user.type(getByRole('textbox', { name: 'Description' }), 'testing');
await user.click(getByRole('button', { name: 'Address' }));
await user.click(getByRole('checkbox', { name: 'create' }));

const button = await findByRole('button', { name: 'Save' });
/**
Expand All @@ -111,23 +113,6 @@ describe('Roles – EditPage', () => {
fireEvent.click(button);
await findByText('Role edited');
await findByText('Authenticated');
});

it("can update a role's permissions", async () => {
const { getByRole, user, getByText } = render();

await waitForElementToBeRemoved(() => getByText('Loading content.'));

await user.click(getByRole('button', { name: 'Address' }));

await user.click(getByRole('checkbox', { name: 'create' }));

/**
* @note user.click will not trigger the form.
*/
fireEvent.click(getByRole('button', { name: 'Save' }));

await waitFor(() => expect(getByText('Role edited')).toBeInTheDocument());

/**
* @note the permissions are refetched, because we're mocking calls no real update will be made.
Expand Down
Loading