@@ -22,25 +22,33 @@ describe('ClusterMenu', () => {
2222 />
2323 ) ;
2424 const getMenuItems = ( ) => screen . getAllByRole ( 'menuitem' ) ;
25- const getMenuItem = ( ) => screen . getByRole ( 'menuitem' ) ;
2625 const getBrokers = ( ) => screen . getByTitle ( 'Brokers' ) ;
27- const getTopics = ( ) => screen . getByTitle ( 'Brokers ' ) ;
28- const getConsumers = ( ) => screen . getByTitle ( 'Brokers ' ) ;
26+ const getTopics = ( ) => screen . getByTitle ( 'Topics ' ) ;
27+ const getConsumers = ( ) => screen . getByTitle ( 'Consumers ' ) ;
2928 const getKafkaConnect = ( ) => screen . getByTitle ( 'Kafka Connect' ) ;
3029 const getCluster = ( ) => screen . getByText ( onlineClusterPayload . name ) ;
3130
31+ // Хелпер для клика по шеврону - ищем SVG с шевроном
32+ const clickChevron = async ( ) => {
33+ const chevronSvg = document . querySelector ( 'svg[viewBox="0 0 10 6"]' ) ;
34+ if ( chevronSvg ) {
35+ await userEvent . click ( chevronSvg as Element ) ;
36+ }
37+ } ;
38+
3239 it ( 'renders cluster menu with default set of features' , async ( ) => {
3340 render ( setupComponent ( onlineClusterPayload ) ) ;
3441 expect ( getCluster ( ) ) . toBeInTheDocument ( ) ;
3542
3643 expect ( getMenuItems ( ) . length ) . toEqual ( 1 ) ;
37- await userEvent . click ( getMenuItem ( ) ) ;
44+ await clickChevron ( ) ;
3845 expect ( getMenuItems ( ) . length ) . toEqual ( 4 ) ;
3946
4047 expect ( getBrokers ( ) ) . toBeInTheDocument ( ) ;
4148 expect ( getTopics ( ) ) . toBeInTheDocument ( ) ;
4249 expect ( getConsumers ( ) ) . toBeInTheDocument ( ) ;
4350 } ) ;
51+
4452 it ( 'renders cluster menu with correct set of features' , async ( ) => {
4553 render (
4654 setupComponent ( {
@@ -53,7 +61,7 @@ describe('ClusterMenu', () => {
5361 } )
5462 ) ;
5563 expect ( getMenuItems ( ) . length ) . toEqual ( 1 ) ;
56- await userEvent . click ( getMenuItem ( ) ) ;
64+ await clickChevron ( ) ;
5765 expect ( getMenuItems ( ) . length ) . toEqual ( 7 ) ;
5866
5967 expect ( getBrokers ( ) ) . toBeInTheDocument ( ) ;
@@ -63,6 +71,7 @@ describe('ClusterMenu', () => {
6371 expect ( getKafkaConnect ( ) ) . toBeInTheDocument ( ) ;
6472 expect ( screen . getByTitle ( 'KSQL DB' ) ) . toBeInTheDocument ( ) ;
6573 } ) ;
74+
6675 it ( 'renders open cluster menu' , ( ) => {
6776 render ( setupComponent ( onlineClusterPayload , true ) , {
6877 initialEntries : [ clusterConnectorsPath ( onlineClusterPayload . name ) ] ,
@@ -74,6 +83,7 @@ describe('ClusterMenu', () => {
7483 expect ( getTopics ( ) ) . toBeInTheDocument ( ) ;
7584 expect ( getConsumers ( ) ) . toBeInTheDocument ( ) ;
7685 } ) ;
86+
7787 it ( 'makes Kafka Connect link active' , async ( ) => {
7888 render (
7989 setupComponent ( {
@@ -83,7 +93,7 @@ describe('ClusterMenu', () => {
8393 { initialEntries : [ clusterConnectorsPath ( onlineClusterPayload . name ) ] }
8494 ) ;
8595 expect ( getMenuItems ( ) . length ) . toEqual ( 1 ) ;
86- await userEvent . click ( getMenuItem ( ) ) ;
96+ await clickChevron ( ) ;
8797 expect ( getMenuItems ( ) . length ) . toEqual ( 5 ) ;
8898
8999 const kafkaConnect = getKafkaConnect ( ) ;
0 commit comments