@@ -86,7 +86,7 @@ describe('Catalogue Items', () => {
8686 it ( 'navigates to items page with spares definition applied' , ( ) => {
8787 cy . visit ( '/catalogue/9/items' ) ;
8888
89- cy . findByRole ( 'link' , { name : '1' } ) . click ( ) ;
89+ cy . findAllByRole ( 'link' , { name : '1' } ) . first ( ) . click ( ) ;
9090
9191 cy . findByText ( 'dfzqkOJbqifO' ) . should ( 'exist' ) ;
9292
@@ -96,7 +96,7 @@ describe('Catalogue Items', () => {
9696 it ( 'navigates to items page with spares definition applied (from landing page)' , ( ) => {
9797 cy . visit ( '/catalogue/9/items/11' ) ;
9898
99- cy . findByRole ( 'link' , { name : '1' } ) . click ( ) ;
99+ cy . findAllByRole ( 'link' , { name : '1' } ) . first ( ) . click ( ) ;
100100
101101 cy . findByText ( 'dfzqkOJbqifO' ) . should ( 'exist' ) ;
102102
@@ -113,7 +113,7 @@ describe('Catalogue Items', () => {
113113
114114 cy . findAllByLabelText ( 'Expand' ) . eq ( 1 ) . click ( ) ;
115115
116- cy . findByRole ( 'link' , { name : '1' } ) . click ( ) ;
116+ cy . findAllByRole ( 'link' , { name : '1' } ) . first ( ) . click ( ) ;
117117
118118 cy . findByText ( 'dfzqkOJbqifO' ) . should ( 'exist' ) ;
119119
@@ -429,6 +429,29 @@ describe('Catalogue Items', () => {
429429 cy . findByText ( 'Cameras 4' ) . should ( 'exist' ) ;
430430 } ) ;
431431
432+ it ( 'displays the table view correctly (Criticality)' , ( ) => {
433+ cy . visit ( '/catalogue/6' ) ;
434+
435+ cy . setMode ( { critical : true } ) ;
436+ cy . findByText ( 'Wavefront Sensors 31' ) . should ( 'exist' ) ;
437+ cy . findByText ( 'Wavefront Sensors 30' ) . should ( 'exist' ) ;
438+
439+ cy . findByTestId ( 'ErrorIcon' ) . should ( 'exist' ) ;
440+ cy . findByTestId ( 'ErrorIcon' ) . trigger ( 'mouseover' ) ;
441+ cy . findByText ( 'This catalogue item is critical.' ) . should ( 'exist' ) ;
442+ } ) ;
443+
444+ it ( 'displays the catalogue item landing page (Criticality)' , ( ) => {
445+ cy . visit ( '/catalogue/6/items/10' ) ;
446+
447+ cy . setMode ( { critical : true } ) ;
448+
449+ cy . findByTestId ( 'ErrorIcon' ) . should ( 'exist' ) ;
450+ cy . findByTestId ( 'ErrorIcon' ) . trigger ( 'mouseover' ) ;
451+ cy . findByText ( 'This catalogue item is critical.' ) . should ( 'exist' ) ;
452+ cy . findAllByText ( '-4.6' ) . should ( 'have.length' , 2 ) ;
453+ } ) ;
454+
432455 it ( 'navigates to the landing page and navigates back to the table view' , ( ) => {
433456 cy . findByText ( 'Cameras 1' ) . click ( ) ;
434457 cy . findByText (
@@ -502,8 +525,6 @@ describe('Catalogue Items', () => {
502525 cy . url ( ) . should ( 'contain' , '/manufacturers/1' ) ;
503526 } ) ;
504527
505-
506-
507528 it ( 'checks the href property of the manufacturer link' , ( ) => {
508529 cy . findByRole ( 'button' , { name : 'Show/Hide columns' } ) . click ( ) ;
509530 cy . findByText ( 'Hide all' ) . click ( ) ;
@@ -758,6 +779,7 @@ describe('Catalogue Items', () => {
758779 } ) ;
759780
760781 it ( 'check table state persists on page reload' , ( ) => {
782+ cy . setMode ( { critical : false } ) ;
761783 cy . findByText ( 'Cameras 1' ) . should ( 'exist' ) ;
762784 cy . findByRole ( 'button' , { name : 'Clear Filters' } ) . should ( 'be.disabled' ) ;
763785
@@ -940,7 +962,14 @@ describe('Catalogue Items', () => {
940962 it ( 'can navigate to an items page from the table view' , ( ) => {
941963 cy . visit ( '/catalogue/5' ) ;
942964
943- cy . findAllByRole ( 'link' , { name : 'Click here' } ) . eq ( 0 ) . click ( ) ;
965+ cy . findAllByRole ( 'link' , { name : 'Click here' } ) . first ( ) . scrollIntoView ( ) ;
966+ cy . findAllByRole ( 'link' , { name : 'Click here' } )
967+ . first ( )
968+ . should ( 'be.visible' ) ;
969+
970+ cy . findAllByRole ( 'link' , { name : 'Click here' } )
971+ . first ( )
972+ . click ( { force : true } ) ;
944973
945974 cy . url ( ) . should ( 'contain' , 'catalogue/5/items/89/items' ) ;
946975 } ) ;
@@ -1102,6 +1131,9 @@ describe('Catalogue Items', () => {
11021131 created_time : '2024-01-01T12:00:00.000+00:00' ,
11031132 modified_time : '2024-01-02T13:10:10.000+00:00' ,
11041133 number_of_spares : 0 ,
1134+ number_of_spares_required : null ,
1135+ criticality : null ,
1136+ is_flagged : false ,
11051137 } )
11061138 ) ;
11071139 expect ( JSON . stringify ( await patchRequests [ 1 ] . json ( ) ) ) . equal (
@@ -1128,6 +1160,9 @@ describe('Catalogue Items', () => {
11281160 created_time : '2024-01-01T12:00:00.000+00:00' ,
11291161 modified_time : '2024-01-02T13:10:10.000+00:00' ,
11301162 number_of_spares : 0 ,
1163+ number_of_spares_required : null ,
1164+ criticality : null ,
1165+ is_flagged : false ,
11311166 } )
11321167 ) ;
11331168 } ) ;
0 commit comments