Skip to content
This repository was archived by the owner on Oct 21, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 50 additions & 11 deletions apps/e2e/scripts/generate-pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,24 @@ interface PageDef {
resource: string;
category?: 'cdn' | 'captions' | 'background' | 'background-preset' | 'source-html' | 'source-react';
/** The packaged skin theme; the default skin unless set. */
skin?: 'neutral';
skin?: 'neutral' | 'compat';
}

type SkinTheme = NonNullable<PageDef['skin']> | 'default';

/** The custom element a packaged HTML skin registers. */
function htmlSkinTag(media: 'video' | 'audio', skin: SkinTheme): string {
return skin === 'neutral' ? `${media}-neutral-skin` : `${media}-skin`;
return skin === 'default' ? `${media}-skin` : `${media}-${skin}-skin`;
}

/** The entry a packaged skin ships under for both frameworks, as `video/skin` or `video/neutral-skin`. */
function skinEntry(media: 'video' | 'audio', skin: SkinTheme): string {
return skin === 'neutral' ? `${media}/neutral-skin` : `${media}/skin`;
return skin === 'default' ? `${media}/skin` : `${media}/${skin}-skin`;
}

/** The React component a packaged skin exports, as `VideoSkin` or `NeutralVideoSkin`. */
function reactSkinComponent(media: 'Video' | 'Audio', skin: SkinTheme): string {
return skin === 'default' ? `${media}Skin` : `${skin[0]!.toUpperCase()}${skin.slice(1)}${media}Skin`;
}

// ---------------------------------------------------------------------------
Expand Down Expand Up @@ -249,12 +254,12 @@ function reactVideoPage(media: string, resource: string, config: MediaTypeConfig
if (!reactMedia) throw new Error(`No React component mapping for media type: ${media}`);

const isDefaultVideo = media === 'video';
const Skin = skin === 'neutral' ? 'NeutralVideoSkin' : 'VideoSkin';
const Skin = reactSkinComponent('Video', skin);
const skinImport =
skin === 'neutral' ? `\nimport { NeutralVideoSkin } from '@videojs/react/video/neutral-skin';` : '';
skin === 'default' ? '' : `\nimport { ${Skin} } from '@videojs/react/${skinEntry('video', skin)}';`;
const mediaImport = isDefaultVideo
? `import { Video, VideoPlayer${skin === 'neutral' ? '' : ', VideoSkin'} } from '@videojs/react/video';${skinImport}`
: `import { ${reactMedia.component} } from '${reactMedia.importPath}';\nimport { VideoPlayer${skin === 'neutral' ? '' : ', VideoSkin'} } from '@videojs/react/video';${skinImport}`;
? `import { Video, VideoPlayer${skin === 'default' ? ', VideoSkin' : ''} } from '@videojs/react/video';${skinImport}`
: `import { ${reactMedia.component} } from '${reactMedia.importPath}';\nimport { VideoPlayer${skin === 'default' ? ', VideoSkin' : ''} } from '@videojs/react/video';${skinImport}`;

const posterProp = config.hasPoster && resourceHasPoster(resource) ? ` poster={MEDIA.${resource}.poster}` : '';
const storyboardTrack = config.hasStoryboard
Expand Down Expand Up @@ -286,12 +291,12 @@ function reactAudioPage(media: string, resource: string, skin: SkinTheme): strin
if (!reactMedia) throw new Error(`No React component mapping for media type: ${media}`);

const isDefaultAudio = media === 'audio';
const Skin = skin === 'neutral' ? 'NeutralAudioSkin' : 'AudioSkin';
const Skin = reactSkinComponent('Audio', skin);
const skinImport =
skin === 'neutral' ? `\nimport { NeutralAudioSkin } from '@videojs/react/audio/neutral-skin';` : '';
skin === 'default' ? '' : `\nimport { ${Skin} } from '@videojs/react/${skinEntry('audio', skin)}';`;
const mediaImport = isDefaultAudio
? `import { Audio, AudioPlayer${skin === 'neutral' ? '' : ', AudioSkin'} } from '@videojs/react/audio';${skinImport}`
: `import { ${reactMedia.component} } from '${reactMedia.importPath}';\nimport { AudioPlayer${skin === 'neutral' ? '' : ', AudioSkin'} } from '@videojs/react/audio';${skinImport}`;
? `import { Audio, AudioPlayer${skin === 'default' ? ', AudioSkin' : ''} } from '@videojs/react/audio';${skinImport}`
: `import { ${reactMedia.component} } from '${reactMedia.importPath}';\nimport { AudioPlayer${skin === 'default' ? ', AudioSkin' : ''} } from '@videojs/react/audio';${skinImport}`;

return `${mediaImport}
import '@videojs/react/${skinEntry('audio', skin)}.css';
Expand Down Expand Up @@ -641,6 +646,40 @@ const PAGES: PageDef[] = [
skin: 'neutral',
},

// Compat skins, for the browser compatibility checks
{
name: 'HTML Video Compat MP4',
path: 'html-video-compat-mp4',
framework: 'html',
media: 'video',
resource: 'mp4',
skin: 'compat',
},
{
name: 'HTML Audio Compat MP4',
path: 'html-audio-compat-mp4',
framework: 'html',
media: 'audio',
resource: 'mp4',
skin: 'compat',
},
{
name: 'React Video Compat MP4',
path: 'react-video-compat-mp4',
framework: 'react',
media: 'video',
resource: 'mp4',
skin: 'compat',
},
{
name: 'React Audio Compat MP4',
path: 'react-audio-compat-mp4',
framework: 'react',
media: 'audio',
resource: 'mp4',
skin: 'compat',
},

// CDN
{ name: 'CDN Video MP4', path: 'cdn-video-mp4', framework: 'html', media: 'video', resource: 'mp4', category: 'cdn' },
{
Expand Down
2 changes: 1 addition & 1 deletion apps/e2e/suites/browserstack/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# BrowserStack compatibility checks

Run the packaged HTML and React video, neutral video, and audio pages at the Chrome, Edge, Firefox, and Safari minimums resolved from the root browserslist. Desktop Safari coverage uses WebKit. The checks cover CSS fallbacks, closed popovers, playback, seeking, and opening menus. Playback failure is a test failure, including missing H.264 support.
Run the packaged HTML and React video, neutral video, and audio pages at the Chrome, Edge, Firefox, and Safari minimums resolved from the root browserslist. The Compat video and audio pages run at the older Chrome, Edge, and Firefox minimums in the root `compatBrowserslist`, and at the shared Safari and iOS minimums. Desktop Safari coverage uses WebKit. The checks cover CSS fallbacks, closed popovers, playback, seeking, and opening menus. Playback failure is a test failure, including missing H.264 support.

This suite replaces the previous Docker floor job and its pinned Playwright clients. BrowserStack's desktop WebKit is still an engine approximation, not actual Safari. The iOS project runs Safari on a real device selected from BrowserStack's device API. BrowserStack selects iOS by major version, so the browserslist minimum is rounded up to the next whole major: iOS 17 for the current 16.4 minimum. This keeps real-device coverage within the supported range, while desktop WebKit retains the 16.4 minimum check. Selection uses a stable ordering of matching iPhones and fails if no matching device is available; the user-agent assertion verifies the selected major version. The suite does not currently verify captions or fullscreen.

Expand Down
54 changes: 51 additions & 3 deletions apps/e2e/suites/browserstack/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import { defineConfig } from '@playwright/test';

import { suiteConfig, WEB_SERVER_SHUTDOWN } from '../../shared/playwright.ts';
import type { Options } from './test.ts';
import { versions } from './versions.ts';
import { compatVersions, versions } from './versions.ts';

// The WebKit and iOS projects run every skin, which holds only while both queries share their minimums.
if (compatVersions.safari !== versions.safari || compatVersions.ios !== versions.ios) {
throw new Error('Compat has its own Safari or iOS minimum; add Compat WebKit and iOS projects.');
}

export default defineConfig<{}, Options>({
...suiteConfig('browserstack'),
Expand All @@ -30,11 +35,19 @@ export default defineConfig<{}, Options>({
: [
{
name: `chrome-${versions.chrome}`,
use: { caps: { browser: 'chrome', browser_version: versions.chrome, os: 'Windows', os_version: '10' } },
use: {
caps: { browser: 'chrome', browser_version: versions.chrome, os: 'Windows', os_version: '10' },
version: versions.chrome,
skins: ['default', 'neutral'],
},
},
{
name: `edge-${versions.edge}`,
use: { caps: { browser: 'edge', browser_version: versions.edge, os: 'Windows', os_version: '10' } },
use: {
caps: { browser: 'edge', browser_version: versions.edge, os: 'Windows', os_version: '10' },
version: versions.edge,
skins: ['default', 'neutral'],
},
},
// Bundled engines require a Playwright release; version checks reject any drift from browserslist.
{
Expand All @@ -46,6 +59,39 @@ export default defineConfig<{}, Options>({
os_version: '10',
'browserstack.playwrightVersion': '1.41.2',
},
version: versions.firefox,
skins: ['default', 'neutral'],
},
},
// Compat supports older Chrome, Edge, and Firefox than the other skins; Safari and iOS share one minimum.
{
name: `compat-chrome-${compatVersions.chrome}`,
use: {
caps: { browser: 'chrome', browser_version: compatVersions.chrome, os: 'Windows', os_version: '10' },
version: compatVersions.chrome,
skins: ['compat'],
},
},
{
name: `compat-edge-${compatVersions.edge}`,
use: {
caps: { browser: 'edge', browser_version: compatVersions.edge, os: 'Windows', os_version: '10' },
version: compatVersions.edge,
skins: ['compat'],
},
},
{
name: `compat-firefox-${compatVersions.firefox}`,
use: {
caps: {
browser: 'playwright-firefox',
os: 'Windows',
os_version: '10',
// The oldest release BrowserStack can drive with the current client; older ones fail to create a context.
'browserstack.playwrightVersion': '1.25.2',
},
version: compatVersions.firefox,
skins: ['compat'],
},
},
{
Expand All @@ -57,12 +103,14 @@ export default defineConfig<{}, Options>({
os_version: 'Big Sur',
'browserstack.playwrightVersion': '1.35.0',
},
version: versions.safari,
},
},
{
name: `ios-safari-${versions.ios}`,
use: {
caps: { browser: 'safari', osVersion: versions.ios, realMobile: 'true' },
version: versions.ios,
// BrowserStack iOS requires an explicit viewport object.
viewport: { width: 390, height: 844 },
},
Expand Down
20 changes: 13 additions & 7 deletions apps/e2e/suites/browserstack/probes.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
interface Page {
readonly path: string;
readonly preset: 'video' | 'audio';
readonly skin: 'default' | 'neutral' | 'compat';
}

export const PAGES: readonly Page[] = [
{ path: '/pages/html-video-mp4.html', preset: 'video' },
{ path: '/pages/react-video-mp4.html', preset: 'video' },
{ path: '/pages/html-video-neutral-mp4.html', preset: 'video' },
{ path: '/pages/react-video-neutral-mp4.html', preset: 'video' },
{ path: '/pages/html-audio-mp4.html', preset: 'audio' },
{ path: '/pages/react-audio-mp4.html', preset: 'audio' },
{ path: '/pages/html-video-mp4.html', preset: 'video', skin: 'default' },
{ path: '/pages/react-video-mp4.html', preset: 'video', skin: 'default' },
{ path: '/pages/html-video-neutral-mp4.html', preset: 'video', skin: 'neutral' },
{ path: '/pages/react-video-neutral-mp4.html', preset: 'video', skin: 'neutral' },
{ path: '/pages/html-audio-mp4.html', preset: 'audio', skin: 'default' },
{ path: '/pages/react-audio-mp4.html', preset: 'audio', skin: 'default' },
{ path: '/pages/html-video-compat-mp4.html', preset: 'video', skin: 'compat' },
{ path: '/pages/react-video-compat-mp4.html', preset: 'video', skin: 'compat' },
{ path: '/pages/html-audio-compat-mp4.html', preset: 'audio', skin: 'compat' },
{ path: '/pages/react-audio-compat-mp4.html', preset: 'audio', skin: 'compat' },
];

/** Values read from the page. Each is a computed style, so an invalid or missing fallback shows as its initial value. */
Expand Down Expand Up @@ -44,7 +49,8 @@ export function readProbe(query: typeof deepQuery): Probe | null {
if (!skin) return null;

const backdrop = query(document, '.video-controls-backdrop');
const buffer = query(document, '.media-slider-buffer');
// Compat names its time slider parts after the time slider.
const buffer = query(document, '.media-slider-buffer, .media-time-slider-buffer');
const surfaces: Element[] = [];
const blurRoots: (Document | ShadowRoot)[] = [document];

Expand Down
6 changes: 6 additions & 0 deletions apps/e2e/suites/browserstack/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ import { getIosDevice } from './ios-device.ts';

export interface Options {
caps: Record<string, string>;
/** The browser version the project must launch, checked against the user agent. */
version: string;
/** The skins whose pages the project runs. */
skins: readonly string[];
}

export const test = base.extend<{ session: Browser }, Options>({
caps: [{}, { option: true, scope: 'worker' }],
version: ['', { option: true, scope: 'worker' }],
skins: [['default', 'neutral', 'compat'], { option: true, scope: 'worker' }],
context: async ({ session: browser, baseURL, viewport, actionTimeout }, use) => {
const options: BrowserContextOptions = { viewport };

Expand Down
Loading
Loading