@@ -1159,28 +1159,24 @@ test.describe("Asset Manager V2", () => {
11591159
11601160 test ( "shows Asset Manager V2 launch guard when Workspace Manager V2 palette context is missing" , async ( { page } ) => {
11611161 const server = await openAssetManagerWithSessionContext ( page , {
1162- version : "workspace-manager-v2" ,
1163- toolId : "asset-manager-v2" ,
1162+ documentKind : "workspace-manifest" ,
1163+ schema : "html-js-gaming.project" ,
1164+ version : 1 ,
1165+ id : "workspace-manager-v2-Asteroids" ,
1166+ name : "Asteroids Workspace Manager V2 Context" ,
11641167 gameId : "Asteroids" ,
11651168 gameRoot : "games/Asteroids/" ,
11661169 assetsPath : "games/Asteroids/assets" ,
1167- workspaceManifest : {
1168- documentKind : "workspace-manifest" ,
1169- schema : "html-js-gaming.project" ,
1170- version : 1 ,
1171- id : "workspace-manager-v2-Asteroids" ,
1172- name : "Asteroids Workspace Manager V2 Context" ,
1173- tools : {
1174- "palette-browser" : {
1175- schema : "html-js-gaming.palette" ,
1176- version : 1 ,
1177- name : "Asteroids Palette" ,
1178- source : "workspace-manager-v2" ,
1179- swatches : [ ]
1180- } ,
1181- "asset-browser" : {
1182- assets : { }
1183- }
1170+ tools : {
1171+ "palette-browser" : {
1172+ schema : "html-js-gaming.palette" ,
1173+ version : 1 ,
1174+ name : "Asteroids Palette" ,
1175+ source : "workspace-manager-v2" ,
1176+ swatches : [ ]
1177+ } ,
1178+ "asset-manager-v2" : {
1179+ assets : { }
11841180 }
11851181 }
11861182 } ) ;
@@ -1195,7 +1191,7 @@ test.describe("Asset Manager V2", () => {
11951191 await expect ( page ) . toHaveURL ( / f r o m T o o l = w o r k s p a c e - m a n a g e r - v 2 / ) ;
11961192 await expect ( page . locator ( "#assetLaunchGuard" ) ) . toBeVisible ( ) ;
11971193 await expect ( page . locator ( "#assetLaunchGuardMessage" ) ) . toHaveText ( "Asset Manager V2 is only available through Workspace Manager with a game workspace and palette." ) ;
1198- await expect ( page . locator ( "#assetLaunchGuardReason" ) ) . toContainText ( "Workspace Manager V2 session context is missing active palette swatches." ) ;
1194+ await expect ( page . locator ( "#assetLaunchGuardReason" ) ) . toContainText ( "Workspace Manager V2 manifest is missing active palette swatches." ) ;
11991195 await expect ( page . locator ( "body" ) ) . toHaveClass ( / a s s e t - m a n a g e r - v 2 - - l a u n c h - b l o c k e d / ) ;
12001196
12011197 expect ( pageErrors ) . toEqual ( [ ] ) ;
@@ -1241,7 +1237,7 @@ test.describe("Asset Manager V2", () => {
12411237 try {
12421238 await expect ( page . locator ( "#assetLaunchGuard" ) ) . toBeVisible ( ) ;
12431239 await expect ( page . locator ( "#assetLaunchGuardMessage" ) ) . toHaveText ( "Asset Manager V2 is only available through Workspace Manager with a game workspace and palette." ) ;
1244- await expect ( page . locator ( "#assetLaunchGuardReason" ) ) . toContainText ( "Workspace Manager V2 session context is required ." ) ;
1240+ await expect ( page . locator ( "#assetLaunchGuardReason" ) ) . toContainText ( "Workspace Manager V2 launch requires a schema-valid workspace manifest ." ) ;
12451241 await expect ( page . locator ( "body" ) ) . toHaveClass ( / a s s e t - m a n a g e r - v 2 - - l a u n c h - b l o c k e d / ) ;
12461242 expect ( pageErrors ) . toEqual ( [ ] ) ;
12471243 } finally {
@@ -1284,20 +1280,22 @@ test.describe("Asset Manager V2", () => {
12841280 await page . locator ( "#activeGameSelect" ) . selectOption ( "Asteroids" ) ;
12851281 await expect ( page . locator ( "#workspaceContextOutput" ) ) . toContainText ( '"gameRoot": "games/Asteroids/"' ) ;
12861282 await expect ( page . locator ( "#workspaceContextOutput" ) ) . toContainText ( '"assetsPath": "games/Asteroids/assets"' ) ;
1287- await expect ( page . locator ( "#workspaceContextOutput" ) ) . toContainText ( '"activePalette"' ) ;
1283+ await expect ( page . locator ( "#workspaceContextOutput" ) ) . toContainText ( '"asset-manager-v2"' ) ;
1284+ await expect ( page . locator ( "#workspaceContextOutput" ) ) . not . toContainText ( '"activePalette"' ) ;
1285+ await expect ( page . locator ( "#workspaceContextOutput" ) ) . not . toContainText ( '"workspaceManifest"' ) ;
12881286 await expect ( page . locator ( "#launchAssetManagerV2Button" ) ) . toBeEnabled ( ) ;
12891287 await page . locator ( "#launchAssetManagerV2Button" ) . click ( ) ;
12901288 await expect ( page ) . toHaveURL ( / a s s e t - m a n a g e r - v 2 \/ i n d e x \. h t m l .* l a u n c h = w o r k s p a c e / ) ;
12911289 await expect ( page ) . toHaveURL ( / f r o m T o o l = w o r k s p a c e - m a n a g e r - v 2 / ) ;
12921290 await expect ( page ) . not . toHaveURL ( / g a m e I d = A s t e r o i d s / ) ;
12931291 await expect ( page . locator ( ".asset-manager-v2__tool__menu" ) ) . toBeHidden ( ) ;
12941292 await expect ( page . locator ( ".asset-manager-v2__workspace__menu" ) ) . toBeVisible ( ) ;
1295- await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / W o r k s p a c e M a n a g e r V 2 l o a d e d 0 v a l i d a t e d A s s e t M a n a g e r V 2 a s s e t s / ) ;
1293+ await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / W o r k s p a c e M a n a g e r V 2 l o a d e d 0 v a l i d a t e d a s s e t s f r o m t o o l s \. a s s e t - m a n a g e r - v 2 \. a s s e t s / ) ;
12961294 await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / W o r k s p a c e M a n a g e r V 2 l o a d e d \d + p a l e t t e c o l o r s f r o m a c t i v e p a l e t t e c o n t e x t / ) ;
12971295 const hostContextId = await page . evaluate ( ( ) => new URL ( window . location . href ) . searchParams . get ( "hostContextId" ) ) ;
12981296 const initialAssetCount = await page . evaluate ( ( id ) => {
12991297 const context = JSON . parse ( sessionStorage . getItem ( id ) ) ;
1300- return Object . keys ( context . workspaceManifest . tools [ "asset-browser " ] . assets ) . length ;
1298+ return Object . keys ( context . tools [ "asset-manager-v2 " ] . assets ) . length ;
13011299 } , hostContextId ) ;
13021300 expect ( initialAssetCount ) . toBe ( 0 ) ;
13031301 const workspacePreviewContext = await page . evaluate ( async ( ) => {
@@ -1401,31 +1399,36 @@ test.describe("Asset Manager V2", () => {
14011399
14021400 await expect ( page . locator ( "#workspaceInsertAssetsButton" ) ) . toBeEnabled ( ) ;
14031401 await page . locator ( "#workspaceInsertAssetsButton" ) . click ( ) ;
1404- await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / O K I n s e r t e d 4 v a l i d a t e d A s s e t M a n a g e r V 2 a s s e t s i n t o W o r k s p a c e M a n a g e r V 2 c o n t e x t / ) ;
1402+ await expect ( page . locator ( "#statusLog" ) ) . toHaveValue ( / O K I n s e r t e d 4 v a l i d a t e d a s s e t s i n t o W o r k s p a c e M a n a g e r V 2 t o o l s \. a s s e t - m a n a g e r - v 2 \. a s s e t s / ) ;
14051403
14061404 const storedContext = await page . evaluate ( ( id ) => JSON . parse ( sessionStorage . getItem ( id ) ) , hostContextId ) ;
1407- expect ( storedContext . workspaceManifest . tools [ "asset-browser" ] . assets [ "assets.audio.sound.fire" ] ) . toEqual ( {
1405+ expect ( storedContext . documentKind ) . toBe ( "workspace-manifest" ) ;
1406+ expect ( storedContext . toolId ) . toBeUndefined ( ) ;
1407+ expect ( storedContext . activePalette ) . toBeUndefined ( ) ;
1408+ expect ( storedContext . workspaceManifest ) . toBeUndefined ( ) ;
1409+ expect ( storedContext . tools [ "asset-browser" ] ) . toBeUndefined ( ) ;
1410+ expect ( storedContext . tools [ "asset-manager-v2" ] . assets [ "assets.audio.sound.fire" ] ) . toEqual ( {
14081411 path : "assets/audio/fire.wav" ,
14091412 type : "audio" ,
14101413 kind : "wav" ,
14111414 role : "sound" ,
14121415 source : "asset-manager-v2"
14131416 } ) ;
1414- expect ( storedContext . workspaceManifest . tools [ "asset-browser " ] . assets [ "assets.font.ui.vector-battle" ] ) . toEqual ( {
1417+ expect ( storedContext . tools [ "asset-manager-v2 " ] . assets [ "assets.font.ui.vector-battle" ] ) . toEqual ( {
14151418 path : "assets/fonts/vector_battle.ttf" ,
14161419 type : "font" ,
14171420 kind : "ttf" ,
14181421 role : "ui" ,
14191422 source : "asset-manager-v2"
14201423 } ) ;
1421- expect ( storedContext . workspaceManifest . tools [ "asset-browser " ] . assets [ "assets.image.sprite.preview" ] ) . toEqual ( {
1424+ expect ( storedContext . tools [ "asset-manager-v2 " ] . assets [ "assets.image.sprite.preview" ] ) . toEqual ( {
14221425 path : "assets/images/preview.png" ,
14231426 type : "image" ,
14241427 kind : "png" ,
14251428 role : "sprite" ,
14261429 source : "asset-manager-v2"
14271430 } ) ;
1428- expect ( storedContext . workspaceManifest . tools [ "asset-browser " ] . assets [ "assets.color.hud.primary-hud.hud-blue" ] ) . toEqual ( {
1431+ expect ( storedContext . tools [ "asset-manager-v2 " ] . assets [ "assets.color.hud.primary-hud.hud-blue" ] ) . toEqual ( {
14291432 path : "palette://workspace/hud-blue" ,
14301433 type : "color" ,
14311434 kind : "hex" ,
@@ -1437,11 +1440,10 @@ test.describe("Asset Manager V2", () => {
14371440 symbol : "*"
14381441 }
14391442 } ) ;
1440- expect ( storedContext . activePalette . source ) . toBe ( "workspace-manager-v2" ) ;
1441- expect ( storedContext . activePalette . swatches . length ) . toBeGreaterThan ( 0 ) ;
1442- expect ( storedContext . workspaceManifest . tools [ "asset-manager-v2" ] ) . toBeUndefined ( ) ;
1443- expect ( storedContext . workspaceManifest . tools [ "workspace-v2" ] ) . toBeUndefined ( ) ;
1444- expect ( Object . keys ( storedContext . workspaceManifest . tools ) . sort ( ) ) . toEqual ( [ "asset-browser" , "palette-browser" ] ) ;
1443+ expect ( storedContext . tools [ "palette-browser" ] . source ) . toBe ( "workspace-manager-v2" ) ;
1444+ expect ( storedContext . tools [ "palette-browser" ] . swatches . length ) . toBeGreaterThan ( 0 ) ;
1445+ expect ( storedContext . tools [ "workspace-v2" ] ) . toBeUndefined ( ) ;
1446+ expect ( Object . keys ( storedContext . tools ) . sort ( ) ) . toEqual ( [ "asset-manager-v2" , "palette-browser" ] ) ;
14451447
14461448 expect ( pageErrors ) . toEqual ( [ ] ) ;
14471449 } finally {
0 commit comments