test: Add browser tests for the media viewing gallery and viewer (#2661)

This commit is contained in:
Dermot Duffy
2026-08-07 16:08:56 -07:00
committed by GitHub
parent 567690831c
commit 673d8fe133
25 changed files with 1563 additions and 144 deletions
+17 -2
View File
@@ -67,13 +67,23 @@ export default defineConfig({
name: 'browser',
include: ['tests/**/*.browser.test.ts'],
// One file at a time. Files otherwise share a browser, in which only one of
// them can hold focus, so a test driving the keyboard loses it to whichever
// sibling clicks next. Measured no slower than running in parallel.
fileParallelism: false,
// The tests under `tests/dist` need a card build to exist (in dist/), which
// this suite does not require. They have their own config, see
// vitest.dist.config.ts .
exclude: ['tests/dist/**'],
// Cosmetic: Style the pages as HA does for screenshots.
setupFiles: ['./tests/browser/style.ts'],
setupFiles: [
// Must run before anything defines an element.
'./tests/browser/scoped-custom-element-registry.ts',
// Cosmetic: Style the pages as HA does for screenshots.
'./tests/browser/style.ts',
],
// A failing test leaves a screenshot and any attachments behind. Both
// default to somewhere else -- a `__screenshots__` directory next to the
@@ -85,6 +95,11 @@ export default defineConfig({
// past the default of 300ms.
slowTestThreshold: 10000,
// How long a test may take before it is called a hang. Mounting a real card
// in three browsers at once is expensive, and a machine running something
// else alongside can push a healthy test past the default of 5 seconds.
testTimeout: 30000,
server: {
deps: {
// These dependencies import without extensions.