test: Update tests

This commit is contained in:
regexowl 2025-05-19 14:01:20 +02:00 committed by Lucas Garfield
parent 2080425753
commit d98dd02fa3
6 changed files with 14 additions and 20 deletions

View file

@ -305,14 +305,14 @@ describe('Import modal', () => {
const reviewButton = await screen.findByRole('button', {
name: /review and finish/i,
});
await waitFor(() => expect(reviewButton).toHaveClass('pf-m-disabled'));
await waitFor(() => expect(reviewButton).toBeDisabled());
};
test('should show alert on invalid blueprint', async () => {
await setUp();
await uploadFile(`blueprints.json`, INVALID_JSON);
const reviewButton = screen.getByTestId('import-blueprint-finish');
expect(reviewButton).toHaveClass('pf-m-disabled');
expect(reviewButton).toBeDisabled();
const helperText = await screen.findByText(
/not compatible with the blueprints format\./i
);
@ -323,7 +323,7 @@ describe('Import modal', () => {
await setUp();
await uploadFile(`blueprints.json`, INVALID_ARCHITECTURE_JSON);
const reviewButton = screen.getByTestId('import-blueprint-finish');
expect(reviewButton).toHaveClass('pf-m-disabled');
expect(reviewButton).toBeDisabled();
const helperText = await screen.findByText(
/not compatible with the blueprints format\./i
);
@ -334,7 +334,7 @@ describe('Import modal', () => {
await setUp();
await uploadFile(`blueprints.json`, IGNORE_SUBSCRIPTION_BLUEPRINT);
const reviewButton = screen.getByTestId('import-blueprint-finish');
await waitFor(() => expect(reviewButton).not.toHaveClass('pf-m-disabled'));
await waitFor(() => expect(reviewButton).toBeEnabled());
user.click(reviewButton);
await waitFor(async () =>
@ -348,7 +348,7 @@ describe('Import modal', () => {
await setUp();
await uploadFile(`blueprints.json`, BLUEPRINT_JSON);
const reviewButton = screen.getByTestId('import-blueprint-finish');
await waitFor(() => expect(reviewButton).not.toHaveClass('pf-m-disabled'));
await waitFor(() => expect(reviewButton).toBeEnabled());
user.click(reviewButton);
await waitFor(async () =>
@ -369,7 +369,7 @@ describe('Import modal', () => {
await setUp();
await uploadFile(`blueprints.toml`, ONPREM_BLUEPRINT_TOML);
const reviewButton = screen.getByTestId('import-blueprint-finish');
await waitFor(() => expect(reviewButton).not.toHaveClass('pf-m-disabled'));
await waitFor(() => expect(reviewButton).toBeEnabled());
user.click(reviewButton);
await waitFor(async () =>
@ -514,7 +514,7 @@ describe('Import modal', () => {
ONPREM_BLUEPRINT_TOML_WITH_INVALID_VALUES
);
const reviewButton = screen.getByTestId('import-blueprint-finish');
await waitFor(() => expect(reviewButton).not.toHaveClass('pf-m-disabled'));
await waitFor(() => expect(reviewButton).toBeEnabled());
user.click(reviewButton);
// Image output

View file

@ -105,12 +105,10 @@ describe('Step Details', () => {
// enter invalid image name
const invalidName = 'a'.repeat(101);
await enterBlueprintName(invalidName);
expect(await getNextButton()).toHaveClass('pf-m-disabled');
expect(await getNextButton()).toBeDisabled();
// enter valid image name
await enterBlueprintName();
expect(await getNextButton()).not.toHaveClass('pf-m-disabled');
expect(await getNextButton()).toBeEnabled();
});
@ -123,12 +121,10 @@ describe('Step Details', () => {
// enter invalid image description
const invalidDescription = 'a'.repeat(251);
await enterBlueprintDescription(invalidDescription);
expect(await getNextButton()).toHaveClass('pf-m-disabled');
expect(await getNextButton()).toBeDisabled();
// enter valid image description
await enterBlueprintDescription();
expect(await getNextButton()).not.toHaveClass('pf-m-disabled');
expect(await getNextButton()).toBeEnabled();
});

View file

@ -239,7 +239,7 @@ describe('repository snapshot tab - ', () => {
name: /select all/i,
});
// eslint-disable-next-line testing-library/no-node-access
expect(bulkSelectCheckbox.closest('div')).toHaveClass('pf-m-disabled');
expect(bulkSelectCheckbox.closest('div')).toBeDisabled();
});
test('button Reset works to empty the snapshot date', async () => {

View file

@ -184,20 +184,20 @@ describe('Step Upload to AWS', () => {
await goToAwsStep();
const nextButton = await getNextButton();
expect(nextButton).toHaveClass('pf-m-disabled');
expect(nextButton).toBeDisabled();
await chooseManualOption();
expect(nextButton).toHaveClass('pf-m-disabled');
expect(nextButton).toBeDisabled();
await enterAccountId();
expect(nextButton).not.toHaveClass('pf-m-disabled');
expect(nextButton).toBeEnabled();
await chooseSourcesOption();
await waitFor(() => expect(nextButton).toHaveClass('pf-m-disabled'));
await waitFor(() => expect(nextButton).toBeDisabled());
await getSourceDropdown();
await selectSource();
await waitFor(() => expect(nextButton).not.toHaveClass('pf-m-disabled'));
await waitFor(() => expect(nextButton).toBeEnabled());
});
test('compose request share_with_sources field is correct', async () => {

View file

@ -150,13 +150,11 @@ describe('Step Upload to Google', () => {
await waitFor(async () =>
user.type(await screen.findByTestId('principal'), 'a')
);
expect(await getNextButton()).toHaveClass('pf-m-disabled');
expect(await getNextButton()).toBeDisabled();
await waitFor(async () =>
user.type(await screen.findByTestId('principal'), 'test@test.com')
);
expect(await getNextButton()).not.toHaveClass('pf-m-disabled');
expect(await getNextButton()).toBeEnabled();
});

View file

@ -43,7 +43,7 @@ describe('Create Share To Regions Modal', () => {
const usEast2 = await screen.findByRole('option', {
name: /us east \(ohio\) us-east-2/i,
});
expect(usEast2).not.toHaveClass('pf-m-disabled');
expect(usEast2).toBeEnabled();
user.click(usEast2);
await waitFor(() => expect(shareButton).toBeEnabled());