disambiguate the snapshot's workspace-group lookup
Latest master seeds a blank session also titled "fixture"; anchor the session-tree lookup on the expandable group row instead of the first text match.
This commit is contained in:
@@ -104,10 +104,13 @@ function visibleText(element: Element): string {
|
|||||||
/** Open the fixture history session (the alpha log carrying the todo_write turn) and wait for its tail. */
|
/** Open the fixture history session (the alpha log carrying the todo_write turn) and wait for its tail. */
|
||||||
async function openFixtureSession(): Promise<void> {
|
async function openFixtureSession(): Promise<void> {
|
||||||
const tree = await screen.findByRole('tree', { name: 'Sessions' }, { timeout: 10_000 })
|
const tree = await screen.findByRole('tree', { name: 'Sessions' }, { timeout: 10_000 })
|
||||||
// Anchor on the Workspace title, not the session-count meta: the count
|
// Anchor on the expandable Workspace group row: the title and the blank
|
||||||
// shifts when a blank session joins the group.
|
// session row can both read "fixture", and the session-count meta shifts
|
||||||
const group = (await within(tree).findByText('fixture')).closest<HTMLElement>('[role="treeitem"]')
|
// when a blank session joins the group.
|
||||||
if (group === null) throw new Error('fixture Workspace group missing')
|
const group = (await within(tree).findAllByText('fixture'))
|
||||||
|
.map(el => el.closest<HTMLElement>('[role="treeitem"]'))
|
||||||
|
.find(el => el?.getAttribute('aria-expanded') !== null)
|
||||||
|
if (group === null || group === undefined) throw new Error('fixture Workspace group missing')
|
||||||
if (group.getAttribute('aria-expanded') === 'false') {
|
if (group.getAttribute('aria-expanded') === 'false') {
|
||||||
fireEvent.click(within(group).getByText('fixture'))
|
fireEvent.click(within(group).getByText('fixture'))
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user