@@ -36,6 +36,23 @@ async function expectIdeaChevron(page, ideaId, iconName) {
3636 expect ( metrics . maskImage ) . toContain ( iconName ) ;
3737}
3838
39+ async function expectButtonLeftAligned ( page , buttonSelector , containerSelector ) {
40+ const metrics = await page . locator ( buttonSelector ) . evaluate ( ( button , selector ) => {
41+ const container = button . ownerDocument . querySelector ( selector ) ;
42+ const buttonRect = button . getBoundingClientRect ( ) ;
43+ const containerRect = container . getBoundingClientRect ( ) ;
44+ const containerStyles = getComputedStyle ( container ) ;
45+ return {
46+ buttonLeft : buttonRect . left ,
47+ containerLeft : containerRect . left ,
48+ containerWidth : containerRect . width ,
49+ expectedLeft : containerRect . left + Number . parseFloat ( containerStyles . paddingLeft || "0" ) ,
50+ } ;
51+ } , containerSelector ) ;
52+ expect ( Math . abs ( metrics . buttonLeft - metrics . expectedLeft ) ) . toBeLessThanOrEqual ( 2 ) ;
53+ expect ( metrics . buttonLeft ) . toBeLessThan ( metrics . containerLeft + metrics . containerWidth / 2 ) ;
54+ }
55+
3956test ( "Idea Board uses DB-shaped accordion table ideas and notes" , async ( { page } ) => {
4057 const server = await startRepoServer ( ) ;
4158 const previousApiUrl = process . env . GAMEFOUNDRY_API_URL ;
@@ -78,6 +95,9 @@ test("Idea Board uses DB-shaped accordion table ideas and notes", async ({ page
7895 await expect ( page . locator ( "[data-idea-board-idea-row]" ) ) . toHaveCount ( 3 ) ;
7996 await expect ( page . locator ( "[data-idea-board-expanded-row]" ) ) . toHaveCount ( 0 ) ;
8097 await expect ( page . locator ( "[data-idea-board-add-idea-row]" ) ) . toHaveCount ( 1 ) ;
98+ await expect ( page . locator ( "[data-idea-board-add-idea]" ) ) . toHaveText ( "Add Idea" ) ;
99+ await expectButtonLeftAligned ( page , "[data-idea-board-add-idea]" , "[data-idea-board-add-idea-row] > td" ) ;
100+ await expect ( page . getByText ( / a n o t h e r / i) ) . toHaveCount ( 0 ) ;
81101 await expect ( page . locator ( "[data-idea-board-notes-chevron]" ) ) . toHaveCount ( 0 ) ;
82102 await expect ( page . getByText ( "Selected idea context" ) ) . toHaveCount ( 0 ) ;
83103 await expect ( page . getByText ( "Notes for Sky Orchard" ) ) . toHaveCount ( 0 ) ;
@@ -109,6 +129,8 @@ test("Idea Board uses DB-shaped accordion table ideas and notes", async ({ page
109129 await expect ( page . locator ( "[data-idea-board-expanded-row='top-thoughts'] :is(h1,h2,h3,h4,h5,h6)" ) . filter ( { hasText : / ^ N o t e s $ / } ) ) . toHaveCount ( 0 ) ;
110130 await expect ( page . locator ( "[data-idea-board-expanded-row='top-thoughts'] > td > .content-stack" ) ) . toHaveCount ( 0 ) ;
111131 await expect ( page . locator ( "[data-idea-board-notes-table='top-thoughts'] th[scope='col']" ) ) . toHaveText ( [ "Note" , "Actions" ] ) ;
132+ await expect ( page . locator ( "[data-idea-board-add-note='top-thoughts']" ) ) . toHaveText ( "Add Note" ) ;
133+ await expectButtonLeftAligned ( page , "[data-idea-board-add-note='top-thoughts']" , "[data-idea-board-expanded-row='top-thoughts'] > td" ) ;
112134 await expect ( page . locator ( "[data-idea-board-notes-table] th[scope='col']" , { hasText : "Type" } ) ) . toHaveCount ( 0 ) ;
113135 await expect ( page . locator ( "[data-idea-board-notes-table] th[scope='col']" , { hasText : "Created By" } ) ) . toHaveCount ( 0 ) ;
114136 await expect ( page . locator ( "[data-idea-board-notes-table] th[scope='col']" , { hasText : "Created" } ) ) . toHaveCount ( 0 ) ;
0 commit comments