-
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
[Security solution] Guided onboarding, alerts & cases design updates #144249
Merged
stephmilovic
merged 57 commits into
elastic:main
from
stephmilovic:guided_onboarding_design
Nov 9, 2022
Merged
Changes from all commits
Commits
Show all changes
57 commits
Select commit
Hold shift + click to select a range
636d34e
next buttons
stephmilovic c48c2ca
set initial value and expose submit function from getCreateCaseFlyout
stephmilovic 50fddb9
Merge branch 'main' into guided_onboarding_design
stephmilovic a19b090
push
stephmilovic 50fe19c
button focus
stephmilovic dea3873
Merge branch 'main' into guided_onboarding_design
stephmilovic 095a436
fixing
stephmilovic b17c725
merge main
stephmilovic bbe2a1d
fix a couple tests
stephmilovic 17e8c0e
fix
stephmilovic d1932bc
ok
stephmilovic bdc4cb4
useAddToCaseActions tests
stephmilovic 810f0ea
make sure AlertsCasesTourSteps is used everywhere
stephmilovic b1d12e4
add tests to cases area
stephmilovic 80ec3c1
rm comment
stephmilovic c969319
add import
stephmilovic 47eb7e0
add test in cases
stephmilovic a134f3f
Merge branch 'main' into guided_onboarding_design
stephmilovic 8a8333f
add fun markdown
stephmilovic 37988ed
test fix
stephmilovic ad08ae6
Merge branch 'main' into guided_onboarding_design
kibanamachine 6f4e9c3
Merge branch 'main' into guided_onboarding_design
stephmilovic afc9902
Merge branch 'guided_onboarding_design' of github.com:stephmilovic/ki…
stephmilovic f6b59ae
codeowners
stephmilovic 5e24730
useMemo on context provider
stephmilovic f98b2ea
fix for mr michael
stephmilovic d854113
Merge branch 'main' into guided_onboarding_design
stephmilovic a1d439c
isSubmit to autoSubmit
stephmilovic aa83e89
autoSubmit to props
stephmilovic 64aaf95
move bool
stephmilovic d0e8a42
fix keys
stephmilovic 506da35
Merge branch 'main' into guided_onboarding_design
stephmilovic 442f5ad
fix tests
stephmilovic 6c22869
end tour on case details page
stephmilovic b2bf83d
Merge branch 'main' into guided_onboarding_design
stephmilovic 1ba3eed
test fix
stephmilovic 4b77eeb
more better
stephmilovic 15740ac
better now
stephmilovic 53f2228
Merge branch 'main' into guided_onboarding_design
stephmilovic fe6ef7b
finish tour on case details page vs onclick of the link
stephmilovic 95403c2
revert submit callback in create case
stephmilovic 6d04afb
revert more cases
stephmilovic 1f821a4
test fix
stephmilovic 0a26e9d
add tests
stephmilovic b26a7bc
fix side effects and tests
stephmilovic 3dcb219
just a fix up
stephmilovic 5f9c56d
adds tests for tour context in related_cases
stephmilovic 3cc0718
data-test-subj to tour-step
stephmilovic 3b91a69
tests for cases_tour_steps
stephmilovic 2df8a1c
more test
stephmilovic 02b28b1
pr fixes
stephmilovic c7615c6
fix type
stephmilovic 92d0ac8
Merge branch 'main' into guided_onboarding_design
stephmilovic b37e65c
setStep function added and type fix
stephmilovic 1a0c157
fix whoops
stephmilovic 4156066
Merge branch 'main' into guided_onboarding_design
stephmilovic 48b739a
fix test
stephmilovic 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 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 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 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 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 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 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
93 changes: 93 additions & 0 deletions
93
x-pack/plugins/security_solution/public/cases/pages/index.test.tsx
This file contains 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,93 @@ | ||
/* | ||
* 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 { Cases } from '.'; | ||
import { Router } from 'react-router-dom'; | ||
import { render } from '@testing-library/react'; | ||
import { TestProviders } from '../../common/mock'; | ||
import { useTourContext } from '../../common/components/guided_onboarding_tour'; | ||
import { | ||
AlertsCasesTourSteps, | ||
SecurityStepId, | ||
} from '../../common/components/guided_onboarding_tour/tour_config'; | ||
|
||
jest.mock('../../common/components/guided_onboarding_tour'); | ||
|
||
type Action = 'PUSH' | 'POP' | 'REPLACE'; | ||
const pop: Action = 'POP'; | ||
const location = { | ||
pathname: '/network', | ||
search: '', | ||
state: '', | ||
hash: '', | ||
}; | ||
const mockHistory = { | ||
length: 2, | ||
location, | ||
action: pop, | ||
push: jest.fn(), | ||
replace: jest.fn(), | ||
go: jest.fn(), | ||
goBack: jest.fn(), | ||
goForward: jest.fn(), | ||
block: jest.fn(), | ||
createHref: jest.fn(), | ||
listen: jest.fn(), | ||
}; | ||
|
||
describe('cases page in security', () => { | ||
const endTourStep = jest.fn(); | ||
beforeEach(() => { | ||
(useTourContext as jest.Mock).mockReturnValue({ | ||
activeStep: AlertsCasesTourSteps.viewCase, | ||
incrementStep: () => null, | ||
endTourStep, | ||
isTourShown: () => true, | ||
}); | ||
jest.clearAllMocks(); | ||
}); | ||
it('calls endTour on cases details page when SecurityStepId.alertsCases tour is active and step is AlertsCasesTourSteps.viewCase', () => { | ||
render( | ||
<Router history={mockHistory}> | ||
<Cases /> | ||
</Router>, | ||
{ wrapper: TestProviders } | ||
); | ||
expect(endTourStep).toHaveBeenCalledWith(SecurityStepId.alertsCases); | ||
}); | ||
it('does not call endTour on cases details page when SecurityStepId.alertsCases tour is not active', () => { | ||
(useTourContext as jest.Mock).mockReturnValue({ | ||
activeStep: AlertsCasesTourSteps.viewCase, | ||
incrementStep: () => null, | ||
endTourStep, | ||
isTourShown: () => false, | ||
}); | ||
render( | ||
<Router history={mockHistory}> | ||
<Cases /> | ||
</Router>, | ||
{ wrapper: TestProviders } | ||
); | ||
expect(endTourStep).not.toHaveBeenCalled(); | ||
}); | ||
it('does not call endTour on cases details page when SecurityStepId.alertsCases tour is active and step is not AlertsCasesTourSteps.viewCase', () => { | ||
(useTourContext as jest.Mock).mockReturnValue({ | ||
activeStep: AlertsCasesTourSteps.expandEvent, | ||
incrementStep: () => null, | ||
endTourStep, | ||
isTourShown: () => true, | ||
}); | ||
render( | ||
<Router history={mockHistory}> | ||
<Cases /> | ||
</Router>, | ||
{ wrapper: TestProviders } | ||
); | ||
expect(endTourStep).not.toHaveBeenCalled(); | ||
}); | ||
}); |
This file contains 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 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 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
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.
These are labels for my tour step anchor. Previously I was using
data-test-subj="create-case-flyout"
but it makes me nervous to call on a test ref in production.