Skip to content

test: update TreeView tests to address flakiness #40405

test: update TreeView tests to address flakiness

test: update TreeView tests to address flakiness #40405

Triggered via pull request May 8, 2026 21:19
Status Failure
Total duration 4m 47s
Artifacts

ci.yml

on: pull_request
Matrix: examples
Matrix: test
Matrix: type-check
Fit to window
Zoom out
Zoom in

Annotations

51 errors and 2 warnings
examples (react-19)
Spread types may only be created from object types.
examples (react-19)
'TrailingVisual' cannot be used as a JSX component.
examples (react-19)
JSX element type 'TrailingVisual' does not have any construct or call signatures.
examples (react-19)
'LeadingVisual' cannot be used as a JSX component.
examples (react-19)
JSX element type 'LeadingVisual' does not have any construct or call signatures.
examples (react-19)
'menuButtonChild.props' is of type 'unknown'.
examples (react-19)
Unused '@ts-expect-error' directive.
examples (react-19)
@primer/react#build: command (/home/runner/work/react/react/packages/react) /opt/hostedtoolcache/node/24.14.1/x64/bin/npm run build exited (2)
examples (react-19)
No overload matches this call.
examples (react-19)
Unused '@ts-expect-error' directive.
lint
Process completed with exit code 1.
type-check (react-19)
'LeadingVisual' cannot be used as a JSX component.
type-check (react-19)
JSX element type 'LeadingVisual' does not have any construct or call signatures.
type-check (react-19)
Type 'RefObject<HTMLElement | null>' is not assignable to type 'RefObject<HTMLElement>'.
type-check (react-19)
'menuButtonChild.props' is of type 'unknown'.
type-check (react-19)
Unused '@ts-expect-error' directive.
type-check (react-19)
No overload matches this call.
type-check (react-19)
Unused '@ts-expect-error' directive.
type-check (react-19)
Type 'RefObject<HTMLButtonElement | null>' is not assignable to type 'RefObject<HTMLElement>'.
type-check (react-19)
Type 'RefObject<HTMLButtonElement | null>' is not assignable to type 'RefObject<HTMLElement>'.
type-check (react-19)
Type 'RefObject<HTMLButtonElement | null>' is not assignable to type 'RefObject<HTMLElement>'.
type-check (react-19)
'child.props' is of type 'unknown'.
type-check (react-19)
Spread types may only be created from object types.
type-check (react-19)
'TrailingVisual' cannot be used as a JSX component.
type-check (react-19)
JSX element type 'TrailingVisual' does not have any construct or call signatures.
type-check (react-19)
'LeadingVisual' cannot be used as a JSX component.
type-check (react-19)
JSX element type 'LeadingVisual' does not have any construct or call signatures.
type-check (react-19)
'menuButtonChild.props' is of type 'unknown'.
type-check (react-19)
Unused '@ts-expect-error' directive.
type-check (react-19)
No overload matches this call.
type-check (react-19)
Unused '@ts-expect-error' directive.
test (react-19)
Spread types may only be created from object types.
test (react-19)
'TrailingVisual' cannot be used as a JSX component.
test (react-19)
JSX element type 'TrailingVisual' does not have any construct or call signatures.
test (react-19)
'LeadingVisual' cannot be used as a JSX component.
test (react-19)
JSX element type 'LeadingVisual' does not have any construct or call signatures.
test (react-19)
'menuButtonChild.props' is of type 'unknown'.
test (react-19)
Unused '@ts-expect-error' directive.
test (react-19)
No overload matches this call.
test (react-19)
Unused '@ts-expect-error' directive.
test (react-19)
@primer/react#build: command (/home/runner/work/react/react/packages/react) /opt/hostedtoolcache/node/24.14.1/x64/bin/npm run build exited (2)
[@primer/react (chromium)] src/TreeView/TreeView.test.tsx > Keyboard interactions > ArrowLeft > moves focus to parent of collapsed item: packages/react/src/TreeView/TreeView.test.tsx#L649
TestingLibraryElementError: Unable to find an accessible element with the role "treeitem" and name "Parent" There are no accessible roles. But there might be some inaccessible roles. If you wish to access them, then set the `hidden` option to `true`. Learn more about this here: https://testing-library.com/docs/dom-testing-library/api-queries#byrole Ignored nodes: comments, script, style <body> <div /> </body> ❯ Object.getElementError ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:339:18 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1206:24 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1185:16 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1228:18 ❯ getByRole src/TreeView/TreeView.test.tsx:649:32
[@primer/react (chromium)] src/TreeView/TreeView.test.tsx > Keyboard interactions > ArrowLeft > moves focus to parent of end item: packages/react/src/TreeView/TreeView.test.tsx#L609
TestingLibraryElementError: Unable to find an accessible element with the role "treeitem" and name "Parent" There are no accessible roles. But there might be some inaccessible roles. If you wish to access them, then set the `hidden` option to `true`. Learn more about this here: https://testing-library.com/docs/dom-testing-library/api-queries#byrole Ignored nodes: comments, script, style <body> <div /> </body> ❯ Object.getElementError ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:339:18 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1206:24 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1185:16 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1228:18 ❯ getByRole src/TreeView/TreeView.test.tsx:609:32
[@primer/react (chromium)] src/TreeView/TreeView.test.tsx > Keyboard interactions > ArrowLeft > does nothing on a root-level end item: packages/react/src/TreeView/TreeView.test.tsx#L582
TestingLibraryElementError: Unable to find an accessible element with the role "treeitem" and name "Item" There are no accessible roles. But there might be some inaccessible roles. If you wish to access them, then set the `hidden` option to `true`. Learn more about this here: https://testing-library.com/docs/dom-testing-library/api-queries#byrole Ignored nodes: comments, script, style <body> <div /> </body> ❯ Object.getElementError ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:339:18 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1206:24 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1185:16 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1228:18 ❯ getByRole src/TreeView/TreeView.test.tsx:582:26
[@primer/react (chromium)] src/TreeView/TreeView.test.tsx > Keyboard interactions > ArrowLeft > does nothing on a root-level collapsed item: packages/react/src/TreeView/TreeView.test.tsx#L555
TestingLibraryElementError: Unable to find an accessible element with the role "treeitem" and name "Parent" There are no accessible roles. But there might be some inaccessible roles. If you wish to access them, then set the `hidden` option to `true`. Learn more about this here: https://testing-library.com/docs/dom-testing-library/api-queries#byrole Ignored nodes: comments, script, style <body> <div /> </body> ❯ Object.getElementError ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:339:18 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1206:24 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1185:16 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1228:18 ❯ getByRole src/TreeView/TreeView.test.tsx:555:32
[@primer/react (chromium)] src/TreeView/TreeView.test.tsx > Keyboard interactions > ArrowLeft > collapses an expanded item: packages/react/src/TreeView/TreeView.test.tsx#L514
TestingLibraryElementError: Unable to find an accessible element with the role "treeitem" and name "Parent" There are no accessible roles. But there might be some inaccessible roles. If you wish to access them, then set the `hidden` option to `true`. Learn more about this here: https://testing-library.com/docs/dom-testing-library/api-queries#byrole Ignored nodes: comments, script, style <body> <div /> </body> ❯ Object.getElementError ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:339:18 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1206:24 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1185:16 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1228:18 ❯ getByRole src/TreeView/TreeView.test.tsx:514:32
[@primer/react (chromium)] src/TreeView/TreeView.test.tsx > Keyboard interactions > ArrowUp > moves focus to the previous visible treeitem: packages/react/src/TreeView/TreeView.test.tsx#L456
TestingLibraryElementError: Unable to find an accessible element with the role "treeitem" and name "Item 1" There are no accessible roles. But there might be some inaccessible roles. If you wish to access them, then set the `hidden` option to `true`. Learn more about this here: https://testing-library.com/docs/dom-testing-library/api-queries#byrole Ignored nodes: comments, script, style <body> <div /> </body> ❯ Object.getElementError ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:339:18 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1206:24 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1185:16 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1228:18 ❯ getByRole src/TreeView/TreeView.test.tsx:456:27
[@primer/react (chromium)] src/TreeView/TreeView.test.tsx > Keyboard interactions > ArrowDown > moves focus to the next visible treeitem: packages/react/src/TreeView/TreeView.test.tsx#L399
TestingLibraryElementError: Unable to find an accessible element with the role "treeitem" and name "Item 1" There are no accessible roles. But there might be some inaccessible roles. If you wish to access them, then set the `hidden` option to `true`. Learn more about this here: https://testing-library.com/docs/dom-testing-library/api-queries#byrole Ignored nodes: comments, script, style <body> <div /> </body> ❯ Object.getElementError ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:339:18 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1206:24 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1185:16 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1228:18 ❯ getByRole src/TreeView/TreeView.test.tsx:399:27
[@primer/react (chromium)] src/TreeView/TreeView.test.tsx > Markup > should move focus to first treeitem when focusing back in after clicking on a treeitem's secondary action: packages/react/src/TreeView/TreeView.test.tsx#L355
TestingLibraryElementError: Unable to find an element with the text: /Link in Item 2/i. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible. Ignored nodes: comments, script, style <body> <div /> </body> ❯ Object.getElementError ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:339:18 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1206:24 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1185:16 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1228:18 ❯ getByText src/TreeView/TreeView.test.tsx:355:31
[@primer/react (chromium)] src/TreeView/TreeView.test.tsx > Markup > should toggle when receiving focus from chevron click: packages/react/src/TreeView/TreeView.test.tsx#L315
TestingLibraryElementError: Unable to find an accessible element with the role "button" and name `/Focusable element/` There are no accessible roles. But there might be some inaccessible roles. If you wish to access them, then set the `hidden` option to `true`. Learn more about this here: https://testing-library.com/docs/dom-testing-library/api-queries#byrole Ignored nodes: comments, script, style <body> <div /> </body> ❯ Object.getElementError ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:339:18 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1206:24 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1185:16 ❯ ../../node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js:1228:18 ❯ getByRole src/TreeView/TreeView.test.tsx:315:26
[@primer/react (chromium)] src/TreeView/TreeView.test.tsx > Markup > should move focus to current treeitem by default: packages/react/src/TreeView/TreeView.test.tsx#L260
Error: Test timed out in 15000ms. If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout". ❯ it src/TreeView/TreeView.test.tsx:260:2
lint: packages/react/src/TreeView/TreeView.test.tsx#L1566
Disabled test - if you want to skip a test temporarily, use .todo() instead
lint: packages/react/src/TreeView/TreeView.test.tsx#L1510
Disabled test - if you want to skip a test temporarily, use .todo() instead