tests/wizard/azure: separate tests
A weird error occurs because when the tests are executing together. To avoid that, as a temporary measure, separate the last test in a separate file to ensure insolation from its peers.
This commit is contained in:
parent
6b1ae7d1d8
commit
baefa79bb8
2 changed files with 69 additions and 14 deletions
|
|
@ -0,0 +1,69 @@
|
|||
import '@testing-library/jest-dom';
|
||||
|
||||
import { screen } from '@testing-library/react';
|
||||
import { rest } from 'msw';
|
||||
|
||||
import { PROVISIONING_API } from '../../../constants.js';
|
||||
import { server } from '../../mocks/server.js';
|
||||
import {
|
||||
clickNext,
|
||||
renderWithReduxRouter,
|
||||
} from '../../testUtils';
|
||||
|
||||
jest.mock('@redhat-cloud-services/frontend-components/useChrome', () => ({
|
||||
useChrome: () => ({
|
||||
auth: {
|
||||
getUser: () => {
|
||||
return {
|
||||
identity: {
|
||||
internal: {
|
||||
org_id: 5,
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
isBeta: () => true,
|
||||
isProd: () => true,
|
||||
getEnvironment: () => 'prod',
|
||||
}),
|
||||
}));
|
||||
|
||||
describe('Step Upload to Azure', () => {
|
||||
beforeAll(() => {
|
||||
// scrollTo is not defined in jsdom
|
||||
window.HTMLElement.prototype.scrollTo = function () {};
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
const setUp = async () => {
|
||||
renderWithReduxRouter('imagewizard', {});
|
||||
// select aws as upload destination
|
||||
const azureTile = screen.getByTestId('upload-azure');
|
||||
azureTile.click();
|
||||
|
||||
await clickNext();
|
||||
|
||||
expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent(
|
||||
'Target environment - Microsoft Azure'
|
||||
);
|
||||
};
|
||||
|
||||
test('component renders error state correctly', async () => {
|
||||
setUp();
|
||||
server.use(
|
||||
rest.get(`${PROVISIONING_API}/sources`, (req, res, ctx) =>
|
||||
res(ctx.status(500))
|
||||
)
|
||||
);
|
||||
|
||||
await screen.findByText(
|
||||
/Sources cannot be reached, try again later or enter an account info for upload manually\./i
|
||||
);
|
||||
//
|
||||
});
|
||||
// set test timeout on 10 seconds
|
||||
}, 15000);
|
||||
|
|
@ -156,19 +156,5 @@ describe('Step Upload to Azure', () => {
|
|||
expect(groups).toBeInTheDocument();
|
||||
expect(screen.getByLabelText('Resource group theirGroup2')).toBeVisible();
|
||||
});
|
||||
|
||||
test('component renders error state correctly', async () => {
|
||||
setUp();
|
||||
server.use(
|
||||
rest.get(`${PROVISIONING_API}/sources`, (req, res, ctx) =>
|
||||
res(ctx.status(500))
|
||||
)
|
||||
);
|
||||
|
||||
await screen.findByText(
|
||||
/Sources cannot be reached, try again later or enter an account info for upload manually\./i
|
||||
);
|
||||
//
|
||||
});
|
||||
// set test timeout on 10 seconds
|
||||
}, 15000);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue