fix: Report and retry media failures for every camera in a grid (#2658)

- Closes: #2637
 - Related: #2099
This commit is contained in:
Dermot Duffy
2026-08-05 21:35:47 -07:00
committed by GitHub
parent 9f88aacefe
commit c137f4c00c
31 changed files with 1719 additions and 1000 deletions
+22 -1
View File
@@ -607,10 +607,31 @@ export class MountedCard {
control.click();
}
/**
* Click the control that steps a carousel one item along.
*
* These carry the name of whatever they move to rather than a name of their
* own, which several other controls also carry, so they are reached by the
* side they sit on instead. Which side moves forward depends on the reading
* direction of the page, exactly as it does for the user.
*/
public async clickNextPreviousControl(side: 'left' | 'right'): Promise<void> {
const control = await this.waitForRender(
() => deepQuery<HTMLElement>(this.card, `ha-icon-button.controls.${side}`),
`the ${side} carousel control`,
);
await clickElement(control);
}
private async _findControl(name: string): Promise<HTMLElement> {
return await this.waitForRender(() => {
const found = deepQueryAll(this.card, '*').find(
(element) => getControlName(element) === name,
(element) =>
getControlName(element) === name &&
// A control the user can press occupies space. An element that only
// wraps one can carry the same name while having no box of its own.
!!element.getBoundingClientRect().width,
);
return found instanceof HTMLElement ? found : null;
}, `a control named ${name}`);
+2 -2
View File
@@ -90,7 +90,7 @@ export const createUnansweredMediaURL = (): string => createMediaURL([]);
*/
export const createStallingMediaURL = (): string => createMediaURL([HTTP_OK]);
export interface StillCameraHASSOptions {
export interface CameraHASSOptions {
// Camera entities beyond the default one.
cameras?: string[];
@@ -105,7 +105,7 @@ export interface StillCameraHASSOptions {
* A Home Assistant holding the cameras a card is about to be given, which is
* the minimum any browser test needs before it can mount anything.
*/
export const createStillCameraHASS = (options?: StillCameraHASSOptions): FakeHASS => {
export const createCameraHASS = (options?: CameraHASSOptions): FakeHASS => {
const cameras = [STILL_CAMERA_ENTITY, ...(options?.cameras ?? [])];
return new FakeHASS({