@@ -10,6 +10,32 @@ function restoreEnvValue(key, value) {
1010 process . env [ key ] = value ;
1111}
1212
13+ async function expectIdeaChevron ( page , ideaId , iconName ) {
14+ const metrics = await page . locator ( `[data-idea-board-idea-row='${ ideaId } '] th` ) . evaluate ( ( cell , targetIdeaId ) => {
15+ const label = cell . querySelector ( ".idea-board-idea-label" ) ;
16+ const icon = cell . querySelector ( `[data-idea-board-chevron='${ targetIdeaId } ']` ) ;
17+ const cellStyles = getComputedStyle ( cell ) ;
18+ const labelStyles = getComputedStyle ( label ) ;
19+ const iconStyles = getComputedStyle ( icon ) ;
20+ return {
21+ iconName : icon . dataset . ideaBoardChevronIcon ,
22+ labelDisplay : labelStyles . display ,
23+ iconWidth : Number . parseFloat ( iconStyles . width ) ,
24+ iconHeight : Number . parseFloat ( iconStyles . height ) ,
25+ fontSize : Number . parseFloat ( cellStyles . fontSize ) ,
26+ iconColor : iconStyles . backgroundColor ,
27+ textColor : cellStyles . color ,
28+ maskImage : iconStyles . getPropertyValue ( "-webkit-mask-image" ) || iconStyles . maskImage ,
29+ } ;
30+ } , ideaId ) ;
31+ expect ( metrics . iconName ) . toBe ( iconName ) ;
32+ expect ( metrics . labelDisplay ) . toBe ( "inline-flex" ) ;
33+ expect ( Math . abs ( metrics . iconWidth - metrics . fontSize ) ) . toBeLessThanOrEqual ( 1 ) ;
34+ expect ( Math . abs ( metrics . iconHeight - metrics . fontSize ) ) . toBeLessThanOrEqual ( 1 ) ;
35+ expect ( metrics . iconColor ) . toBe ( metrics . textColor ) ;
36+ expect ( metrics . maskImage ) . toContain ( iconName ) ;
37+ }
38+
1339test ( "Idea Board uses DB-shaped accordion table ideas and notes" , async ( { page } ) => {
1440 const server = await startRepoServer ( ) ;
1541 const previousApiUrl = process . env . GAMEFOUNDRY_API_URL ;
@@ -58,15 +84,15 @@ test("Idea Board uses DB-shaped accordion table ideas and notes", async ({ page
5884 await expect ( page . getByText ( "Selected" ) ) . toHaveCount ( 0 ) ;
5985
6086 await expect ( page . locator ( "[data-idea-board-idea-row='top-thoughts'] th" ) ) . toHaveText ( "Top Thoughts" ) ;
61- await expect ( page . locator ( "[data-idea-board-chevron=' top-thoughts']" ) ) . toHaveAttribute ( "src" , / g f s - c h e v r o n - d o w n \ .s v g $ / ) ;
87+ await expectIdeaChevron ( page , " top-thoughts" , " gfs-chevron-down.svg" ) ;
6288 await expect ( page . locator ( "[data-idea-board-idea-row='top-thoughts'] td" ) . nth ( 0 ) ) . toHaveText ( "Smartest person wins..." ) ;
6389 await expect ( page . locator ( "[data-idea-board-idea-row='top-thoughts'] td" ) . nth ( 1 ) ) . toHaveText ( "Exploring" ) ;
6490 await expect ( page . locator ( "[data-idea-board-idea-row='top-thoughts'] td" ) . nth ( 2 ) ) . toHaveText ( "2026-06-20" ) ;
6591 await expect ( page . locator ( "[data-idea-board-notes-count='top-thoughts']" ) ) . toHaveText ( "3 Notes" ) ;
6692 await expect ( page . locator ( "[data-idea-board-idea-row='top-thoughts'] [data-idea-board-idea-action]" ) ) . toHaveText ( [ "Edit" , "Delete" ] ) ;
6793
6894 await expect ( page . locator ( "[data-idea-board-idea-row='sky-orchard'] th" ) ) . toHaveText ( "Sky Orchard" ) ;
69- await expect ( page . locator ( "[data-idea-board-chevron=' sky-orchard']" ) ) . toHaveAttribute ( "src" , / g f s - c h e v r o n - d o w n \ .s v g $ / ) ;
95+ await expectIdeaChevron ( page , " sky-orchard" , " gfs-chevron-down.svg" ) ;
7096 await expect ( page . locator ( "[data-idea-board-idea-row='sky-orchard'] td" ) . nth ( 0 ) ) . toHaveText ( "Grow floating islands..." ) ;
7197 await expect ( page . locator ( "[data-idea-board-notes-count='sky-orchard']" ) ) . toHaveText ( "3 Notes" ) ;
7298 await expect ( page . locator ( "[data-idea-board-idea-row='clockwork-courier'] th" ) ) . toHaveText ( "Clockwork Courier" ) ;
@@ -77,7 +103,7 @@ test("Idea Board uses DB-shaped accordion table ideas and notes", async ({ page
77103 await expect ( page . locator ( "[data-idea-board-expanded-row]" ) ) . toHaveCount ( 0 ) ;
78104 await page . locator ( "[data-idea-board-idea-cell='top-thoughts']" ) . click ( ) ;
79105 await expect ( page . locator ( "[data-idea-board-expanded-row='top-thoughts']" ) ) . toBeVisible ( ) ;
80- await expect ( page . locator ( "[data-idea-board-chevron=' top-thoughts']" ) ) . toHaveAttribute ( "src" , / g f s - c h e v r o n - u p \ .s v g $ / ) ;
106+ await expectIdeaChevron ( page , " top-thoughts" , " gfs-chevron-up.svg" ) ;
81107 await expect ( page . locator ( "[data-idea-board-expanded-row='top-thoughts'] [data-idea-board-notes-header='top-thoughts']" ) ) . toHaveText ( "Notes" ) ;
82108 await expect ( page . locator ( "[data-idea-board-notes-table='top-thoughts'] th[scope='col']" ) ) . toHaveText ( [ "Note" , "Actions" ] ) ;
83109 await expect ( page . locator ( "[data-idea-board-notes-table] th[scope='col']" , { hasText : "Type" } ) ) . toHaveCount ( 0 ) ;
@@ -113,12 +139,12 @@ test("Idea Board uses DB-shaped accordion table ideas and notes", async ({ page
113139 await page . locator ( "[data-idea-board-idea-cell='sky-orchard']" ) . click ( ) ;
114140 await expect ( page . locator ( "[data-idea-board-expanded-row='top-thoughts']" ) ) . toHaveCount ( 0 ) ;
115141 await expect ( page . locator ( "[data-idea-board-expanded-row='sky-orchard']" ) ) . toBeVisible ( ) ;
116- await expect ( page . locator ( "[data-idea-board-chevron=' sky-orchard']" ) ) . toHaveAttribute ( "src" , / g f s - c h e v r o n - u p \ .s v g $ / ) ;
142+ await expectIdeaChevron ( page , " sky-orchard" , " gfs-chevron-up.svg" ) ;
117143 await page . locator ( "[data-idea-board-notes-count='sky-orchard']" ) . click ( ) ;
118144 await expect ( page . locator ( "[data-idea-board-expanded-row='sky-orchard']" ) ) . toBeVisible ( ) ;
119145 await page . locator ( "[data-idea-board-idea-cell='sky-orchard']" ) . click ( ) ;
120146 await expect ( page . locator ( "[data-idea-board-expanded-row]" ) ) . toHaveCount ( 0 ) ;
121- await expect ( page . locator ( "[data-idea-board-chevron=' sky-orchard']" ) ) . toHaveAttribute ( "src" , / g f s - c h e v r o n - d o w n \ .s v g $ / ) ;
147+ await expectIdeaChevron ( page , " sky-orchard" , " gfs-chevron-down.svg" ) ;
122148
123149 await page . locator ( "[data-idea-board-add-idea]" ) . click ( ) ;
124150 const ideaInputRow = page . locator ( "[data-idea-board-idea-input-row]" ) . last ( ) ;
0 commit comments