Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
35 changes: 35 additions & 0 deletions player/app-data/fixture-content-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,41 @@
"isAvailable": true,
"path": "fixture-stories/content_player"
},
{
"identifier": "org.ekstep.contentpreview",
"mimeType": "application/vnd.ekstep.html-archive",
"contentData": {
"hierarchyInfo": [
{
"contentType": "textbook",
"identifier": "do_2125251490189148161635"
},
{
"contentType": "textbookunit",
"identifier": "do_2125251493823201281636"
}
],
"questionnaire": null,
"appIcon": "fixture-stories/content_preview/logo.png",
"subject": "literacy_v2",
"description": "content_preview",
"name": "Content preview test",
"owner": "Gourav More",
"downloadUrl": "",
"checksum": null,
"loadingMessage": "Without requirements or design, programming is the art of adding bugs to an empty text file. ...",
"concepts": [{
"identifier": "LO1",
"name": "Receptive Vocabulary",
"objectType": "Concept"
}],
"identifier": "org.ekstep.contentpreview",
"grayScaleAppIcon": null,
"pkgVersion": 1
},
"isAvailable": true,
"path": "fixture-stories/content_preview"
},
{
"identifier": "org.ekstep.customeval",
"mimeType": "application/vnd.ekstep.ecml-archive",
Expand Down
124 changes: 124 additions & 0 deletions player/public/fixture-stories/content_preview/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>HTML Content</title>
<meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy" content="default-src * data: filesystem:; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; font-src *;" >
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
</head>
<body>

<h1 style="text-align: center;">Content player test</h1>
<div class="content-player">
<iframe id="previewContentIframe" title="player" src="preview/preview.html?webview=false" style="width:100%;height:100vh;border:none;"></iframe>
</div>
<script type="text/javascript">
var previewContentIframe = document.getElementById('previewContentIframe');
window.onload = function() {
setTimeout(function() {
var metadata = {
"identifier": "do_312719162116210688118940",
"mimeType": "video/mp4",
// "contentData":
// {
// "subject": "Mathematics",
// "channel": "01254592085869363222",
// "language": [
// "English"
// ],
// "mimeType": "video/mp4",
// "appIcon": "https://ntpproductionall.blob.core.windows.net/ntp-content-production/content/do_312719162116210688118940/artifact/1bfnp6jsjtiqughwossozy1ibot_3mh5w.thumb.png",
// "gradeLevel": [
// "Class 7"
// ],
// "artifactUrl": "https://ntpproductionall.blob.core.windows.net/ntp-content-production/content/assets/do_312719162116210688118940/1e9id3spwfzvobzbuyonlibqgwl2r-de6_1_streamed.mp4",
// "contentType": "Resource",
// "identifier": "do_312719162116210688118940",
// "audience": [
// "Learner"
// ],
// "visibility": "Default",
// "mediaType": "content",
// "osId": "org.ekstep.quiz.app",
// "name": "Perimeter of Circle",
// "attributions": [
// "NCERT"
// ],
// "status": "Live",
// "code": "org.sunbird.PVFF72",
// "streamingUrl": "https://ntpprodmedia-inct.streaming.media.azure.net/30901810-e22d-4b37-8807-9c6fc727343f/1e9id3spwfzvobzbuyonlibqgwl2r-de.ism/manifest(format=m3u8-aapl-v3)",
// "medium": "English",
// "createdOn": "2019-03-15T06:41:34.264+0000",
// "lastUpdatedOn": "2019-03-29T10:20:02.506+0000",
// "owner": "DIKSHA Creator",
// "pkgVersion": 3,
// "versionKey": "1553854802684",
// "framework": "ekstep_ncert_k-12",
// "createdBy": "ebbbe5b4-a55f-4081-9ee9-38117231ccbb",
// "board": "CBSE",
// "resourceType": "Learn",
// "languageCode": "en",
// "orgDetails": {
// "email": null,
// "orgName": "Jammu And Kashmir"
// }
// },
"contentData":{
"subject": "Mathematics",
"channel": "0123221617357783046602",
"language": [
"English"
],
"mimeType": "application/pdf",
"appIcon": "https://ntpproductionall.blob.core.windows.net/ntp-content-production/content/assets/do_31268669755482931215420/0b2zkgdpsivvzbvrtszl5tvzyd2qty0nredhsexzmwfnqtgnj.jpg",
"gradeLevel": [
"Class 10"
],
"artifactUrl": "https://ntpproductionall.blob.core.windows.net/ntp-content-production/content/assets/do_31268669755482931215420/1zdciyexh_xurufjo9exwhlcxzaoxutq_.pdf",
"contentType": "Resource",
"identifier": "do_31268669755482931215420",
"audience": [
"Learner"
],
"visibility": "Default",
"mediaType": "content",
"osId": "org.ekstep.quiz.app",
"name": "MarathiMathematicsPart-2(Geometry)Set_1_Ans.pdf",
"attributions": [
"Balbharati"
],
"status": "Live",
"code": "org.sunbird.zWhFbY",
"medium": "Marathi",
"streamingUrl": "https://ntpproductionall.blob.core.windows.net/ntp-content-production/content/assets/do_31268669755482931215420/1zdciyexh_xurufjo9exwhlcxzaoxutq_.pdf",
"createdOn": "2019-01-28T09:52:15.110+0000",
"lastUpdatedOn": "2019-01-28T10:10:49.853+0000",
"owner": "undefined",
"pkgVersion": 1,
"versionKey": "1548670249853",
"framework": "mh_k-12_1",
"createdBy": "80ae760d-f9dd-43a9-91a7-09dfabba2293",
"board": "State (Maharashtra)",
"resourceType": "Learn",
"languageCode": "en",
"orgDetails": {
"email": "vgarad@maa.ac.in",
"orgName": "MITRA"
}
},
"isAvailable": true,
"path": "fixture-stories/custom_eval"
};
var data = '';

var configuration = {};
configuration.context = {};
configuration.config = {showEndPage: true};
configuration.metadata = metadata;
configuration.data = data;
previewContentIframe.contentWindow.initializePreview(configuration);
}, 1000);
};
</script>
</body>
</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions player/public/fixture-stories/content_preview/preview
120 changes: 120 additions & 0 deletions player/public/fixture-stories/content_preview/test/localData.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{
"content": [{
"identifier": "do_20043647",
"mimeType": "application/vnd.ekstep.html-archive",
"localData": {
"questionnaire": null,
"appIcon": "fixture-stories/HTMLContent/logo.png",
"subject": "literacy_v2",
"description": "HTML Content",
"name": "HTML Content",
"downloadUrl": "",
"checksum": null,
"loadingMessage": "Without requirements or design, programming is the art of adding bugs to an empty text file. ...",
"concepts": [{
"identifier": "LO1",
"name": "Receptive Vocabulary",
"objectType": "Concept"
}],
"config": {
"languageL2": "en",
"sid": "de305d54-75b4-431b-adb2-eb6b9e546013",
"uid": "123e4567-e89b-12d3-a456-426655440000",
"did": "ff305d54-85b4-341b-da2f-eb6b9e5460fa",
"level": "5"
},
"identifier": "do_20043647",
"grayScaleAppIcon": null,
"pkgVersion": 1
},
"isAvailable": true,
"path": "fixture-stories/HTMLContent"
},{
"identifier": "do_20045479",
"mimeType": "application/vnd.ekstep.html-archive",
"localData": {
"questionnaire": null,
"appIcon": "fixture-stories/HTMLContent/logo.png",
"subject": "literacy_v2",
"description": "HTML Content2",
"name": "HTML Content2",
"downloadUrl": "",
"checksum": null,
"loadingMessage": "Without requirements or design, programming is the art of adding bugs to an empty text file. ...",
"concepts": [{
"identifier": "LO1",
"name": "Receptive Vocabulary",
"objectType": "Concept"
}],
"config": {
"theme": "blue",
"language": "english"
},
"identifier": "do_20045479",
"grayScaleAppIcon": null,
"pkgVersion": 1
},
"isAvailable": true,
"path": "fixture-stories/HTMLContent2"
}
],
"languageSearch":{
"words": [
{
"identifier": "en_2",
"score": 1.0,
"lemma": "cat",
"pictures": [
"https://s3.amazon.com/ekstep-public/language_assets/cat.jpg"
],
"pronunciations": [
"https://s3.amazon.com/ekstep-public/language_assets/cat.mp3"
]
},
{
"identifier": "en_5",
"score": 1.0,
"lemma": "tiger",
"pictures": [
"https://s3.amazon.com/ekstep-public/language_assets/tiger.jpg"
],
"pronunciations": [
"https://s3.amazon.com/ekstep-public/language_assets/tiger.mp3"
]
},
{
"identifier": "en_1",
"score": 0.8,
"lemma": "rat",
"pictures": [
"https://s3.amazon.com/ekstep-public/language_assets/rat.jpg"
],
"pronunciations": [
"https://s3.amazon.com/ekstep-public/language_assets/rat.mp3"
]
}
],
"relations": [
{
"score": "6.4",
"title": "",
"list": [
"en_2",
"en_5",
"en_1"
],
"relation": "akshara_boundary"
},
{
"score": "4.5",
"title": "",
"list": [
"en_12",
"en_11",
"en_20"
],
"relation": "akshara_boundary"
}
]
}
}
66 changes: 66 additions & 0 deletions player/public/functional_test/__tests__/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/**
* Functional test cases for question set
* @author rahul shukla <rahul.shukla@ilimi.in>
* @todo To use image diff we need to ignore options container in MCQ cause it always shuffle
* @link https://github.com/americanexpress/jest-image-snapshot#ignoring-parts-of-the-image-snapshot-if-using-puppeteer
*/

const timeout = 50000

const typingSpeed = 50

let jestscreenshot = require('@jeeyah/jestscreenshot');
const devices = require('puppeteer/DeviceDescriptors');

const { toMatchImageSnapshot } = require('jest-image-snapshot');
expect.extend({ toMatchImageSnapshot });

describe(
'Sunbird Player functional testing - preview testing',
() => {
let page
beforeAll(async () => {
jest.setTimeout(timeout)
page = await global.__BROWSER__.newPage()
await page.goto('http://127.0.0.1:3000')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we still running player ? or we just need to play from the preview folder


await page.setViewport({width: 1280,height: 800})
// const metrics = await page.metrics();
// console.info(metrics);
let path = require('path');
let scriptName = path.basename(__filename).replace('.js', '');
let options = {
page: page,
dirName: __dirname,
scriptName: scriptName,
onlyFailures: true
};
await jestscreenshot.init(options);
}, timeout)

afterEach(async () => {
await page.waitFor(5000)
})

afterAll(async () => {
jestscreenshot.cleanup(function () {
if (browser) {
browser.close();
}
done();
});
await page.close()
})

it('Player shell loaded with fixture stories', async () => {
await page.waitForSelector('body > div:nth-child(7) > div > ion-pane > ion-content > div > div:nth-child(3)')
})

it('Should open content player', async() => {
const playQuestion = await page.waitForSelector('body > div:nth-child(7) > div > ion-pane > ion-content > div > div:nth-child(3)')
await playQuestion.click()
})

},
timeout
)