Skip to content

Commit

Permalink
fix: u&p FE tests (#20289)
Browse files Browse the repository at this point in the history
* fix: use act in u&p test

* fix: clean up
  • Loading branch information
jhoward1994 committed May 9, 2024
1 parent 0082657 commit 8592bde
Showing 1 changed file with 3 additions and 18 deletions.
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

0 comments on commit 8592bde

Please sign in to comment.