diff --git a/sandbox/package-lock.json b/sandbox/package-lock.json index 5cb573495..fe93ae47d 100644 --- a/sandbox/package-lock.json +++ b/sandbox/package-lock.json @@ -4209,6 +4209,8 @@ "version": "8.11.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "optional": true, + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -4223,7 +4225,9 @@ "node_modules/ajv-formats/node_modules/json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "optional": true, + "peer": true }, "node_modules/ajv-keywords": { "version": "3.5.2", @@ -19202,14 +19206,13 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", - "requires": { - "ajv": "^8.0.0" - }, + "requires": {}, "dependencies": { "ajv": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "version": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "optional": true, + "peer": true, "requires": { "fast-deep-equal": "^3.1.1", "json-schema-traverse": "^1.0.0", @@ -19220,7 +19223,9 @@ "json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", - "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "optional": true, + "peer": true } } }, @@ -26770,7 +26775,6 @@ "normalize-path": "^3.0.0", "object-hash": "^3.0.0", "picocolors": "^1.0.0", - "postcss": "^8.4.14", "postcss-import": "^14.1.0", "postcss-js": "^4.0.0", "postcss-load-config": "^3.1.4", diff --git a/test/functional/helpers/constants/configParts/mediaCollection.js b/test/functional/helpers/constants/configParts/mediaCollection.js new file mode 100644 index 000000000..bfeb147e3 --- /dev/null +++ b/test/functional/helpers/constants/configParts/mediaCollection.js @@ -0,0 +1,17 @@ +/* +Copyright 2023 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ +export default { + mediaCollection: { + channel: "functional tests channel", + playerName: "functional test player" + } +}; diff --git a/test/functional/helpers/constants/configParts/orgMediaConfig.js b/test/functional/helpers/constants/configParts/orgMediaConfig.js new file mode 100644 index 000000000..f8717ad7d --- /dev/null +++ b/test/functional/helpers/constants/configParts/orgMediaConfig.js @@ -0,0 +1,17 @@ +/* +Copyright 2023 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ +import getBaseConfig from "../../getBaseConfig"; + +export default getBaseConfig( + "97D1F3F459CE0AD80A495CBE@AdobeOrg", + "27dae196-8c75-4eed-82d1-3895616f85d6" +); diff --git a/test/functional/helpers/createAlloyProxy.js b/test/functional/helpers/createAlloyProxy.js index d1fbf154c..22a9995f0 100644 --- a/test/functional/helpers/createAlloyProxy.js +++ b/test/functional/helpers/createAlloyProxy.js @@ -92,7 +92,9 @@ const commands = [ "appendIdentityToUrl", "applyPropositions", "subscribeRulesetItems", - "evaluateRulesets" + "evaluateRulesets", + "createMediaSession", + "sendMediaEvent" ]; export default (instanceName = "alloy") => { diff --git a/test/functional/helpers/networkLogger/index.js b/test/functional/helpers/networkLogger/index.js index 362827a59..6f36dd397 100644 --- a/test/functional/helpers/networkLogger/index.js +++ b/test/functional/helpers/networkLogger/index.js @@ -32,6 +32,7 @@ const createNetworkLogger = () => { const acquireEndpoint = /v1\/identity\/acquire\?configId=/; const targetDeliveryEndpoint = /rest\/v1\/delivery\?client=/; const targetMboxJsonEndpoint = /m2\/unifiedjsqeonly\/mbox\/json\?mbox=/; + const mediaEdgeEndpoint = /va\/v1/; const edgeEndpointLogs = createRequestLogger(edgeEndpoint); const edgeCollectEndpointLogs = createRequestLogger(edgeCollectEndpoint); @@ -44,6 +45,7 @@ const createNetworkLogger = () => { const targetMboxJsonEndpointLogs = createRequestLogger( targetMboxJsonEndpoint ); + const mediaEdgeEndpointLogs = createRequestLogger(mediaEdgeEndpoint); const clearLogs = async () => { await edgeEndpointLogs.clear(); @@ -53,6 +55,7 @@ const createNetworkLogger = () => { await acquireEndpointLogs.clear(); await targetDeliveryEndpointLogs.clear(); await targetMboxJsonEndpointLogs.clear(); + await mediaEdgeEndpointLogs.clear(); }; return { @@ -65,6 +68,7 @@ const createNetworkLogger = () => { acquireEndpointLogs, targetDeliveryEndpointLogs, targetMboxJsonEndpointLogs, + mediaEdgeEndpointLogs, clearLogs }; }; diff --git a/test/functional/specs/MediaCollection/MA1.js b/test/functional/specs/MediaCollection/MA1.js new file mode 100644 index 000000000..72d5fed6c --- /dev/null +++ b/test/functional/specs/MediaCollection/MA1.js @@ -0,0 +1,99 @@ +/* +Copyright 2023 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ +import { t, ClientFunction } from "testcafe"; +import createNetworkLogger from "../../helpers/networkLogger"; +import { responseStatus } from "../../helpers/assertions/index"; +import createFixture from "../../helpers/createFixture"; +import { + compose, + orgMainConfigMain, + debugEnabled +} from "../../helpers/constants/configParts"; +import getResponseBody from "../../helpers/networkLogger/getResponseBody"; +import createResponse from "../../helpers/createResponse"; +import { TEST_PAGE as TEST_PAGE_URL } from "../../helpers/constants/url"; +import createAlloyProxy from "../../helpers/createAlloyProxy"; +import orgMediaConfig from "../../helpers/constants/configParts/orgMediaConfig"; +import mediaCollection from "../../helpers/constants/configParts/mediaCollection"; + +const networkLogger = createNetworkLogger(); +const config = compose(orgMediaConfig, mediaCollection); +createFixture({ + title: "Implement Media Collection in automatic mode", + url: TEST_PAGE_URL, + requestHooks: [networkLogger.edgeEndpointLogs] +}); + +test.meta({ + ID: "C28757", + SEVERITY: "P0", + TEST_RUN: "Regression" +}); + +test.only("Test : Implement Media Collection in automatic mode", async () => { + const alloy = createAlloyProxy(); + await alloy.configure(config); + const sessionResult = await alloy.createMediaSession({ + playerId: "player1", + xdm: { + mediaCollection: { + sessionDetails: { + length: 60, + contentType: "VOD", + name: "test name of the video" + } + } + }, + onBeforeMediaEvent: () => { + return { + playhead: 3, + qoeDataDetails: { + bitrate: 1, + droppedFrames: 2, + framesPerSecond: 3, + timeToStart: 4 + } + }; + } + }); + const playEventResult = await alloy.sendMediaEvent({ + playerId: "player1", + xdm: { + eventType: "media.play" + } + }); + console.log("play", playEventResult); + + await responseStatus(networkLogger.edgeEndpointLogs.requests, 200); + await t.expect(networkLogger.edgeEndpointLogs.requests.length).eql(1); + + const createSession = networkLogger.edgeEndpointLogs.requests[0]; + const requestBody = JSON.parse(createSession.request.body); + await t.expect(requestBody.events[0].xdm.eventType).eql("media.sessionStart"); + await t.expect(requestBody.events[0].xdm.mediaCollection.playhead).eql(3); + const response = JSON.parse( + getResponseBody(networkLogger.edgeEndpointLogs.requests[0]) + ); + const mediaCollectionPayload = createResponse({ + content: response + }).getPayloadsByType("media-analytics:new-session"); + await t + .expect(mediaCollectionPayload[0].sessionId) + .eql(sessionResult.sessionId); + const playEvent = networkLogger.mediaEdgeEndpointLogs.requests; + console.log("ree", playEvent); + const playEventBody = JSON.parse(playEvent.request.body).events[0]; + await t.expect(playEventBody.xdm.mediaCollection.playhead).eql(3); + await t + .expect(playEventBody.xdm.mediaCollection.sessionID) + .eql(sessionResult.sessionId); +}); diff --git a/test/unit/specs/components/MediaCollection/createHeartbeatEngine.spec.js b/test/unit/specs/components/MediaCollection/createHeartbeatEngine.spec.js new file mode 100644 index 000000000..26ef92385 --- /dev/null +++ b/test/unit/specs/components/MediaCollection/createHeartbeatEngine.spec.js @@ -0,0 +1,11 @@ +/* +Copyright 2023 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ diff --git a/test/unit/specs/components/MediaCollection/createMediaEventManager.spec.js b/test/unit/specs/components/MediaCollection/createMediaEventManager.spec.js new file mode 100644 index 000000000..26ef92385 --- /dev/null +++ b/test/unit/specs/components/MediaCollection/createMediaEventManager.spec.js @@ -0,0 +1,11 @@ +/* +Copyright 2023 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ diff --git a/test/unit/specs/components/MediaCollection/createMediaRequest.spec.js b/test/unit/specs/components/MediaCollection/createMediaRequest.spec.js new file mode 100644 index 000000000..26ef92385 --- /dev/null +++ b/test/unit/specs/components/MediaCollection/createMediaRequest.spec.js @@ -0,0 +1,11 @@ +/* +Copyright 2023 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ diff --git a/test/unit/specs/components/MediaCollection/createMediaRequestPayload.spec.js b/test/unit/specs/components/MediaCollection/createMediaRequestPayload.spec.js new file mode 100644 index 000000000..26ef92385 --- /dev/null +++ b/test/unit/specs/components/MediaCollection/createMediaRequestPayload.spec.js @@ -0,0 +1,11 @@ +/* +Copyright 2023 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ diff --git a/test/unit/specs/components/MediaCollection/createMediaSessionCacheManager.spec.js b/test/unit/specs/components/MediaCollection/createMediaSessionCacheManager.spec.js new file mode 100644 index 000000000..26ef92385 --- /dev/null +++ b/test/unit/specs/components/MediaCollection/createMediaSessionCacheManager.spec.js @@ -0,0 +1,11 @@ +/* +Copyright 2023 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ diff --git a/test/unit/specs/components/MediaCollection/createUpdateMediaSessionState.spec.js b/test/unit/specs/components/MediaCollection/createUpdateMediaSessionState.spec.js new file mode 100644 index 000000000..26ef92385 --- /dev/null +++ b/test/unit/specs/components/MediaCollection/createUpdateMediaSessionState.spec.js @@ -0,0 +1,11 @@ +/* +Copyright 2023 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ diff --git a/test/unit/specs/components/MediaCollection/index.spec.js b/test/unit/specs/components/MediaCollection/index.spec.js new file mode 100644 index 000000000..26ef92385 --- /dev/null +++ b/test/unit/specs/components/MediaCollection/index.spec.js @@ -0,0 +1,11 @@ +/* +Copyright 2023 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ diff --git a/test/unit/specs/components/MediaCollection/validateMediaEventOptions.spec.js b/test/unit/specs/components/MediaCollection/validateMediaEventOptions.spec.js new file mode 100644 index 000000000..26ef92385 --- /dev/null +++ b/test/unit/specs/components/MediaCollection/validateMediaEventOptions.spec.js @@ -0,0 +1,11 @@ +/* +Copyright 2023 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/ diff --git a/test/unit/specs/components/MediaCollection/validateMediaSessionOptions.spec.js b/test/unit/specs/components/MediaCollection/validateMediaSessionOptions.spec.js new file mode 100644 index 000000000..26ef92385 --- /dev/null +++ b/test/unit/specs/components/MediaCollection/validateMediaSessionOptions.spec.js @@ -0,0 +1,11 @@ +/* +Copyright 2023 Adobe. All rights reserved. +This file is licensed to you under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. You may obtain a copy +of the License at http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software distributed under +the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +OF ANY KIND, either express or implied. See the License for the specific language +governing permissions and limitations under the License. +*/