@@ -5,7 +5,14 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
5
5
import { ServiceIncidentFixture } from 'sentry-fixture/serviceIncident' ;
6
6
import { UserFixture } from 'sentry-fixture/user' ;
7
7
8
- import { act , render , screen , userEvent , waitFor } from 'sentry-test/reactTestingLibrary' ;
8
+ import {
9
+ act ,
10
+ render ,
11
+ screen ,
12
+ userEvent ,
13
+ waitFor ,
14
+ within ,
15
+ } from 'sentry-test/reactTestingLibrary' ;
9
16
10
17
import { logout } from 'sentry/actionCreators/account' ;
11
18
import { OnboardingContextProvider } from 'sentry/components/onboarding/onboardingContext' ;
@@ -91,6 +98,10 @@ describe('Sidebar', function () {
91
98
method : 'GET' ,
92
99
body : { onboardingTasks : [ ] } ,
93
100
} ) ;
101
+ MockApiClient . addMockResponse ( {
102
+ url : `/organizations/${ organization . slug } /prompts-activity/` ,
103
+ body : { data : null } ,
104
+ } ) ;
94
105
} ) ;
95
106
96
107
afterEach ( function ( ) {
@@ -412,23 +423,13 @@ describe('Sidebar', function () {
412
423
} ) ;
413
424
414
425
it ( 'should render the sidebar banner with no dismissed prompts and the feature flag enabled' , async ( ) => {
415
- MockApiClient . addMockResponse ( {
416
- url : `/organizations/${ organization . slug } /prompts-activity/` ,
417
- body : { data : null } ,
418
- } ) ;
419
-
420
- renderSidebarWithFeatures ( [ 'navigation-sidebar-v2' ] ) ;
426
+ renderSidebar ( { organization} ) ;
421
427
422
428
expect ( await screen . findByText ( / N e w N a v i g a t i o n / ) ) . toBeInTheDocument ( ) ;
423
429
} ) ;
424
430
425
431
it ( 'will not render sidebar banner when collapsed' , async ( ) => {
426
- MockApiClient . addMockResponse ( {
427
- url : `/organizations/${ organization . slug } /prompts-activity/` ,
428
- body : { data : null } ,
429
- } ) ;
430
-
431
- renderSidebarWithFeatures ( [ 'navigation-sidebar-v2' ] ) ;
432
+ renderSidebar ( { organization} ) ;
432
433
433
434
await userEvent . click ( screen . getByTestId ( 'sidebar-collapse' ) ) ;
434
435
@@ -438,18 +439,13 @@ describe('Sidebar', function () {
438
439
} ) ;
439
440
440
441
it ( 'should show dot on help menu after dismissing sidebar banner' , async ( ) => {
441
- MockApiClient . addMockResponse ( {
442
- url : `/organizations/${ organization . slug } /prompts-activity/` ,
443
- body : { data : null } ,
444
- } ) ;
445
-
446
442
const dismissMock = MockApiClient . addMockResponse ( {
447
443
url : `/organizations/${ organization . slug } /prompts-activity/` ,
448
444
method : 'PUT' ,
449
445
body : { } ,
450
446
} ) ;
451
447
452
- renderSidebarWithFeatures ( [ 'navigation-sidebar-v2' ] ) ;
448
+ renderSidebar ( { organization } ) ;
453
449
454
450
await userEvent . click ( await screen . findByRole ( 'button' , { name : / D i s m i s s / } ) ) ;
455
451
@@ -480,11 +476,6 @@ describe('Sidebar', function () {
480
476
options : { ...user . options , prefersChonkUI : true } ,
481
477
} ) ;
482
478
483
- MockApiClient . addMockResponse ( {
484
- url : `/organizations/${ organization . slug } /prompts-activity/` ,
485
- body : { data : null } ,
486
- } ) ;
487
-
488
479
renderSidebarWithFeatures ( [ 'chonk-ui' ] ) ;
489
480
expect ( screen . queryByText ( / S e n t r y h a s a n e w l o o k / ) ) . not . toBeInTheDocument ( ) ;
490
481
} ) ;
@@ -528,11 +519,6 @@ describe('Sidebar', function () {
528
519
options : { ...user . options , prefersChonkUI : false } ,
529
520
} ) ;
530
521
531
- MockApiClient . addMockResponse ( {
532
- url : `/organizations/${ organization . slug } /prompts-activity/` ,
533
- body : { data : null } ,
534
- } ) ;
535
-
536
522
const dismiss = MockApiClient . addMockResponse ( {
537
523
url : `/organizations/${ organization . slug } /prompts-activity/` ,
538
524
method : 'PUT' ,
@@ -591,11 +577,6 @@ describe('Sidebar', function () {
591
577
options : { ...user . options , prefersChonkUI : false } ,
592
578
} ) ;
593
579
594
- MockApiClient . addMockResponse ( {
595
- url : `/organizations/${ organization . slug } /prompts-activity/` ,
596
- body : { data : null } ,
597
- } ) ;
598
-
599
580
const dismiss = MockApiClient . addMockResponse ( {
600
581
url : `/organizations/${ organization . slug } /prompts-activity/` ,
601
582
method : 'PUT' ,
@@ -610,8 +591,15 @@ describe('Sidebar', function () {
610
591
611
592
// The dot is not visible initially - banner takes precedence
612
593
expect ( screen . queryByTestId ( 'help-menu-dot' ) ) . not . toBeInTheDocument ( ) ;
613
- expect ( await screen . findByText ( / S e n t r y h a s a n e w l o o k / ) ) . toBeInTheDocument ( ) ;
614
- await userEvent . click ( screen . getByRole ( 'button' , { name : / D i s m i s s / } ) ) ;
594
+ const chonkBanner = await screen . findByText ( / S e n t r y h a s a n e w l o o k / ) ;
595
+ expect ( chonkBanner ) . toBeInTheDocument ( ) ;
596
+
597
+ // Find the dismiss button within the chonk UI banner
598
+ await userEvent . click (
599
+ within ( screen . getByRole ( 'complementary' ) ) . getByRole ( 'button' , {
600
+ name : / D i s m i s s / ,
601
+ } )
602
+ ) ;
615
603
616
604
expect ( optionsRequest ) . not . toHaveBeenCalled ( ) ;
617
605
expect ( dismiss ) . toHaveBeenCalledWith (
0 commit comments