@@ -11,6 +11,7 @@ import {
1111 buildMockWorkspaceCreate ,
1212 buildMockWorkspaceKind ,
1313} from '~/shared/mock/mockBuilder' ;
14+ import { interceptListValues } from '~/__tests__/cypress/cypress/utils/testBuilders' ;
1415import { navBar } from '~/__tests__/cypress/cypress/pages/components/navBar' ;
1516import {
1617 secretsDetachModal ,
@@ -119,6 +120,8 @@ describe('Create workspace', () => {
119120 mockModArchResponse ( [ mockWorkspaceKind ] ) ,
120121 ) . as ( 'getWorkspaceKinds' ) ;
121122
123+ interceptListValues ( mockWorkspaceKind ) ;
124+
122125 workspaces . visit ( ) ;
123126 cy . wait ( '@getNamespaces' ) ;
124127
@@ -364,6 +367,7 @@ describe('Create workspace', () => {
364367 { path : { apiVersion : NOTEBOOKS_API_VERSION } } ,
365368 mockModArchResponse ( [ mockWorkspaceKindWithMultipleImages ] ) ,
366369 ) . as ( 'getWorkspaceKindsMultiple' ) ;
370+ interceptListValues ( mockWorkspaceKindWithMultipleImages ) ;
367371
368372 createWorkspace . visit ( ) ;
369373 cy . wait ( '@getWorkspaceKindsMultiple' ) ;
@@ -414,6 +418,7 @@ describe('Create workspace', () => {
414418 { path : { apiVersion : NOTEBOOKS_API_VERSION } } ,
415419 mockModArchResponse ( [ mockWorkspaceKindWithMultiplePodConfigs ] ) ,
416420 ) . as ( 'getWorkspaceKindsMultiplePodConfigs' ) ;
421+ interceptListValues ( mockWorkspaceKindWithMultiplePodConfigs ) ;
417422
418423 createWorkspace . visit ( ) ;
419424 cy . wait ( '@getWorkspaceKindsMultiplePodConfigs' ) ;
@@ -451,6 +456,8 @@ describe('Create workspace', () => {
451456 { path : { apiVersion : NOTEBOOKS_API_VERSION } } ,
452457 mockModArchResponse ( [ mockWorkspaceKind , mockWorkspaceKind2 ] ) ,
453458 ) . as ( 'getMultipleWorkspaceKinds' ) ;
459+ interceptListValues ( mockWorkspaceKind ) ;
460+ interceptListValues ( mockWorkspaceKind2 ) ;
454461
455462 createWorkspace . visit ( ) ;
456463 cy . wait ( '@getMultipleWorkspaceKinds' ) ;
@@ -528,6 +535,7 @@ describe('Create workspace', () => {
528535 { path : { apiVersion : NOTEBOOKS_API_VERSION } } ,
529536 mockModArchResponse ( [ mockWorkspaceKindSingleImage ] ) ,
530537 ) . as ( 'getWorkspaceKindsSingleImage' ) ;
538+ interceptListValues ( mockWorkspaceKindSingleImage ) ;
531539
532540 createWorkspace . visit ( ) ;
533541 cy . wait ( '@getWorkspaceKindsSingleImage' ) ;
@@ -564,6 +572,7 @@ describe('Create workspace', () => {
564572 { path : { apiVersion : NOTEBOOKS_API_VERSION } } ,
565573 mockModArchResponse ( [ mockWorkspaceKindSinglePodConfig ] ) ,
566574 ) . as ( 'getWorkspaceKindsSinglePodConfig' ) ;
575+ interceptListValues ( mockWorkspaceKindSinglePodConfig ) ;
567576
568577 createWorkspace . visit ( ) ;
569578 cy . wait ( '@getWorkspaceKindsSinglePodConfig' ) ;
@@ -691,6 +700,7 @@ describe('Create workspace', () => {
691700 { path : { apiVersion : NOTEBOOKS_API_VERSION } } ,
692701 mockModArchResponse ( [ mockWorkspaceKindWithMultipleOptions ] ) ,
693702 ) . as ( 'getWorkspaceKindsWithOptions' ) ;
703+ interceptListValues ( mockWorkspaceKindWithMultipleOptions ) ;
694704 } ) ;
695705
696706 it ( 'should filter images by name' , ( ) => {
@@ -742,6 +752,7 @@ describe('Create workspace', () => {
742752 { path : { apiVersion : NOTEBOOKS_API_VERSION } } ,
743753 mockModArchResponse ( [ mockWorkspaceKindWithMultipleOptions ] ) ,
744754 ) . as ( 'getWorkspaceKindsWithOptions' ) ;
755+ interceptListValues ( mockWorkspaceKindWithMultipleOptions ) ;
745756 } ) ;
746757
747758 it ( 'should filter pod configs by name' , ( ) => {
@@ -1431,4 +1442,145 @@ describe('Create workspace', () => {
14311442 } ) ;
14321443 } ) ;
14331444 } ) ;
1445+
1446+ describe ( 'ListValues options' , ( ) => {
1447+ const cpuImage : OptionsImageConfigValue = {
1448+ id : 'jupyter_cpu' ,
1449+ displayName : 'jupyter-scipy:v2.1.0' ,
1450+ description : 'JupyterLab, CPU only' ,
1451+ labels : [ { key : 'pythonVersion' , value : '3.13' } ] ,
1452+ hidden : false ,
1453+ } ;
1454+
1455+ const cudaImage : OptionsImageConfigValue = {
1456+ id : 'jupyter_cuda' ,
1457+ displayName : 'jupyter-scipy:v2.1.0-cuda' ,
1458+ description : 'JupyterLab with CUDA support' ,
1459+ labels : [
1460+ { key : 'pythonVersion' , value : '3.13' } ,
1461+ { key : 'cuda' , value : '12.4' } ,
1462+ { key : 'gpuRequired' , value : 'true' } ,
1463+ ] ,
1464+ hidden : false ,
1465+ } ;
1466+
1467+ const smallCpuPod : OptionsPodConfigValue = {
1468+ id : 'small_cpu' ,
1469+ displayName : 'Small CPU' ,
1470+ description : 'Pod with 0.5 CPU, 512 Mb RAM' ,
1471+ labels : [
1472+ { key : 'cpu' , value : '500m' } ,
1473+ { key : 'memory' , value : '512Mi' } ,
1474+ ] ,
1475+ hidden : false ,
1476+ } ;
1477+
1478+ const bigGpuPod : OptionsPodConfigValue = {
1479+ id : 'big_gpu' ,
1480+ displayName : 'Big GPU' ,
1481+ description : 'Pod with 4 CPU, 16 GB RAM, and 1 GPU' ,
1482+ labels : [
1483+ { key : 'cpu' , value : '4000m' } ,
1484+ { key : 'memory' , value : '16Gi' } ,
1485+ { key : 'gpu' , value : '1' } ,
1486+ ] ,
1487+ hidden : false ,
1488+ } ;
1489+
1490+ it ( 'should show all images and pod configs from listValues response' , ( ) => {
1491+ const kind = buildMockWorkspaceKind ( {
1492+ podTemplate : {
1493+ ...mockWorkspaceKind . podTemplate ,
1494+ options : {
1495+ imageConfig : { default : cpuImage . id , values : [ cpuImage , cudaImage ] } ,
1496+ podConfig : { default : smallCpuPod . id , values : [ smallCpuPod , bigGpuPod ] } ,
1497+ } ,
1498+ } ,
1499+ } ) ;
1500+
1501+ cy . interceptApi (
1502+ 'GET /api/:apiVersion/workspacekinds' ,
1503+ { path : { apiVersion : NOTEBOOKS_API_VERSION } } ,
1504+ mockModArchResponse ( [ kind ] ) ,
1505+ ) . as ( 'getWorkspaceKindsListValues' ) ;
1506+ interceptListValues ( kind ) ;
1507+
1508+ createWorkspace . visit ( ) ;
1509+ cy . wait ( '@getWorkspaceKindsListValues' ) ;
1510+
1511+ createWorkspace . selectKind ( kind . name ) ;
1512+ createWorkspace . clickNext ( ) ;
1513+
1514+ createWorkspace . findImageCard ( cpuImage . id ) . should ( 'be.visible' ) ;
1515+ createWorkspace . findImageCard ( cudaImage . id ) . should ( 'be.visible' ) ;
1516+
1517+ createWorkspace . selectImage ( cudaImage . id ) ;
1518+ createWorkspace . clickNext ( ) ;
1519+
1520+ createWorkspace . findPodConfigCard ( smallCpuPod . id ) . should ( 'be.visible' ) ;
1521+ createWorkspace . findPodConfigCard ( bigGpuPod . id ) . should ( 'be.visible' ) ;
1522+ } ) ;
1523+
1524+ it ( 'should show only CPU pod configs when listValues returns no GPU options' , ( ) => {
1525+ const kind = buildMockWorkspaceKind ( {
1526+ podTemplate : {
1527+ ...mockWorkspaceKind . podTemplate ,
1528+ options : {
1529+ imageConfig : { default : cpuImage . id , values : [ cpuImage ] } ,
1530+ podConfig : { default : smallCpuPod . id , values : [ smallCpuPod ] } ,
1531+ } ,
1532+ } ,
1533+ } ) ;
1534+
1535+ cy . interceptApi (
1536+ 'GET /api/:apiVersion/workspacekinds' ,
1537+ { path : { apiVersion : NOTEBOOKS_API_VERSION } } ,
1538+ mockModArchResponse ( [ kind ] ) ,
1539+ ) . as ( 'getWorkspaceKindsListValues' ) ;
1540+ interceptListValues ( kind ) ;
1541+
1542+ createWorkspace . visit ( ) ;
1543+ cy . wait ( '@getWorkspaceKindsListValues' ) ;
1544+
1545+ createWorkspace . selectKind ( kind . name ) ;
1546+ createWorkspace . clickNext ( ) ;
1547+
1548+ createWorkspace . selectImage ( cpuImage . id ) ;
1549+ createWorkspace . clickNext ( ) ;
1550+
1551+ createWorkspace . findPodConfigCard ( smallCpuPod . id ) . should ( 'be.visible' ) ;
1552+ createWorkspace . findPodConfigCard ( bigGpuPod . id ) . should ( 'not.exist' ) ;
1553+ } ) ;
1554+
1555+ it ( 'should auto-select default image and pod config from listValues' , ( ) => {
1556+ const kind = buildMockWorkspaceKind ( {
1557+ podTemplate : {
1558+ ...mockWorkspaceKind . podTemplate ,
1559+ options : {
1560+ imageConfig : { default : cudaImage . id , values : [ cpuImage , cudaImage ] } ,
1561+ podConfig : { default : bigGpuPod . id , values : [ smallCpuPod , bigGpuPod ] } ,
1562+ } ,
1563+ } ,
1564+ } ) ;
1565+
1566+ cy . interceptApi (
1567+ 'GET /api/:apiVersion/workspacekinds' ,
1568+ { path : { apiVersion : NOTEBOOKS_API_VERSION } } ,
1569+ mockModArchResponse ( [ kind ] ) ,
1570+ ) . as ( 'getWorkspaceKindsListValues' ) ;
1571+ interceptListValues ( kind ) ;
1572+
1573+ createWorkspace . visit ( ) ;
1574+ cy . wait ( '@getWorkspaceKindsListValues' ) ;
1575+
1576+ createWorkspace . selectKind ( kind . name ) ;
1577+ createWorkspace . clickNext ( ) ;
1578+
1579+ createWorkspace . assertImageSelected ( cudaImage . id ) ;
1580+
1581+ createWorkspace . clickNext ( ) ;
1582+
1583+ createWorkspace . assertPodConfigSelected ( bigGpuPod . id ) ;
1584+ } ) ;
1585+ } ) ;
14341586} ) ;
0 commit comments