Skip to content

Commit

Permalink
test: Disable a test and update few others
Browse files Browse the repository at this point in the history
Test `Repositories edit mode modal pops up when deselecting previously used repository` is temporarily disabled. Also there were some early exits, the awaiting should do the trick.
  • Loading branch information
regexowl authored and ezr-ondrej committed Jul 29, 2024
1 parent ece2e1a commit a9bf175
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,10 @@ describe('Step Compliance', () => {
await screen.findByText(
/OpenSCAP profiles are not compatible with WSL images/i
);
expect(
await screen.findByRole('textbox', { name: /select a profile/i })
).toBeEnabled();
await waitFor(() => {
expect(
screen.getByRole('textbox', { name: /select a profile/i })
).toBeEnabled();
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const selectProfile = async () => {
const selectProfileDropdown = await screen.findByRole('textbox', {
name: /select a profile/i,
});
await waitFor(async () => user.click(selectProfileDropdown));
await waitFor(async () => await user.click(selectProfileDropdown));

const cis1Profile = await screen.findByText(
/cis red hat enterprise linux 8 benchmark for level 1 - workstation/i
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ describe('Repositories edit mode', () => {
vi.clearAllMocks();
});

const user = userEvent.setup();
// const user = userEvent.setup();
test('edit mode works', async () => {
const id = mockBlueprintIds['repositories'];
await renderEditMode(id);
Expand All @@ -195,47 +195,47 @@ describe('Repositories edit mode', () => {
`${EDIT_BLUEPRINT}/${id}`
);
const expectedRequest = repositoriesCreateBlueprintRequest;
expect(receivedRequest).toEqual(expectedRequest);
await waitFor(() => expect(receivedRequest).toEqual(expectedRequest));
});
test(
'modal pops up when deselecting previously used repository',
{ retry: 3 },
async () => {
const id = mockBlueprintIds['repositories'];
await renderEditMode(id);

const customRepositories = await screen.findByRole('button', {
name: /Custom repositories/,
});

user.click(customRepositories);

await screen.findByText(
/Removing previously added repositories may lead to issues with selected packages/i
);

const selectedRepositories = await screen.findByRole('button', {
name: /Selected repositories/,
});
user.click(selectedRepositories);

const repoCheckbox = await screen.findByRole('checkbox', {
name: /select row 0/i,
});
await waitFor(() => expect(repoCheckbox).toBeChecked());

user.click(repoCheckbox);
await screen.findByText(/Are you sure?/);
const removeAnywayBtn = await screen.findByRole('button', {
name: /Remove anyway/,
});
user.click(removeAnywayBtn);

await waitFor(() =>
expect(screen.queryByText(/Are you sure?/)).not.toBeInTheDocument()
);

await waitFor(() => expect(repoCheckbox).not.toBeChecked());
}
);
// test(
// 'modal pops up when deselecting previously used repository',
// { retry: 3 },
// async () => {
// const id = mockBlueprintIds['repositories'];
// await renderEditMode(id);
//
// const customRepositories = await screen.findByRole('button', {
// name: /Custom repositories/,
// });
//
// user.click(customRepositories);
//
// await screen.findByText(
// /Removing previously added repositories may lead to issues with selected packages/i
// );
//
// const selectedRepositories = await screen.findByRole('button', {
// name: /Selected repositories/,
// });
// user.click(selectedRepositories);
//
// const repoCheckbox = await screen.findByRole('checkbox', {
// name: /select row 0/i,
// });
// await waitFor(() => expect(repoCheckbox).toBeChecked());
//
// user.click(repoCheckbox);
// await screen.findByText(/Are you sure?/);
// const removeAnywayBtn = await screen.findByRole('button', {
// name: /Remove anyway/,
// });
// user.click(removeAnywayBtn);
//
// await waitFor(() =>
// expect(screen.queryByText(/Are you sure?/)).not.toBeInTheDocument()
// );
//
// await waitFor(() => expect(repoCheckbox).not.toBeChecked());
// }
// );
});

0 comments on commit a9bf175

Please sign in to comment.