-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[SecuritySolution] Unskip fields browser timeline tests #174597
[SecuritySolution] Unskip fields browser timeline tests #174597
Conversation
The fields browser is opened in beforeEach
The timeline's data / its rows are not actually tested
Pinging @elastic/security-threat-hunting-investigations (Team:Threat Hunting:Investigations) |
Pinging @elastic/response-ops (Team:ResponseOps) |
/ci |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a few comments on some cleanup and potential merge of tests to reduce run time :)
@@ -369,7 +369,7 @@ export const markAsFavorite = () => { | |||
}; | |||
|
|||
export const openTimelineFieldsBrowser = () => { | |||
cy.get(TIMELINE_FIELDS_BUTTON).first().click({ force: true }); | |||
cy.get(TIMELINE_FIELDS_BUTTON).first().click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just want to note that the first()
here is pretty dangerous/brittle. I was trying to remove it and realized that we have 3 instances of the FieldBrowserComponent
which contains the EuiButtonEmpty
that has the data-test-subj="show-field-browser"
property.
It happens that in the DOM the first one is the one that we mostly want, but that could change.
I don't think this PR is the right place to do it, so this is just a note, but we should at some point modify the FieldBrowserComponent
to take the `data-test-subj- as a prop so we can guarantee the uniqueness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, first()
often is a source of flakiness/trouble in the future. I wouldn't want to touch it in this PR. Also, it seems like the component is owned by ResponseOps and not us...
it('displays "view all" option by default', () => { | ||
cy.get(FIELDS_BROWSER_VIEW_BUTTON).should('contain.text', 'View: all'); | ||
}); | ||
|
||
it('displays the expected count of categories that match the filter input', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think about merging some of the tests below?
I can see the first (displays the expected count of categories that match the filter input) and second (displays a search results label with the expected count of fields matching the filter input) together. They have the same input and only check a small UI element each...
I can also see the last 3 (or 2) in this describe merged together, under a title that would say something like should correctly create and search category
or something more descriptive. A few cy.log
in the test would clarify what exactly happens in each step.
The whole test suite would run much faster
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, nice catch. I'll merge them.
beforeEach(() => { | ||
login(); | ||
visitWithTimeRange(hostsUrl('allHosts')); | ||
openTimelineUsingToggle(); | ||
populateTimeline(); | ||
openTimelineFieldsBrowser(); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment here, I feel like the first 3 tests could easily be merged into a single one that would test add, remove and reset fields.
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually even the fourth one (restores focus to the Customize Columns button when
Reset Fields is clicked
) can easily be merged with the other 3. Just check the focus after you've reset. It would just be a this single line added at the end
cy.get(TIMELINE_FIELDS_BUTTON).should('have.focus');
It doesn't really make sense to have a whole test that verifies just that
x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/fields_browser.cy.ts
Outdated
Show resolved
Hide resolved
x-pack/test/security_solution_cypress/cypress/e2e/investigations/timelines/fields_browser.cy.ts
Show resolved
Hide resolved
@PhilippeOberti Thanks for looking into how to simplify these tests. I consolidated a bunch of them into combined tests now. However, I didn't merge them all as that would have created super long tests that, even with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks super clean, thank you!!
it looks awesome. I took the liberty to push a commit that just changes the name of 2 tests to use |
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
History
To update your PR or re-run it, just comment with: cc @janmonschke |
Summary
Unskips the fields browser tests.
The fields browser tests have been skipped because of issues during the population of the timeline (as described in #169363, #169271, #169197). As investigated in previous PRs (e.g. #174593) that flakiness has been removed in #173413 so it is safe to unskip the tests now.
In addition to that, unnecessary timeline population was removed, force clicks/checks/unchecks cleaned up. Also, parts of the acceptance test have been moved to the unit test.
Flaky test runner (200/200)
fixes #169197
fixes #169271
fixes #169363