Custom Repositories gate by Feature flag

This commit is contained in:
Ondrej Ezr 2023-08-23 13:54:47 +02:00 committed by Lucas Garfield
parent 77ff00d107
commit b486f44dcb
4 changed files with 75 additions and 7 deletions

View file

@ -69,6 +69,13 @@ jest
.spyOn(api, 'getComposes')
.mockImplementation(() => Promise.resolve(mockComposesEmpty));
jest.mock('@unleash/proxy-client-react', () => ({
useUnleashContext: () => jest.fn(),
useFlag: jest.fn((flag) =>
flag === 'image-builder.enable-content-sources' ? true : false
),
}));
const searchForAvailablePackages = async (searchbox, searchTerm) => {
const user = userEvent.setup();
await user.type(searchbox, searchTerm);

View file

@ -76,6 +76,13 @@ jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
}),
}));
jest.mock('@unleash/proxy-client-react', () => ({
useUnleashContext: () => jest.fn(),
useFlag: jest.fn((flag) =>
flag === 'image-builder.enable-content-sources' ? true : false
),
}));
const searchForAvailablePackages = async (searchbox, searchTerm) => {
const user = userEvent.setup();
await user.type(searchbox, searchTerm);
@ -414,6 +421,7 @@ describe('Step Upload to AWS', () => {
await clickNext();
await clickNext();
await clickNext();
await clickNext();
});
const composeImage = jest
@ -615,6 +623,10 @@ describe('Step Registration', () => {
await act(async () => {
n4.click();
});
const n5 = screen.getByRole('button', { name: /Next/ });
await act(async () => {
n5.click();
});
const review = screen.getByTestId('review-registration');
expect(review).toHaveTextContent(
'Register with Red Hat Subscription Manager (RHSM)'
@ -677,6 +689,10 @@ describe('Step Registration', () => {
await act(async () => {
n4.click();
});
const n5 = screen.getByRole('button', { name: /Next/ });
await act(async () => {
n5.click();
});
const review = screen.getByTestId('review-registration');
expect(review).toHaveTextContent(
'Register with Red Hat Subscription Manager (RHSM)'
@ -737,6 +753,10 @@ describe('Step Registration', () => {
await act(async () => {
n4.click();
});
const n5 = screen.getByRole('button', { name: /Next/ });
await act(async () => {
n5.click();
});
const exp1 = screen.getByTestId('registration-expandable');
await act(async () => {
exp1.click();
@ -782,6 +802,10 @@ describe('Step Registration', () => {
await act(async () => {
n4.click();
});
const n5 = screen.getByRole('button', { name: /Next/ });
await act(async () => {
n5.click();
});
screen.getByText('Register the system later');
});
@ -919,6 +943,7 @@ describe('Step Packages', () => {
await act(async () => {
await clickNext();
await clickNext();
});
screen.getByRole('heading', {
@ -1084,6 +1109,12 @@ describe('Step Packages', () => {
brs.click();
});
// skip repositories
const bnRep = screen.getByRole('button', { name: /Next/ });
await act(async () => {
bnRep.click();
});
// skip name page
const bn1 = screen.getByRole('button', { name: /Next/ });
await act(async () => {
@ -1109,6 +1140,10 @@ describe('Step Packages', () => {
await act(async () => {
bb2.click();
});
const bb3 = screen.getByRole('button', { name: /Back/ });
await act(async () => {
bb3.click();
});
await screen.findByTestId('search-available-pkgs-input');
const op = screen.getByRole('option', { name: /summary for test package/ });
await act(async () => {
@ -1128,6 +1163,10 @@ describe('Step Packages', () => {
await act(async () => {
n2.click();
});
const n3 = screen.getByRole('button', { name: /Next/ });
await act(async () => {
n3.click();
});
// await screen.findByTestId('chosen-packages-count');
chosen = await screen.findByTestId('chosen-packages-count');
@ -1362,6 +1401,8 @@ describe('Step Details', () => {
await clickNext();
// skip packages
await clickNext();
// skip repositories
await clickNext();
});
};
@ -1436,6 +1477,8 @@ describe('Step Review', () => {
// skip packages
await clickNext();
// skip repositories
await clickNext();
// skip name
await clickNext();
});
@ -1478,6 +1521,8 @@ describe('Step Review', () => {
// skip packages
await clickNext();
// skip repositories
await clickNext();
// skip name
await clickNext();
});
@ -1697,6 +1742,11 @@ describe('Click through all steps', () => {
await clickNext();
});
// TODO: should select a repo here
await act(async () => {
await clickNext();
});
// Enter image name
const nameInput = screen.getByRole('textbox', {
name: 'Image Name',
@ -2155,6 +2205,9 @@ describe('Keyboard accessibility', () => {
expect(availablePackagesInput).toHaveFocus();
await clickNext();
// TODO: what should have focus on Custom Repos step?
await clickNext();
// Name
const nameInput = screen.getByRole('textbox', { name: /image name/i });
expect(nameInput).toHaveFocus();