Screenshots in UI Unit Testing
UI Unit testing supports returning a text representation of the UI for tests that fail.
└── UI[]
├── MainLayout[primarySection='drawer']
│ ├── Header[@class='view-header', @slot='navbar touch-optimized']
│ │ ├── DrawerToggle[@aria-label='Menu toggle', @class='view-toggle', @theme='contrast']
│ │ └── H1[text='Hello World', @class='view-title']
│ ├── Section[@class='drawer-section', @slot='drawer']
│ │ ├── H2[text='My App', @class='app-name']
│ │ ├── Nav[@aria-labelledby='views', @class='menu-item-container']
│ │ │ └── UnorderedList[@class='navigation-list']
│ │ │ ├── MenuItemInfo[]
│ │ │ │ └── RouterLink[@class='menu-item-link']
│ │ │ │ ├── LineAwesomeIcon[@class='menu-item-icon la la-globe']
│ │ │ │ └── Span[text='Hello World', @class='menu-item-text']
│ │ │ └── MenuItemInfo[]
│ │ │ └── RouterLink[@class='menu-item-link']
│ │ │ ├── LineAwesomeIcon[@class='menu-item-icon la la-file']
│ │ │ └── Span[text='About', @class='menu-item-text']
│ │ └── Footer[@class='footer']
│ └── HelloWorldView[@theme='margin spacing']
│ ├── TextField[label='Your name', value='', @style='align-self:flex-end']
│ └── Button[caption='Say hello', @style='align-self:flex-end']
└── Notification[duration='5000', opened='true', position='bottom-start']
The feature is not active by default and can be enabled by adding @ExtendWith(TreeOnFailureExtension.class)
to the test class in JUnit5.
For JUnit4 tests based on UIUnit4Test
, the feature can be activated by overriding the printTree()
method to return true.
99487CB3-54AB-4C0A-8A46-926A527EB381