diff --git a/playwright/e2e/oddname/oddname-video.spec.ts b/playwright/e2e/oddname/oddname-video.spec.ts index 34c9c1714..2d02a870d 100644 --- a/playwright/e2e/oddname/oddname-video.spec.ts +++ b/playwright/e2e/oddname/oddname-video.spec.ts @@ -3,17 +3,16 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ +import { OGV_UNSUPPORTED } from '../../support/codecs.ts' import { oddnameTest } from '../../mixins/oddname.ts' -// [file, mimeType, decodable] — see mediaTest's `decodable` param in media.ts. -// Ogg Theora isn't decodable by Chromium's open-source build. -const files: [string, string, boolean?][] = [ +const files: [string, string, string?][] = [ ['video1.mp4', 'video/mp4'], ['video.mkv', 'video/mkv'], - ['video.ogv', 'video/ogv', false], + ['video.ogv', 'video/ogv', OGV_UNSUPPORTED], ['video.webm', 'video/webm'], ] -for (const [file, mimeType, decodable] of files) { - oddnameTest(file, mimeType, false, decodable) +for (const [file, mimeType, skipReason] of files) { + oddnameTest(file, mimeType, false, skipReason) } diff --git a/playwright/e2e/videos/video.ogv.spec.ts b/playwright/e2e/videos/video.ogv.spec.ts index 3a8120b5c..f9f0d7722 100644 --- a/playwright/e2e/videos/video.ogv.spec.ts +++ b/playwright/e2e/videos/video.ogv.spec.ts @@ -3,9 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ +import { OGV_UNSUPPORTED } from '../../support/codecs.ts' import { videoTest } from '../../mixins/media.ts' -// Ogg Theora isn't decodable by Chromium's open-source build (canPlayType -// returns '' for `video/ogg; codecs="theora"`), unlike Electron's Cypress -// browser which had it. See mediaTest's `decodable` param. -videoTest('video.ogv', 'video/ogv', false) +videoTest('video.ogv', 'video/ogv', OGV_UNSUPPORTED) diff --git a/playwright/mixins/media.ts b/playwright/mixins/media.ts index fdaa43ea5..39a324ddf 100644 --- a/playwright/mixins/media.ts +++ b/playwright/mixins/media.ts @@ -26,14 +26,11 @@ import { * @param type the media element to assert on * @param fileName the media file to upload and test against * @param mimeType the media mime type - * @param decodable whether the CI browser can actually decode this codec. Set - * to false for formats Chromium's open-source build can't play (e.g. Ogg - * Theora): the loading spinner never clears since `canplay` never fires, so - * asserting on it would block every later test in this `describe.serial` - * block instead of just the one check that can't pass here. */ -function mediaTest(type: 'video' | 'audio', fileName: string, mimeType: string, decodable = true) { +function mediaTest(type: 'video' | 'audio', fileName: string, mimeType: string, skipReason?: string) { test.describe.serial(`Open ${fileName} in viewer`, () => { + test.skip(!!skipReason, skipReason) + let page: Page let user: User @@ -58,9 +55,7 @@ function mediaTest(type: 'video' | 'audio', fileName: string, mimeType: string, await expect(getViewer(page)).toBeVisible() await sourceResponse - if (decodable) { - await expectViewerLoaded(page) - } + await expectViewerLoaded(page) }) test('See the menu icon and title on the viewer header', async () => { @@ -85,10 +80,10 @@ function mediaTest(type: 'video' | 'audio', fileName: string, mimeType: string, * * @param fileName the video to upload and test against * @param mimeType the video mime type - * @param decodable whether the CI browser can decode this codec, see {@link mediaTest} + * @param skipReason if set, the whole group is skipped with this reason */ -export function videoTest(fileName: string, mimeType: string, decodable = true) { - mediaTest('video', fileName, mimeType, decodable) +export function videoTest(fileName: string, mimeType: string, skipReason?: string) { + mediaTest('video', fileName, mimeType, skipReason) } /** diff --git a/playwright/mixins/oddname.ts b/playwright/mixins/oddname.ts index ecdf14b99..bf5a8714f 100644 --- a/playwright/mixins/oddname.ts +++ b/playwright/mixins/oddname.ts @@ -45,9 +45,9 @@ function naughtyFileName(realName: string): string { * @param file the fixture file to upload * @param mimeType the fixture mime type * @param sidebar whether to also exercise the sidebar - * @param decodable whether the CI browser can decode this codec, see {@link mediaTest} in media.ts + * @param skipReason if set, the whole group is skipped with this reason */ -export function oddnameTest(file: string, mimeType: string, sidebar = false, decodable = true) { +export function oddnameTest(file: string, mimeType: string, sidebar = false, skipReason?: string) { const placedName = naughtyFileName(file) const folderName = 'Nextcloud "%27%22%60%25%21%23" >`⛰️<' + file + "><` e*'rocks!#?#%~" @@ -63,6 +63,8 @@ export function oddnameTest(file: string, mimeType: string, sidebar = false, dec } test.describe.serial(`Open ${file} in viewer with a naughty name ${sidebar ? 'with sidebar' : ''}`, () => { + test.skip(!!skipReason, skipReason) + let page: Page let user: User @@ -90,9 +92,7 @@ export function oddnameTest(file: string, mimeType: string, sidebar = false, dec }) test('Does not see a loading animation', async () => { - if (decodable) { - await expectViewerLoaded(page) - } + await expectViewerLoaded(page) }) test('See the menu icon and title on the viewer header', async () => { @@ -124,9 +124,7 @@ export function oddnameTest(file: string, mimeType: string, sidebar = false, dec }) test('Does not see a loading animation (public)', async () => { - if (decodable) { - await expectViewerLoaded(page) - } + await expectViewerLoaded(page) }) test('See the menu icon and title on the viewer header (public)', async () => { diff --git a/playwright/support/codecs.ts b/playwright/support/codecs.ts new file mode 100644 index 000000000..7214268c3 --- /dev/null +++ b/playwright/support/codecs.ts @@ -0,0 +1,10 @@ +/** + * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +// Playwright's bundled Chromium ships without the Ogg/Theora decoder (verified +// on CI: canPlayType returns "" and the