Skip to content

Commit

Permalink
[8.11] [Cases] fix description user actions flaky test (#170324) (#17…
Browse files Browse the repository at this point in the history
…0420)

# Backport

This will backport the following commits from `main` to `8.11`:
- [[Cases] fix description user actions flaky test
(#170324)](#170324)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Janki
Salvi","email":"[email protected]"},"sourceCommit":{"committedDate":"2023-11-02T13:52:25Z","message":"[Cases]
fix description user actions flaky test (#170324)\n\n## Summary\r\n\r\nI
removed the description user actions tests
from\r\n`x-pack/plugins/cases/public/components/case_view/components/case_view_activity.test.tsx`\r\n\r\nThere
were a few things being tested:\r\n\r\n| Old Test | Where is it covered
|\r\n| ------------- | ------------- |\r\n| should render the
description correctly | added description\r\nintegration on case view
activity page `should render the activity\r\ncontent and main
components` , text of the description is already\r\nverified
in\r\n`x-pack/plugins/cases/public/components/user_actions/description.test.tsx`\r\n|\r\n|
renders edit description user action correctly | Already
testing\r\ndescription create and update user actions in `renders user
actions\r\ncorrectly` in
file\r\n`x-pack/plugins/cases/public/components/user_actions/user_actions_list.test.tsx`\r\n|\r\n\r\n\r\nFixes
https://github.com/elastic/kibana/issues/151981\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [x] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"1d337e300f2de05cb356032f596318490f6d95e3","branchLabelMapping":{"^v8.12.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ResponseOps","Feature:Cases","v8.11.0","v8.12.0"],"number":170324,"url":"https://github.com/elastic/kibana/pull/170324","mergeCommit":{"message":"[Cases]
fix description user actions flaky test (#170324)\n\n## Summary\r\n\r\nI
removed the description user actions tests
from\r\n`x-pack/plugins/cases/public/components/case_view/components/case_view_activity.test.tsx`\r\n\r\nThere
were a few things being tested:\r\n\r\n| Old Test | Where is it covered
|\r\n| ------------- | ------------- |\r\n| should render the
description correctly | added description\r\nintegration on case view
activity page `should render the activity\r\ncontent and main
components` , text of the description is already\r\nverified
in\r\n`x-pack/plugins/cases/public/components/user_actions/description.test.tsx`\r\n|\r\n|
renders edit description user action correctly | Already
testing\r\ndescription create and update user actions in `renders user
actions\r\ncorrectly` in
file\r\n`x-pack/plugins/cases/public/components/user_actions/user_actions_list.test.tsx`\r\n|\r\n\r\n\r\nFixes
https://github.com/elastic/kibana/issues/151981\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [x] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"1d337e300f2de05cb356032f596318490f6d95e3"}},"sourceBranch":"main","suggestedTargetBranches":["8.11"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.12.0","labelRegex":"^v8.12.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/170324","number":170324,"mergeCommit":{"message":"[Cases]
fix description user actions flaky test (#170324)\n\n## Summary\r\n\r\nI
removed the description user actions tests
from\r\n`x-pack/plugins/cases/public/components/case_view/components/case_view_activity.test.tsx`\r\n\r\nThere
were a few things being tested:\r\n\r\n| Old Test | Where is it covered
|\r\n| ------------- | ------------- |\r\n| should render the
description correctly | added description\r\nintegration on case view
activity page `should render the activity\r\ncontent and main
components` , text of the description is already\r\nverified
in\r\n`x-pack/plugins/cases/public/components/user_actions/description.test.tsx`\r\n|\r\n|
renders edit description user action correctly | Already
testing\r\ndescription create and update user actions in `renders user
actions\r\ncorrectly` in
file\r\n`x-pack/plugins/cases/public/components/user_actions/user_actions_list.test.tsx`\r\n|\r\n\r\n\r\nFixes
https://github.com/elastic/kibana/issues/151981\r\n\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n\r\n### For
maintainers\r\n\r\n- [x] This was checked for breaking API changes and
was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"1d337e300f2de05cb356032f596318490f6d95e3"}}]}]
BACKPORT-->

Co-authored-by: Janki Salvi <[email protected]>
  • Loading branch information
kibanamachine and js-jankisalvi authored Nov 2, 2023
1 parent dc456b5 commit 1ea2b44
Showing 1 changed file with 2 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ describe('Case View Page activity tab', () => {

expect(await screen.findByTestId('case-view-activity')).toBeInTheDocument();
expect(await screen.findAllByTestId('user-actions-list')).toHaveLength(2);
expect(await screen.findByTestId('description')).toBeInTheDocument();
expect(await screen.findByTestId('case-tags')).toBeInTheDocument();
expect(await screen.findByTestId('cases-categories')).toBeInTheDocument();
expect(await screen.findByTestId('connector-edit-header')).toBeInTheDocument();
Expand Down Expand Up @@ -417,38 +418,7 @@ describe('Case View Page activity tab', () => {
});
});

// FLAKY: https://github.com/elastic/kibana/issues/151981
describe.skip('User actions', () => {
it('renders the description correctly', async () => {
appMockRender = createAppMockRenderer();
appMockRender.render(<CaseViewActivity {...caseProps} />);

const description = within(await screen.findByTestId('description'));

expect(await description.findByText(caseData.description)).toBeInTheDocument();
});

it('renders edit description user action correctly', async () => {
useFindCaseUserActionsMock.mockReturnValue({
...defaultUseFindCaseUserActions,
data: {
userActions: [
getUserAction('description', 'create'),
getUserAction('description', 'update'),
],
},
});

appMockRender = createAppMockRenderer();
appMockRender.render(<CaseViewActivity {...caseProps} />);

const userActions = within((await screen.findAllByTestId('user-actions-list'))[1]);

expect(
userActions.getByTestId('description-update-action-description-update')
).toBeInTheDocument();
});

describe('User actions', () => {
it('renders the unassigned users correctly', async () => {
useFindCaseUserActionsMock.mockReturnValue({
...defaultUseFindCaseUserActions,
Expand Down

0 comments on commit 1ea2b44

Please sign in to comment.