test: Add Review and finish button tests
This add tests to check whether the Review and finish button works properly, sending user to the Details step. And whether it's disabled when the state is invalid.
This commit is contained in:
parent
558bb50c34
commit
3ae642b848
8 changed files with 137 additions and 5 deletions
|
|
@ -10,7 +10,11 @@ import {
|
|||
} from '../../../../../constants';
|
||||
import { mockBlueprintIds } from '../../../../fixtures/blueprints';
|
||||
import { fscCreateBlueprintRequest } from '../../../../fixtures/editMode';
|
||||
import { clickNext, getNextButton } from '../../wizardTestUtils';
|
||||
import {
|
||||
clickNext,
|
||||
clickReviewAndFinish,
|
||||
getNextButton,
|
||||
} from '../../wizardTestUtils';
|
||||
import {
|
||||
blueprintRequest,
|
||||
clickRegisterLater,
|
||||
|
|
@ -130,6 +134,33 @@ describe('Step File system configuration', () => {
|
|||
});
|
||||
|
||||
const user = userEvent.setup();
|
||||
|
||||
test('clicking Review and finish leads to Details', async () => {
|
||||
await renderCreateMode();
|
||||
await selectGuestImage();
|
||||
await goToFileSystemConfigurationStep();
|
||||
await clickReviewAndFinish();
|
||||
await screen.findByRole('heading', {
|
||||
name: 'Details',
|
||||
});
|
||||
});
|
||||
|
||||
test('button Review and finish is disabled for invalid state', async () => {
|
||||
await renderCreateMode();
|
||||
await selectGuestImage();
|
||||
await goToFileSystemConfigurationStep();
|
||||
await clickManuallyConfigurePartitions();
|
||||
|
||||
// Create duplicate partitions
|
||||
await addPartition();
|
||||
await addPartition();
|
||||
|
||||
await clickReviewAndFinish();
|
||||
expect(
|
||||
await screen.findByRole('button', { name: /Review and finish/ })
|
||||
).toBeDisabled();
|
||||
});
|
||||
|
||||
test('error validation occurs upon clicking next button', async () => {
|
||||
await renderCreateMode();
|
||||
await selectGuestImage();
|
||||
|
|
|
|||
|
|
@ -13,7 +13,11 @@ import {
|
|||
firstBootCreateBlueprintRequest,
|
||||
firstBootData,
|
||||
} from '../../../../fixtures/editMode';
|
||||
import { clickNext, getNextButton } from '../../wizardTestUtils';
|
||||
import {
|
||||
clickNext,
|
||||
clickReviewAndFinish,
|
||||
getNextButton,
|
||||
} from '../../wizardTestUtils';
|
||||
import {
|
||||
blueprintRequest,
|
||||
clickRegisterLater,
|
||||
|
|
@ -87,6 +91,15 @@ describe('First Boot step', () => {
|
|||
await screen.findByText('First boot configuration');
|
||||
});
|
||||
|
||||
test('clicking Review and finish leads to Details', async () => {
|
||||
await renderCreateMode();
|
||||
await goToFirstBootStep();
|
||||
await clickReviewAndFinish();
|
||||
await screen.findByRole('heading', {
|
||||
name: 'Details',
|
||||
});
|
||||
});
|
||||
|
||||
// test('should validate shebang', async () => {
|
||||
// await renderCreateMode();
|
||||
// await goToFirstBootStep();
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import {
|
|||
expectedServicesCisL2,
|
||||
oscapCreateBlueprintRequest,
|
||||
} from '../../../../fixtures/editMode';
|
||||
import { clickNext } from '../../wizardTestUtils';
|
||||
import { clickNext, clickReviewAndFinish } from '../../wizardTestUtils';
|
||||
import {
|
||||
clickRegisterLater,
|
||||
enterBlueprintName,
|
||||
|
|
@ -91,6 +91,21 @@ const clickRevisitButton = async () => {
|
|||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
describe('Step Compliance', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
test('clicking Review and finish leads to Details', async () => {
|
||||
await renderCreateMode();
|
||||
await goToOscapStep();
|
||||
await clickReviewAndFinish();
|
||||
await screen.findByRole('heading', {
|
||||
name: 'Details',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('OpenSCAP', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import {
|
|||
import {
|
||||
clickBack,
|
||||
clickNext,
|
||||
clickReviewAndFinish,
|
||||
verifyCancelButton,
|
||||
} from '../../wizardTestUtils';
|
||||
import { selectCustomRepo } from '../../wizardTestUtils';
|
||||
|
|
@ -196,6 +197,15 @@ describe('Step Packages', () => {
|
|||
await verifyCancelButton(router);
|
||||
});
|
||||
|
||||
test('clicking Review and finish leads to Details', async () => {
|
||||
await renderCreateMode();
|
||||
await goToPackagesStep();
|
||||
await clickReviewAndFinish();
|
||||
await screen.findByRole('heading', {
|
||||
name: 'Details',
|
||||
});
|
||||
});
|
||||
|
||||
test('should display search bar and toggle buttons', async () => {
|
||||
await renderCreateMode();
|
||||
await goToPackagesStep();
|
||||
|
|
|
|||
|
|
@ -1,11 +1,13 @@
|
|||
import type { Router as RemixRouter } from '@remix-run/router';
|
||||
import { screen, waitFor, within } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
import { http, HttpResponse } from 'msw';
|
||||
|
||||
import {
|
||||
CREATE_BLUEPRINT,
|
||||
EDIT_BLUEPRINT,
|
||||
RHEL_9,
|
||||
RHSM_API,
|
||||
} from '../../../../../constants';
|
||||
import {
|
||||
CreateBlueprintRequest,
|
||||
|
|
@ -13,6 +15,7 @@ import {
|
|||
} from '../../../../../store/imageBuilderApi';
|
||||
import { mockBlueprintIds } from '../../../../fixtures/blueprints';
|
||||
import { registrationCreateBlueprintRequest } from '../../../../fixtures/editMode';
|
||||
import { server } from '../../../../mocks/server';
|
||||
import {
|
||||
enterBlueprintName,
|
||||
renderCreateMode,
|
||||
|
|
@ -25,6 +28,7 @@ import {
|
|||
clickNext,
|
||||
clickBack,
|
||||
verifyCancelButton,
|
||||
clickReviewAndFinish,
|
||||
} from '../../wizardTestUtils';
|
||||
|
||||
const localStorageMock = (() => {
|
||||
|
|
@ -135,6 +139,29 @@ describe('Step Registration', () => {
|
|||
await verifyCancelButton(router);
|
||||
});
|
||||
|
||||
test('clicking Review and finish leads to Details', async () => {
|
||||
await renderCreateMode();
|
||||
await goToRegistrationStep();
|
||||
await clickReviewAndFinish();
|
||||
await screen.findByRole('heading', {
|
||||
name: 'Details',
|
||||
});
|
||||
});
|
||||
|
||||
test('button Review and finish is disabled for invalid state', async () => {
|
||||
server.use(
|
||||
http.get(`${RHSM_API}/activation_keys`, () => {
|
||||
return new HttpResponse(null, { status: 404 });
|
||||
})
|
||||
);
|
||||
|
||||
await renderCreateMode();
|
||||
await goToRegistrationStep();
|
||||
expect(
|
||||
await screen.findByRole('button', { name: /Review and finish/ })
|
||||
).toBeDisabled();
|
||||
});
|
||||
|
||||
test('default registration includes rhsm, rhc and insights', async () => {
|
||||
await renderCreateMode();
|
||||
await goToRegistrationStep();
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import {
|
|||
expectedPayloadRepositories,
|
||||
repositoriesCreateBlueprintRequest,
|
||||
} from '../../../../fixtures/editMode';
|
||||
import { clickNext } from '../../wizardTestUtils';
|
||||
import { clickNext, clickReviewAndFinish } from '../../wizardTestUtils';
|
||||
import {
|
||||
blueprintRequest,
|
||||
clickRegisterLater,
|
||||
|
|
@ -85,6 +85,15 @@ describe('Step Custom repositories', () => {
|
|||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
test('clicking Review and finish leads to Details', async () => {
|
||||
await renderCreateMode();
|
||||
await goToRepositoriesStep();
|
||||
await clickReviewAndFinish();
|
||||
await screen.findByRole('heading', {
|
||||
name: 'Details',
|
||||
});
|
||||
});
|
||||
|
||||
test('revisit step button on Review works', async () => {
|
||||
await renderCreateMode();
|
||||
await goToRepositoriesStep();
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import {
|
|||
expectedPayloadRepositories,
|
||||
snapshotCreateBlueprintRequest,
|
||||
} from '../../../../fixtures/editMode';
|
||||
import { clickNext } from '../../wizardTestUtils';
|
||||
import { clickNext, clickReviewAndFinish } from '../../wizardTestUtils';
|
||||
import {
|
||||
blueprintRequest,
|
||||
clickRegisterLater,
|
||||
|
|
@ -104,6 +104,25 @@ describe('repository snapshot tab - ', () => {
|
|||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
test('clicking Review and finish leads to Details', async () => {
|
||||
await renderCreateMode();
|
||||
await goToSnapshotStep();
|
||||
await clickReviewAndFinish();
|
||||
await screen.findByRole('heading', {
|
||||
name: 'Details',
|
||||
});
|
||||
});
|
||||
|
||||
test('button Review and finish is disabled for invalid state', async () => {
|
||||
await renderCreateMode();
|
||||
await goToSnapshotStep();
|
||||
await selectUseSnapshot();
|
||||
await updateDatePickerWithValue('00/00/2024');
|
||||
expect(
|
||||
await screen.findByRole('button', { name: /Review and finish/ })
|
||||
).toBeDisabled();
|
||||
});
|
||||
|
||||
test('select use a snapshot with 1 repo selected', async () => {
|
||||
await renderCreateMode();
|
||||
await goToSnapshotStep();
|
||||
|
|
|
|||
|
|
@ -185,6 +185,14 @@ export const clickCancel = async () => {
|
|||
await waitFor(() => user.click(cancelBtn));
|
||||
};
|
||||
|
||||
export const clickReviewAndFinish = async () => {
|
||||
const user = userEvent.setup();
|
||||
const reviewAndFinishBtn = await screen.findByRole('button', {
|
||||
name: /Review and finish/,
|
||||
});
|
||||
await waitFor(() => user.click(reviewAndFinishBtn));
|
||||
};
|
||||
|
||||
export const getNextButton = async () => {
|
||||
const next = await screen.findByRole('button', { name: /Next/ });
|
||||
return next;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue