-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #SB-0000 fix: content player function test cases for content preview #358
Open
gouravmore
wants to merge
4
commits into
Sunbird-Knowlg:functional-test
Choose a base branch
from
gouravmore:functional-test-rahul
base: functional-test
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
052a14e
Issue #SB-0000 fix: content player function test cases for content pr…
gouravmore 8b67671
Issue #SB-13699 feat: functional test for content player
rahulshukla 23180c2
Issue #SB-0000 fix: resolved conflicts
gouravmore 8eaa1f2
Issue #SB-0000 fix: functional test cases for content player preview …
gouravmore File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
150 changes: 150 additions & 0 deletions
150
player/public/fixture-stories/content_preview/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
<!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" 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 = { | ||
"streamingUrl": "https://ekstep-public-prod.s3-ap-south-1.amazonaws.com/content/ecml/do_312473549722288128119665-latest", | ||
"publish_type": "public", | ||
"keywords": [ | ||
"Story" | ||
], | ||
"subject": "English", | ||
"channel": "in.ekstep", | ||
"downloadUrl": "do_312473549722288128119665/1531308826198_do_312473549722288128119665.zip", | ||
"language": [ | ||
"English" | ||
], | ||
"mimeType": "application/vnd.ekstep.ecml-archive", | ||
"source": "", | ||
"variants": null, | ||
"objectType": "Content", | ||
"appIcon": "do_312473549722288128119665/0c5509c8c7cf945b1b23dacc66a05c0d_1522654872904.jpeg", | ||
"gradeLevel": [ | ||
"Class 7" | ||
], | ||
"appId": "ekstep_portal", | ||
"copyType": "Enhance", | ||
"collaborators": [ | ||
"5469" | ||
], | ||
"contentEncoding": "gzip", | ||
"artifactUrl": "do_312473549722288128119665/1531308826198_do_312473549722288128119665.zip", | ||
"contentType": "Resource", | ||
"lastUpdatedBy": "539", | ||
"identifier": "do_312473549722288128119665", | ||
"audience": [ | ||
"Learner" | ||
], | ||
"visibility": "Default", | ||
"consumerId": "62e15662-bb09-439f-86e2-d65bd84f3c23", | ||
"mediaType": "content", | ||
"osId": "org.ekstep.quiz.app", | ||
"ageGroup": [ | ||
">10" | ||
], | ||
"lastPublishedBy": "539", | ||
"languageCode": "en", | ||
"tags": [ | ||
"Story" | ||
], | ||
"prevState": "Review", | ||
"lastPublishedOn": "2018-07-11T11:33:47.231+0000", | ||
"domain": [ | ||
"literacy" | ||
], | ||
"name": "The Squirrel", | ||
"publisher": "", | ||
"attributions": [ | ||
"" | ||
], | ||
"status": "Live", | ||
"template": "", | ||
"totalQuestions": 5, | ||
"code": "org.ekstep.literacy.story.16782.fork", | ||
"publishError": null, | ||
"origin": "do_31243457742290944024273", | ||
"description": "Students Resources", | ||
"idealScreenSize": "normal", | ||
"posterImage": "do_312473549722288128119665/0c5509c8c7cf945b1b23dacc66a05c0d_1522654872904.jpeg", | ||
"createdOn": "2018-04-02T06:21:52.584+0000", | ||
"contentDisposition": "inline", | ||
"lastUpdatedOn": "2018-07-11T11:33:12.141+0000", | ||
"owner": "Aprajita Tomar", | ||
"creator": "Aprajita Tomar", | ||
"os": [ | ||
"All" | ||
], | ||
"flagReasons": null, | ||
"totalScore": 5, | ||
"pkgVersion": 1, | ||
"versionKey": "1531308792141", | ||
"idealScreenDensity": "hdpi", | ||
"framework": "NCF", | ||
"lastSubmittedOn": "2018-05-18T01:40:15.750+0000", | ||
"createdBy": "6116", | ||
"compatibilityLevel": 2, | ||
"board": "CBSE", | ||
"resourceType": "Read" | ||
} | ||
|
||
var configuration = { | ||
"context": { | ||
"mode": "edit", | ||
"contentId": "do_112694410769801216167", | ||
"sid": "7W23qQKd_n4wT17sxVeLsG55t2FOZ6Bi", | ||
"uid": "874ed8a5-782e-4f6c-8f36-e0288455901e", | ||
"channel": "b00bc992ef25f1a9a8d63291e20efc8d", | ||
"pdata": { | ||
"id": "dev.sunbird.portal", | ||
"ver": "1.14.0", | ||
"pid": "sunbird-portal.contenteditor" | ||
}, | ||
"app": [], | ||
"dims": [], | ||
"partner": [] | ||
}, | ||
"config": { | ||
"repos": [ | ||
"/sunbird-plugins/renderer" | ||
], | ||
"plugins": [ | ||
{ | ||
"id": "org.sunbird.player.endpage", | ||
"ver": 1.1, | ||
"type": "plugin" | ||
} | ||
], | ||
"splash": { | ||
"text": "", | ||
"icon": "", | ||
"bgImage": "assets/icons/splacebackground_1.png", | ||
"webLink": "" | ||
}, | ||
"overlay": { | ||
"showUser": false | ||
}, | ||
"showEndPage": false | ||
}, | ||
"metadata": metadata, | ||
"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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/home/dell/Documents/git/sunbird-content-player/player/www/preview | ||
120 changes: 120 additions & 0 deletions
120
player/public/fixture-stories/content_preview/test/localData.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* Functional test cases for question set | ||
* @author rahul shukla <[email protected]> | ||
* @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') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This path should be generic not a local path.