itemengine-cypress-automation 1.0.175-15thAprilRepoUpdate-cb0f7d0.0 → 1.0.176

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.
@@ -155,13 +155,13 @@ Cypress.Commands.add('learnosityLoaderWait', () => {
155
155
  });
156
156
 
157
157
  Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
158
- iePage.questionWrapper()
158
+ iePage.questionAndResourceWrapper()
159
159
  .then((elements) => {
160
160
  if (retries <= 0) {
161
161
  throw new Error('Itemengine questions did not lazy load in time');
162
162
  };
163
163
  if (elements.length < count) {
164
- iePage.questionWrapper()
164
+ iePage.questionAndResourceWrapper()
165
165
  .last()
166
166
  .scrollIntoView()
167
167
  .wait(1000);
@@ -32,6 +32,7 @@ export const lrnPage = {
32
32
  uploadResponseSupportedFileTypes: () => cy.get('.lrn-fileupload-support-copy'),
33
33
  uploadResponseFileLimit: () => cy.get('.lrn-limit-status'),
34
34
  uploadResponseToolbar: () => cy.get('[data-lrn-component="toolbar"]'),
35
+ contentBlocksQuestion: () => cy.get('.lrn_sharedpassage'),
35
36
  steps: {
36
37
  checkShowAnswersToggle: () => {
37
38
  lrnPage.showAnswersToggle()
@@ -630,6 +631,20 @@ export const extractLrnQuestionData = {
630
631
  lrnQuestionDataArr.push(obj);
631
632
  },
632
633
 
634
+ contentBlocks: (lrnQuestionDataArr, index) => {
635
+ let obj = {};
636
+ cy.log(`Extracting the passage from question ${index}`);
637
+ obj.questionIndex = index;
638
+ obj.questionType = 'contentBlocks';
639
+ lrnPage.contentBlocksQuestion()
640
+ .eq(index)
641
+ .then(($question) => {
642
+ let text = $question[0].innerText;
643
+ obj.passageText = text;
644
+ });
645
+ lrnQuestionDataArr.push(obj);
646
+ }
647
+
633
648
  /* singleSelection: (lrnQuestionDataArr, index) => {
634
649
  let obj = {};
635
650
  cy.log(`Extracting the question instructions and options from question ${index}`);
@@ -11,7 +11,8 @@ const lrnQuestionTypesENUM = {
11
11
  trueOrFalse: 'True or false',
12
12
  figText: 'Cloze with text',
13
13
  shortTextResponse: 'Short text',
14
- uploadResponse: 'File upload'
14
+ uploadResponse: 'File upload',
15
+ contentBlocks: 'Passage'
15
16
  }
16
17
 
17
18
  export default lrnQuestionTypesENUM;
@@ -26,6 +26,7 @@ const extractLrnPreviewData = (currQuestionType, lrnQuestionDataArr, index) => {
26
26
  case lrnQuestionTypesENUM.figText: return extractLrnQuestionData.figText(lrnQuestionDataArr, index);
27
27
  case lrnQuestionTypesENUM.shortTextResponse: return extractLrnQuestionData.shortTextResponse(lrnQuestionDataArr, index);
28
28
  case lrnQuestionTypesENUM.uploadResponse: return extractLrnQuestionData.uploadResponse(lrnQuestionDataArr, index);
29
+ case lrnQuestionTypesENUM.contentBlocks: return extractLrnQuestionData.contentBlocks(lrnQuestionDataArr, index);
29
30
  default: throw new Error('Invalid lrn question type');
30
31
  }
31
32
  }
@@ -42,6 +43,7 @@ const verifyIePreviewData = (questionType, questionData, index) => {
42
43
  case 'figText': return verifyIeQuestionData.figText(questionData, index);
43
44
  case 'shortTextResponse': return verifyIeQuestionData.shortTextResponse(questionData, index);
44
45
  case 'uploadResponse': return verifyIeQuestionData.uploadResponse(questionData, index);
46
+ case 'contentBlocks': return verifyIeQuestionData.contentBlocks(questionData, index);
45
47
  default: throw new Error('Invalid ngie question type');
46
48
  }
47
49
  }
@@ -55,6 +57,7 @@ const extractLrnGradingData = (currQuestionType, lrnGradingDataArr, index) => {
55
57
  case lrnQuestionTypesENUM.figText: return extractLrnQuestionData.figTextGrading(lrnGradingDataArr, index);
56
58
  case lrnQuestionTypesENUM.shortTextResponse: return extractLrnQuestionData.shortTextResponseGrading(lrnGradingDataArr, index);
57
59
  case lrnQuestionTypesENUM.uploadResponse: return cy.log('Manually Graded Question Type');
60
+ case lrnQuestionTypesENUM.contentBlocks: return cy.log('Resource and tool');
58
61
  default: throw new Error('Invalid lrn question type');
59
62
  }
60
63
  }
@@ -68,6 +71,7 @@ const verifyIeGradingData = (questionType, questionData, index) => {
68
71
  case 'figText': return verifyIeQuestionData.figTextGrading(questionData, index);
69
72
  case 'shortTextResponse': return verifyIeQuestionData.shortTextResponseGrading(questionData, index);
70
73
  case 'uploadResponse': return cy.log('Manually Graded Question Type');
74
+ case 'contentBlocks': return cy.log('Resource and tool');
71
75
  default: throw new Error('Invalid ngie question type');
72
76
  }
73
77
  }
@@ -88,7 +92,7 @@ export const migrationScript = (referenceIds) => {
88
92
  cy.visit(`/items-list/item/${utilities.base64Encoding(referenceId)}`);
89
93
  cy.pageLoadWait('getItemPreview');
90
94
  cy.get('@getItemPreview').then((req) => {
91
- let questionCount = req.response.body.data.getItemPreview.item.questionParts.length;
95
+ let questionCount = req.response.body.data.getItemPreview.item.questionParts.length + req.response.body.data.getItemPreview.item.resources.length;
92
96
  cy.lazyLoadPreviewQuestions(questionCount);
93
97
  });
94
98
  });
@@ -1,4 +1,4 @@
1
- import { essayResponsePage, fillInTheGapsTextPage, multipleSelectionPage, textEntryMathPage, uploadResponsePage } from "../../pages";
1
+ import { contentBlocksPage, essayResponsePage, fillInTheGapsTextPage, multipleSelectionPage, textEntryMathPage, uploadResponsePage } from "../../pages";
2
2
  import { draggableOptionContainer } from "../../pages/components";
3
3
  import { singleSelectionPage } from "../../pages/singleSelectionPage"
4
4
  import utilities from "../helpers/utilities";
@@ -9,6 +9,7 @@ export const iePage = {
9
9
  mcqOption: () => cy.get('.mcq_Label'),
10
10
  mcqOptionWrapper: () => cy.get('div[class*="option-wrapper"]'),
11
11
  questionWrapper: () => cy.get('.ngie-question-wrapper'),
12
+ questionAndResourceWrapper: () => cy.get('.item_Widget'),
12
13
  barsPreloader: () => cy.get('[id="question-item-instruction-loader"]'),
13
14
  previewQuestionTextWrapper: () => cy.get('.preview-question-text-wrapper'),
14
15
  //textEntryMathResponseWrapper: () => cy.get('.cloze-math-preview-wrapper .cloze-math-response-input-field'),
@@ -19,6 +20,7 @@ export const iePage = {
19
20
  essayResponseWordLimit: () => cy.get('.input-limit-label'),
20
21
  essayResponseWordCount: () => cy.get('[class*="indexstyle__WordCharCountWrapper"]'),
21
22
  essayResponseFooter: () => cy.get('.essay-character-view-wrapper'),
23
+ essayResponseLoader: () => cy.get('[class*="InlineLoaderstyles__LoaderDiv"] img'),
22
24
  drawingResponseToolbarButton: () => cy.get('[class*="DrawingToolButtonstyled__Container"] svg'),
23
25
  drawingResponseLowerCanvas: () => cy.get('.lower-canvas'),
24
26
  figCorrectAnswerBlock: () => cy.get('[class*="AnswerCell"]'),
@@ -244,6 +246,9 @@ export const verifyIeQuestionData = {
244
246
  cy.get('[class*="ngie-essay-response"]')
245
247
  .eq(index)
246
248
  .within(() => {
249
+ iePage.essayResponseLoader()
250
+ .scrollIntoView()
251
+ .should('not.be.visible');
247
252
  iePage.steps.verifyQuestionInstructions(expectedQuestionData);
248
253
  essayResponsePage.responseField()
249
254
  .then(($element) => {
@@ -289,6 +294,9 @@ export const verifyIeQuestionData = {
289
294
  cy.get('[class*="ngie-essay-response"]')
290
295
  .eq(index)
291
296
  .within(() => {
297
+ iePage.essayResponseLoader()
298
+ .scrollIntoView()
299
+ .should('not.be.visible');
292
300
  iePage.steps.verifyQuestionInstructions(expectedQuestionData);
293
301
  essayResponsePage.responseField()
294
302
  .then(($element) => {
@@ -593,6 +601,15 @@ export const verifyIeQuestionData = {
593
601
  });
594
602
  }
595
603
  });
604
+ },
605
+
606
+ contentBlocks: (expectedQuestionData, index) => {
607
+ cy.get('[class*="ContentBlocksPreviewstyles__ContentBlocksPreviewWrapper"]')
608
+ .eq(index)
609
+ .then(($element) => {
610
+ let passageText = $element[0].innerText
611
+ expect(passageText).to.be.eq(expectedQuestionData.passageText)
612
+ });
596
613
  }
597
614
 
598
615
  /* singleSelection: (expectedQuestionData, index) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.175-15thAprilRepoUpdate-cb0f7d0.0",
3
+ "version": "1.0.176",
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
+ }