itemengine-cypress-automation 1.0.157-error-message-fix-944b14e.0 → 1.0.157

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,7 +25,19 @@ export const iePage = {
25
25
  steps: {
26
26
  verifyQuestionInstructions: (expectedQuestionData) => {
27
27
  if (expectedQuestionData.previewQuestionInstructions) {
28
- utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.previewQuestionInstructions);
28
+ //utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.previewQuestionInstructions);
29
+ // singleSelectionPage.questionInstructionsText().should(($element) => {
30
+ // let questionInstructions = $element.get(0).innerText;
31
+ // questionInstructions = questionInstructions.replace(/00:00\n\/\n00:00\n/g, '');
32
+ // console.log('questionInstructions', questionInstructions);
33
+ // expect(questionInstructions).to.deep.eq(expectedQuestionData.previewQuestionInstructions);
34
+ // });
35
+ singleSelectionPage.questionInstructionsText()
36
+ .then(($questionInstructions) => {
37
+ let questionInstructions = $questionInstructions.get(0).innerText
38
+ questionInstructions = questionInstructions.replace(/00:00\n\/\n00:00\n/g, '');
39
+ expect(questionInstructions).to.be.eq(expectedQuestionData.previewQuestionInstructions)
40
+ });
29
41
  } else {
30
42
  utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), '');
31
43
  }
@@ -91,52 +103,80 @@ export const verifyIeQuestionData = {
91
103
  },
92
104
 
93
105
  textEntryMath: (expectedQuestionData, index) => {
106
+ const textEntryMathQuestionsArr = [];
94
107
  cy.get('.cloze-math-preview-wrapper')
95
- .eq(index)
96
- .within(() => {
97
- iePage.steps.verifyQuestionInstructions(expectedQuestionData);
98
- utilities.verifyInnerText(iePage.previewQuestionTextWrapper(), expectedQuestionData.previewQuestion);
99
- textEntryMathPage.answersInputField()
100
- .then(($resposneWrapper) => {
101
- expect($resposneWrapper.length).to.be.eq(expectedQuestionData.previewResponseCount);
108
+ .each(($question) => {
109
+ console.log('$question', $question)
110
+ if (!$question[0].innerHTML.includes('label-image-with-text-preview')) {
111
+ textEntryMathQuestionsArr.push($question);
112
+ }
113
+ })
114
+ .then(() => {
115
+ cy.wrap(textEntryMathQuestionsArr[index])
116
+ .within(() => {
117
+ iePage.steps.verifyQuestionInstructions(expectedQuestionData);
118
+ utilities.verifyInnerText(iePage.previewQuestionTextWrapper(), expectedQuestionData.previewQuestion);
119
+ textEntryMathPage.answersInputField()
120
+ .then(($resposneWrapper) => {
121
+ expect($resposneWrapper.length).to.be.eq(expectedQuestionData.previewResponseCount);
122
+ });
102
123
  });
103
124
  });
125
+ // cy.get('.cloze-math-preview-wrapper')
126
+ // .eq(index)
127
+ // .within(() => {
128
+ // iePage.steps.verifyQuestionInstructions(expectedQuestionData);
129
+ // utilities.verifyInnerText(iePage.previewQuestionTextWrapper(), expectedQuestionData.previewQuestion);
130
+ // textEntryMathPage.answersInputField()
131
+ // .then(($resposneWrapper) => {
132
+ // expect($resposneWrapper.length).to.be.eq(expectedQuestionData.previewResponseCount);
133
+ // });
134
+ // });
104
135
  },
105
136
 
106
137
  textEntryMathGrading: (expectedQuestionData, index) => {
138
+ const textEntryMathQuestionsArr = [];
107
139
  cy.get('.cloze-math-preview-wrapper')
108
- .eq(index)
109
- .parents('.ngie-question-wrapper')
110
- .within(() => {
111
- iePage.steps.verifyQuestionInstructions(expectedQuestionData);
112
- iePage.previewQuestionTextWrapper()
113
- .should('exist');
114
- //Not working due to numeration being displayed above responses in IE
115
- // utilities.verifyInnerText(iePage.previewQuestionTextWrapper(), expectedQuestionData.gradingQuestion);
116
- textEntryMathPage.answersInputField()
117
- .then(($resposneWrapper) => {
118
- expect($resposneWrapper.length).to.be.eq(expectedQuestionData.gradingResponseCount);
119
- });
120
- iePage.answerBlock()
121
- .then(($answerBlock) => {
122
- expect($answerBlock.length).to.be.eq(expectedQuestionData.gradingResponseCount);
123
- });
124
- iePage.answerBlock()
125
- .each(($element, 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
- }
134
- });
135
- iePage.answerBlock()
136
- .each(($element, index) => {
137
- utilities.verifyInnerText(cy.wrap($element), expectedQuestionData.correctAnswersText[index]);
140
+ .each(($question) => {
141
+ console.log('$question', $question)
142
+ if (!$question[0].innerHTML.includes('label-image-with-text-preview')) {
143
+ textEntryMathQuestionsArr.push($question);
144
+ }
145
+ })
146
+ .then(() => {
147
+ cy.wrap(textEntryMathQuestionsArr[index])
148
+ .parents('.ngie-question-wrapper')
149
+ .within(() => {
150
+ iePage.steps.verifyQuestionInstructions(expectedQuestionData);
151
+ iePage.previewQuestionTextWrapper()
152
+ .should('exist');
153
+ //Not working due to numeration being displayed above responses in IE
154
+ // utilities.verifyInnerText(iePage.previewQuestionTextWrapper(), expectedQuestionData.gradingQuestion);
155
+ textEntryMathPage.answersInputField()
156
+ .then(($resposneWrapper) => {
157
+ expect($resposneWrapper.length).to.be.eq(expectedQuestionData.gradingResponseCount);
158
+ });
159
+ iePage.answerBlock()
160
+ .then(($answerBlock) => {
161
+ expect($answerBlock.length).to.be.eq(expectedQuestionData.gradingResponseCount);
162
+ });
163
+ iePage.answerBlock()
164
+ .each(($element, index) => {
165
+ //checking if there is any answer text, excluding the numeration
166
+ if (expectedQuestionData.correctAnswersText[index].length > 2) {
167
+ iePage.textEntryMathCorrectAnswerMathMl()
168
+ .eq(index)
169
+ .then(($element) => {
170
+ expect($element.get(0).outerHTML).to.deep.eq(expectedQuestionData.correctAnswersMathMl[index]);
171
+ });
172
+ }
173
+ });
174
+ iePage.answerBlock()
175
+ .each(($element, index) => {
176
+ utilities.verifyInnerText(cy.wrap($element), expectedQuestionData.correctAnswersText[index]);
177
+ });
138
178
  });
139
- });
179
+ })
140
180
  },
141
181
 
142
182
  textEntryMathImage: (expectedQuestionData, index) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.157-error-message-fix-944b14e.0",
3
+ "version": "1.0.157",
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
+ }