@@ -12,7 +12,11 @@ import { test, expect } from '@playwright/test';
1212 * - ungrouped → flat details body, no section cards
1313 * - stageField:false → NO `record:path` stepper despite a `status` field
1414 * named to bait the heuristic
15- * - related-heavy → related lists surface as tabs (prominence rule)
15+ * - related-heavy → related lists surface by prominence (ADR-0085), in the
16+ * tabbed tier as record page v3 draws it (objectstack#27055,
17+ * Target 8): a `relatedList: 'primary'` list is a body
18+ * table in the Details tab, the rest sit behind the
19+ * Related tab and self-fetch when it is shown
1620 *
1721 * Runs against the console the backend serves at /_console (baseURL from
1822 * playwright.config.ts; storageState carries the admin session). The
@@ -156,25 +160,51 @@ test('stageField:false: status renders as a plain field, no stepper', async ({ p
156160test ( 'ungrouped + related-heavy: flat details and related-list tabs on Contoso' , async ( { page } ) => {
157161 // The synthesized record page lays itself out by the width of the view it
158162 // occupies (objectstack#26678): the tab strip this case opens exists only
159- // below the two-column floor (`RECORD_PAGE_TWO_COLUMN_MIN_WIDTH` in
160- // `@object-ui/plugin-detail`). The Desktop Chrome viewport leaves the record
161- // view right at that floor once the console sidebar takes its share — two
162- // columns and a "Related" toggle, no tablist — so the case pins a viewport
163- // that keeps the page in its tabbed tier.
164- await page . setViewportSize ( { width : 1200 , height : 800 } ) ;
163+ // below the two-column floor, a record view narrower than
164+ // `RECORD_PAGE_TWO_COLUMN_MIN_WIDTH` (760 px, `@object-ui/plugin-detail`).
165+ // The case stays in that tabbed tier on purpose: the column tiers are what
166+ // every other page of this smoke draws at the Desktop Chrome viewport, and
167+ // the tab strip is also what the drawer and split pane draw at any width.
168+ //
169+ // The window is derived, not picked. Measured on this harness (a fresh
170+ // browser context, so no stored sidebar cookie): from a 768 px window
171+ // (`MOBILE_BREAKPOINT`, the desktop shell) to 1000 px the console sidebar
172+ // came up as its 48 px icon rail, and the record view was the window minus
173+ // that rail — two columns at 808 px (760 of view), tabs at 800 px (752).
174+ // So the desktop tabbed tier is a window of 768 to 807 px, and an expanded
175+ // sidebar (256 px) only narrows the view further. 780 sits inside it with
176+ // headroom on both sides: 732 px of view against the 760 floor, 12 px above
177+ // the mobile breakpoint. ⛔ Not 1200 px: since objectstack#27473 moved the
178+ // floor to a 760 px view, 1200 draws columns and no tablist. ⛔ Not below
179+ // 768 px: that is the mobile shell, where the off-canvas sidebar gives the
180+ // view the whole window (760 px measured as two columns).
181+ await page . setViewportSize ( { width : 780 , height : 800 } ) ;
165182 const errors = await openRecord ( page , recordUrl ( 'showcase_account' , contosoId ) ) ;
166183
167184 // Heuristic stepper (account.status is a select named "status").
168185 // record:path renders a desktop + a mobile variant — assert the visible one.
169186 await expect ( page . locator ( PATH_STEPPER ) . first ( ) ) . toBeVisible ( ) ;
170187
171- // Related lists surface as tabs (ADR-0085 prominence rule).
188+ // Related lists surface by prominence (ADR-0085), as record page v3 draws
189+ // them (objectstack#27055, Target 8): Invoices and Projects are
190+ // `relatedList: 'primary'` (CORE relationships), so each is a body table in
191+ // the Details tab, with its rows read at open; the rest of Contoso's lists
192+ // (Contacts and the Field Zoo lookups) sit behind the Related tab.
172193 const detailsTab = page . getByRole ( 'tab' , { name : / D e t a i l s / i } ) ;
194+ const relatedTab = page . getByRole ( 'tab' , { name : / ^ R e l a t e d / } ) ;
173195 await expect ( detailsTab ) . toBeVisible ( ) ;
174- const invoicesTab = page . getByRole ( 'tab' , { name : / I n v o i c e s / i } ) ;
175- const projectsTab = page . getByRole ( 'tab' , { name : / P r o j e c t s / i } ) ;
176- await expect ( invoicesTab ) . toBeVisible ( ) ;
177- await expect ( projectsTab ) . toBeVisible ( ) ;
196+ await expect ( detailsTab ) . toHaveAttribute ( 'aria-selected' , 'true' ) ;
197+ await expect ( relatedTab ) . toBeVisible ( ) ;
198+ await expect ( page . getByRole ( 'tab' , { name : / I n v o i c e s | P r o j e c t s / i } ) ) . toHaveCount ( 0 ) ;
199+ const detailsPanel = page . getByRole ( 'tabpanel' , { name : / D e t a i l s / i } ) ;
200+ const invoicesTable = detailsPanel
201+ . getByRole ( 'table' )
202+ . filter ( { has : page . getByRole ( 'columnheader' , { name : 'Invoice Number' } ) } ) ;
203+ const projectsTable = detailsPanel
204+ . getByRole ( 'table' )
205+ . filter ( { has : page . getByRole ( 'columnheader' , { name : 'Project Name' } ) } ) ;
206+ await expect ( invoicesTable . getByRole ( 'cell' , { name : 'INV-1002' , exact : true } ) ) . toBeVisible ( ) ;
207+ await expect ( projectsTable . getByRole ( 'cell' , { name : 'Data Platform' , exact : true } ) ) . toBeVisible ( ) ;
178208
179209 // Ungrouped shape: the Details body is flat — no fieldGroup section cards.
180210 // (Contoso declares no fieldGroups; spot-check a body field label.)
@@ -190,13 +220,13 @@ test('ungrouped + related-heavy: flat details and related-list tabs on Contoso',
190220 expect ( footerText , 'footer dangles "Created by" without an actor' ) . not . toMatch ( / C r e a t e d b y / ) ;
191221 expect ( footerText ) . toMatch ( / C r e a t e d / ) ;
192222
193- // Related lists self-fetch lazily when their tab is shown.
194- await invoicesTab . click ( ) ;
195- const panel = page . getByRole ( 'tabpanel' ) ;
196- await expect ( panel ) . toBeVisible ( ) ;
197- await page . waitForTimeout ( 1500 ) ;
198- const panelText = ( await panel . innerText ( ) . catch ( ( ) => '' ) ) || '' ;
199- expect ( panelText . trim ( ) . length , 'invoices tab rendered no content' ) . toBeGreaterThan ( 0 ) ;
223+ // The non-primary lists self-fetch lazily when their tab is shown: the
224+ // Related tab's Contacts list reads Contoso's seeded contacts.
225+ await relatedTab . click ( ) ;
226+ await expect ( relatedTab ) . toHaveAttribute ( 'aria-selected' , 'true' ) ;
227+ const relatedPanel = page . getByRole ( 'tabpanel' , { name : / ^ R e l a t e d / } ) ;
228+ await expect ( relatedPanel ) . toBeVisible ( ) ;
229+ await expect ( relatedPanel . getByRole ( 'cell' , { name : 'Carl Fox' , exact : true } ) ) . toBeVisible ( ) ;
200230
201231 expect ( errors , 'uncaught page errors on related-heavy detail' ) . toEqual ( [ ] ) ;
202232} ) ;
0 commit comments