From 052a14e142d3fae1bfc358a7b6ee8273951cd819 Mon Sep 17 00:00:00 2001 From: Gourav More Date: Mon, 16 Mar 2020 19:50:57 +0530 Subject: [PATCH 1/3] Issue #SB-0000 fix: content player function test cases for content preview --- player/app-data/fixture-content-list.json | 35 +++++ .../content_preview/index.html | 124 ++++++++++++++++++ .../fixture-stories/content_preview/logo.png | Bin 0 -> 4510 bytes .../fixture-stories/content_preview/preview | 1 + .../content_preview/test/localData.json | 120 +++++++++++++++++ .../functional_test/__tests__/preview.js | 66 ++++++++++ 6 files changed, 346 insertions(+) create mode 100644 player/public/fixture-stories/content_preview/index.html create mode 100644 player/public/fixture-stories/content_preview/logo.png create mode 120000 player/public/fixture-stories/content_preview/preview create mode 100644 player/public/fixture-stories/content_preview/test/localData.json create mode 100644 player/public/functional_test/__tests__/preview.js diff --git a/player/app-data/fixture-content-list.json b/player/app-data/fixture-content-list.json index cf5cf5c8e..f17947ba7 100644 --- a/player/app-data/fixture-content-list.json +++ b/player/app-data/fixture-content-list.json @@ -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", diff --git a/player/public/fixture-stories/content_preview/index.html b/player/public/fixture-stories/content_preview/index.html new file mode 100644 index 000000000..4a6e3535c --- /dev/null +++ b/player/public/fixture-stories/content_preview/index.html @@ -0,0 +1,124 @@ + + + + HTML Content + + + + + + +

Content player test

+
+ +
+ + + \ No newline at end of file diff --git a/player/public/fixture-stories/content_preview/logo.png b/player/public/fixture-stories/content_preview/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..6692c0f4cc9e018bb204c44e63c7eff118d1576f GIT binary patch literal 4510 zcmaKw2UHVV*M=t)I|?dAigXJRkS<8O)C(US3>r#AdNYJ39c&<7DWQXuBmzpV5PA~< zHG-6c5Q@MBqy&%>iUbXOf$ME+egFR^S#xI2InRF2%-*xk%HGi4?*O}@o`D_!0s#Ps z@d5Tmfk(j6Lx)eDI>pX*ik+cT?2INiyyASEoWe39;$X0p zloYq1+%>r?N|z+1z@THtj-6yX$;-~pCn+c>Ao+*Dl9G(?!SCmle;@Wce`@ayz;Of^ z1HLeWH~=ON5Hkm8uLIy?7-VAJxB8brhget-GchwdHP`_r5EC;i^D!3YBg_W_7^f_( zhd53P%lu;QfVhA7jEJbLmWA)L*LMor`p;HQYCHNpc$o5bRZPy30pMkT8SsD6Sy-75 zF){iiI2e&ZEFflXW0SX!)QTTC~Vn0)k&0Cso?=fvq zk?wvC6Uer8wMpVh>D>r6d-3B=(gX>%JV$>VA$(keFbB7!_lxc{(tFp7m%f|#B6~+L z5Ot2o(slSbq>7Ozg*r4k+a;0Hv=AT3ivUmPX1AUsksJ$&&Ua16aqCp zKMLxiXf;uqUl^K2KE{RF2uOCcFV}n9BTpzPk6H9v5pdR>4KOS7u4#8T{P?xa46JAL znQZS0`M8Xn($(I;=H7?0a&A<|Wu@ds?ek?B(=$y*<%DjNm0$khA2j7_pg3ZHfIr~i zD{{R%u+)}2&E{_7t_(McSXf^0a1ZmJ$f;Ui6lpToZ)hlmm;|_9#;>Q6DSgB5x4?qzf=Y#%&ACe0{7r^D3Aq>Jlt4tSJubPWW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0p~XUA6;ec}vsB~SNDbp&VS z(eCQ=tHt!~PYfz$AsTyR_byu;{&oeS%G|yzB3+625{972Lto&HF?Dx5 zu7*f&yT`8+aF2xky*pB~e3)t;ch|yQtghw*J_XG8(GzC1v``N_1i_tl55`j@l4~*d zXB9$XyCU2DjH53@=F5-&+>gC^=kvj~KmFWlC~@wb6q|t0Y%XL|8)<8v(x|KljuON7G&S?@fi$P zZ;p`;{PL5mDejk;^g#c*`ef8Q_J|d)MkBSm4c;65r6__G$jtMAcBFSk*;cF`jF##h}4F}Qp6Mw55M@Hrf^ zgf0n+s5;XvVf5>tX$SC!6{f~aZr;66N_dz$hnE_p@yoeZT$;FN8-xuWb=B$0g5=et zOSoHLVS$3u%MKpZgI%3L(KT#WEVFJBE-lyN)c!OD0EeQ2)2u-aijcLJg<36Dn1wQp z$02N6MO$p)Yip`+(RSi+LVBEYV|lo3X?^3^G3%%laV0u zu|zRxKD;f&SHdjP^S0Wx$}o3!4>&e9wJnM?)|L5=B4oabKzlp+v*7b}I;`F*&1!C+`72idqLS-;}(G=wFzNuxJ{eL zy1P^vo~O2avKYpn^CRw-0u8=>3!Rd_f}|!MY4dt30WLBSLA~_#fc!oAF00a&P#*Gxh?K literal 0 HcmV?d00001 diff --git a/player/public/fixture-stories/content_preview/preview b/player/public/fixture-stories/content_preview/preview new file mode 120000 index 000000000..9f9ae2eee --- /dev/null +++ b/player/public/fixture-stories/content_preview/preview @@ -0,0 +1 @@ +/home/dell/Documents/git/sunbird-content-player/player/www/preview \ No newline at end of file diff --git a/player/public/fixture-stories/content_preview/test/localData.json b/player/public/fixture-stories/content_preview/test/localData.json new file mode 100644 index 000000000..ee5461f57 --- /dev/null +++ b/player/public/fixture-stories/content_preview/test/localData.json @@ -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" + } + ] + } +} \ No newline at end of file diff --git a/player/public/functional_test/__tests__/preview.js b/player/public/functional_test/__tests__/preview.js new file mode 100644 index 000000000..a2345e433 --- /dev/null +++ b/player/public/functional_test/__tests__/preview.js @@ -0,0 +1,66 @@ +/** + * Functional test cases for question set + * @author rahul shukla + * @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') + + 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 +) \ No newline at end of file From 8b676714786250d392e2cf7bc0d81f93093215f2 Mon Sep 17 00:00:00 2001 From: Rahul Shukla Date: Tue, 17 Mar 2020 09:57:29 +0530 Subject: [PATCH 2/3] Issue #SB-13699 feat: functional test for content player --- .../functional_test/__tests__/pdfContent.js | 2 +- .../functional_test/__tests__/questionset.js | 68 ++++++++++++++----- player/public/functional_test/makefile | 13 ---- player/public/functional_test/package.json | 3 +- 4 files changed, 55 insertions(+), 31 deletions(-) delete mode 100644 player/public/functional_test/makefile diff --git a/player/public/functional_test/__tests__/pdfContent.js b/player/public/functional_test/__tests__/pdfContent.js index 41c878a49..6df171c1c 100644 --- a/player/public/functional_test/__tests__/pdfContent.js +++ b/player/public/functional_test/__tests__/pdfContent.js @@ -25,7 +25,7 @@ describe( page: page, dirName: __dirname, scriptName: scriptName, - onlyFailures: true + onlyFailures: false }; await jestscreenshot.init(options); }, timeout) diff --git a/player/public/functional_test/__tests__/questionset.js b/player/public/functional_test/__tests__/questionset.js index a38b6ab52..bf76527c6 100644 --- a/player/public/functional_test/__tests__/questionset.js +++ b/player/public/functional_test/__tests__/questionset.js @@ -54,25 +54,30 @@ describe( 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(38)') + await page.screenshot({path: '__tests__/screenshots/fixture_stories.png'}); }) it('Should open question set', async() => { const playQuestion = await page.waitForSelector('body > div:nth-child(7) > div > ion-pane > ion-content > div > div:nth-child(38)') await playQuestion.click() + await page.screenshot({path: '__tests__/screenshots/onclick_questionset.png'}); }) it('Zoom button should open the image in zoomed view', async () => { const zoomImg = await page.waitForSelector('#org-ekstep-contentrenderer-questionunit-questionComponent-ZoomImg') await zoomImg.click() + await page.screenshot({path: '__tests__/screenshots/onzoom_image.png'}); }) it('check pop exists or not', async()=>{ const popup = await page.waitForSelector('#image-model-popup > div.popup-full-body > div > div') await popup.click() + await page.screenshot({path: '__tests__/screenshots/afterpop_close.png'}); }) it('Test for title', async () => { const title = await page.waitForSelector('#mcq-question-container > div.question-content-container > div > div.hiding-container > div > p') + await page.screenshot({path: '__tests__/screenshots/test_title.png'}); }) it('Question title font size should be same in Mobile and Web and height and width should be different', async() => { @@ -84,15 +89,18 @@ describe( await page.waitForSelector('#mcq-question-container > div.question-content-container > div > div.hiding-container > div > p') const btnStylesInMobile = await page.$eval('#mcq-question-container > div.question-content-container > div > div.hiding-container > div > p', btnStylesInMobile => JSON.parse(JSON.stringify(getComputedStyle(btnStylesInMobile)))); // console.info("font size is" + btnStylesInWeb.fontsize) - expect(btnStylesInWeb.fontsize).toEqual(btnStylesInMobile.fontsize) - expect(btnStylesInWeb.height).not.toEqual(btnStylesInMobile.height) - expect(btnStylesInWeb.width).not.toEqual(btnStylesInMobile.width) + expect(parseFloat(btnStylesInWeb.fontsize)).toEqual(parseFloat(btnStylesInMobile.fontsize)) + expect(parseFloat(btnStylesInWeb.height)).not.toEqual(parseFloat(btnStylesInMobile.height)) + expect(parseFloat(btnStylesInWeb.width)).not.toEqual(parseFloat(btnStylesInMobile.width)) }) it('Test for Question Set', async () => { await page.setViewport({width: 1280,height: 800}) const playQuestion = await page.waitForSelector('body > div:nth-child(7) > div > ion-pane > ion-content > div > div:nth-child(38)') await playQuestion.click() + }) + + it('Test for mcq', async() => { await page.waitForSelector('#mcq-question-container > div.question-content-container > div > div.hiding-container > div > p') const wrongAnswer = await page.waitForSelector('#mcq-question-container > div.bg-graphics-2 > div.outer-option-container.horizontal > div > div > div:nth-child(2)') const nextButton = await page.waitForSelector('body > div:nth-child(8) > div > div > custom-next-navigation > div > a > img') @@ -106,9 +114,16 @@ describe( await nextButton.click() const nextPopupButton = await page.waitForSelector('#popup-buttons-container > div') await nextPopupButton.click() + }) + + it('Skipping match test',async() => { + const nextButton = await page.waitForSelector('body > div:nth-child(8) > div > div > custom-next-navigation > div > a > img') await nextButton.click() const popupNextButton = await page.waitForSelector('#popup-buttons-container > div.left.button') await popupNextButton.click() + }) + + it('Input type test', async() => { await page.waitForSelector('#ans-field1'); await page.evaluate(() => { document.querySelector('#ans-field1').value = 'jupiter'; @@ -117,45 +132,66 @@ describe( await page.evaluate(() => { document.querySelector('#ans-field2').value = 'mercury'; }); + await page.screenshot({path: '__tests__/screenshots/setting_fields.png'}); + const nextButton = await page.waitForSelector('body > div:nth-child(8) > div > div > custom-next-navigation > div > a > img') await nextButton.click(); - const nextPopupButton2 = await page.waitForSelector('#popup-buttons-container > div') - await nextPopupButton2.click(); + const nextPopupButton = await page.waitForSelector('#popup-buttons-container > div') + await nextPopupButton.click(); + }) + + it('Skipping arranging test', async() => { + const nextButton = await page.waitForSelector('body > div:nth-child(8) > div > div > custom-next-navigation > div > a > img') await nextButton.click() - const popupNextButton2 = await page.waitForSelector('#popup-buttons-container > div.left.button') - await popupNextButton2.click() + const popupNextButton = await page.waitForSelector('#popup-buttons-container > div.left.button') + await popupNextButton.click() + }) + it('Sentence creation test', async() => { + const select0 = await page.waitForSelector('#w0') + await select0.click() + await page.screenshot({path: '__tests__/screenshots/setting_what.png'}); - const select1 = await page.waitForSelector('#w0') + const select1 = await page.waitForSelector('#w1') await select1.click() + await page.screenshot({path: '__tests__/screenshots/setting_are.png'}); - const select2 = await page.waitForSelector('#w1') + const select2 = await page.waitForSelector('#w2') await select2.click() + await page.screenshot({path: '__tests__/screenshots/setting_you.png'}); const select3 = await page.waitForSelector('#w3') await select3.click() + await page.screenshot({path: '__tests__/screenshots/setting_looking.png'}); const select4 = await page.waitForSelector('#w4') await select4.click() + await page.screenshot({path: '__tests__/screenshots/setting_for.png'}); const select5 = await page.waitForSelector('#w5') await select5.click() + await page.screenshot({path: '__tests__/screenshots/setting_questionmark.png'}); + const nextButton = await page.waitForSelector('body > div:nth-child(8) > div > div > custom-next-navigation > div > a > img') await nextButton.click() - const nextPopupButton3 = await page.waitForSelector('#popup-buttons-container > div') - await nextPopupButton3.click(); - + const nextPopupButton = await page.waitForSelector('#popup-buttons-container > div') + await nextPopupButton.click(); + }) + + it('Rating and comment test', async() => { const ratingFour = await page.waitForSelector('#gcFbPopup > div.gc-popup-new.gc-fc-popup > div.gc-popup-body-new > div > div:nth-child(1) > div:nth-child(4) > img') - ratingFour.click() + await ratingFour.click() + await page.screenshot({path: '__tests__/screenshots/four_rating.png'}); await page.waitForSelector('#commentText'); await page.evaluate(() => { document.querySelector('#commentText').value = 'test comment'; }); + await page.screenshot({path: '__tests__/screenshots/comment_rating.png'}); const submitButton = await page.waitForSelector('#gcFbPopup > div.gc-popup-new.gc-fc-popup > div.gc-popup-body-new > div') await submitButton.click() - - - }) + await page.screenshot({path: '__tests__/screenshots/submit_rating.png'}); + }) + }, timeout diff --git a/player/public/functional_test/makefile b/player/public/functional_test/makefile deleted file mode 100644 index 2191a4396..000000000 --- a/player/public/functional_test/makefile +++ /dev/null @@ -1,13 +0,0 @@ -.PHONY: dev test help -.DEFAULT_GOAL: help - -default: help - -help: ## Output available commands - @echo "Available commands:" - @echo - @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' - -ci_test: - @docker-compose build ci_test - @docker-compose run --rm ci_test \ No newline at end of file diff --git a/player/public/functional_test/package.json b/player/public/functional_test/package.json index 8ff368a36..d002ed788 100644 --- a/player/public/functional_test/package.json +++ b/player/public/functional_test/package.json @@ -24,6 +24,7 @@ }, "devDependencies": { "jest-html-reporter": "^2.8.0", - "jest-html-reporters": "^1.2.1" + "jest-html-reporters": "^1.2.1", + "jest-sonar-reporter": "^2.0.0" } } From 8eaa1f2ba9ade52a7caefe77f57946a06e66e8d3 Mon Sep 17 00:00:00 2001 From: Gourav More Date: Wed, 18 Mar 2020 14:41:25 +0530 Subject: [PATCH 3/3] Issue #SB-0000 fix: functional test cases for content player preview folder --- .../content_preview/index.html | 224 ++++++++++-------- .../functional_test/__tests__/preview.js | 1 - 2 files changed, 125 insertions(+), 100 deletions(-) diff --git a/player/public/fixture-stories/content_preview/index.html b/player/public/fixture-stories/content_preview/index.html index 4a6e3535c..69cd6aaff 100644 --- a/player/public/fixture-stories/content_preview/index.html +++ b/player/public/fixture-stories/content_preview/index.html @@ -10,112 +10,138 @@

Content player test

- +