@@ -4478,9 +4478,16 @@ describe('SearchQueryBuilder', function () {
4478
4478
4479
4479
describe ( 'user clicks on enable gen ai button' , ( ) => {
4480
4480
it ( 'calls promptsUpdate' , async ( ) => {
4481
- const organization = OrganizationFixture ( ) ;
4481
+ const organization = OrganizationFixture ( {
4482
+ slug : 'org-slug' ,
4483
+ features : [ 'gen-ai-features' , 'gen-ai-explore-traces' ] ,
4484
+ } ) ;
4485
+ const promptsUpdateMock = MockApiClient . addMockResponse ( {
4486
+ url : `/organizations/${ organization . slug } /prompts-activity/` ,
4487
+ method : 'PUT' ,
4488
+ } ) ;
4482
4489
MockApiClient . addMockResponse ( {
4483
- url : ' /organizations/org- slug/seer/setup-check/' ,
4490
+ url : ` /organizations/${ organization . slug } /seer/setup-check/` ,
4484
4491
body : AutofixSetupFixture ( {
4485
4492
setupAcknowledgement : {
4486
4493
orgHasAcknowledged : false ,
@@ -4489,21 +4496,15 @@ describe('SearchQueryBuilder', function () {
4489
4496
} ) ,
4490
4497
} ) ;
4491
4498
4492
- const promptsUpdateMock = MockApiClient . addMockResponse ( {
4493
- url : `/organizations/${ organization . slug } /prompts-activity/` ,
4494
- method : 'PUT' ,
4495
- } ) ;
4496
-
4497
- render ( < SearchQueryBuilder { ...defaultProps } enableAISearch /> , {
4498
- organization : { features : [ 'gen-ai-features' , 'gen-ai-explore-traces' ] } ,
4499
- } ) ;
4499
+ render ( < SearchQueryBuilder { ...defaultProps } enableAISearch /> , { organization} ) ;
4500
4500
4501
4501
await userEvent . click ( getLastInput ( ) ) ;
4502
4502
4503
- const enableAi = await screen . findByText ( / E n a b l e G e n A I / ) ;
4503
+ const enableAi = await screen . findByRole ( 'option' , { name : / E n a b l e G e n A I / } ) ;
4504
4504
expect ( enableAi ) . toBeInTheDocument ( ) ;
4505
4505
4506
- await userEvent . click ( enableAi ) ;
4506
+ await userEvent . hover ( enableAi ) ;
4507
+ await userEvent . keyboard ( '{enter}' ) ;
4507
4508
4508
4509
await waitFor ( ( ) => {
4509
4510
expect ( promptsUpdateMock ) . toHaveBeenCalledWith (
0 commit comments