itemengine-cypress-automation 1.0.154-migrationScripts-36ae74d.0 → 1.0.154

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,7 @@ export const lrnPage = {
10
10
  clozeMathResponseWrapper: () => cy.get('.lrn_cloze_response_container'),
11
11
  clozeResponse: () => cy.get('.lrn_cloze_response'),
12
12
  clozeMathCorrectAnswerMathMl: () => cy.get('.lrn_correctAnswerList math'),
13
- correctAnswersResponseText: () => cy.get('.lrn_responseText'),
13
+ correctAnswersResponseText: () => cy.get('.lrn_correctAnswerList li'),
14
14
  backgroundCanvasImage: () => cy.get('.lrn_imagecloze_image'),
15
15
  essayResponseTextArea: () => cy.get('.lrn_texteditor_editable'),
16
16
  essayResponseToolbarButton: () => cy.get('[aria-label="Text controls"] button.lrn_btn'),
@@ -194,7 +194,6 @@ export const extractLrnQuestionData = {
194
194
  });
195
195
  obj.correctAnswersMathMl = correctAnswersMathMl;
196
196
  obj.correctAnswersText = correctAnswersText;
197
- //response numeration in show answers
198
197
  });
199
198
  lrnGradingDataArr.push(obj);
200
199
  },
@@ -5,7 +5,7 @@ import lrnQuestionTypesENUM from "../../support/migrationHelpers/lrnQestionTypes
5
5
  import { verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
6
6
  import abortEarlySetup from "../../support/helpers/abortEarly";
7
7
 
8
- const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');//["essayResponse", "essayResponseBasic", "mcq", "textEntryMath"]
8
+ const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');//["textEntryMath"]
9
9
  const migrationQuestionTypesLrn = migrationQuestionTypes.map((questionType) => lrnQuestionTypesENUM[questionType]);
10
10
  let lrnMcqTypesRegex = /Multiple choice – standard|Multiple choice – multiple response|True or false|Multiple choice – block layout/;
11
11
  let lrnEssayResponseRegex = /Math essay with rich text|Essay with rich text/
@@ -12,6 +12,7 @@ export const iePage = {
12
12
  barsPreloader: () => cy.get('[id="question-item-instruction-loader"]'),
13
13
  previewQuestionTextWrapper: () => cy.get('.preview-question-text-wrapper'),
14
14
  //textEntryMathResponseWrapper: () => cy.get('.cloze-math-preview-wrapper .cloze-math-response-input-field'),
15
+ answerBlock: () => cy.get('.answer-block'),
15
16
  textEntryMathCorrectAnswerMathMl: () => cy.get('.answer-block math'),
16
17
  textEntryMathCorrectAnswersResponseText: () => cy.get('.answer-block .math-jax-wrapper'),
17
18
  backgroundCanvasImage: () => cy.get('.background-image'),
@@ -116,11 +117,22 @@ export const verifyIeQuestionData = {
116
117
  .then(($resposneWrapper) => {
117
118
  expect($resposneWrapper.length).to.be.eq(expectedQuestionData.gradingResponseCount);
118
119
  });
119
- iePage.textEntryMathCorrectAnswerMathMl()
120
+ iePage.answerBlock()
121
+ .then(($answerBlock) => {
122
+ expect($answerBlock.length).to.be.eq(expectedQuestionData.gradingResponseCount);
123
+ });
124
+ iePage.answerBlock()
120
125
  .each(($element, index) => {
121
- expect($element.get(0).outerHTML).to.deep.eq(expectedQuestionData.correctAnswersMathMl[index]);
126
+ //checking if there is any answer text, excluding the numeration
127
+ if (expectedQuestionData.correctAnswersText[index].length > 2) {
128
+ iePage.textEntryMathCorrectAnswerMathMl()
129
+ .eq(index)
130
+ .then(($element) => {
131
+ expect($element.get(0).outerHTML).to.deep.eq(expectedQuestionData.correctAnswersMathMl[index]);
132
+ });
133
+ }
122
134
  });
123
- iePage.textEntryMathCorrectAnswersResponseText()
135
+ iePage.answerBlock()
124
136
  .each(($element, index) => {
125
137
  utilities.verifyInnerText(cy.wrap($element), expectedQuestionData.correctAnswersText[index]);
126
138
  });
@@ -158,18 +170,29 @@ export const verifyIeQuestionData = {
158
170
  .then(($resposneWrapper) => {
159
171
  expect($resposneWrapper.length).to.be.eq(expectedQuestionData.gradingResponseCount);
160
172
  });
161
- iePage.textEntryMathCorrectAnswerMathMl()
173
+ iePage.backgroundCanvasImage()
174
+ .then(($element) => {
175
+ expect($element[0].alt).to.be.eq(expectedQuestionData.bgImageAltText);
176
+ });
177
+ iePage.answerBlock()
178
+ .then(($answerBlock) => {
179
+ expect($answerBlock.length).to.be.eq(expectedQuestionData.gradingResponseCount);
180
+ });
181
+ iePage.answerBlock()
162
182
  .each(($element, index) => {
163
- expect($element.get(0).outerHTML).to.deep.eq(expectedQuestionData.correctAnswersMathMl[index]);
183
+ //checking if there is any answer text, excluding the numeration
184
+ if (expectedQuestionData.correctAnswersText[index].length > 2) {
185
+ iePage.textEntryMathCorrectAnswerMathMl()
186
+ .eq(index)
187
+ .then(($element) => {
188
+ expect($element.get(0).outerHTML).to.deep.eq(expectedQuestionData.correctAnswersMathMl[index]);
189
+ });
190
+ }
164
191
  });
165
- iePage.textEntryMathCorrectAnswersResponseText()
192
+ iePage.answerBlock()
166
193
  .each(($element, index) => {
167
194
  utilities.verifyInnerText(cy.wrap($element), expectedQuestionData.correctAnswersText[index]);
168
195
  });
169
- iePage.backgroundCanvasImage()
170
- .then(($element) => {
171
- expect($element[0].alt).to.be.eq(expectedQuestionData.bgImageAltText);
172
- });
173
196
  });
174
197
  },
175
198
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.154-migrationScripts-36ae74d.0",
3
+ "version": "1.0.154",
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
+ }