@@ -984,17 +984,26 @@ test.describe("Workspace Manager V2 bootstrap", () => {
984984 const utilitiesGrid = firstClassToolsSection ?. querySelector ( "[data-active-tools-utilities-grid]" ) ;
985985 const viewersGrid = firstClassToolsSection ?. querySelector ( "[data-active-tools-viewers-grid]" ) ;
986986 const workspaceCard = workflowGrid ?. querySelector ( ".tools-platform-card" ) ;
987+ const cards = Array . from ( firstClassToolsSection ?. querySelectorAll ( ".tools-platform-card" ) || [ ] ) ;
988+ const actionClassesForCard = ( title ) => {
989+ const toolCard = cards . find ( ( candidate ) => candidate . querySelector ( "h3" ) ?. textContent ?. trim ( ) === title ) ;
990+ return Object . fromEntries ( Array . from ( toolCard ?. querySelectorAll ( ".tools-platform-card__action" ) || [ ] )
991+ . map ( ( action ) => [ action . textContent . trim ( ) , action . className . trim ( ) ] ) ) ;
992+ } ;
987993 const plannedToolsGrid = document . querySelector ( "[data-planned-tools-grid]" ) ;
988994 return {
989995 actionLabels : Array . from ( firstClassToolsSection ?. querySelectorAll ( ".tools-platform-card__action" ) || [ ] )
990996 . map ( ( action ) => action . textContent . trim ( ) ) ,
997+ allCards : cards . map ( ( toolCard ) => toolCard . querySelector ( "h3" ) ?. textContent ?. trim ( ) || "" ) ,
991998 headings : Array . from ( firstClassToolsSection ?. querySelectorAll ( ":scope > h3" ) || [ ] )
992999 . map ( ( heading ) => heading . textContent . trim ( ) ) ,
1000+ paletteManagerActionClasses : actionClassesForCard ( "Palette Manager V2" ) ,
9931001 plannedCards : Array . from ( plannedToolsGrid ?. querySelectorAll ( ".card h3" ) || [ ] )
9941002 . map ( ( heading ) => heading . textContent . trim ( ) ) ,
9951003 sampleLabels : Array . from ( firstClassToolsSection ?. querySelectorAll ( ".tools-platform-card__action" ) || [ ] )
9961004 . map ( ( action ) => action . textContent . trim ( ) )
9971005 . filter ( ( label ) => label . startsWith ( "Samples" ) ) ,
1006+ sessionInspectorActionClasses : actionClassesForCard ( "Session Inspector V2" ) ,
9981007 utilitiesCards : Array . from ( utilitiesGrid ?. querySelectorAll ( ".tools-platform-card h3" ) || [ ] )
9991008 . map ( ( heading ) => heading . textContent . trim ( ) ) ,
10001009 viewersCards : Array . from ( viewersGrid ?. querySelectorAll ( ".tools-platform-card h3" ) || [ ] )
@@ -1009,10 +1018,12 @@ test.describe("Workspace Manager V2 bootstrap", () => {
10091018 expect ( toolsIndexState . workflowCards ) . toEqual ( [ "Workspace Manager V2" ] ) ;
10101019 expect ( toolsIndexState . utilitiesCards ) . not . toContain ( "Workspace Manager V2" ) ;
10111020 expect ( toolsIndexState . utilitiesCards ) . toContain ( "Text to Speech V2" ) ;
1021+ expect ( toolsIndexState . allCards ) . not . toContain ( "Asset Browser / Import Hub" ) ;
1022+ expect ( toolsIndexState . allCards ) . not . toContain ( "Tile Model Converter" ) ;
10121023 expect ( toolsIndexState . plannedCards ) . toContain ( "Piper WASM Backend" ) ;
10131024 expect ( toolsIndexState . plannedCards ) . toContain ( "Optional SSML Processing Layer" ) ;
1014- expect ( toolsIndexState . plannedCards ) . toContain ( "Character Voice Presets" ) ;
1015- expect ( toolsIndexState . plannedCards ) . toContain ( "Game Character Voice / Event Integration" ) ;
1025+ expect ( toolsIndexState . plannedCards ) . not . toContain ( "Character Voice Presets" ) ;
1026+ expect ( toolsIndexState . plannedCards ) . not . toContain ( "Game Character Voice / Event Integration" ) ;
10161027 expect ( toolsIndexState . plannedCards ) . not . toEqual ( expect . arrayContaining ( [
10171028 "Raspberry Pi Speech Deployment" ,
10181029 "Queue-Based Speech Playback" ,
@@ -1023,6 +1034,9 @@ test.describe("Workspace Manager V2 bootstrap", () => {
10231034 expect ( toolsIndexState . viewersCards ) . toContain ( "Session Inspector V2" ) ;
10241035 expect ( toolsIndexState . viewersCards ) . not . toContain ( "Session Inspector" ) ;
10251036 expect ( toolsIndexState . workspaceActionLabels ) . toEqual ( [ "How To Use" , "Read Me" ] ) ;
1037+ expect ( toolsIndexState . sessionInspectorActionClasses [ "How To Use" ] ) . toBe ( toolsIndexState . paletteManagerActionClasses [ "How To Use" ] ) ;
1038+ expect ( toolsIndexState . sessionInspectorActionClasses [ "Read Me" ] ) . toBe ( toolsIndexState . paletteManagerActionClasses [ "Read Me" ] ) ;
1039+ expect ( toolsIndexState . sessionInspectorActionClasses [ "How To Use" ] ) . toBe ( "tools-platform-card__action tools-platform-card__action--secondary" ) ;
10261040 expect ( toolsIndexState . actionLabels ) . not . toContain ( "README" ) ;
10271041 expect ( toolsIndexState . sampleLabels . every ( ( label ) => / ^ S a m p l e s \( \d + \) $ / . test ( label ) ) ) . toBe ( true ) ;
10281042 expect ( pageErrors ) . toEqual ( [ ] ) ;
@@ -2116,8 +2130,8 @@ test.describe("Workspace Manager V2 bootstrap", () => {
21162130 await selectMockRepo ( page ) ;
21172131 await page . locator ( "#activeGameSelect" ) . selectOption ( "Asteroids" ) ;
21182132 await expectWorkspaceReturnRehydrated ( page ) ;
2119- expect ( await page . evaluate ( ( ) => Object . hasOwn ( window . __workspaceManagerV2App . activeContext . tools , "text2speech-V2" ) ) ) . toBe ( false ) ;
2120- expect ( await page . evaluate ( ( ) => JSON . parse ( sessionStorage . getItem ( "workspace.tools.text2speech-V2" ) ) . data ) ) . toBeNull ( ) ;
2133+ expect ( await page . evaluate ( ( ) => Object . hasOwn ( window . __workspaceManagerV2App . activeContext . tools , "text2speech-V2" ) ) ) . toBe ( true ) ;
2134+ expect ( await page . evaluate ( ( ) => JSON . parse ( sessionStorage . getItem ( "workspace.tools.text2speech-V2" ) ) . data ) ) . toEqual ( [ ] ) ;
21212135 const schemaContract = await page . evaluate ( async ( ) => {
21222136 const schema = await fetch ( "/tools/schemas/tools/text2speech-V2.schema.json" , { cache : "no-store" } ) . then ( ( response ) => response . json ( ) ) ;
21232137 return {
@@ -3198,7 +3212,8 @@ test.describe("Workspace Manager V2 bootstrap", () => {
31983212 await expect ( textToSpeechToolTile ) . toBeEnabled ( ) ;
31993213 await expect ( textToSpeechToolTile ) . toContainText ( "Text to Speech V2" ) ;
32003214 await expect ( textToSpeechToolTile ) . toContainText ( "Ready to launch" ) ;
3201- await expect ( textToSpeechToolTile ) . toContainText ( "Speech synthesis ready" ) ;
3215+ await expect ( textToSpeechToolTile ) . toContainText ( "0 text to speech" ) ;
3216+ await expect ( textToSpeechToolTile ) . not . toContainText ( "Speech synthesis ready" ) ;
32023217 await expect ( sessionInspectorTile ) . toBeEnabled ( ) ;
32033218 await expect ( sessionInspectorTile ) . toContainText ( "Session Inspector V2" ) ;
32043219 await expect ( sessionInspectorTile ) . not . toContainText ( "Session storage inspector" ) ;
@@ -3692,7 +3707,8 @@ test.describe("Workspace Manager V2 bootstrap", () => {
36923707 await expect ( textToSpeechToolTile ) . toBeEnabled ( ) ;
36933708 await expect ( textToSpeechToolTile ) . toContainText ( "Text to Speech V2" ) ;
36943709 await expect ( textToSpeechToolTile ) . toContainText ( "Ready to launch" ) ;
3695- await expect ( textToSpeechToolTile ) . toContainText ( "Speech synthesis ready" ) ;
3710+ await expect ( textToSpeechToolTile ) . toContainText ( "0 text to speech" ) ;
3711+ await expect ( textToSpeechToolTile ) . not . toContainText ( "Speech synthesis ready" ) ;
36963712 await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / O K H y d r a t e d w o r k s p a c e s e s s i o n f o r a s s e t - m a n a g e r - v 2 , p a l e t t e - m a n a g e r - v 2 , p r e v i e w - g e n e r a t o r - v 2 , t e x t 2 s p e e c h - V 2 , s e s s i o n - i n s p e c t o r - v 2 \. / ) ;
36973713 const textToSpeechSessionData = await page . evaluate ( ( ) => JSON . parse ( sessionStorage . getItem ( "workspace.tools.text2speech-V2" ) ) . data ) ;
36983714 const activeContextHasTextToSpeechPayload = await page . evaluate ( ( ) => Object . hasOwn ( window . __workspaceManagerV2App . activeContext . tools , "text2speech-V2" ) ) ;
@@ -3737,6 +3753,17 @@ test.describe("Workspace Manager V2 bootstrap", () => {
37373753 context . tools [ "text2speech-V2" ] = payload ;
37383754 const validation = await app . contextService . validateGeneratedManifest ( context ) ;
37393755 const hostContextId = app . contextService . writePersistedContext ( app . activeHostContextId , context ) ;
3756+ const session = JSON . parse ( sessionStorage . getItem ( "workspace.tools.text2speech-V2" ) ) ;
3757+ sessionStorage . setItem ( "workspace.tools.text2speech-V2" , JSON . stringify ( {
3758+ ...session ,
3759+ data : payload ,
3760+ dirty : {
3761+ isDirty : false ,
3762+ reason : null ,
3763+ changedAt : null ,
3764+ changedKeys : [ ]
3765+ }
3766+ } ) ) ;
37403767 const metrics = app . contextSummaryMetrics ( context ) ;
37413768 app . applyContextResult ( {
37423769 assetCount : metrics . assetCount ,
@@ -3748,6 +3775,8 @@ test.describe("Workspace Manager V2 bootstrap", () => {
37483775 return { hostContextId, validation } ;
37493776 } , TEXT_TO_SPEECH_SAMPLE_PRESET_PATH ) ;
37503777 expect ( seededWorkspace . validation ) . toEqual ( { ok : true } ) ;
3778+ await expect ( page . locator ( '[data-workspace-tool-id="text2speech-V2"]' ) ) . toContainText ( "1 text to speech" ) ;
3779+ await expect ( page . locator ( '[data-workspace-tool-id="text2speech-V2"]' ) ) . not . toContainText ( "Speech synthesis ready" ) ;
37513780 expect ( await page . evaluate ( async ( ) => {
37523781 const app = window . __workspaceManagerV2App ;
37533782 const context = structuredClone ( app . activeContext ) ;
@@ -3768,6 +3797,8 @@ test.describe("Workspace Manager V2 bootstrap", () => {
37683797 await page . locator ( "#returnToWorkspaceButton" ) . click ( ) ;
37693798 await expect ( page ) . toHaveURL ( new RegExp ( `workspace-manager-v2/index\\.html\\?hostContextId=${ seededWorkspace . hostContextId } ` ) ) ;
37703799 await expectWorkspaceReturnedFromTool ( page , { dirty : true } ) ;
3800+ await expect ( page . locator ( '[data-workspace-tool-id="text2speech-V2"]' ) ) . toContainText ( "0 text to speech" ) ;
3801+ await expect ( page . locator ( '[data-workspace-tool-id="text2speech-V2"]' ) ) . not . toContainText ( "Speech synthesis ready" ) ;
37713802 const returnedState = await page . evaluate ( ( ) => {
37723803 const session = JSON . parse ( sessionStorage . getItem ( "workspace.tools.text2speech-V2" ) ) ;
37733804 const outputContext = JSON . parse ( document . querySelector ( "#workspaceContextOutput" ) . value ) ;
@@ -3987,7 +4018,7 @@ test.describe("Workspace Manager V2 bootstrap", () => {
39874018 await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / O K S a v e d p a t h : g a m e s \/ A s t e r o i d s \/ g a m e \. m a n i f e s t \. j s o n \. / ) ;
39884019 await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / O K S a v e w r i t e v a l i d a t i o n : f i l e c o n t e n t c h a n g e d \. / ) ;
39894020 await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / I N F O S a v e d f i l e s i z e : \d + b y t e s \. / ) ;
3990- await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / I N F O S a v e d t o o l S t a t e i t e m s : (?: 3 \( a s s e t - m a n a g e r - v 2 a s s e t s = 1 4 ; p a l e t t e - m a n a g e r - v 2 s w a t c h e s = 1 1 ; v e c t o r - m a p - e d i t o r v e c t o r s = 5 \) | 4 \( a s s e t - m a n a g e r - v 2 a s s e t s = 1 4 ; p a l e t t e - m a n a g e r - v 2 s w a t c h e s = 1 1 ; t e x t 2 s p e e c h - V 2 q u e u e = 1 ; v e c t o r - m a p - e d i t o r v e c t o r s = 5 \) ) \. / ) ;
4021+ await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / I N F O S a v e d t o o l S t a t e i t e m s : (?: 3 \( a s s e t - m a n a g e r - v 2 a s s e t s = 1 4 ; p a l e t t e - m a n a g e r - v 2 s w a t c h e s = 1 1 ; v e c t o r - m a p - e d i t o r v e c t o r s = 5 \) | 4 \( a s s e t - m a n a g e r - v 2 a s s e t s = 1 4 ; p a l e t t e - m a n a g e r - v 2 s w a t c h e s = 1 1 ; t e x t 2 s p e e c h - V 2 q u e u e = (?: 0 | 1 ) ; v e c t o r - m a p - e d i t o r v e c t o r s = 5 \) ) \. / ) ;
39914022 await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / O K S a v e v a l i d a t i o n r e s u l t : g a m e m a n i f e s t v a l i d ; r o o t g a m e \. w o r k s p a c e t o o l S t a t e v a l i d ; s a v e d c o n t e x t m a t c h e d r e - r e a d f i l e \. / ) ;
39924023 await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / O K S a v e d i r t y \/ c l e a n v a l i d a t i o n : 1 d i r t y t o o l S t a t e p a y l o a d p e r s i s t e d ; 1 t o o l S t a t e k e y m a r k e d c l e a n \. / ) ;
39934024 await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / O K S a v e d W o r k s p a c e M a n a g e r V 2 t o o l S t a t e c o n t e x t w o r k s p a c e - m a n a g e r - v 2 - A s t e r o i d s \. / ) ;
0 commit comments