Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cases] Add e2e tests for category #160149

Merged
merged 8 commits into from
Jun 26, 2023

Conversation

js-jankisalvi
Copy link
Contributor

@js-jankisalvi js-jankisalvi commented Jun 21, 2023

@js-jankisalvi js-jankisalvi added release_note:skip Skip the PR/issue when compiling release notes backport:skip This commit does not require backporting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Feature:Cases Cases feature v8.9.0 labels Jun 21, 2023
@js-jankisalvi js-jankisalvi self-assigned this Jun 21, 2023
@js-jankisalvi js-jankisalvi requested a review from a team as a code owner June 21, 2023 14:54
@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops-cases (Feature:Cases)

await testSubjects.click('category-remove-button');

// validate user action
await find.byCssSelector('[data-test-subj*="category-delete-action"]');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we could also look to see if the text exists that states that no category exists.

@@ -16,6 +16,6 @@ describe('Category viewer ', () => {
it('renders category', () => {
render(<CategoryViewer category={sampleCategory} />);

expect(screen.getByText(sampleCategory)).toBeInTheDocument();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between the getByText and toHaveTextContent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getByText will return true even if the text exists but is not set in category field, however it could give correct result if we check with particular test subject's text content.

});

it('deletes a category from a case', async () => {
await testSubjects.click('category-remove-button');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should validate in the begging of the test that the category exists like await testSubjects.existOrFail('category-' + category);

Copy link
Member

@cnasikas cnasikas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Janki for this! Can you add a test where we filter the cases by category correctly in the cases table?

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
cases 420.8KB 420.9KB +84.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
enterpriseSearch 14 16 +2
securitySolution 416 420 +4
total +6

Total ESLint disabled count

id before after diff
enterpriseSearch 15 17 +2
securitySolution 497 501 +4
total +6

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @js-jankisalvi

@js-jankisalvi js-jankisalvi merged commit 2c24494 into elastic:main Jun 26, 2023
@js-jankisalvi js-jankisalvi deleted the category-e2e-test branch October 6, 2023 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Cases Cases feature release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.9.0 v8.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants