test: Add a browser based test harness (#2641)

This commit is contained in:
Dermot Duffy
2026-07-31 10:16:58 -07:00
committed by GitHub
parent 51c0fab1ce
commit e590f72783
26 changed files with 2224 additions and 37 deletions
+34 -27
View File
@@ -11,39 +11,46 @@ class HomeAssistantElementsLoadError extends AdvancedCameraCardError {
}
}
/**
* The Home Assistant elements this card renders and expects to already be
* registered.
*/
export const SIDE_LOADED_ELEMENTS = [
'ha-alert',
'ha-button',
'ha-camera-stream',
'ha-card',
'ha-combo-box',
'ha-dropdown-item',
'ha-dropdown',
'ha-expansion-panel',
'ha-form',
'ha-hls-player',
'ha-icon-button-prev',
'ha-icon-button',
'ha-icon',
'ha-md-list-item',
'ha-md-list',
'ha-menu-button',
'ha-selector',
'ha-sortable',
'ha-spinner',
'ha-state-icon',
'ha-web-rtc-player',
'hui-conditional-element',
'mwc-list-item',
'state-badge',
];
/**
* Side loads the HA elements this card needs. This trickery is unfortunate
* necessary, see:
* - https://github.com/thomasloven/hass-config/wiki/PreLoading-Lovelace-Elements
*/
export const sideLoadHomeAssistantElements = async (): Promise<void> => {
const neededElements = [
'ha-alert',
'ha-button',
'ha-camera-stream',
'ha-card',
'ha-combo-box',
'ha-dropdown-item',
'ha-dropdown',
'ha-expansion-panel',
'ha-form',
'ha-hls-player',
'ha-icon-button-prev',
'ha-icon-button',
'ha-icon',
'ha-md-list-item',
'ha-md-list',
'ha-menu-button',
'ha-selector',
'ha-sortable',
'ha-spinner',
'ha-state-icon',
'ha-web-rtc-player',
'mwc-list-item',
'state-badge',
];
if (neededElements.every((element) => customElements.get(element))) {
if (SIDE_LOADED_ELEMENTS.every((element) => customElements.get(element))) {
return;
}