@absoluteui/angular/testing
Component harnesses for @angular/cdk/testing: test through the rendered DOM as a user does.
import { AuiButtonHarness, AuiFieldHarness, AuiTextInputHarness, AuiSelectHarness, AuiDatePickerHarness, AuiTabsHarness, AuiDialogHarness, AuiDataTableHeaderHarness, AuiDataTableRowHarness, AuiDataTableHarness, AuiCheckboxHarness, AuiSwitchHarness, AuiRadioGroupHarness, AuiTextareaHarness, AuiNumberInputHarness, AuiComboboxHarness, AuiMultiSelectHarness, AuiSidebarHarness, AuiPaginationHarness, AuiMenuHarness } from '@absoluteui/angular/testing';AuiButtonHarness
Section titled “AuiButtonHarness”harness.
button[auiButton] and a[auiButton].
Methods
Section titled “Methods”| Method | Description |
|---|---|
with<T extends AuiButtonHarness>(this: ComponentHarnessConstructor<T>, options?: AuiButtonHarnessFilters | undefined): HarnessPredicate<T> |
|
getText(): Promise<string> |
Visible text, or the accessible label of an icon-only button. |
getVariant(): Promise<string | null> |
|
isDisabled(): Promise<boolean> |
Native disabled, or aria-disabled (disabled links, loading). |
isLoading(): Promise<boolean> |
|
isLink(): Promise<boolean> |
|
click(): Promise<void> |
|
focus(): Promise<void> |
AuiFieldHarness
Section titled “AuiFieldHarness”harness.
Label, description, validation message, required and disabled state of a form field.
Methods
Section titled “Methods”| Method | Description |
|---|---|
getLabel(): Promise<string> |
|
getDescription(): Promise<string | null> |
|
getErrorMessage(): Promise<string | null> |
The message shown to the user, or null. |
isRequired(): Promise<boolean> |
|
isDisabled(): Promise<boolean> |
|
isInvalid(): Promise<boolean> |
|
focus(): Promise<void> |
|
blur(): Promise<void> |
Leaves the field (marks it touched). |
AuiTextInputHarness
Section titled “AuiTextInputHarness”harness.
<aui-text-input>.
Methods
Section titled “Methods”| Method | Description |
|---|---|
with<T extends AuiTextInputHarness>(this: ComponentHarnessConstructor<T>, options?: AuiFieldHarnessFilters | undefined): HarnessPredicate<T> |
|
getValue(): Promise<string> |
|
setValue(value: string): Promise<void> |
Replaces the value by typing, as a user would (input events per key). |
getPlaceholder(): Promise<string> |
AuiSelectHarness
Section titled “AuiSelectHarness”harness.
<aui-select>. The listbox renders inside the host.
Methods
Section titled “Methods”| Method | Description |
|---|---|
with<T extends AuiSelectHarness>(this: ComponentHarnessConstructor<T>, options?: AuiFieldHarnessFilters | undefined): HarnessPredicate<T> |
|
getValueText(): Promise<string> |
The selected option’s label as shown, or the placeholder. |
isOpen(): Promise<boolean> |
|
open(): Promise<void> |
|
close(): Promise<void> |
|
getOptions(): Promise<AuiSelectOption[]> |
Options (opens the listbox first). |
selectOption(label: string | RegExp): Promise<void> |
Opens the listbox and chooses the first option whose label matches. |
AuiDatePickerHarness
Section titled “AuiDatePickerHarness”harness.
<aui-date-picker>: typed segments and the calendar popup.
Methods
Section titled “Methods”| Method | Description |
|---|---|
with<T extends AuiDatePickerHarness>(this: ComponentHarnessConstructor<T>, options?: AuiFieldHarnessFilters | undefined): HarnessPredicate<T> |
|
getLabel(): Promise<string> |
|
getSegments(): Promise<string[]> |
The typed segments in display order, e.g. [‘08’, ‘03’, ‘2026’] in en-GB. |
typeDate(date: { year: number; month: number; day: number; }): Promise<void> |
Types a date into the segments by their accessible names (locale-independent). |
isCalendarOpen(): Promise<boolean> |
|
openCalendar(): Promise<void> |
|
getCalendarMonth(): Promise<string> |
The visible month heading, e.g. “November 2026”. |
getDayLabels(): Promise<string[]> |
Accessible names of the days of the visible month (they name non-working days and holidays). |
isDayDisabled(day: number): Promise<boolean> |
|
selectDay(day: number): Promise<void> |
Chooses a day of the visible month in the calendar. |
nextMonth(): Promise<void> |
|
previousMonth(): Promise<void> |
AuiTabsHarness
Section titled “AuiTabsHarness”harness.
<aui-tabs>.
Methods
Section titled “Methods”| Method | Description |
|---|---|
with<T extends AuiTabsHarness>(this: ComponentHarnessConstructor<T>, options?: AuiTabsHarnessFilters | undefined): HarnessPredicate<T> |
|
getLabel(): Promise<string> |
|
getTabLabels(): Promise<string[]> |
|
getSelectedTabLabel(): Promise<string | null> |
|
isTabDisabled(label: string): Promise<boolean> |
|
selectTab(label: string): Promise<void> |
|
getPanelText(): Promise<string> |
Text of the visible panel. |
AuiDialogHarness
Section titled “AuiDialogHarness”harness.
An open AbsoluteUI dialog (<aui-dialog> or AuiDialogService). Dialogs render in the body layer: load it with TestbedHarnessEnvironment.documentRootLoader(fixture).
Methods
Section titled “Methods”| Method | Description |
|---|---|
with<T extends AuiDialogHarness>(this: ComponentHarnessConstructor<T>, options?: AuiDialogHarnessFilters | undefined): HarnessPredicate<T> |
|
getTitle(): Promise<string> |
|
getDescription(): Promise<string | null> |
|
getBodyText(): Promise<string> |
|
getRole(): Promise<string> |
dialog or alertdialog. |
getActionLabels(): Promise<string[]> |
|
clickAction(label: string): Promise<void> |
|
getFocusedText(): Promise<string | null> |
Text of the element that has focus inside the dialog, or null. |
close(): Promise<void> |
|
pressEscape(): Promise<void> |
AuiDataTableHeaderHarness
Section titled “AuiDataTableHeaderHarness”harness.
A column header of <aui-data-table>.
Methods
Section titled “Methods”| Method | Description |
|---|---|
getText(): Promise<string> |
|
isSortable(): Promise<boolean> |
|
getSortDirection(): Promise<"ascending" | "descending" | null> |
The sort direction of the primary sort (aria-sort), or null. |
sort(): Promise<void> |
Activates the sort button (cycles ascending, descending, unsorted). |
AuiDataTableRowHarness
Section titled “AuiDataTableRowHarness”harness.
A rendered data row of <aui-data-table>.
Methods
Section titled “Methods”| Method | Description |
|---|---|
getCellTexts(): Promise<string[]> |
Cell texts in column order (selection and expander cells are empty strings). |
isSelected(): Promise<boolean> |
|
toggleSelection(): Promise<void> |
Toggles the row’s selection control. |
isEditable(columnId: string): Promise<boolean> |
|
isEditing(): Promise<boolean> |
True while a cell editor is open in this row (for example after an invalid value). |
startEdit(columnId: string): Promise<void> |
Opens a cell editor (the row is rebuilt: query the row again afterwards). No-op while one is open. |
commitEdit(value: string): Promise<void> |
Replaces the open editor’s text and commits with Enter (the row is rebuilt: query it again). |
AuiDataTableHarness
Section titled “AuiDataTableHarness”harness.
<aui-data-table>: rows are the rendered data rows of the current page (or virtual window).
Methods
Section titled “Methods”| Method | Description |
|---|---|
with<T extends AuiDataTableHarness>(this: ComponentHarnessConstructor<T>, options?: AuiDataTableHarnessFilters | undefined): HarnessPredicate<T> |
|
getCaption(): Promise<string> |
|
getHeaders(): Promise<AuiDataTableHeaderHarness[]> |
|
getHeaderTexts(): Promise<string[]> |
|
getHeader(text: string): Promise<AuiDataTableHeaderHarness> |
|
getRows(): Promise<AuiDataTableRowHarness[]> |
|
getCellTexts(): Promise<string[][]> |
Cell texts of every rendered row. |
getSort(): Promise<{ column: string; direction: "ascending" | "descending"; } | null> |
The primary sort, or null. |
sortBy(header: string): Promise<void> |
|
search(text: string): Promise<void> |
Types into the search field and presses Enter, which applies it without the typing delay. |
editCell(rowIndex: number, columnId: string, value: string): Promise<string | null> |
Opens the editor of a cell (rendered row index, column id), replaces its text, and commits with Enter. Returns the message shown for an invalid value (the editor stays open), or null. |
getEditError(): Promise<string | null> |
The message of an open cell editor (invalid value), or null. |
goToPage(target: number | "next" | "previous" | "first" | "last"): Promise<void> |
Moves to another page through the pager. |
AuiCheckboxHarness
Section titled “AuiCheckboxHarness”harness.
<aui-checkbox>.
Methods
Section titled “Methods”| Method | Description |
|---|---|
with<T extends AuiCheckboxHarness>(this: ComponentHarnessConstructor<T>, options?: AuiFieldHarnessFilters | undefined): HarnessPredicate<T> |
|
isChecked(): Promise<boolean> |
|
isIndeterminate(): Promise<boolean> |
|
toggle(): Promise<void> |
|
check(): Promise<void> |
|
uncheck(): Promise<void> |
AuiSwitchHarness
Section titled “AuiSwitchHarness”harness.
<aui-switch>.
Methods
Section titled “Methods”| Method | Description |
|---|---|
with<T extends AuiSwitchHarness>(this: ComponentHarnessConstructor<T>, options?: AuiFieldHarnessFilters | undefined): HarnessPredicate<T> |
|
isChecked(): Promise<boolean> |
|
toggle(): Promise<void> |
AuiRadioGroupHarness
Section titled “AuiRadioGroupHarness”harness.
<aui-radio-group>.
Methods
Section titled “Methods”| Method | Description |
|---|---|
with<T extends AuiRadioGroupHarness>(this: ComponentHarnessConstructor<T>, options?: AuiFieldHarnessFilters | undefined): HarnessPredicate<T> |
|
getOptionLabels(): Promise<string[]> |
|
getCheckedLabel(): Promise<string | null> |
Label of the checked option, or null. |
isOptionDisabled(label: string): Promise<boolean> |
|
select(label: string): Promise<void> |
AuiTextareaHarness
Section titled “AuiTextareaHarness”harness.
<aui-textarea>.
Methods
Section titled “Methods”| Method | Description |
|---|---|
with<T extends AuiTextareaHarness>(this: ComponentHarnessConstructor<T>, options?: AuiFieldHarnessFilters | undefined): HarnessPredicate<T> |
|
getValue(): Promise<string> |
|
setValue(value: string): Promise<void> |
AuiNumberInputHarness
Section titled “AuiNumberInputHarness”harness.
<aui-number-input>: typing and the spin button keys.
Methods
Section titled “Methods”| Method | Description |
|---|---|
with<T extends AuiNumberInputHarness>(this: ComponentHarnessConstructor<T>, options?: AuiFieldHarnessFilters | undefined): HarnessPredicate<T> |
|
getText(): Promise<string> |
The text shown (formatted for the locale). |
getValue(): Promise<number | null> |
The value as announced (aria-valuenow), or null when empty. |
setText(text: string): Promise<void> |
Types text and leaves the field, as a user would. |
increment(): Promise<void> |
|
decrement(): Promise<void> |
AuiComboboxHarness
Section titled “AuiComboboxHarness”harness.
<aui-combobox>: typing, options (static or loaded), choosing.
Methods
Section titled “Methods”| Method | Description |
|---|---|
with<T extends AuiComboboxHarness>(this: ComponentHarnessConstructor<T>, options?: AuiFieldHarnessFilters | undefined): HarnessPredicate<T> |
|
getLabel(): Promise<string> |
|
getInputText(): Promise<string> |
|
isOpen(): Promise<boolean> |
|
type(text: string): Promise<void> |
Replaces the text by typing (filters the options or starts a load). |
getOptionLabels(): Promise<string[]> |
Labels of the options shown. |
waitForOptions(timeout?: number | undefined): Promise<string[]> |
Waits (up to timeout ms) until at least one option is shown: loads are debounced outside Angular’s stability tracking. |
selectOption(label: string | RegExp): Promise<void> |
AuiMultiSelectHarness
Section titled “AuiMultiSelectHarness”harness.
<aui-multi-select>: typing, toggling options, selected chips.
Methods
Section titled “Methods”| Method | Description |
|---|---|
with<T extends AuiMultiSelectHarness>(this: ComponentHarnessConstructor<T>, options?: AuiFieldHarnessFilters | undefined): HarnessPredicate<T> |
|
getLabel(): Promise<string> |
|
isOpen(): Promise<boolean> |
|
open(): Promise<void> |
|
close(): Promise<void> |
|
type(text: string): Promise<void> |
Replaces the text by typing (filters the options or starts a load). |
getSelectedLabels(): Promise<string[]> |
Labels of the selected values (the chips), in selection order. |
getOptionLabels(): Promise<string[]> |
Labels of the options shown (including “Select all” when enabled). |
toggleOption(label: string | RegExp): Promise<void> |
Toggles the option with this label (opens the list first). |
removeValue(label: string): Promise<void> |
Removes a selected value with its chip remove button (not available when read-only or disabled). |
AuiSidebarHarness
Section titled “AuiSidebarHarness”harness.
<aui-sidebar>.
Methods
Section titled “Methods”| Method | Description |
|---|---|
with<T extends AuiSidebarHarness>(this: ComponentHarnessConstructor<T>, options?: AuiSidebarHarnessFilters | undefined): HarnessPredicate<T> |
|
getLabel(): Promise<string> |
|
getItemLabels(): Promise<string[]> |
Labels of the visible items (items of collapsed groups are hidden). |
getCurrentLabel(): Promise<string | null> |
Label of the current item (aria-current="page"), or null. |
click(label: string): Promise<void> |
Activates an item or toggles a group, as a click does. |
isGroupExpanded(label: string): Promise<boolean> |
|
isCollapsed(): Promise<boolean> |
|
toggleCollapsed(): Promise<void> |
The collapse button (inline mode, collapsible). |
AuiPaginationHarness
Section titled “AuiPaginationHarness”harness.
<aui-pagination>.
Methods
Section titled “Methods”| Method | Description |
|---|---|
getCurrentPage(): Promise<number | null> |
|
getPageNumbers(): Promise<number[]> |
Page numbers shown as buttons (ellipses are not pages). |
isDisabled(target: "next" | "previous" | "first" | "last"): Promise<boolean> |
|
goTo(target: number | "next" | "previous" | "first" | "last"): Promise<void> |
AuiMenuHarness
Section titled “AuiMenuHarness”harness.
button[auiMenu]: the trigger; the menu renders next to it, so items are read from the document.
Methods
Section titled “Methods”| Method | Description |
|---|---|
with<T extends AuiMenuHarness>(this: ComponentHarnessConstructor<T>, options?: AuiMenuHarnessFilters | undefined): HarnessPredicate<T> |
|
isOpen(): Promise<boolean> |
|
open(): Promise<void> |
|
close(): Promise<void> |
|
getItems(): Promise<AuiMenuItem[]> |
Items of the top-level menu (opens it). |
select(...path: string[]): Promise<void> |
Opens the menu and activates the item at path (submenus by their labels). |
Functions, constants, and types
Section titled “Functions, constants, and types”Interfaces
Section titled “Interfaces”AuiButtonHarnessFilters
Filters for AuiButtonHarness.with().
interface AuiButtonHarnessFilters extends BaseHarnessFilters { text?: string | RegExp; variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger';}AuiDataTableHarnessFilters
Filters for AuiDataTableHarness.with().
interface AuiDataTableHarnessFilters extends BaseHarnessFilters { caption?: string | RegExp;}AuiDialogHarnessFilters
Filters for AuiDialogHarness.with().
interface AuiDialogHarnessFilters extends BaseHarnessFilters { title?: string | RegExp;}AuiFieldHarnessFilters
Filters for the form field harnesses (with({ label })).
interface AuiFieldHarnessFilters extends BaseHarnessFilters { label?: string | RegExp;}AuiMenuHarnessFilters
Filters for AuiMenuHarness.with().
interface AuiMenuHarnessFilters extends BaseHarnessFilters { triggerText?: string | RegExp;}AuiMenuItem
A menu item, as the harness reads it.
interface AuiMenuItem { label: string; disabled: boolean; checked: boolean | null; hasSubmenu: boolean;}AuiSelectOption
An option of a Select, as the harness reads it.
interface AuiSelectOption { label: string; disabled: boolean; selected: boolean;}AuiSidebarHarnessFilters
Filters for AuiSidebarHarness.with().
interface AuiSidebarHarnessFilters extends BaseHarnessFilters { label?: string | RegExp;}AuiTabsHarnessFilters
Filters for AuiTabsHarness.with().
interface AuiTabsHarnessFilters extends BaseHarnessFilters { label?: string | RegExp;}