From 909b411937ae2cc7107dd8e51d8d26068f4374b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFs=20Poujade?= <lois.poujade@tetras-libre.fr> Date: Wed, 30 Nov 2022 10:22:50 +0100 Subject: [PATCH] Add basic video test + samples video manifests --- __tests__/fixtures/version-3/video.json | 41 ++++++++++++ .../fixtures/version-3/video_subtitles.json | 66 +++++++++++++++++++ .../integration/mirador/basic_video.test.js | 18 +++++ 3 files changed, 125 insertions(+) create mode 100644 __tests__/fixtures/version-3/video.json create mode 100644 __tests__/fixtures/version-3/video_subtitles.json create mode 100644 __tests__/integration/mirador/basic_video.test.js diff --git a/__tests__/fixtures/version-3/video.json b/__tests__/fixtures/version-3/video.json new file mode 100644 index 000000000..18353bee8 --- /dev/null +++ b/__tests__/fixtures/version-3/video.json @@ -0,0 +1,41 @@ +{ + "@context": "http://iiif.io/api/presentation/3/context.json", + "id": "https://preview.iiif.io/cookbook/master/recipe/0003-mvm-video/manifest.json", + "type": "Manifest", + "label": { + "en": [ + "Video Example 3" + ] + }, + "items": [ + { + "id": "https://preview.iiif.io/cookbook/master/recipe/0003-mvm-video/canvas", + "type": "Canvas", + "height": 360, + "width": 640, + "duration": 1801.055, + "items": [ + { + "id": "https://preview.iiif.io/cookbook/master/recipe/0003-mvm-video/canvas/page", + "type": "AnnotationPage", + "items": [ + { + "id": "https://preview.iiif.io/cookbook/master/recipe/0003-mvm-video/canvas/page/annotation", + "type": "Annotation", + "motivation": "painting", + "body": { + "id": "https://fixtures.iiif.io/video/indiana/30-minute-clock/medium/30-minute-clock.mp4", + "type": "Video", + "height": 360, + "width": 640, + "duration": 1801.055, + "format": "video/mp4" + }, + "target": "https://preview.iiif.io/cookbook/master/recipe/0003-mvm-video/canvas" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/__tests__/fixtures/version-3/video_subtitles.json b/__tests__/fixtures/version-3/video_subtitles.json new file mode 100644 index 000000000..c6467c352 --- /dev/null +++ b/__tests__/fixtures/version-3/video_subtitles.json @@ -0,0 +1,66 @@ +{ + "@context": "http://iiif.io/api/presentation/3/context.json", + "id": "https://iiif.io/api/cookbook/recipe/0219-using-caption-file/manifest.json", + "type": "Manifest", + "label": { + "en": [ + "Lunchroom Manners" + ] + }, + "items": [ + { + "id": "https://iiif.io/api/cookbook/recipe/0219-using-caption-file/canvas", + "type": "Canvas", + "height": 360, + "width": 480, + "duration": 572.034, + "items": [ + { + "id": "https://iiif.io/api/cookbook/recipe/0219-using-caption-file/canvas/page", + "type": "AnnotationPage", + "items": [ + { + "id": "https://iiif.io/api/cookbook/recipe/0219-using-caption-file/canvas/page/annotation1", + "type": "Annotation", + "motivation": "painting", + "body": { + "id": "https://fixtures.iiif.io/video/indiana/lunchroom_manners/high/lunchroom_manners_1024kb.mp4", + "type": "Video", + "height": 360, + "width": 480, + "duration": 572.034, + "format": "video/mp4" + }, + "target": "https://iiif.io/api/cookbook/recipe/0219-using-caption-file/canvas" + } + ] + } + ], + "annotations": [ + { + "id": "https://iiif.io/api/cookbook/recipe/0219-using-caption-file/canvas/page2", + "type": "AnnotationPage", + "items": [ + { + "id": "https://iiif.io/api/cookbook/recipe/0219-using-caption-file/canvas/page2/a1", + "type": "Annotation", + "motivation": "supplementing", + "body": { + "id": "https://fixtures.iiif.io/video/indiana/lunchroom_manners/lunchroom_manners.vtt", + "type": "Text", + "format": "text/vtt", + "label": { + "en": [ + "Captions in WebVTT format" + ] + }, + "language": "en" + }, + "target": "https://iiif.io/api/cookbook/recipe/0219-using-caption-file/canvas" + } + ] + } + ] + } + ] +} diff --git a/__tests__/integration/mirador/basic_video.test.js b/__tests__/integration/mirador/basic_video.test.js new file mode 100644 index 000000000..819f2e1b2 --- /dev/null +++ b/__tests__/integration/mirador/basic_video.test.js @@ -0,0 +1,18 @@ +describe('Basic end to end Mirador with video content', () => { + beforeAll(async () => { + await page.goto('http://localhost:4488/__tests__/integration/mirador/video.html'); + }); + it('loads a manifest and displays it', async () => { + await page.waitForSelector('#addBtn'); + await expect(page).toClick('#addBtn'); + await expect(page).toClick('.mirador-add-resource-button'); + await expect(page).toFill('#manifestURL', 'http://localhost:4488/__tests__/fixtures/version-3/video.json'); + await expect(page).toClick('#fetchBtn'); + await expect(page).toMatchElement('[data-manifestid="http://localhost:4488/__tests__/fixtures/version-3/video.json"] button'); + await expect(page).toClick('[data-manifestid="http://localhost:4488/__tests__/fixtures/version-3/video.json"] button'); + await expect(page).toMatchElement( + 'h2', + { text: /Video Example 3/ }, + ); + }); +}); -- GitLab