Skip to content

Commit

Permalink
Merge branch 'paella7-local-tests' of miesgre/opencast into develop
Browse files Browse the repository at this point in the history
Pull request #5684

  Make the paella 7 tests locally without depending on develop.opencast…
  • Loading branch information
gregorydlogan committed Mar 28, 2024
2 parents 5922734 + 01caed4 commit 4affd60
Show file tree
Hide file tree
Showing 11 changed files with 253 additions and 27 deletions.
3 changes: 2 additions & 1 deletion modules/engage-paella-player-7/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ module.exports = defineConfig({

/* Run your local dev server before starting the tests */
webServer: {
command: 'npm run testenv:dev',
// command: 'npm run testenv:dev',
command: 'npm run dev',
url: 'http://127.0.0.1:7070/paella7/ui/watch.html',
reuseExistingServer: !process.env.CI,
},
Expand Down
11 changes: 5 additions & 6 deletions modules/engage-paella-player-7/tests/load.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@
* the License.
*
*/
import { test, expect } from '@playwright/test';
import { clickToStartVideo } from './utils';

import { expect } from '@playwright/test';
import { test, clickToStartVideo } from './utils';

test('Has the correct title', async ({ page }) => {
await page.goto('/paella7/ui/watch.html?id=ID-dual-stream-demo');
await expect(page).toHaveTitle('Dual-Stream Demo - No series | Opencast');
await page.goto('/paella7/ui/watch.html?id=ID-strong-river-flowing-down-the-green-forest');
await expect(page).toHaveTitle('Strong river flowing down the forest - No series | Opencast');
});

test('Video is loaded', async ({ page }) => {
await page.goto('/paella7/ui/watch.html?id=ID-dual-stream-demo');
await page.goto('/paella7/ui/watch.html?id=ID-strong-river-flowing-down-the-green-forest');
await clickToStartVideo(page);
});
48 changes: 48 additions & 0 deletions modules/engage-paella-player-7/tests/mock/info/me.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"org": {
"anonymousRole": "ROLE_ANONYMOUS",
"name": "Opencast Project",
"adminRole": "ROLE_ADMIN",
"id": "mh_default_org",
"properties": {
"admin.shortcut.general.select_next_dashboard_filter": "f",
"admin.shortcut.general.main_menu": "m",
"admin.shortcut.editor.play_current_segment_with_pre-roll": "C",
"org.opencastproject.admin.help.restdocs.url": "/rest_docs.html",
"admin.shortcut.player.step_backward": "ctrl+left",
"adminui.user.external_role_display": "false",
"org.opencastproject.admin.mediamodule.url": "/engage/ui",
"admin.shortcut.general.new_series": "N",
"admin.shortcut.general.new_event": "n",
"admin.shortcut.editor.split_at_current_time": "v",
"admin.shortcut.player.play_pause": "space",
"admin.shortcut.editor.play_current_segment": "c",
"admin.shortcut.player.mute": "m",
"admin.shortcut.general.select_previous_dashboard_filter": "F",
"admin.shortcut.add_media.next_tab": "shift+alt+right",
"admin.shortcut.player.previous_segment": "up",
"admin.shortcut.player.volume_up": "plus",
"admin.shortcut.player.volume_down": "-",
"admin.shortcut.editor.cut_selected_segment": "backspace",
"org.opencastproject.oaipmh.server.hosturl": "",
"org.opencastproject.admin.help.documentation.url": "https://docs.opencast.org",
"admin.shortcut.player.next_segment": "down",
"admin.shortcut.add_media.previous_tab": "shift+alt+left",
"admin.shortcut.general.series_view": "s",
"admin.shortcut.player.next_frame": "right",
"admin.shortcut.player.previous_frame": "left",
"admin.shortcut.general.event_view": "e",
"admin.shortcut.general.remove_filters": "r",
"admin.shortcut.editor.clear_list": "ctrl+backspace",
"admin.shortcut.player.step_forward": "ctrl+right",
"admin.shortcut.editor.play_ending_of_current_segment": "n"
}
},
"roles": [
"ROLE_ANONYMOUS"
],
"userRole": "ROLE_USER_ANONYMOUS",
"user": {
"username": "anonymous"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
{
"search-results": {
"offset": 0,
"limit": 100,
"total": 1,
"searchTime": 0,
"query": "(id:ID\\-strong\\-river\\-flowing\\-down\\-the\\-green\\-forest) AND oc_organization:mh_default_org AND (oc_acl_read:ROLE_USER OR oc_acl_read:ROLE_GROUP_MH_DEFAULT_ORG_SYSTEM_ADMINS OR oc_acl_read:ROLE_ADMIN OR oc_acl_read:ROLE_SUDO OR oc_acl_read:ROLE_USER_ADMIN OR oc_acl_read:ROLE_ANONYMOUS OR oc_acl_read:ROLE_OAUTH_USER) AND -oc_mediatype:Series AND -oc_deleted:[* TO *]",
"result": {
"id": "ID-strong-river-flowing-down-the-green-forest",
"org": "mh_default_org",
"mediapackage": {
"duration": 29996,
"id": "ID-strong-river-flowing-down-the-green-forest",
"start": "2019-06-18T07:40:53Z",
"title": "Strong river flowing down the forest",
"creators": {
"creator": "Nature Stock Videos"
},
"license": "CC0",
"media": {
"track": {
"id": "7e038786-3d06-4073-8ce8-55086f8e7b08",
"type": "presenter/preview",
"ref": "track:28b54cbc-124c-4d29-98ab-6ce104e9ca6c",
"mimetype": "video/mp4",
"tags": {
"tag": [
"atom",
"default",
"engage-download",
"engage-streaming",
"rss"
]
},
"url": "/test_mock_static/mh_default_org/engage-player/ID-strong-river-flowing-down-the-green-forest/2835803a-a332-4512-a231-a2236271b6e6/strong-river-flowing-down-the-green-forest.mp4",
"size": 186376983,
"checksum": {
"type": "md5",
"$": "30d52a37438495e2847aa54959e0f60b"
},
"duration": 29996,
"video": {
"id": "video-1",
"device": "",
"encoder": {
"type": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"
},
"framecount": 899,
"bitrate": 4.9702744E7,
"framerate": 29.97003,
"resolution": "3840x2160"
},
"live": false,
"master": false
}
},
"metadata": {
"catalog": {
"id": "5d1f0251-34f2-4244-aab5-652b11ea5d1b",
"type": "dublincore/episode",
"mimetype": "text/xml",
"tags": "",
"url": "/test_mock_static/mh_default_org/engage-player/ID-strong-river-flowing-down-the-green-forest/1c91233a-7535-456d-b656-e85c7d47fb1a/dublincore.xml"
}
},
"attachments": {
"attachment": [
{
"id": "7fe05664-2f0c-4aef-b4c0-5700344f42c6",
"type": "security/xacml+episode",
"mimetype": "text/xml",
"tags": "",
"url": "/test_mock_static/mh_default_org/engage-player/ID-strong-river-flowing-down-the-green-forest/c51dd2c1-3105-424f-9744-ac1ecb36d9f4/episode-security.xml"
},
{
"id": "140b770a-a320-4a4f-931f-b815c98f0ab4",
"type": "presenter/search+preview",
"ref": "track:28b54cbc-124c-4d29-98ab-6ce104e9ca6c",
"mimetype": "image/jpeg",
"tags": {
"tag": "engage-download"
},
"url": "/test_mock_static/mh_default_org/engage-player/ID-strong-river-flowing-down-the-green-forest/d815d2f2-af37-442e-91ee-84062209fccb/strong-river-flowing-down-the-green-forest_1.000s-search.jpg",
"size": 4879
},
{
"id": "a1e6c4f7-9147-49e7-9ba8-61b3f163207f",
"type": "presenter/player+preview",
"ref": "track:28b54cbc-124c-4d29-98ab-6ce104e9ca6c",
"mimetype": "image/jpeg",
"tags": {
"tag": "engage-download"
},
"url": "/test_mock_static/mh_default_org/engage-player/ID-strong-river-flowing-down-the-green-forest/82f402ac-73f6-4fb6-90f1-3c64278739e9/strong-river-flowing-down-the-green-forest_1.000s-player.jpg",
"size": 156020
}
]
},
"publications": ""
},
"acl": {
"ace": [
{
"action": "read",
"allow": true,
"role": "ROLE_ADMIN"
},
{
"action": "read",
"allow": true,
"role": "ROLE_ANONYMOUS"
},
{
"action": "write",
"allow": true,
"role": "ROLE_ADMIN"
}
]
},
"dcExtent": 29996,
"dcTitle": "Strong river flowing down the forest",
"dcCreator": "Nature Stock Videos",
"dcDescription": "Free stock footage of a strong river flowing down the dense green summer forest on a sunny day, late in the evening. Different trees on each side of the river, while white bubbles coming from the water as it rushes down the rocky landscape. This footage was taken with a Mavic 2 Pro drone mounted on a tripod with a Katana grip",
"dcCreated": "2019-06-18T09:40:53+02:00",
"dcLicense": "CC0",
"ocMediapackage": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><mediapackage duration=\"29996\" id=\"ID-strong-river-flowing-down-the-green-forest\" start=\"2019-06-18T07:40:53Z\" xmlns=\"http://mediapackage.opencastproject.org\"><title>Strong river flowing down the forest<\/title><creators><creator>Nature Stock Videos<\/creator><\/creators><license>CC0<\/license><media><track id=\"7e038786-3d06-4073-8ce8-55086f8e7b08\" type=\"presenter/preview\" ref=\"track:28b54cbc-124c-4d29-98ab-6ce104e9ca6c\"><mimetype>video/mp4<\/mimetype><tags><tag>atom<\/tag><tag>default<\/tag><tag>engage-download<\/tag><tag>engage-streaming<\/tag><tag>rss<\/tag><\/tags><url>/test_mock_static/mh_default_org/engage-player/ID-strong-river-flowing-down-the-green-forest/2835803a-a332-4512-a231-a2236271b6e6/strong-river-flowing-down-the-green-forest.mp4<\/url><size>186376983<\/size><checksum type=\"md5\">30d52a37438495e2847aa54959e0f60b<\/checksum><duration>29996<\/duration><video id=\"video-1\"><device/><encoder type=\"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10\"/><framecount>899<\/framecount><bitrate>4.9702744E7<\/bitrate><framerate>29.97003<\/framerate><resolution>3840x2160<\/resolution><\/video><live>false<\/live><master>false<\/master><\/track><\/media><metadata><catalog id=\"5d1f0251-34f2-4244-aab5-652b11ea5d1b\" type=\"dublincore/episode\"><mimetype>text/xml<\/mimetype><tags/><url>/test_mock_static/mh_default_org/engage-player/ID-strong-river-flowing-down-the-green-forest/1c91233a-7535-456d-b656-e85c7d47fb1a/dublincore.xml<\/url><\/catalog><\/metadata><attachments><attachment id=\"7fe05664-2f0c-4aef-b4c0-5700344f42c6\" type=\"security/xacml+episode\"><mimetype>text/xml<\/mimetype><tags/><url>/test_mock_static/mh_default_org/engage-player/ID-strong-river-flowing-down-the-green-forest/c51dd2c1-3105-424f-9744-ac1ecb36d9f4/episode-security.xml<\/url><\/attachment><attachment id=\"140b770a-a320-4a4f-931f-b815c98f0ab4\" type=\"presenter/search+preview\" ref=\"track:28b54cbc-124c-4d29-98ab-6ce104e9ca6c\"><mimetype>image/jpeg<\/mimetype><tags><tag>engage-download<\/tag><\/tags><url>/test_mock_static/mh_default_org/engage-player/ID-strong-river-flowing-down-the-green-forest/d815d2f2-af37-442e-91ee-84062209fccb/strong-river-flowing-down-the-green-forest_1.000s-search.jpg<\/url><size>4879<\/size><\/attachment><attachment id=\"a1e6c4f7-9147-49e7-9ba8-61b3f163207f\" type=\"presenter/player+preview\" ref=\"track:28b54cbc-124c-4d29-98ab-6ce104e9ca6c\"><mimetype>image/jpeg<\/mimetype><tags><tag>engage-download<\/tag><\/tags><url>/test_mock_static/mh_default_org/engage-player/ID-strong-river-flowing-down-the-green-forest/82f402ac-73f6-4fb6-90f1-3c64278739e9/strong-river-flowing-down-the-green-forest_1.000s-player.jpg<\/url><size>156020<\/size><\/attachment><\/attachments><publications/><\/mediapackage>",
"mediaType": "AudioVisual",
"keywords": "",
"modified": "2024-03-20T02:15:19.968+01:00",
"score": 1.3249191
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?><dublincore xmlns="http://www.opencastproject.org/xsd/1.0/dublincore/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<dcterms:created>2019-06-18T07:40:53Z</dcterms:created>
<dcterms:creator>Nature Stock Videos</dcterms:creator>
<dcterms:description>Free stock footage of a strong river flowing down the dense green summer forest on a sunny day, late in the evening. Different trees on each side of the river, while white bubbles coming from the water as it rushes down the rocky landscape. This footage was taken with a Mavic 2 Pro drone mounted on a tripod with a Katana grip</dcterms:description>
<dcterms:extent xsi:type="dcterms:ISO8601">PT29.996S</dcterms:extent>
<dcterms:identifier>ID-strong-river-flowing-down-the-green-forest</dcterms:identifier>
<dcterms:license>CC0</dcterms:license>
<dcterms:source>https://www.naturestockvideos.com/free-stock-footage-of-rivers/strong-river-flowing-down-the-green-forest/</dcterms:source>
<dcterms:temporal xsi:type="dcterms:Period">start=2019-06-18T07:40:53Z; end=2019-06-18T07:41:22Z; scheme=W3C-DTF;</dcterms:temporal>
<dcterms:title>Strong river flowing down the forest</dcterms:title>
</dublincore>
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Policy PolicyId="db0ff0dc-e58b-4316-8753-44bc5caf0ed9" Version="2.0" RuleCombiningAlgId="urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:permit-overrides" xmlns="urn:oasis:names:tc:xacml:2.0:policy:schema:os"><Target><Resources><Resource><ResourceMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"><AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">db0ff0dc-e58b-4316-8753-44bc5caf0ed9</AttributeValue><ResourceAttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string"/></ResourceMatch></Resource></Resources></Target><Rule RuleId="ROLE_ANONYMOUS_read_Permit" Effect="Permit"><Target><Actions><Action><ActionMatch MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal"><AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">read</AttributeValue><ActionAttributeDesignator AttributeId="urn:oasis:names:tc:xacml:1.0:action:action-id" DataType="http://www.w3.org/2001/XMLSchema#string"/></ActionMatch></Action></Actions></Target><Condition><Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:string-is-in"><AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">ROLE_ANONYMOUS</AttributeValue><SubjectAttributeDesignator AttributeId="urn:oasis:names:tc:xacml:2.0:subject:role" DataType="http://www.w3.org/2001/XMLSchema#string"/></Apply></Condition></Rule><Rule RuleId="DenyRule" Effect="Deny"/></Policy>
34 changes: 18 additions & 16 deletions modules/engage-paella-player-7/tests/queryparameters.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
* the License.
*
*/
import { expect, test } from '@playwright/test';
import { clickToStartVideo, pauseVideo, playerInstanceStr } from './utils';
import { expect } from '@playwright/test';
import { test, clickToStartVideo, pauseVideo, playerInstanceStr } from './utils';


test.describe('Player URL query parameters', () => {

test('Without additional query parameters', async ({ page }) => {
await page.goto('/paella7/ui/watch.html?id=ID-dual-stream-demo');
await page.goto('/paella7/ui/watch.html?id=ID-strong-river-flowing-down-the-green-forest');
await clickToStartVideo(page);
await pauseVideo(page);
await page.waitForTimeout(1000);
Expand All @@ -36,17 +36,17 @@ test.describe('Player URL query parameters', () => {
await expect(captionsVisible).toBeFalsy();
});

test('Check time param in URL and seek: ?time=20s', async ({ page }) => {
await page.goto('/paella7/ui/watch.html?id=ID-dual-stream-demo&time=20s');
test('Check time param in URL and seek: ?time=10s', async ({ page }) => {
await page.goto('/paella7/ui/watch.html?id=ID-strong-river-flowing-down-the-green-forest&time=10s');
await clickToStartVideo(page);
await pauseVideo(page);
await page.waitForTimeout(5000);
const currentTime = await page.evaluate(`${playerInstanceStr}.videoContainer.currentTime()`);
await expect(currentTime).toBeCloseTo(20, 0);
await expect(currentTime).toBeCloseTo(10, 0);
});

test('Check trimming param in URL: ?trimming=10s;50s', async ({ page }) => {
await page.goto('/paella7/ui/watch.html?id=ID-dual-stream-demo&trimming=10s;50s');
test('Check trimming param in URL: ?trimming=5s;20s', async ({ page }) => {
await page.goto('/paella7/ui/watch.html?id=ID-strong-river-flowing-down-the-green-forest&trimming=5s;20s');
await clickToStartVideo(page);
await pauseVideo(page);
await page.waitForTimeout(5000);
Expand All @@ -55,27 +55,29 @@ test.describe('Player URL query parameters', () => {
const trimEnd = await page.evaluate(`${playerInstanceStr}.videoContainer.trimEnd`);
const duration = await page.evaluate(`${playerInstanceStr}.videoContainer.duration()`);
await expect(trimState).toBeTruthy;
await expect(trimStart).toBe(10);
await expect(trimEnd).toBe(50);
await expect(duration).toBe(40);
await expect(trimStart).toBe(5);
await expect(trimEnd).toBe(20);
await expect(duration).toBe(15);
});

test('Check time param in URL and seek: &start=20&end=45', async ({ page }) => {
await page.goto('/paella7/ui/watch.html?id=ID-dual-stream-demo&start=20&end=45');
test('Check time param in URL and seek: &start=5&end=20', async ({ page }) => {
await page.goto('/paella7/ui/watch.html?id=ID-strong-river-flowing-down-the-green-forest&start=5&end=20');
await clickToStartVideo(page);
await pauseVideo(page);
await page.waitForTimeout(5000);
// Test video trim attributes
const trimState = await page.evaluate(`${playerInstanceStr}.videoContainer.isTrimEnabled`);
const trimStart = await page.evaluate(`${playerInstanceStr}.videoContainer.trimStart`);
const trimEnd = await page.evaluate(`${playerInstanceStr}.videoContainer.trimEnd`);
const duration = await page.evaluate(`${playerInstanceStr}.videoContainer.duration()`);
await expect(trimState).toBeTruthy;
await expect(trimStart).toBe(20);
await expect(trimEnd).toBe(45);
await expect(trimStart).toBe(5);
await expect(trimEnd).toBe(20);
await expect(duration).toBe(15);
});

// test('Check captions param in URL: ?captions=<lang>', async ({ page }) => {
// await page.goto('/paella7/ui/watch.html?id=ID-dual-stream-demo&captions=en');
// await page.goto('/paella7/ui/watch.html?id=ID-strong-river-flowing-down-the-green-forest&captions=en');
// await clickToStartVideo(page);
// await pauseVideo(page);
// await page.waitForTimeout(5000);
Expand Down
Loading

0 comments on commit 4affd60

Please sign in to comment.