test: Add revisit step button checks
This adds tests to check that the revisit buttons on the Review step are working correctly. Also some minor cleanup, namely making case used in the names of describe and test more consistent and moving render functions outside of functions selecting targets to make the structure easier to go through.
This commit is contained in:
parent
4a15b25ceb
commit
558bb50c34
14 changed files with 324 additions and 36 deletions
|
|
@ -46,7 +46,7 @@ describe('Create Image Wizard', () => {
|
|||
await screen.findByRole('button', { name: 'Image output' });
|
||||
await screen.findByRole('button', { name: 'Register' });
|
||||
await screen.findByRole('button', { name: 'File system configuration' });
|
||||
await screen.findByRole('button', { name: 'Content' });
|
||||
await screen.findByRole('button', { name: 'Repository snapshot' });
|
||||
await screen.findByRole('button', { name: 'Custom repositories' });
|
||||
await screen.findByRole('button', { name: 'Additional packages' });
|
||||
await screen.findByRole('button', { name: 'Details' });
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { screen, waitFor, within } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
|
||||
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT } from '../../../../../constants';
|
||||
|
|
@ -41,6 +41,15 @@ const goToReviewStep = async () => {
|
|||
await clickNext();
|
||||
};
|
||||
|
||||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
const expandable = await screen.findByTestId('image-details-expandable');
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-details'
|
||||
);
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
describe('validates name', () => {
|
||||
beforeEach(async () => {
|
||||
vi.clearAllMocks();
|
||||
|
|
@ -76,6 +85,16 @@ describe('validates name', () => {
|
|||
const nextButton = await getNextButton();
|
||||
await waitFor(() => expect(nextButton).toBeDisabled());
|
||||
});
|
||||
|
||||
test('revisit step button on Review works', async () => {
|
||||
await renderCreateMode();
|
||||
await goToRegistrationStep();
|
||||
await clickRegisterLater();
|
||||
await goToDetailsStep();
|
||||
await goToReviewStep();
|
||||
await clickRevisitButton();
|
||||
await screen.findByRole('heading', { name: /Details/ });
|
||||
});
|
||||
});
|
||||
|
||||
describe('registration request generated correctly', () => {
|
||||
|
|
|
|||
|
|
@ -113,15 +113,15 @@ const goToReviewStep = async () => {
|
|||
await clickNext();
|
||||
};
|
||||
|
||||
const clickFromImageOutputToFsc = async () => {
|
||||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
await clickNext();
|
||||
const registerLaterCheckbox = await screen.findByTestId(
|
||||
'automatically-register-checkbox'
|
||||
const expandable = await screen.findByTestId(
|
||||
'file-system-configuration-expandable'
|
||||
);
|
||||
await waitFor(async () => user.click(registerLaterCheckbox));
|
||||
await clickNext();
|
||||
await clickNext(); // skip OSCAP
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-file-system'
|
||||
);
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
describe('Step File system configuration', () => {
|
||||
|
|
@ -130,7 +130,7 @@ describe('Step File system configuration', () => {
|
|||
});
|
||||
|
||||
const user = userEvent.setup();
|
||||
test('Error validation occurs upon clicking next button', async () => {
|
||||
test('error validation occurs upon clicking next button', async () => {
|
||||
await renderCreateMode();
|
||||
await selectGuestImage();
|
||||
await goToFileSystemConfigurationStep();
|
||||
|
|
@ -166,24 +166,33 @@ describe('Step File system configuration', () => {
|
|||
expect(await getNextButton()).toBeEnabled();
|
||||
});
|
||||
|
||||
test('Manual partitioning is hidden for ISO targets only', async () => {
|
||||
test('manual partitioning is hidden for ISO targets only', async () => {
|
||||
await renderCreateMode();
|
||||
await selectImageInstaller();
|
||||
await clickFromImageOutputToFsc();
|
||||
await goToFileSystemConfigurationStep();
|
||||
expect(
|
||||
screen.queryByText(/manually configure partitions/i)
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('Manual partitioning is shown for ISO target and other target', async () => {
|
||||
test('manual partitioning is shown for ISO target and other target', async () => {
|
||||
await renderCreateMode();
|
||||
await selectImageInstaller();
|
||||
await selectGuestImage();
|
||||
await clickFromImageOutputToFsc();
|
||||
await goToFileSystemConfigurationStep();
|
||||
await clickManuallyConfigurePartitions();
|
||||
|
||||
await screen.findByText('Configure partitions');
|
||||
});
|
||||
|
||||
test('revisit step button on Review works', async () => {
|
||||
await renderCreateMode();
|
||||
await selectGuestImage();
|
||||
await goToFileSystemConfigurationStep();
|
||||
await goToReviewStep();
|
||||
await clickRevisitButton();
|
||||
await screen.findByRole('heading', { name: /File system configuration/ });
|
||||
});
|
||||
});
|
||||
|
||||
describe('File system configuration request generated correctly', () => {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { screen, waitFor, within } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
|
||||
import {
|
||||
|
|
@ -67,6 +67,15 @@ const goToReviewStep = async (): Promise<void> => {
|
|||
await clickNext(); // Review
|
||||
};
|
||||
|
||||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
const expandable = await screen.findByTestId('firstboot-expandable');
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-first-boot'
|
||||
);
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
describe('First Boot step', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
|
|
@ -118,6 +127,14 @@ describe('First Boot step', () => {
|
|||
// });
|
||||
// });
|
||||
// });
|
||||
|
||||
test('revisit step button on Review works', async () => {
|
||||
await renderCreateMode();
|
||||
await goToFirstBootStep();
|
||||
await goToReviewStep();
|
||||
await clickRevisitButton();
|
||||
await screen.findByRole('heading', { name: /First boot/ });
|
||||
});
|
||||
});
|
||||
|
||||
describe('First Boot edit mode', () => {
|
||||
|
|
|
|||
|
|
@ -135,6 +135,15 @@ const goToReviewStep = async () => {
|
|||
await clickNext(); // Review
|
||||
};
|
||||
|
||||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
const expandable = await screen.findByTestId('image-output-expandable');
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-image-output'
|
||||
);
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
describe('Step Image output', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
|
|
@ -245,6 +254,14 @@ describe('Step Image output', () => {
|
|||
'CentOS Stream builds are intended for the development of future versions of RHEL and are not supported for production workloads or other use cases.'
|
||||
);
|
||||
});
|
||||
|
||||
test('revisit step button on Review works', async () => {
|
||||
await renderCreateMode();
|
||||
await selectGuestImageTarget();
|
||||
await goToReviewStep();
|
||||
await clickRevisitButton();
|
||||
await screen.findByRole('heading', { name: /Image output/ });
|
||||
});
|
||||
});
|
||||
|
||||
describe('Check that the target filtering is in accordance to mock content', () => {
|
||||
|
|
@ -448,7 +465,7 @@ describe('Set release using query parameter', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('set architecture using query parameter', () => {
|
||||
describe('Set architecture using query parameter', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { screen, waitFor, within } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
|
||||
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT } from '../../../../../constants';
|
||||
|
|
@ -82,7 +82,16 @@ const goToReviewStep = async () => {
|
|||
await clickNext(); // Review
|
||||
};
|
||||
|
||||
describe('oscap', () => {
|
||||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
const expandable = await screen.findByTestId('oscap-detail-expandable');
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-openscap'
|
||||
);
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
describe('OpenSCAP', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
|
@ -150,6 +159,15 @@ describe('oscap', () => {
|
|||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
});
|
||||
|
||||
test('revisit step button on Review works', async () => {
|
||||
await renderCreateMode();
|
||||
await goToOscapStep();
|
||||
await selectProfile();
|
||||
await goToReviewStep();
|
||||
await clickRevisitButton();
|
||||
await screen.findByRole('heading', { name: /OpenSCAP/ });
|
||||
});
|
||||
});
|
||||
|
||||
describe('OpenSCAP edit mode', () => {
|
||||
|
|
|
|||
|
|
@ -151,6 +151,20 @@ const deselectRecommendation = async () => {
|
|||
await waitFor(async () => user.click(row1Checkbox));
|
||||
};
|
||||
|
||||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
const expandable = await screen.findByTestId('content-expandable');
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-custom-repositories'
|
||||
);
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
await waitFor(() =>
|
||||
expect(
|
||||
screen.queryByRole('button', { name: /Create blueprint/ })
|
||||
).not.toBeInTheDocument()
|
||||
);
|
||||
};
|
||||
|
||||
describe('Step Packages', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
|
|
@ -326,6 +340,16 @@ describe('Step Packages', () => {
|
|||
await within(pkgTable).findByText('recommendedPackage1');
|
||||
});
|
||||
|
||||
test('revisit step button on Review works', async () => {
|
||||
await renderCreateMode();
|
||||
await goToPackagesStep();
|
||||
await typeIntoSearchBox('test');
|
||||
await clickFirstPackageCheckbox();
|
||||
await goToReviewStep();
|
||||
await clickRevisitButton();
|
||||
await screen.findByRole('heading', { name: /Custom repositories/ });
|
||||
});
|
||||
|
||||
describe('Pagination', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { Router as RemixRouter } from '@remix-run/router';
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { screen, waitFor, within } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
|
||||
import {
|
||||
|
|
@ -96,6 +96,15 @@ const goToReviewStep = async () => {
|
|||
await clickNext();
|
||||
};
|
||||
|
||||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
const expandable = await screen.findByTestId('registration-expandable');
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-registration'
|
||||
);
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
describe('Step Registration', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
|
|
@ -161,6 +170,18 @@ describe('Step Registration', () => {
|
|||
await goToReviewStep();
|
||||
await screen.findByText('Register the system later');
|
||||
});
|
||||
|
||||
test('revisit step button on Review works', async () => {
|
||||
await renderCreateMode();
|
||||
await goToRegistrationStep();
|
||||
await openActivationKeyDropdown();
|
||||
await selectActivationKey('name0');
|
||||
await goToReviewStep();
|
||||
await clickRevisitButton();
|
||||
await screen.findByRole('heading', {
|
||||
name: /Register systems using this image/,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Registration request generated correctly', () => {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { screen, waitFor, within } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
|
||||
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT } from '../../../../../constants';
|
||||
|
|
@ -47,6 +47,15 @@ const goToReviewStep = async () => {
|
|||
await clickNext(); // Review
|
||||
};
|
||||
|
||||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
const expandable = await screen.findByTestId('content-expandable');
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-custom-repositories'
|
||||
);
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
const selectFirstRepository = async () => {
|
||||
const user = userEvent.setup();
|
||||
const row0Checkbox = await screen.findByRole('checkbox', {
|
||||
|
|
@ -71,6 +80,21 @@ const clickBulkSelect = async () => {
|
|||
await waitFor(async () => user.click(bulkSelectCheckbox));
|
||||
};
|
||||
|
||||
describe('Step Custom repositories', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
test('revisit step button on Review works', async () => {
|
||||
await renderCreateMode();
|
||||
await goToRepositoriesStep();
|
||||
await selectFirstRepository();
|
||||
await goToReviewStep();
|
||||
await clickRevisitButton();
|
||||
await screen.findByRole('heading', { name: /Custom repositories/ });
|
||||
});
|
||||
});
|
||||
|
||||
describe('repositories request generated correctly', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { screen, waitFor, within } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
|
||||
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT } from '../../../../../constants';
|
||||
|
|
@ -42,6 +42,15 @@ const goToReviewStep = async () => {
|
|||
await clickNext();
|
||||
};
|
||||
|
||||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
const expandable = await screen.findByTestId('content-expandable');
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-custom-repositories'
|
||||
);
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
const searchForRepository = async (repo: string) => {
|
||||
const user = userEvent.setup();
|
||||
const search = await screen.findByLabelText('Search repositories');
|
||||
|
|
@ -200,6 +209,17 @@ describe('repository snapshot tab - ', () => {
|
|||
|
||||
expect(receivedRequest).toEqual(expectedRequest);
|
||||
});
|
||||
|
||||
test('revisit step button on Review works', async () => {
|
||||
await renderCreateMode();
|
||||
await goToSnapshotStep();
|
||||
await selectUseSnapshot();
|
||||
await updateDatePickerWithValue('04/22/2024');
|
||||
await clickNext();
|
||||
await goToReviewStep();
|
||||
await clickRevisitButton();
|
||||
await screen.findByRole('heading', { name: /Custom repositories/ });
|
||||
});
|
||||
});
|
||||
|
||||
describe('Snapshot edit mode', () => {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { Router as RemixRouter } from '@remix-run/router';
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { screen, waitFor, within } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
import { http, HttpResponse } from 'msw';
|
||||
|
||||
|
|
@ -50,9 +50,19 @@ const goToReview = async () => {
|
|||
await clickNext(); // Review
|
||||
};
|
||||
|
||||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
const expandable = await screen.findByTestId(
|
||||
'target-environments-expandable'
|
||||
);
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-target-environments'
|
||||
);
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
const selectAwsTarget = async () => {
|
||||
const user = userEvent.setup();
|
||||
await renderCreateMode();
|
||||
const awsCard = await screen.findByTestId('upload-aws');
|
||||
await waitFor(() => user.click(awsCard));
|
||||
await clickNext();
|
||||
|
|
@ -125,6 +135,7 @@ describe('Step Upload to AWS', () => {
|
|||
const user = userEvent.setup();
|
||||
|
||||
test('clicking Next loads Registration', async () => {
|
||||
await renderCreateMode();
|
||||
await selectAwsTarget();
|
||||
await goToAwsStep();
|
||||
await chooseManualOption();
|
||||
|
|
@ -135,7 +146,8 @@ describe('Step Upload to AWS', () => {
|
|||
});
|
||||
});
|
||||
|
||||
test('clicking Back loads Release', async () => {
|
||||
test('clicking Back loads Image output', async () => {
|
||||
await renderCreateMode();
|
||||
await selectAwsTarget();
|
||||
await goToAwsStep();
|
||||
await clickBack();
|
||||
|
|
@ -143,6 +155,7 @@ describe('Step Upload to AWS', () => {
|
|||
});
|
||||
|
||||
test('clicking Cancel loads landing page', async () => {
|
||||
await renderCreateMode();
|
||||
await selectAwsTarget();
|
||||
await goToAwsStep();
|
||||
await verifyCancelButton(router);
|
||||
|
|
@ -154,6 +167,7 @@ describe('Step Upload to AWS', () => {
|
|||
return new HttpResponse(null, { status: 500 });
|
||||
})
|
||||
);
|
||||
await renderCreateMode();
|
||||
await selectAwsTarget();
|
||||
await goToAwsStep();
|
||||
await screen.findByText(
|
||||
|
|
@ -162,6 +176,7 @@ describe('Step Upload to AWS', () => {
|
|||
});
|
||||
|
||||
test('validation works', async () => {
|
||||
await renderCreateMode();
|
||||
await selectAwsTarget();
|
||||
await goToAwsStep();
|
||||
|
||||
|
|
@ -183,6 +198,7 @@ describe('Step Upload to AWS', () => {
|
|||
});
|
||||
|
||||
test('compose request share_with_sources field is correct', async () => {
|
||||
await renderCreateMode();
|
||||
await selectAwsTarget();
|
||||
await goToAwsStep();
|
||||
await getSourceDropdown();
|
||||
|
|
@ -197,6 +213,17 @@ describe('Step Upload to AWS', () => {
|
|||
});
|
||||
user.click(createBlueprintBtn);
|
||||
});
|
||||
|
||||
test('revisit step button on Review works', async () => {
|
||||
await renderCreateMode();
|
||||
await selectAwsTarget();
|
||||
await goToAwsStep();
|
||||
await chooseManualOption();
|
||||
await enterAccountId();
|
||||
await goToReview();
|
||||
await clickRevisitButton();
|
||||
await screen.findByRole('heading', { name: /Image output/ });
|
||||
});
|
||||
});
|
||||
|
||||
describe('AWS image type request generated correctly', () => {
|
||||
|
|
@ -205,6 +232,7 @@ describe('AWS image type request generated correctly', () => {
|
|||
});
|
||||
|
||||
test('using a source', async () => {
|
||||
await renderCreateMode();
|
||||
await selectAwsTarget();
|
||||
await goToAwsStep();
|
||||
await selectSource();
|
||||
|
|
@ -231,6 +259,7 @@ describe('AWS image type request generated correctly', () => {
|
|||
});
|
||||
|
||||
test('using an account id', async () => {
|
||||
await renderCreateMode();
|
||||
await selectAwsTarget();
|
||||
await goToAwsStep();
|
||||
await chooseManualOption();
|
||||
|
|
@ -258,6 +287,7 @@ describe('AWS image type request generated correctly', () => {
|
|||
});
|
||||
|
||||
test('after selecting and deselecting aws', async () => {
|
||||
await renderCreateMode();
|
||||
await selectAwsTarget();
|
||||
await goToAwsStep();
|
||||
await selectSource();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { Router as RemixRouter } from '@remix-run/router';
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { screen, waitFor, within } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
import { http, HttpResponse } from 'msw';
|
||||
|
||||
|
|
@ -50,9 +50,19 @@ const goToReview = async () => {
|
|||
await clickNext(); // Review
|
||||
};
|
||||
|
||||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
const expandable = await screen.findByTestId(
|
||||
'target-environments-expandable'
|
||||
);
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-target-environments'
|
||||
);
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
const selectAzureTarget = async () => {
|
||||
const user = userEvent.setup();
|
||||
await renderCreateMode();
|
||||
const azureCard = await screen.findByTestId('upload-azure');
|
||||
await waitFor(() => user.click(azureCard));
|
||||
await clickNext();
|
||||
|
|
@ -162,6 +172,7 @@ describe('Step Upload to Azure', () => {
|
|||
const user = userEvent.setup();
|
||||
|
||||
test('clicking Next loads Registration', async () => {
|
||||
await renderCreateMode();
|
||||
await selectAzureTarget();
|
||||
await goToAzureStep();
|
||||
await selectManuallyEnterInformation();
|
||||
|
|
@ -175,6 +186,7 @@ describe('Step Upload to Azure', () => {
|
|||
});
|
||||
|
||||
test('clicking Back loads Image output', async () => {
|
||||
await renderCreateMode();
|
||||
await selectAzureTarget();
|
||||
await goToAzureStep();
|
||||
await clickBack();
|
||||
|
|
@ -182,12 +194,14 @@ describe('Step Upload to Azure', () => {
|
|||
});
|
||||
|
||||
test('clicking Cancel loads landing page', async () => {
|
||||
await renderCreateMode();
|
||||
await selectAzureTarget();
|
||||
await goToAzureStep();
|
||||
await verifyCancelButton(router);
|
||||
});
|
||||
|
||||
test('basics work', { retry: 3 }, async () => {
|
||||
await renderCreateMode();
|
||||
await selectAzureTarget();
|
||||
await goToAzureStep();
|
||||
await selectManuallyEnterInformation();
|
||||
|
|
@ -234,6 +248,7 @@ describe('Step Upload to Azure', () => {
|
|||
});
|
||||
|
||||
test('handles change of selected Source', async () => {
|
||||
await renderCreateMode();
|
||||
await selectAzureTarget();
|
||||
await goToAzureStep();
|
||||
await selectSource('azureSource1');
|
||||
|
|
@ -264,13 +279,24 @@ describe('Step Upload to Azure', () => {
|
|||
return new HttpResponse(null, { status: 500 });
|
||||
})
|
||||
);
|
||||
|
||||
await renderCreateMode();
|
||||
await selectAzureTarget();
|
||||
await goToAzureStep();
|
||||
await screen.findByText(
|
||||
/Sources cannot be reached, try again later or enter an account info for upload manually\./i
|
||||
);
|
||||
});
|
||||
|
||||
test('revisit step button on Review works', async () => {
|
||||
await renderCreateMode();
|
||||
await selectAzureTarget();
|
||||
await goToAzureStep();
|
||||
await selectSource('azureSource1');
|
||||
await selectResourceGroup();
|
||||
await goToReview();
|
||||
await clickRevisitButton();
|
||||
await screen.findByRole('heading', { name: /Image output/ });
|
||||
});
|
||||
});
|
||||
|
||||
describe('Azure image type request generated correctly', () => {
|
||||
|
|
@ -279,6 +305,7 @@ describe('Azure image type request generated correctly', () => {
|
|||
});
|
||||
|
||||
test('using a source', async () => {
|
||||
await renderCreateMode();
|
||||
await selectAzureTarget();
|
||||
await goToAzureStep();
|
||||
await selectSource('azureSource1');
|
||||
|
|
@ -311,6 +338,7 @@ describe('Azure image type request generated correctly', () => {
|
|||
});
|
||||
|
||||
test('manually entering info', async () => {
|
||||
await renderCreateMode();
|
||||
await selectAzureTarget();
|
||||
await goToAzureStep();
|
||||
await selectManuallyEnterInformation();
|
||||
|
|
@ -342,6 +370,7 @@ describe('Azure image type request generated correctly', () => {
|
|||
});
|
||||
|
||||
test('after selecting and deselecting azure', async () => {
|
||||
await renderCreateMode();
|
||||
await selectAzureTarget();
|
||||
await goToAzureStep();
|
||||
await selectSource('azureSource1');
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import type { Router as RemixRouter } from '@remix-run/router';
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { screen, waitFor, within } from '@testing-library/react';
|
||||
import { userEvent } from '@testing-library/user-event';
|
||||
|
||||
import { CREATE_BLUEPRINT, EDIT_BLUEPRINT } from '../../../../../constants';
|
||||
|
|
@ -45,6 +45,17 @@ const goToReview = async () => {
|
|||
await clickNext(); // Review
|
||||
};
|
||||
|
||||
const clickRevisitButton = async () => {
|
||||
const user = userEvent.setup();
|
||||
const expandable = await screen.findByTestId(
|
||||
'target-environments-expandable'
|
||||
);
|
||||
const revisitButton = await within(expandable).findByTestId(
|
||||
'revisit-target-environments'
|
||||
);
|
||||
await waitFor(() => user.click(revisitButton));
|
||||
};
|
||||
|
||||
const createGCPCloudImage = (
|
||||
image_type: ImageTypes,
|
||||
options: GcpUploadRequestOptions
|
||||
|
|
@ -61,7 +72,6 @@ const createGCPCloudImage = (
|
|||
|
||||
const clickGCPTarget = async () => {
|
||||
const user = userEvent.setup();
|
||||
await renderCreateMode();
|
||||
const googleOption = await screen.findByTestId('upload-google');
|
||||
await waitFor(() => user.click(googleOption));
|
||||
await clickNext();
|
||||
|
|
@ -96,6 +106,7 @@ describe('Step Upload to Google', () => {
|
|||
const user = userEvent.setup();
|
||||
|
||||
test('clicking Next loads Registration', async () => {
|
||||
await renderCreateMode();
|
||||
await clickGCPTarget();
|
||||
await selectGoogleAccount('google-account');
|
||||
await clickNext();
|
||||
|
|
@ -105,17 +116,20 @@ describe('Step Upload to Google', () => {
|
|||
});
|
||||
|
||||
test('clicking Back loads Image output', async () => {
|
||||
await renderCreateMode();
|
||||
await clickGCPTarget();
|
||||
await clickBack();
|
||||
await screen.findByRole('heading', { name: 'Image output' });
|
||||
});
|
||||
|
||||
test('clicking Cancel loads landing page', async () => {
|
||||
await renderCreateMode();
|
||||
await clickGCPTarget();
|
||||
await verifyCancelButton(router);
|
||||
});
|
||||
|
||||
test('the google account id field is shown and required', async () => {
|
||||
await renderCreateMode();
|
||||
await clickGCPTarget();
|
||||
const principalInput = await screen.findByTestId('principal');
|
||||
expect(principalInput).toHaveValue('');
|
||||
|
|
@ -123,6 +137,7 @@ describe('Step Upload to Google', () => {
|
|||
});
|
||||
|
||||
test('the google email field must be a valid email', async () => {
|
||||
await renderCreateMode();
|
||||
await clickGCPTarget();
|
||||
|
||||
await waitFor(async () =>
|
||||
|
|
@ -137,6 +152,15 @@ describe('Step Upload to Google', () => {
|
|||
expect(await getNextButton()).not.toHaveClass('pf-m-disabled');
|
||||
expect(await getNextButton()).toBeEnabled();
|
||||
});
|
||||
|
||||
test('revisit step button on Review works', async () => {
|
||||
await renderCreateMode();
|
||||
await clickGCPTarget();
|
||||
await selectGoogleAccount('google-account');
|
||||
await goToReview();
|
||||
await clickRevisitButton();
|
||||
await screen.findByRole('heading', { name: /Image output/ });
|
||||
});
|
||||
});
|
||||
|
||||
describe('GCP image type request generated correctly', () => {
|
||||
|
|
@ -145,6 +169,7 @@ describe('GCP image type request generated correctly', () => {
|
|||
});
|
||||
|
||||
test('share image with google account', async () => {
|
||||
await renderCreateMode();
|
||||
await clickGCPTarget();
|
||||
await selectGoogleAccount('google-account');
|
||||
await goToReview();
|
||||
|
|
@ -164,6 +189,7 @@ describe('GCP image type request generated correctly', () => {
|
|||
});
|
||||
|
||||
test('share image with service account', async () => {
|
||||
await renderCreateMode();
|
||||
await clickGCPTarget();
|
||||
await selectGoogleAccount('service-account');
|
||||
await goToReview();
|
||||
|
|
@ -179,6 +205,7 @@ describe('GCP image type request generated correctly', () => {
|
|||
});
|
||||
|
||||
test('share image with google group', async () => {
|
||||
await renderCreateMode();
|
||||
await clickGCPTarget();
|
||||
await selectGoogleAccount('google-group');
|
||||
await goToReview();
|
||||
|
|
@ -194,6 +221,7 @@ describe('GCP image type request generated correctly', () => {
|
|||
});
|
||||
|
||||
test('share image with domain', async () => {
|
||||
await renderCreateMode();
|
||||
await clickGCPTarget();
|
||||
await selectGoogleAccount('google-domain');
|
||||
await goToReview();
|
||||
|
|
@ -210,6 +238,7 @@ describe('GCP image type request generated correctly', () => {
|
|||
|
||||
test('share image with red hat insight only', async () => {
|
||||
const user = userEvent.setup();
|
||||
await renderCreateMode();
|
||||
await clickGCPTarget();
|
||||
const shareWithInsightOption = await screen.findByTestId(
|
||||
'share-with-insights'
|
||||
|
|
@ -227,6 +256,7 @@ describe('GCP image type request generated correctly', () => {
|
|||
});
|
||||
|
||||
test('after selecting and deselecting gcp', async () => {
|
||||
await renderCreateMode();
|
||||
await clickGCPTarget();
|
||||
await selectGoogleAccount('google-domain');
|
||||
await clickBack();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue