@@ -9,6 +9,7 @@ import React from 'react'
99import { SetupSection , SetupData } from 'dvc/src/setup/webview/contract'
1010import { App } from './App'
1111import { vsCodeApi } from '../../shared/api'
12+ import { TooltipIconType } from '../../shared/components/sectionContainer/InfoTooltip'
1213
1314jest . mock ( '../../shared/api' )
1415jest . mock ( '../../shared/components/codeSlider/CodeSlider' )
@@ -629,6 +630,58 @@ describe('App', () => {
629630 type : MessageFromWebviewType . SELECT_PYTHON_INTERPRETER
630631 } )
631632 } )
633+
634+ it ( 'should show an error icon if DVC is not setup' , ( ) => {
635+ renderApp ( {
636+ canGitInitialize : false ,
637+ cliCompatible : true ,
638+ dvcCliDetails : {
639+ command : 'python -m dvc' ,
640+ version : '1.0.0'
641+ } ,
642+ hasData : false ,
643+ isPythonExtensionUsed : false ,
644+ isStudioConnected : false ,
645+ needsGitCommit : false ,
646+ needsGitInitialized : undefined ,
647+ projectInitialized : false ,
648+ pythonBinPath : undefined ,
649+ sectionCollapsed : undefined ,
650+ shareLiveToStudio : false
651+ } )
652+
653+ const iconWrapper = screen . getAllByTestId ( 'info-tooltip-toggle' ) [ 0 ]
654+
655+ expect (
656+ within ( iconWrapper ) . getByTestId ( TooltipIconType . ERROR )
657+ ) . toBeInTheDocument ( )
658+ } )
659+
660+ it ( 'should show a passed icon if DVC CLI is compatible and project is initialized' , ( ) => {
661+ renderApp ( {
662+ canGitInitialize : false ,
663+ cliCompatible : true ,
664+ dvcCliDetails : {
665+ command : 'python -m dvc' ,
666+ version : '1.0.0'
667+ } ,
668+ hasData : true ,
669+ isPythonExtensionUsed : true ,
670+ isStudioConnected : true ,
671+ needsGitCommit : false ,
672+ needsGitInitialized : false ,
673+ projectInitialized : true ,
674+ pythonBinPath : 'python' ,
675+ sectionCollapsed : undefined ,
676+ shareLiveToStudio : false
677+ } )
678+
679+ const iconWrapper = screen . getAllByTestId ( 'info-tooltip-toggle' ) [ 0 ]
680+
681+ expect (
682+ within ( iconWrapper ) . getByTestId ( TooltipIconType . PASSED )
683+ ) . toBeInTheDocument ( )
684+ } )
632685 } )
633686
634687 describe ( 'Experiments' , ( ) => {
@@ -823,6 +876,84 @@ describe('App', () => {
823876 type : MessageFromWebviewType . OPEN_EXPERIMENTS_WEBVIEW
824877 } )
825878 } )
879+
880+ it ( 'should show an error icon if experiments are not setup' , ( ) => {
881+ renderApp ( {
882+ canGitInitialize : false ,
883+ cliCompatible : true ,
884+ dvcCliDetails : {
885+ command : 'python -m dvc' ,
886+ version : '1.0.0'
887+ } ,
888+ hasData : false ,
889+ isPythonExtensionUsed : false ,
890+ isStudioConnected : false ,
891+ needsGitCommit : false ,
892+ needsGitInitialized : undefined ,
893+ projectInitialized : true ,
894+ pythonBinPath : undefined ,
895+ sectionCollapsed : undefined ,
896+ shareLiveToStudio : false
897+ } )
898+
899+ const iconWrapper = screen . getAllByTestId ( 'info-tooltip-toggle' ) [ 1 ]
900+
901+ expect (
902+ within ( iconWrapper ) . getByTestId ( TooltipIconType . ERROR )
903+ ) . toBeInTheDocument ( )
904+ } )
905+
906+ it ( 'should show an error icon if dvc is not setup' , ( ) => {
907+ renderApp ( {
908+ canGitInitialize : false ,
909+ cliCompatible : false ,
910+ dvcCliDetails : {
911+ command : 'dvc' ,
912+ version : '1.0.0'
913+ } ,
914+ hasData : false ,
915+ isPythonExtensionUsed : false ,
916+ isStudioConnected : false ,
917+ needsGitCommit : false ,
918+ needsGitInitialized : undefined ,
919+ projectInitialized : false ,
920+ pythonBinPath : undefined ,
921+ sectionCollapsed : undefined ,
922+ shareLiveToStudio : false
923+ } )
924+
925+ const iconWrapper = screen . getAllByTestId ( 'info-tooltip-toggle' ) [ 1 ]
926+
927+ expect (
928+ within ( iconWrapper ) . getByTestId ( TooltipIconType . ERROR )
929+ ) . toBeInTheDocument ( )
930+ } )
931+
932+ it ( 'should show a passed icon if experiments are setup' , ( ) => {
933+ renderApp ( {
934+ canGitInitialize : false ,
935+ cliCompatible : true ,
936+ dvcCliDetails : {
937+ command : 'python -m dvc' ,
938+ version : '1.0.0'
939+ } ,
940+ hasData : true ,
941+ isPythonExtensionUsed : true ,
942+ isStudioConnected : true ,
943+ needsGitCommit : false ,
944+ needsGitInitialized : false ,
945+ projectInitialized : true ,
946+ pythonBinPath : 'python' ,
947+ sectionCollapsed : undefined ,
948+ shareLiveToStudio : false
949+ } )
950+
951+ const iconWrapper = screen . getAllByTestId ( 'info-tooltip-toggle' ) [ 1 ]
952+
953+ expect (
954+ within ( iconWrapper ) . getByTestId ( TooltipIconType . PASSED )
955+ ) . toBeInTheDocument ( )
956+ } )
826957 } )
827958
828959 describe ( 'Studio not connected' , ( ) => {
@@ -933,6 +1064,58 @@ describe('App', () => {
9331064 type : MessageFromWebviewType . SAVE_STUDIO_TOKEN
9341065 } )
9351066 } )
1067+
1068+ it ( 'should show an error icon if dvc is not compatible' , ( ) => {
1069+ renderApp ( {
1070+ canGitInitialize : false ,
1071+ cliCompatible : false ,
1072+ dvcCliDetails : {
1073+ command : 'python -m dvc' ,
1074+ version : '1.0.0'
1075+ } ,
1076+ hasData : false ,
1077+ isPythonExtensionUsed : false ,
1078+ isStudioConnected : false ,
1079+ needsGitCommit : false ,
1080+ needsGitInitialized : undefined ,
1081+ projectInitialized : true ,
1082+ pythonBinPath : undefined ,
1083+ sectionCollapsed : undefined ,
1084+ shareLiveToStudio : false
1085+ } )
1086+
1087+ const iconWrapper = screen . getAllByTestId ( 'info-tooltip-toggle' ) [ 2 ]
1088+
1089+ expect (
1090+ within ( iconWrapper ) . getByTestId ( TooltipIconType . ERROR )
1091+ ) . toBeInTheDocument ( )
1092+ } )
1093+
1094+ it ( 'should show an info icon if dvc is compatible but studio is not connected' , ( ) => {
1095+ renderApp ( {
1096+ canGitInitialize : false ,
1097+ cliCompatible : true ,
1098+ dvcCliDetails : {
1099+ command : 'python -m dvc' ,
1100+ version : '1.0.0'
1101+ } ,
1102+ hasData : true ,
1103+ isPythonExtensionUsed : true ,
1104+ isStudioConnected : false ,
1105+ needsGitCommit : false ,
1106+ needsGitInitialized : false ,
1107+ projectInitialized : true ,
1108+ pythonBinPath : 'python' ,
1109+ sectionCollapsed : undefined ,
1110+ shareLiveToStudio : false
1111+ } )
1112+
1113+ const iconWrapper = screen . getAllByTestId ( 'info-tooltip-toggle' ) [ 2 ]
1114+
1115+ expect (
1116+ within ( iconWrapper ) . getByTestId ( TooltipIconType . INFO )
1117+ ) . toBeInTheDocument ( )
1118+ } )
9361119 } )
9371120
9381121 describe ( 'Studio connected' , ( ) => {
@@ -990,6 +1173,32 @@ describe('App', () => {
9901173 type : MessageFromWebviewType . SAVE_STUDIO_TOKEN
9911174 } )
9921175 } )
1176+
1177+ it ( 'should show a passed icon if connected' , ( ) => {
1178+ renderApp ( {
1179+ canGitInitialize : false ,
1180+ cliCompatible : true ,
1181+ dvcCliDetails : {
1182+ command : 'python -m dvc' ,
1183+ version : '1.0.0'
1184+ } ,
1185+ hasData : false ,
1186+ isPythonExtensionUsed : false ,
1187+ isStudioConnected : true ,
1188+ needsGitCommit : true ,
1189+ needsGitInitialized : false ,
1190+ projectInitialized : true ,
1191+ pythonBinPath : undefined ,
1192+ sectionCollapsed : undefined ,
1193+ shareLiveToStudio : false
1194+ } )
1195+
1196+ const iconWrapper = screen . getAllByTestId ( 'info-tooltip-toggle' ) [ 2 ]
1197+
1198+ expect (
1199+ within ( iconWrapper ) . getByTestId ( TooltipIconType . PASSED )
1200+ ) . toBeInTheDocument ( )
1201+ } )
9931202 } )
9941203
9951204 describe ( 'focused section' , ( ) => {
0 commit comments