@@ -290,24 +290,48 @@ test("Game Hub creates, opens, and deletes mock games", async ({ page }) => {
290290 const demoGameRow = page . locator ( "[data-game-row='demo-game']" ) ;
291291 await expect ( demoGameRow . locator ( "td" ) ) . toHaveText ( [ "Game" , "Under Construction" , "Edit" ] ) ;
292292 await expect ( demoGameRow ) . not . toContainText ( "User 1" ) ;
293- await expect ( demoGameRow ) . toHaveAttribute ( "data-game-active" , "true" ) ;
294- await expect ( demoGameRow ) . toHaveAttribute ( "aria-current" , "true" ) ;
295- await expect ( demoGameRow . locator ( "th[data-game-active-cell='true']" ) ) . toContainText ( "Demo Game" ) ;
296- const activeCellStyle = await demoGameRow . locator ( "th[data-game-active-cell='true']" ) . evaluate ( ( cell ) => {
297- const styles = getComputedStyle ( cell ) ;
298- return {
299- backgroundColor : styles . backgroundColor ,
300- boxShadow : styles . boxShadow ,
301- } ;
302- } ) ;
303- const inactiveCellBackground = await page . locator ( "[data-game-row='gravity-demo'] th" ) . evaluate ( ( cell ) => getComputedStyle ( cell ) . backgroundColor ) ;
304- expect ( activeCellStyle . backgroundColor ) . toBe ( inactiveCellBackground ) ;
305- expect ( activeCellStyle . boxShadow ) . not . toBe ( "none" ) ;
293+ await expect ( demoGameRow ) . not . toHaveAttribute ( "data-game-active" , "true" ) ;
294+ await expect ( demoGameRow ) . not . toHaveAttribute ( "aria-current" , "true" ) ;
295+ await expect ( demoGameRow . locator ( "th[data-game-active-cell='true']" ) ) . toHaveCount ( 0 ) ;
296+ await expect ( page . locator ( "[data-game-row][data-game-active='true']" ) ) . toHaveCount ( 0 ) ;
297+ await expect ( page . locator ( "[data-game-row][aria-current='true']" ) ) . toHaveCount ( 0 ) ;
298+ await expect ( page . locator ( "[data-game-active-cell='true']" ) ) . toHaveCount ( 0 ) ;
299+ const rowVisuals = await page . locator ( "[data-game-row]" ) . evaluateAll ( ( rows ) => rows . map ( ( row ) => {
300+ const cells = Array . from ( row . children ) . slice ( 1 ) ;
301+ return cells . map ( ( cell ) => {
302+ const styles = getComputedStyle ( cell ) ;
303+ return {
304+ backgroundColor : styles . backgroundColor ,
305+ boxShadow : styles . boxShadow ,
306+ } ;
307+ } ) ;
308+ } ) ) ;
309+ expect ( rowVisuals [ 0 ] ) . toEqual ( rowVisuals [ 1 ] ) ;
306310 await expect ( demoGameRow . locator ( "> .status" ) ) . toHaveCount ( 0 ) ;
307311 await expect ( demoGameRow . locator ( "[data-game-toggle='demo-game']" ) ) . toHaveAttribute ( "aria-expanded" , "false" ) ;
308312 await expect ( demoGameRow . locator ( "[data-game-toggle='demo-game']" ) ) . not . toHaveClass ( / p r i m a r y / ) ;
309313 await expect ( demoGameRow . locator ( "[data-game-toggle='demo-game']" ) ) . toHaveClass ( / \b b t n - - c o m p a c t \b / ) ;
314+ await expect ( demoGameRow . locator ( "[data-game-toggle='demo-game']" ) ) . toHaveAttribute ( "data-game-active" , "true" ) ;
310315 await expect ( demoGameRow . locator ( "[data-game-toggle='demo-game']" ) ) . toHaveAttribute ( "aria-current" , "true" ) ;
316+ await expect ( page . locator ( "[data-game-toggle][aria-current='true']" ) ) . toHaveCount ( 1 ) ;
317+ await expect ( page . locator ( "[data-game-toggle][data-game-active='true']" ) ) . toHaveCount ( 1 ) ;
318+ const activeButtonStyle = await demoGameRow . locator ( "[data-game-toggle='demo-game']" ) . evaluate ( ( button ) => {
319+ const styles = getComputedStyle ( button ) ;
320+ return {
321+ backgroundColor : styles . backgroundColor ,
322+ borderColor : styles . borderColor ,
323+ boxShadow : styles . boxShadow ,
324+ } ;
325+ } ) ;
326+ const inactiveButtonStyle = await page . locator ( "[data-game-row='gravity-demo'] [data-game-toggle='gravity-demo']" ) . evaluate ( ( button ) => {
327+ const styles = getComputedStyle ( button ) ;
328+ return {
329+ backgroundColor : styles . backgroundColor ,
330+ borderColor : styles . borderColor ,
331+ boxShadow : styles . boxShadow ,
332+ } ;
333+ } ) ;
334+ expect ( activeButtonStyle ) . not . toEqual ( inactiveButtonStyle ) ;
311335 await expect ( demoGameRow . getByRole ( "button" , { name : "Edit Demo Game" } ) ) . toHaveText ( "Edit" ) ;
312336 await expect ( demoGameRow . getByRole ( "button" , { name : "Edit Demo Game" } ) ) . not . toHaveClass ( / p r i m a r y / ) ;
313337 await expect ( demoGameRow . getByRole ( "button" , { name : "Edit Demo Game" } ) ) . toHaveClass ( / \b b t n - - c o m p a c t \b / ) ;
@@ -348,7 +372,10 @@ test("Game Hub creates, opens, and deletes mock games", async ({ page }) => {
348372 await addGameRow . getByLabel ( "Status" ) . selectOption ( "Ready for Testing" ) ;
349373 await addGameRow . getByRole ( "button" , { name : "Save" } ) . click ( ) ;
350374 await expect ( page . locator ( "[data-game-list]" ) ) . toContainText ( "Launch Test Game" ) ;
351- await expect ( page . locator ( "[data-game-row='launch-test-game-1']" ) ) . toHaveAttribute ( "data-game-active" , "true" ) ;
375+ await expect ( page . locator ( "[data-game-row='launch-test-game-1']" ) ) . not . toHaveAttribute ( "data-game-active" , "true" ) ;
376+ await expect ( page . locator ( "[data-game-row='launch-test-game-1']" ) ) . not . toHaveAttribute ( "aria-current" , "true" ) ;
377+ await expect ( page . locator ( "[data-game-toggle][aria-current='true']" ) ) . toHaveCount ( 1 ) ;
378+ await expect ( page . locator ( "[data-game-row='launch-test-game-1'] [data-game-toggle='launch-test-game-1']" ) ) . toHaveAttribute ( "aria-current" , "true" ) ;
352379 await expect ( page . locator ( "[data-game-row='launch-test-game-1'] [data-game-toggle='launch-test-game-1']" ) ) . not . toHaveClass ( / p r i m a r y / ) ;
353380 await expect ( page . locator ( "[data-game-row='launch-test-game-1']" ) . getByRole ( "button" , { name : "Edit Launch Test Game" } ) ) . not . toHaveClass ( / p r i m a r y / ) ;
354381 await expect ( page . locator ( "[data-game-row='launch-test-game-1'] td" ) . nth ( 0 ) ) . toHaveText ( "Learning Game" ) ;
@@ -376,14 +403,21 @@ test("Game Hub creates, opens, and deletes mock games", async ({ page }) => {
376403 await page . getByRole ( "button" , { name : "Add Game" } ) . click ( ) ;
377404 await page . locator ( "[data-game-add-row='input']" ) . getByLabel ( "Game" ) . fill ( "Archive Game" ) ;
378405 await page . locator ( "[data-game-add-row='input']" ) . getByRole ( "button" , { name : "Save" } ) . click ( ) ;
379- await expect ( page . locator ( "[data-game-row='archive-game-2']" ) ) . toHaveAttribute ( "data-game-active" , "true" ) ;
406+ await expect ( page . locator ( "[data-game-row='archive-game-2']" ) ) . not . toHaveAttribute ( "data-game-active" , "true" ) ;
407+ await expect ( page . locator ( "[data-game-row='archive-game-2'] [data-game-toggle='archive-game-2']" ) ) . toHaveAttribute ( "aria-current" , "true" ) ;
380408 await expect ( page . locator ( "[data-game-row='archive-game-2'] [data-game-toggle='archive-game-2']" ) ) . not . toHaveClass ( / p r i m a r y / ) ;
381409
382410 await page . locator ( "[data-game-row='launch-test-game-1'] [data-game-toggle='launch-test-game-1']" ) . click ( ) ;
383- await expect ( page . locator ( "[data-game-row='launch-test-game-1']" ) ) . toHaveAttribute ( "data-game-active" , "true" ) ;
411+ await expect ( page . locator ( "[data-game-row='launch-test-game-1']" ) ) . not . toHaveAttribute ( "data-game-active" , "true" ) ;
412+ await expect ( page . locator ( "[data-game-row='launch-test-game-1'] [data-game-toggle='launch-test-game-1']" ) ) . toHaveAttribute ( "aria-current" , "true" ) ;
413+ await expect ( page . locator ( "[data-game-row='archive-game-2'] [data-game-toggle='archive-game-2']" ) ) . not . toHaveAttribute ( "aria-current" , "true" ) ;
414+ await expect ( page . locator ( "[data-game-toggle][aria-current='true']" ) ) . toHaveCount ( 1 ) ;
415+ await expect ( page . locator ( "[data-game-toggle][data-game-active='true']" ) ) . toHaveCount ( 1 ) ;
416+ await expect ( page . locator ( "[data-game-expanded-row='launch-test-game-1']" ) ) . toHaveCount ( 2 ) ;
417+ await expect ( page . locator ( "[data-game-expanded-row='archive-game-2']" ) ) . toHaveCount ( 0 ) ;
384418 await expect ( page . locator ( "[data-game-row='launch-test-game-1'] [data-game-toggle='launch-test-game-1']" ) ) . not . toHaveClass ( / p r i m a r y / ) ;
385419 await expect ( page . locator ( "[data-game-row='launch-test-game-1']" ) . getByRole ( "button" , { name : "Edit Launch Test Game" } ) ) . not . toHaveClass ( / p r i m a r y / ) ;
386- await expect ( page . locator ( "[data-game-hub-log]" ) ) . toHaveText ( "Selected Launch Test Game." ) ;
420+ await expect ( page . locator ( "[data-game-hub-log]" ) ) . not . toHaveText ( "Selected Launch Test Game." ) ;
387421
388422 await page . getByRole ( "button" , { name : "Delete Open Game" } ) . click ( ) ;
389423 await expect ( page . locator ( "[data-game-row='launch-test-game-1']" ) ) . toHaveCount ( 0 ) ;
0 commit comments