diff --git a/src/__tests__/role.js b/src/__tests__/role.js index c709d82e..3e9093e9 100644 --- a/src/__tests__/role.js +++ b/src/__tests__/role.js @@ -53,6 +53,55 @@ test('when hidden: true logs available roles when it fails', () => { `) }) +test('when hidden: logs elements with their names when it fails', () => { + const {getByRole} = render( + `

Hi

`, + ) + expect(() => getByRole('article', {hidden: true})) + .toThrowErrorMatchingInlineSnapshot(` + Unable to find an element with the role "article" + + Here are the available roles: + + heading: + + Name "Hi": +

+ + -------------------------------------------------- + alertdialog: + + Name "My Dialog": +