itemengine-cypress-automation 1.0.176 → 1.0.177-contentBlocksScript-b1350d4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -636,11 +636,27 @@ export const extractLrnQuestionData = {
636
636
  cy.log(`Extracting the passage from question ${index}`);
637
637
  obj.questionIndex = index;
638
638
  obj.questionType = 'contentBlocks';
639
+ const passageArray = [];
639
640
  lrnPage.contentBlocksQuestion()
640
- .eq(index)
641
- .then(($question) => {
642
- let text = $question[0].innerText;
643
- obj.passageText = text;
641
+ .find('p')
642
+ .each(($element) => {
643
+ let innerText = $element[0].innerText;
644
+ passageArray.push(innerText);
645
+ });
646
+ obj.passageArray = passageArray;
647
+ lrnPage.contentBlocksQuestion()
648
+ .then(($element) => {
649
+ if ($element[0].innerHTML.includes('passage-next-btn')) {
650
+ obj.pagination = true;
651
+ cy.get('.lrn-sharedpassage-index')
652
+ .then(($element) => {
653
+ let innerText = $element[0].innerText;
654
+ let pageCount = innerText.trim().replace(/\s+/g, '');
655
+ obj.pageCount = pageCount;
656
+ });
657
+ } else {
658
+ obj.pagination = false;
659
+ }
644
660
  });
645
661
  lrnQuestionDataArr.push(obj);
646
662
  }
@@ -606,9 +606,24 @@ export const verifyIeQuestionData = {
606
606
  contentBlocks: (expectedQuestionData, index) => {
607
607
  cy.get('[class*="ContentBlocksPreviewstyles__ContentBlocksPreviewWrapper"]')
608
608
  .eq(index)
609
- .then(($element) => {
610
- let passageText = $element[0].innerText
611
- expect(passageText).to.be.eq(expectedQuestionData.passageText)
609
+ .within(() => {
610
+ contentBlocksPage.contentWrapperPreviewTab()
611
+ .find('p')
612
+ .each(($element, index) => {
613
+ let innerText = $element[0].innerText;
614
+ expect(innerText).to.be.eq(expectedQuestionData.passageArray[index]);
615
+ });
616
+ if (expectedQuestionData.pagination) {
617
+ cy.get('.content-blocks-pagination')
618
+ .should('exist');
619
+ //Unable to check the passage on all pages, checked only for first page
620
+ contentBlocksPage.paginationText()
621
+ .then(($element) => {
622
+ let pageCount = $element[0].innerText;
623
+ let pageCountText = pageCount.trim().replace(/\s+/g, '');
624
+ expect(pageCountText).to.be.eq(expectedQuestionData.pageCount);
625
+ });
626
+ }
612
627
  });
613
628
  }
614
629
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.176",
3
+ "version": "1.0.177-contentBlocksScript-b1350d4.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -35,4 +35,4 @@
35
35
  "node-fetch": "^3.3.2",
36
36
  "react-uuid": "^2.0.0"
37
37
  }
38
- }
38
+ }