@@ -56,7 +56,7 @@ describe('GpuComparisonCard', () => {
5656 { value : 'h200_sglang' , label : 'H200 SGLang' } ,
5757 ] ;
5858
59- it ( 'renders two required GPU slots and an Add GPU button; date range disabled ' , ( ) => {
59+ it ( 'renders GPU multiselect; date range disabled until a GPU is selected ' , ( ) => {
6060 mountWithProviders ( < GpuComparisonCard /> , {
6161 inference : {
6262 selectedGPUs : [ ] ,
@@ -66,11 +66,16 @@ describe('GpuComparisonCard', () => {
6666
6767 cy . get ( '[data-testid="gpu-comparison-card"]' ) . should ( 'be.visible' ) ;
6868 cy . contains ( 'GPU Comparison' ) . should ( 'be.visible' ) ;
69- cy . get ( '[data-testid="gpu-comparison-select-1"]' ) . should ( 'be.visible' ) ;
70- cy . get ( '[data-testid="gpu-comparison-select-2"]' ) . should ( 'be.visible' ) ;
71- cy . get ( '[data-testid="gpu-comparison-select-3"]' ) . should ( 'not.exist' ) ;
72- cy . get ( '[data-testid="gpu-comparison-select-4"]' ) . should ( 'not.exist' ) ;
73- cy . get ( '[data-testid="gpu-comparison-add-slot"]' ) . should ( 'be.visible' ) ;
69+ cy . contains ( 'Select one or more GPUs for date range comparison.' ) . should ( 'not.exist' ) ;
70+ cy . get ( '[data-testid="gpu-comparison-expand-toggle"]' ) . should (
71+ 'have.attr' ,
72+ 'aria-expanded' ,
73+ 'false' ,
74+ ) ;
75+ cy . get ( '[data-testid="gpu-comparison-expand-toggle"]' ) . click ( ) ;
76+ cy . contains ( 'Select one or more GPUs for date range comparison.' ) . should ( 'be.visible' ) ;
77+ cy . get ( '[data-testid="gpu-multiselect"]' ) . should ( 'be.visible' ) ;
78+ cy . get ( '[data-testid="gpu-multiselect-trigger"]' ) . should ( 'be.visible' ) ;
7479 cy . contains ( 'Comparison Date Range' ) . should ( 'be.visible' ) ;
7580 cy . get ( '#gpu-comparison-date-picker' ) . should ( 'be.disabled' ) ;
7681 cy . get ( '[data-testid="date-range-shortcuts"]' ) . should ( 'be.visible' ) ;
@@ -79,6 +84,20 @@ describe('GpuComparisonCard', () => {
7984 cy . get ( '[data-testid="date-shortcut-last-30-days"]' ) . should ( 'be.disabled' ) ;
8085 } ) ;
8186
87+ it ( 'enables date range picker and shortcuts when one GPU is selected' , ( ) => {
88+ mountWithProviders ( < GpuComparisonCard /> , {
89+ inference : {
90+ selectedGPUs : [ 'h100_sglang' ] ,
91+ selectedDateRange : { startDate : '' , endDate : '' } ,
92+ availableGPUs : gpuOptions ,
93+ dateRangeAvailableDates : [ '2025-10-05' , '2025-11-01' , '2025-12-01' ] ,
94+ } ,
95+ } ) ;
96+
97+ cy . get ( '#gpu-comparison-date-picker' ) . should ( 'not.be.disabled' ) ;
98+ cy . get ( '[data-testid="date-shortcut-all-time"]' ) . should ( 'not.be.disabled' ) ;
99+ } ) ;
100+
82101 it ( 'shows enabled shortcut buttons that call setSelectedDateRange when two GPUs are selected' , ( ) => {
83102 mountWithProviders ( < GpuComparisonCard /> , {
84103 inference : {
@@ -101,7 +120,7 @@ describe('GpuComparisonCard', () => {
101120 cy . get ( '@setSelectedDateRange' ) . should ( 'have.been.calledOnce' ) ;
102121 } ) ;
103122
104- it ( 'shows slot 3 after clicking Add GPU when two GPUs are selected ' , ( ) => {
123+ it ( 'selecting a third GPU from the multiselect calls setSelectedGPUs with three GPUs ' , ( ) => {
105124 mountWithProviders ( < GpuComparisonCard /> , {
106125 inference : {
107126 selectedGPUs : [ 'h100_sglang' , 'b200_sglang' ] ,
@@ -111,29 +130,32 @@ describe('GpuComparisonCard', () => {
111130 } ) ;
112131
113132 cy . get ( '#gpu-comparison-date-picker' ) . should ( 'not.be.disabled' ) ;
114- cy . get ( '[data-testid="gpu-comparison-select-3"]' ) . should ( 'not.exist' ) ;
115- cy . get ( '[data-testid="gpu-comparison-add-slot"]' ) . click ( ) ;
116- cy . get ( '[data-testid="gpu-comparison-select-3"]' ) . should ( 'be.visible' ) ;
117- cy . get ( '[data-testid="gpu-comparison-select-4"]' ) . should ( 'not.exist' ) ;
118- cy . get ( '[data-testid="gpu-comparison-add-slot"]' ) . should ( 'be.visible' ) ;
133+ cy . get ( '[data-testid="gpu-multiselect-trigger"]' ) . click ( ) ;
134+ cy . contains ( '[role="option"]' , 'MI300X SGLang' ) . click ( ) ;
135+ cy . get ( '@setSelectedGPUs' ) . should (
136+ 'have.been.calledWith' ,
137+ Cypress . sinon . match ( ( v : string [ ] ) => v . length === 3 && v . includes ( 'mi300x_sglang' ) ) ,
138+ ) ;
119139 } ) ;
120140
121- it ( 'shows all four slots when mounted with three GPUs and Add GPU clicked ' , ( ) => {
141+ it ( 'shows max-selection summary when four GPUs are selected ' , ( ) => {
122142 mountWithProviders ( < GpuComparisonCard /> , {
123143 inference : {
124- selectedGPUs : [ 'h100_sglang' , 'b200_sglang' , 'mi300x_sglang' ] ,
144+ selectedGPUs : [ 'h100_sglang' , 'b200_sglang' , 'mi300x_sglang' , 'h200_sglang' ] ,
125145 selectedDateRange : { startDate : '' , endDate : '' } ,
126146 availableGPUs : gpuOptions ,
127147 } ,
128148 } ) ;
129149
130- cy . get ( '[data-testid="gpu-comparison-select-3"]' ) . should ( 'be.visible' ) ;
131- cy . get ( '[data-testid="gpu-comparison-add-slot"]' ) . click ( ) ;
132- cy . get ( '[data-testid="gpu-comparison-select-4"]' ) . should ( 'be.visible' ) ;
133- cy . get ( '[data-testid="gpu-comparison-add-slot"]' ) . should ( 'not.exist' ) ;
150+ // Wait for card expansion, then open the dropdown.
151+ // With 4 chips the center of the trigger may land on a chip's remove
152+ // button (which stopPropagates), so target the chevron icon instead.
153+ cy . get ( '[data-testid="gpu-multiselect-trigger"]' ) . should ( 'be.visible' ) ;
154+ cy . get ( '[data-testid="gpu-multiselect-trigger"] svg' ) . last ( ) . click ( ) ;
155+ cy . contains ( '4 / 4 selected' ) . should ( 'be.visible' ) ;
134156 } ) ;
135157
136- it ( 'calls setSelectedGPUs without the removed GPU when its X button is clicked' , ( ) => {
158+ it ( 'calls setSelectedGPUs without the removed GPU when a chip remove control is clicked' , ( ) => {
137159 mountWithProviders ( < GpuComparisonCard /> , {
138160 inference : {
139161 selectedGPUs : [ 'h100_sglang' , 'b200_sglang' , 'mi300x_sglang' ] ,
@@ -142,8 +164,7 @@ describe('GpuComparisonCard', () => {
142164 } ,
143165 } ) ;
144166
145- cy . get ( '[data-testid="gpu-comparison-select-3"]' ) . should ( 'be.visible' ) ;
146- cy . get ( '[data-testid="gpu-comparison-clear-3"]' ) . click ( ) ;
167+ cy . get ( '[aria-label="Remove MI300X SGLang"]' ) . click ( ) ;
147168 cy . get ( '@setSelectedGPUs' ) . should (
148169 'have.been.calledWith' ,
149170 Cypress . sinon . match ( ( v : string [ ] ) => v . length === 2 && ! v . includes ( 'mi300x_sglang' ) ) ,
0 commit comments