-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[Security Solution][Attacks/Alerts] Add a scheduled attack icon (#17461) #271871
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
Open
e40pud
wants to merge
8
commits into
elastic:main
Choose a base branch
from
e40pud:security/attack-alerts-alignment/17461-schedule-details
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
60503ef
[Security Solution][Attacks/Alerts] Add a scheduled attack icon (#17461)
e40pud 3d0a64a
i18n error fix
e40pud 4855746
Fix tests
e40pud d68bb55
Merge branch 'main' into security/attack-alerts-alignment/17461-sched…
e40pud 49a98ad
Merge branch 'main' into security/attack-alerts-alignment/17461-sched…
e40pud 24fb94a
Fix tests
e40pud d897289
Merge branch 'main' into security/attack-alerts-alignment/17461-sched…
e40pud 1d856e7
Review feedback
e40pud File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...ic/detections/components/attacks/schedule_details_button/schedule_details_button.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import React from 'react'; | ||
| import { render, fireEvent } from '@testing-library/react'; | ||
|
|
||
| import { ScheduleDetailsButton } from './schedule_details_button'; | ||
|
|
||
| describe('ScheduleDetailsButton', () => { | ||
| it('renders the button and tooltip', () => { | ||
| const onClickMock = jest.fn(); | ||
| const { getByTestId, getByLabelText } = render(<ScheduleDetailsButton onClick={onClickMock} />); | ||
|
|
||
| const button = getByTestId('scheduleButton'); | ||
| expect(button).toBeInTheDocument(); | ||
| expect(getByLabelText('Open schedule details')).toBeInTheDocument(); | ||
| }); | ||
|
|
||
| it('calls onClick when the button is clicked', () => { | ||
| const onClickMock = jest.fn(); | ||
| const { getByTestId } = render(<ScheduleDetailsButton onClick={onClickMock} />); | ||
|
|
||
| const button = getByTestId('scheduleButton'); | ||
| fireEvent.click(button); | ||
|
|
||
| expect(onClickMock).toHaveBeenCalledTimes(1); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This is semantically equivalent to .first(), which playwright/no-nth-methods targets. Since the test always seeds exactly one attack and tableScheduleButtons is already scoped to attacksTableSection, the locator should resolve to a single element — which means await this.tableScheduleButtons.click() would work directly and Playwright's strict mode would enforce uniqueness. The .all() destructure adds complexity without benefit here.
The same issue exists in the pre-existing openFirstAttackDetailsFromTable() method — but since you're adding a new method, it's worth getting right rather than copying the pattern.
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 agree that
.click()would work with Playwright's strict mode right now since we only seed one attack. However, in an upcoming PR, I will be extending the seeding to add multiple attacks to the table. I've left the.all()destructuring pattern in place to future-proof these methods so they don't break when multiple buttons are present.