mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
[Cases] Fix jira flaky tests (#170507)
Fixes #169392 Fixes #169393 Fixes #169391 Fixes #169390 Fixes #169387 Fixes #169386 Fixes #169385 Fixes #169384 Fixes #169383 ## Summary Summarize your PR. If it involves visual changes include a screenshot or gif.
This commit is contained in:
parent
22a2bfe22a
commit
25522bb99c
1 changed files with 43 additions and 40 deletions
|
@ -101,9 +101,10 @@ describe('Jira Fields', () => {
|
|||
</MockFormWrapperComponent>
|
||||
);
|
||||
|
||||
expect(await screen.findByTestId('prioritySelect')).toBeInTheDocument();
|
||||
expect(await screen.findByTestId('issueTypeSelect')).toBeInTheDocument();
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('prioritySelect')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('issueTypeSelect')).toBeInTheDocument();
|
||||
expect(screen.queryByTestId('search-parent-issues')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
@ -115,15 +116,15 @@ describe('Jira Fields', () => {
|
|||
</MockFormWrapperComponent>
|
||||
);
|
||||
|
||||
const issueTypeSelect = screen.getByTestId('issueTypeSelect');
|
||||
const issueTypeSelect = await screen.findByTestId('issueTypeSelect');
|
||||
expect(issueTypeSelect).toBeInTheDocument();
|
||||
|
||||
userEvent.selectOptions(issueTypeSelect, 'Task');
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('prioritySelect')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('search-parent-issues')).toBeInTheDocument();
|
||||
fireEvent.change(issueTypeSelect, {
|
||||
target: { value: 'Task' },
|
||||
});
|
||||
|
||||
expect(await screen.findByTestId('prioritySelect')).toBeInTheDocument();
|
||||
expect(await screen.findByTestId('search-parent-issues')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('sets parent correctly', async () => {
|
||||
|
@ -132,7 +133,7 @@ describe('Jira Fields', () => {
|
|||
<Fields connector={connector} />
|
||||
</MockFormWrapperComponent>
|
||||
);
|
||||
const input = screen.getByTestId('comboBoxSearchInput');
|
||||
const input = await screen.findByTestId('comboBoxSearchInput');
|
||||
|
||||
fireEvent.change(input, { target: { value: 'parentId' } });
|
||||
|
||||
|
@ -146,15 +147,18 @@ describe('Jira Fields', () => {
|
|||
</MockFormWrapperComponent>
|
||||
);
|
||||
|
||||
const checkbox = within(screen.getByTestId('search-parent-issues')).getByTestId(
|
||||
const checkbox = within(await screen.findByTestId('search-parent-issues')).getByTestId(
|
||||
'comboBoxSearchInput'
|
||||
);
|
||||
|
||||
userEvent.type(checkbox, 'Person Task{enter}');
|
||||
expect(checkbox).toHaveValue('Person Task');
|
||||
fireEvent.change(checkbox, {
|
||||
target: { value: 'Person Task{enter}' },
|
||||
});
|
||||
|
||||
expect(checkbox).toHaveValue('Person Task{enter}');
|
||||
});
|
||||
|
||||
it('disabled the fields when loading issue types', () => {
|
||||
it('disabled the fields when loading issue types', async () => {
|
||||
useGetIssueTypesMock.mockReturnValue({ ...useGetIssueTypesResponse, isLoading: true });
|
||||
|
||||
appMockRenderer.render(
|
||||
|
@ -163,11 +167,11 @@ describe('Jira Fields', () => {
|
|||
</MockFormWrapperComponent>
|
||||
);
|
||||
|
||||
expect(screen.getByTestId('issueTypeSelect')).toBeDisabled();
|
||||
expect(screen.getByTestId('prioritySelect')).toBeDisabled();
|
||||
expect(await screen.findByTestId('issueTypeSelect')).toBeDisabled();
|
||||
expect(await screen.findByTestId('prioritySelect')).toBeDisabled();
|
||||
});
|
||||
|
||||
it('disabled the priority when loading fields', () => {
|
||||
it('disabled the priority when loading fields', async () => {
|
||||
useGetFieldsByIssueTypeMock.mockReturnValue({
|
||||
...useGetFieldsByIssueTypeResponse,
|
||||
isLoading: true,
|
||||
|
@ -179,7 +183,7 @@ describe('Jira Fields', () => {
|
|||
</MockFormWrapperComponent>
|
||||
);
|
||||
|
||||
expect(screen.getByTestId('prioritySelect')).toBeDisabled();
|
||||
expect(await screen.findByTestId('prioritySelect')).toBeDisabled();
|
||||
});
|
||||
|
||||
it('hides the priority if not supported', () => {
|
||||
|
@ -210,27 +214,27 @@ describe('Jira Fields', () => {
|
|||
expect(screen.queryByTestId('search-parent-issues')).not.toBeVisible();
|
||||
});
|
||||
|
||||
it('sets issue type correctly', () => {
|
||||
it('sets issue type correctly', async () => {
|
||||
appMockRenderer.render(
|
||||
<MockFormWrapperComponent fields={fields}>
|
||||
<Fields connector={connector} />
|
||||
</MockFormWrapperComponent>
|
||||
);
|
||||
|
||||
userEvent.selectOptions(screen.getByTestId('issueTypeSelect'), '10007');
|
||||
expect(screen.getByTestId('issueTypeSelect')).toHaveValue('10007');
|
||||
userEvent.selectOptions(await screen.findByTestId('issueTypeSelect'), '10007');
|
||||
expect(await screen.findByTestId('issueTypeSelect')).toHaveValue('10007');
|
||||
});
|
||||
|
||||
it('sets priority correctly', () => {
|
||||
it('sets priority correctly', async () => {
|
||||
appMockRenderer.render(
|
||||
<MockFormWrapperComponent fields={fields}>
|
||||
<Fields connector={connector} />
|
||||
</MockFormWrapperComponent>
|
||||
);
|
||||
|
||||
userEvent.selectOptions(screen.getByTestId('prioritySelect'), 'Low');
|
||||
userEvent.selectOptions(await screen.findByTestId('prioritySelect'), 'Low');
|
||||
|
||||
expect(screen.getByTestId('prioritySelect')).toHaveValue('Low');
|
||||
expect(await screen.findByTestId('prioritySelect')).toHaveValue('Low');
|
||||
});
|
||||
|
||||
it('should submit Jira connector', async () => {
|
||||
|
@ -240,25 +244,25 @@ describe('Jira Fields', () => {
|
|||
</MockFormWrapperComponent>
|
||||
);
|
||||
|
||||
const issueTypeSelect = screen.getByTestId('issueTypeSelect');
|
||||
const issueTypeSelect = await screen.findByTestId('issueTypeSelect');
|
||||
expect(issueTypeSelect).toBeInTheDocument();
|
||||
|
||||
userEvent.selectOptions(issueTypeSelect, 'Bug');
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('prioritySelect')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('search-parent-issues')).toBeInTheDocument();
|
||||
});
|
||||
expect(await screen.findByTestId('prioritySelect')).toBeInTheDocument();
|
||||
expect(await screen.findByTestId('search-parent-issues')).toBeInTheDocument();
|
||||
|
||||
const checkbox = within(screen.getByTestId('search-parent-issues')).getByTestId(
|
||||
const checkbox = within(await screen.findByTestId('search-parent-issues')).getByTestId(
|
||||
'comboBoxSearchInput'
|
||||
);
|
||||
|
||||
userEvent.type(checkbox, 'Person Task{enter}');
|
||||
userEvent.selectOptions(screen.getByTestId('prioritySelect'), ['Low']);
|
||||
fireEvent.change(checkbox, {
|
||||
target: { value: 'Person Task' },
|
||||
});
|
||||
userEvent.selectOptions(await screen.findByTestId('prioritySelect'), ['Low']);
|
||||
|
||||
expect(screen.getByTestId('issueTypeSelect')).toHaveValue('10007');
|
||||
expect(screen.getByTestId('prioritySelect')).toHaveValue('Low');
|
||||
expect(await screen.findByTestId('issueTypeSelect')).toHaveValue('10007');
|
||||
expect(await screen.findByTestId('prioritySelect')).toHaveValue('Low');
|
||||
expect(checkbox).toHaveValue('Person Task');
|
||||
});
|
||||
|
||||
|
@ -269,17 +273,16 @@ describe('Jira Fields', () => {
|
|||
</MockFormWrapperComponent>
|
||||
);
|
||||
|
||||
expect(await screen.findByTestId('prioritySelect')).toBeInTheDocument();
|
||||
expect(await screen.findByTestId('issueTypeSelect')).toBeInTheDocument();
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByTestId('prioritySelect')).toBeInTheDocument();
|
||||
expect(screen.getByTestId('issueTypeSelect')).toBeInTheDocument();
|
||||
expect(screen.queryByTestId('search-parent-issues')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
userEvent.click(screen.getByTestId('submit-form'));
|
||||
userEvent.click(await screen.findByTestId('submit-form'));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText('Issue type is required')).toBeInTheDocument();
|
||||
});
|
||||
expect(await screen.findByText('Issue type is required')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should not show the loading skeleton when loading issue types', async () => {
|
||||
|
@ -328,6 +331,6 @@ describe('Jira Fields', () => {
|
|||
</MockFormWrapperComponent>
|
||||
);
|
||||
|
||||
expect(screen.getByTestId('fields-by-issue-type-loading')).toBeInTheDocument();
|
||||
expect(await screen.findByTestId('fields-by-issue-type-loading')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue