@@ -13,7 +13,9 @@ async function performUIReview() {
1313
1414 const baseUrl = process . env . DEPLOYMENT_URL || 'http://localhost:3000'
1515
16- await context . addCookies ( [ { name : 'session-id' , value : 'mock' , url : baseUrl } ] )
16+ await context . addCookies ( [
17+ { name : 'session-id' , value : 'mock' , url : baseUrl } ,
18+ ] )
1719
1820 const page = await context . newPage ( )
1921 const targetUrl = new URL ( baseUrl )
@@ -28,7 +30,11 @@ async function performUIReview() {
2830 } )
2931
3032 // Inject mock application state so the UI review has something to analyze
31- await page . waitForFunction ( ( ) => ! ! ( window as any ) . __TEST_CONTROLS__ )
33+ await page . waitForFunction (
34+ ( ) =>
35+ ! ! ( window as unknown as { __TEST_CONTROLS__ : boolean } )
36+ . __TEST_CONTROLS__
37+ )
3238
3339 // Build type-safe messages outside evaluate to ensure types are correct at compile time
3440 const timerMessage : ServerMessage = {
@@ -42,26 +48,28 @@ async function performUIReview() {
4248 mode : 'TABATA' ,
4349 workDuration : 30 ,
4450 restDuration : 10 ,
45- soundEventId : 0
46- }
51+ soundEventId : 0 ,
52+ } ,
4753 }
4854
4955 const hrmMessage : ServerMessage = {
5056 type : 'HRM_UPDATE' ,
51- payload : [ {
52- clientId : 'mock-1' ,
53- value : 155 ,
54- maxHr : 185 ,
55- zone : 'ZONE_3' ,
56- percentage : 85 ,
57- name : 'Mock Device' ,
58- calories : 120
59- } ]
57+ payload : [
58+ {
59+ clientId : 'mock-1' ,
60+ value : 155 ,
61+ maxHr : 185 ,
62+ zone : 'ZONE_3' ,
63+ percentage : 85 ,
64+ name : 'Mock Device' ,
65+ calories : 120 ,
66+ } ,
67+ ] ,
6068 }
6169
6270 const spotifyInitMessage : ServerMessage = {
6371 type : 'SPOTIFY_SERVICE_INIT_UPDATE' ,
64- payload : true
72+ payload : true ,
6573 }
6674
6775 const spotifyMessage : ServerMessage = {
@@ -74,28 +82,35 @@ async function performUIReview() {
7482 name : 'UI Review Track' ,
7583 artist : 'Gemini' ,
7684 albumName : 'Review Album' ,
77- albumArtUrl : ''
85+ albumArtUrl : '' ,
7886 } ,
7987 is_playing : true ,
8088 volume_percent : 50 ,
8189 isMuted : false ,
82- progress_ms : 30000
83- }
84- }
90+ progress_ms : 30000 ,
91+ } ,
92+ } ,
8593 }
8694
87- await page . evaluate ( ( { timerMsg, hrmMsg, spotifyInitMsg, spotifyMsg } ) => {
88- const dispatch = ( window as any ) . __TEST_CONTROLS__ . dispatch
89- dispatch ( timerMsg )
90- dispatch ( hrmMsg )
91- dispatch ( spotifyInitMsg )
92- dispatch ( spotifyMsg )
93- } , {
94- timerMsg : timerMessage ,
95- hrmMsg : hrmMessage ,
96- spotifyInitMsg : spotifyInitMessage ,
97- spotifyMsg : spotifyMessage
98- } )
95+ await page . evaluate (
96+ ( { timerMsg, hrmMsg, spotifyInitMsg, spotifyMsg } ) => {
97+ const dispatch = (
98+ window as unknown as {
99+ __TEST_CONTROLS__ : { dispatch : ( msg : ServerMessage ) => void }
100+ }
101+ ) . __TEST_CONTROLS__ . dispatch
102+ dispatch ( timerMsg )
103+ dispatch ( hrmMsg )
104+ dispatch ( spotifyInitMsg )
105+ dispatch ( spotifyMsg )
106+ } ,
107+ {
108+ timerMsg : timerMessage ,
109+ hrmMsg : hrmMessage ,
110+ spotifyInitMsg : spotifyInitMessage ,
111+ spotifyMsg : spotifyMessage ,
112+ }
113+ )
99114
100115 // Force layout stabilization for the screenshot
101116 await page . addStyleTag ( {
@@ -134,7 +149,9 @@ async function performUIReview() {
134149 ] )
135150
136151 const response = await result . response
137- const feedback = response . candidates ?. [ 0 ] ?. content ?. parts ?. [ 0 ] ?. text || "No feedback generated."
152+ const feedback =
153+ response . candidates ?. [ 0 ] ?. content ?. parts ?. [ 0 ] ?. text ||
154+ 'No feedback generated.'
138155
139156 const prNumber = process . env . PR_NUMBER
140157 const githubToken = process . env . GITHUB_TOKEN
0 commit comments