5555 </div >
5656 <div
5757 class =" font-medium pt-2 text-indigo-600 text-18px leading-28px"
58- :class =" { 'text-jade-600': browser.isSelected , 'text-gray-500': browser.disabled || !browser.isVersionSupported }"
58+ :class =" { 'text-jade-600': checked , 'text-gray-500': browser.disabled || !browser.isVersionSupported }"
5959 >
6060 {{ browser.displayName }}
6161 </div >
7070 class =" mb-14"
7171 >
7272 <div class =" flex mb-4 gap-16px items-center justify-center" >
73- <template v-if =" browserStatus .closed || browserStatus .opening " >
74- <Button
75- v-if =" browserStatus.closed"
76- size =" lg"
77- type =" submit"
78- :prefix-icon =" testingTypeIcon"
79- prefix-icon-class =" icon-dark-white"
80- variant =" secondary"
81- data-cy =" launch-button"
82- class =" font-medium"
83- >
84- {{ browserText[props.gql.currentTestingType].start }}
85- </Button >
86- <Button
87- v-else
88- size =" lg"
89- type =" button"
90- disabled
91- variant =" pending"
92- class =" font-medium disabled:cursor-default"
93- :prefix-icon =" StatusRunningIcon"
94- prefix-icon-class =" icon-light-gray-300 icon-dark-white animate-spin"
95- >
96- {{ browserText[props.gql.currentTestingType].opening }}
97- </Button >
98- </template >
99-
100- <template v-else >
101- <Button
102- size =" lg"
103- type =" button"
104- disabled
105- variant =" pending"
106- :prefix-icon =" testingTypeIcon"
107- prefix-icon-class =" icon-dark-white"
108- class =" font-medium disabled:cursor-default"
109- >
110- {{ browserText.running }}
111- </Button >
112- <Button
113- v-if =" props.gql.currentBrowser?.isFocusSupported"
114- size =" lg"
115- type =" button"
116- variant =" outline"
117- :prefix-icon =" ExportIcon"
118- prefix-icon-class =" icon-dark-gray-500"
119- class =" font-medium"
120- @click =" emit('focusBrowser')"
121- >
122- {{ browserText.focus }}
123- </Button >
124- <Button
125- size =" lg"
126- type =" button"
127- variant =" outline"
128- :prefix-icon =" PowerStandbyIcon"
129- prefix-icon-class =" icon-dark-gray-500"
130- class =" font-medium"
131- @click =" emit('closeBrowser')"
132- >
133- {{ browserText.close }}
134- </Button >
73+ <template v-if =" selectedBrowserId " >
74+ <template v-if =" browserStatus .closed || browserStatus .opening " >
75+ <Button
76+ v-if =" browserStatus.closed"
77+ size =" lg"
78+ type =" submit"
79+ :prefix-icon =" testingTypeIcon"
80+ prefix-icon-class =" icon-dark-white"
81+ variant =" secondary"
82+ data-cy =" launch-button"
83+ class =" font-medium"
84+ >
85+ {{ browserText[props.gql.currentTestingType].start }}
86+ </Button >
87+ <Button
88+ v-else
89+ size =" lg"
90+ type =" button"
91+ disabled
92+ variant =" pending"
93+ class =" font-medium disabled:cursor-default"
94+ :prefix-icon =" StatusRunningIcon"
95+ prefix-icon-class =" icon-light-gray-300 icon-dark-white animate-spin"
96+ >
97+ {{ browserText[props.gql.currentTestingType].opening }}
98+ </Button >
99+ </template >
100+ <template v-else >
101+ <Button
102+ size =" lg"
103+ type =" button"
104+ disabled
105+ variant =" pending"
106+ :prefix-icon =" testingTypeIcon"
107+ prefix-icon-class =" icon-dark-white"
108+ class =" font-medium disabled:cursor-default"
109+ >
110+ {{ browserText.running }}
111+ </Button >
112+ <Button
113+ v-if =" props.gql.currentBrowser?.isFocusSupported"
114+ size =" lg"
115+ type =" button"
116+ variant =" outline"
117+ :prefix-icon =" ExportIcon"
118+ prefix-icon-class =" icon-dark-gray-500"
119+ class =" font-medium"
120+ @click =" emit('focusBrowser')"
121+ >
122+ {{ browserText.focus }}
123+ </Button >
124+ <Button
125+ size =" lg"
126+ type =" button"
127+ variant =" outline"
128+ :prefix-icon =" PowerStandbyIcon"
129+ prefix-icon-class =" icon-dark-gray-500"
130+ class =" font-medium"
131+ @click =" emit('closeBrowser')"
132+ >
133+ {{ browserText.close }}
134+ </Button >
135+ </template >
135136 </template >
136137 </div >
137138
@@ -182,21 +183,14 @@ fragment OpenBrowserList on CurrentProject {
182183 id
183184 currentBrowser {
184185 id
185- displayName
186- path
187186 isFocusSupported
188187 }
189188 browsers {
190189 id
191- name
192- family
193190 disabled
194- isSelected
195191 isVersionSupported
196- channel
192+ name
197193 displayName
198- path
199- version
200194 warning
201195 majorVersion
202196 }
@@ -208,6 +202,10 @@ subscription OpenBrowserList_browserStatusChange {
208202 browserStatusChange {
209203 id
210204 browserStatus
205+ currentBrowser {
206+ id
207+ isFocusSupported
208+ }
211209 }
212210}
213211`
@@ -238,7 +236,11 @@ const browsers = computed(() => {
238236const setBrowser = useMutation (OpenBrowserList_SetBrowserDocument )
239237
240238const selectedBrowserId = computed ({
241- get : () => props .gql .currentBrowser ?.id || props .gql .browsers ?.find ((browser ) => browser .displayName === ' Electron' )?.id ,
239+ get : () => {
240+ // NOTE: The currentBrowser is set to the first detected browser
241+ // found during project initialization. It should always be defined.
242+ return props .gql .currentBrowser ?.id
243+ },
242244 set (browserId ) {
243245 if (browserId ) {
244246 setBrowser .executeMutation ({ id: browserId })
0 commit comments