itemengine-cypress-automation 1.0.152-28th-March-fixes-6236e0e.0 → 1.0.153-migrationScripts-9a4087e.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cypress/e2e/migration/migration.js +3 -155
- package/cypress/e2e/migration/migration10.js +3 -155
- package/cypress/e2e/migration/migration11.js +3 -155
- package/cypress/e2e/migration/migration2.js +3 -155
- package/cypress/e2e/migration/migration3.js +3 -155
- package/cypress/e2e/migration/migration4.js +3 -155
- package/cypress/e2e/migration/migration5.js +3 -155
- package/cypress/e2e/migration/migration6.js +3 -155
- package/cypress/e2e/migration/migration7.js +3 -155
- package/cypress/e2e/migration/migration8.js +3 -155
- package/cypress/e2e/migration/migration9.js +3 -155
- package/cypress/support/migrationHelpers/extractLrnQuestionData.js +36 -77
- package/cypress/support/migrationHelpers/migrationScript.js +160 -0
- package/cypress/support/migrationHelpers/verifyIeQuestionData.js +23 -13
- package/package.json +1 -1
@@ -31,6 +31,24 @@ export const lrnPage = {
|
|
31
31
|
lrnPage.showAnswersToggle()
|
32
32
|
.click()
|
33
33
|
.should('have.class', 'checked');
|
34
|
+
},
|
35
|
+
|
36
|
+
extractQuestionInstructions: (obj, index) => {
|
37
|
+
lrnPage.questionWrapper()
|
38
|
+
.eq(index)
|
39
|
+
.then(($question) => {
|
40
|
+
if ($question[0].innerHTML.includes('lrn_question')) {
|
41
|
+
lrnPage.questionWrapper()
|
42
|
+
.eq(index)
|
43
|
+
.within(() => {
|
44
|
+
lrnPage.questionInstructions()
|
45
|
+
.then(($ins) => {
|
46
|
+
let text = $ins[0].innerText;
|
47
|
+
obj.previewQuestionInstructions = text;
|
48
|
+
});
|
49
|
+
});
|
50
|
+
}
|
51
|
+
});
|
34
52
|
}
|
35
53
|
}
|
36
54
|
}
|
@@ -41,15 +59,10 @@ export const extractLrnQuestionData = {
|
|
41
59
|
cy.log(`Extracting the question instructions and options from question ${index}`);
|
42
60
|
obj.questionIndex = index;
|
43
61
|
obj.questionType = 'mcq'
|
62
|
+
lrnPage.steps.extractQuestionInstructions(obj, index);
|
44
63
|
lrnPage.questionWrapper()
|
45
64
|
.eq(index)
|
46
65
|
.within(() => {
|
47
|
-
lrnPage.questionInstructions()
|
48
|
-
.then(($ins) => {
|
49
|
-
let text = $ins[0].innerText;
|
50
|
-
obj.previewQuestionInstructions = text;
|
51
|
-
});
|
52
|
-
|
53
66
|
let optionsText = [];
|
54
67
|
lrnPage.mcqOptionWrapper()
|
55
68
|
.each(($options) => {
|
@@ -72,15 +85,10 @@ export const extractLrnQuestionData = {
|
|
72
85
|
cy.log(`Extracting the question instructions, options and correct answers from question ${index}`);
|
73
86
|
obj.questionIndex = index;
|
74
87
|
obj.questionType = 'mcq'
|
88
|
+
lrnPage.steps.extractQuestionInstructions(obj, index);
|
75
89
|
lrnPage.questionWrapper()
|
76
90
|
.eq(index)
|
77
91
|
.within(() => {
|
78
|
-
lrnPage.questionInstructions()
|
79
|
-
.then(($ins) => {
|
80
|
-
let text = $ins[0].innerText;
|
81
|
-
obj.gradingQuestionInstructions = text;
|
82
|
-
});
|
83
|
-
|
84
92
|
let optionsText = [];
|
85
93
|
let correctAnswersIndex = [];
|
86
94
|
lrnPage.mcqOptionWrapper()
|
@@ -107,15 +115,10 @@ export const extractLrnQuestionData = {
|
|
107
115
|
cy.log(`Extracting the question instructions, options and correct answers from question ${index}`);
|
108
116
|
obj.questionIndex = index;
|
109
117
|
obj.questionType = 'singleSelection'
|
118
|
+
lrnPage.steps.extractQuestionInstructions(obj, index);
|
110
119
|
lrnPage.questionWrapper()
|
111
120
|
.eq(index)
|
112
121
|
.within(() => {
|
113
|
-
lrnPage.questionInstructions()
|
114
|
-
.then(($ins) => {
|
115
|
-
let text = $ins[0].innerText;
|
116
|
-
obj.gradingQuestionInstructions = text;
|
117
|
-
});
|
118
|
-
|
119
122
|
let optionsText = [];
|
120
123
|
let correctAnswersIndex = [];
|
121
124
|
lrnPage.mcqOptionWrapper()
|
@@ -142,14 +145,10 @@ export const extractLrnQuestionData = {
|
|
142
145
|
cy.log(`Extracting the question instructions, question and response count from question ${index}`);
|
143
146
|
obj.questionIndex = index;
|
144
147
|
obj.questionType = 'textEntryMath';
|
148
|
+
lrnPage.steps.extractQuestionInstructions(obj, index);
|
145
149
|
lrnPage.questionWrapper()
|
146
150
|
.eq(index)
|
147
151
|
.within(() => {
|
148
|
-
lrnPage.questionInstructions()
|
149
|
-
.then(($ins) => {
|
150
|
-
let text = $ins[0].innerText;
|
151
|
-
obj.previewQuestionInstructions = text;
|
152
|
-
});
|
153
152
|
lrnPage.clozeMathResponseWrapper()
|
154
153
|
.then(($question) => {
|
155
154
|
let innerText = $question[0].innerText;
|
@@ -168,14 +167,10 @@ export const extractLrnQuestionData = {
|
|
168
167
|
cy.log(`Extracting the question instructions, question, response count and correct responses from question ${index}`);
|
169
168
|
obj.questionIndex = index;
|
170
169
|
obj.questionType = 'textEntryMath';
|
170
|
+
lrnPage.steps.extractQuestionInstructions(obj, index);
|
171
171
|
lrnPage.questionWrapper()
|
172
172
|
.eq(index)
|
173
173
|
.within(() => {
|
174
|
-
lrnPage.questionInstructions()
|
175
|
-
.then(($ins) => {
|
176
|
-
let text = $ins[0].innerText;
|
177
|
-
obj.gradingQuestionInstructions = text;
|
178
|
-
});
|
179
174
|
lrnPage.clozeMathResponseWrapper()
|
180
175
|
.then(($question) => {
|
181
176
|
let innerText = $question[0].innerText;
|
@@ -209,14 +204,10 @@ export const extractLrnQuestionData = {
|
|
209
204
|
cy.log(`Extracting the question instructions, question and response count from question ${index}`);
|
210
205
|
obj.questionIndex = index;
|
211
206
|
obj.questionType = 'textEntryMathImage';
|
207
|
+
lrnPage.steps.extractQuestionInstructions(obj, index);
|
212
208
|
lrnPage.questionWrapper()
|
213
209
|
.eq(index)
|
214
210
|
.within(() => {
|
215
|
-
lrnPage.questionInstructions()
|
216
|
-
.then(($ins) => {
|
217
|
-
let text = $ins[0].innerText;
|
218
|
-
obj.previewQuestionInstructions = text;
|
219
|
-
});
|
220
211
|
lrnPage.clozeResponse()
|
221
212
|
.then(($responseFields) => {
|
222
213
|
obj.previewResponseCount = $responseFields.length;
|
@@ -235,14 +226,10 @@ export const extractLrnQuestionData = {
|
|
235
226
|
cy.log(`Extracting the question instructions, question, response count and correct responses from question ${index}`);
|
236
227
|
obj.questionIndex = index;
|
237
228
|
obj.questionType = 'textEntryMathImage';
|
229
|
+
lrnPage.steps.extractQuestionInstructions(obj, index);
|
238
230
|
lrnPage.questionWrapper()
|
239
231
|
.eq(index)
|
240
232
|
.within(() => {
|
241
|
-
lrnPage.questionInstructions()
|
242
|
-
.then(($ins) => {
|
243
|
-
let text = $ins[0].innerText;
|
244
|
-
obj.gradingQuestionInstructions = text;
|
245
|
-
});
|
246
233
|
lrnPage.clozeMathResponseWrapper()
|
247
234
|
.then(($question) => {
|
248
235
|
let innerText = $question[0].innerText;
|
@@ -279,15 +266,11 @@ export const extractLrnQuestionData = {
|
|
279
266
|
let obj = {};
|
280
267
|
cy.log(`Extracting the question instructions, placeholder, toolbar options and word count/limit data from question ${index}`);
|
281
268
|
obj.questionIndex = index;
|
282
|
-
obj.questionType = 'essayResponse'
|
269
|
+
obj.questionType = 'essayResponse';
|
270
|
+
lrnPage.steps.extractQuestionInstructions(obj, index);
|
283
271
|
lrnPage.questionWrapper()
|
284
272
|
.eq(index)
|
285
273
|
.within(() => {
|
286
|
-
lrnPage.questionInstructions()
|
287
|
-
.then(($ins) => {
|
288
|
-
let text = $ins[0].innerText;
|
289
|
-
obj.previewQuestionInstructions = text;
|
290
|
-
});
|
291
274
|
lrnPage.essayResponseTextArea()
|
292
275
|
.then(($element) => {
|
293
276
|
let textAreaPlaceholder = $element[0].attributes["data-placeholder"]?.nodeValue;
|
@@ -316,14 +299,10 @@ export const extractLrnQuestionData = {
|
|
316
299
|
cy.log(`Extracting the question instructions, placeholder and word limit data from question ${index}`);
|
317
300
|
obj.questionIndex = index;
|
318
301
|
obj.questionType = 'essayResponseBasic';
|
302
|
+
lrnPage.steps.extractQuestionInstructions(obj, index);
|
319
303
|
lrnPage.questionWrapper()
|
320
304
|
.eq(index)
|
321
305
|
.within(() => {
|
322
|
-
lrnPage.questionInstructions()
|
323
|
-
.then(($ins) => {
|
324
|
-
let text = $ins[0].innerText;
|
325
|
-
obj.previewQuestionInstructions = text;
|
326
|
-
});
|
327
306
|
lrnPage.essayResponseTextArea()
|
328
307
|
.then(($element) => {
|
329
308
|
let textAreaPlaceholder = $element[0].attributes["data-placeholder"]?.nodeValue;
|
@@ -342,15 +321,11 @@ export const extractLrnQuestionData = {
|
|
342
321
|
let obj = {};
|
343
322
|
cy.log(`Extracting the question instructions, toolbar options and canvas background from question ${index}`);
|
344
323
|
obj.questionIndex = index;
|
345
|
-
obj.questionType = 'drawingResponse'
|
324
|
+
obj.questionType = 'drawingResponse';
|
325
|
+
lrnPage.steps.extractQuestionInstructions(obj, index);
|
346
326
|
lrnPage.questionWrapper()
|
347
327
|
.eq(index)
|
348
328
|
.within(() => {
|
349
|
-
lrnPage.questionInstructions()
|
350
|
-
.then(($ins) => {
|
351
|
-
let text = $ins[0].innerText;
|
352
|
-
obj.previewQuestionInstructions = text;
|
353
|
-
});
|
354
329
|
let toolbarButtons = [];
|
355
330
|
lrnPage.drawingToolbar()
|
356
331
|
.eq(0)
|
@@ -377,15 +352,11 @@ export const extractLrnQuestionData = {
|
|
377
352
|
let obj = {};
|
378
353
|
cy.log(`Extracting the question instructions, rows columns text and draggable options from question ${index}`);
|
379
354
|
obj.questionIndex = index;
|
380
|
-
obj.questionType = 'dndIntoCategories'
|
355
|
+
obj.questionType = 'dndIntoCategories';
|
356
|
+
lrnPage.steps.extractQuestionInstructions(obj, index);
|
381
357
|
lrnPage.questionWrapper()
|
382
358
|
.eq(index)
|
383
359
|
.within(() => {
|
384
|
-
lrnPage.questionInstructions()
|
385
|
-
.then(($ins) => {
|
386
|
-
let text = $ins[0].innerText;
|
387
|
-
obj.previewQuestionInstructions = text;
|
388
|
-
});
|
389
360
|
//TODO: for now treating all the cells as same and just storing the inner text, lateron type of the cell can also be stored
|
390
361
|
let tableMatrix = [];
|
391
362
|
lrnPage.dndCategoriesTableRow()
|
@@ -435,15 +406,11 @@ export const extractLrnQuestionData = {
|
|
435
406
|
let obj = {};
|
436
407
|
cy.log(`Extracting the question instructions, rows columns text and correct answer options from question ${index}`);
|
437
408
|
obj.questionIndex = index;
|
438
|
-
obj.questionType = 'dndIntoCategories'
|
409
|
+
obj.questionType = 'dndIntoCategories';
|
410
|
+
lrnPage.steps.extractQuestionInstructions(obj, index);
|
439
411
|
lrnPage.questionWrapper()
|
440
412
|
.eq(index)
|
441
413
|
.within(() => {
|
442
|
-
lrnPage.questionInstructions()
|
443
|
-
.then(($ins) => {
|
444
|
-
let text = $ins[0].innerText;
|
445
|
-
obj.previewQuestionInstructions = text;
|
446
|
-
});
|
447
414
|
let tableMatrix = [];
|
448
415
|
lrnPage.dndCategoriesTableRow()
|
449
416
|
.each(($tr) => {
|
@@ -507,14 +474,10 @@ export const extractLrnQuestionData = {
|
|
507
474
|
cy.log(`Extracting the question instructions, question and response count from question ${index}`);
|
508
475
|
obj.questionIndex = index;
|
509
476
|
obj.questionType = 'figText';
|
477
|
+
lrnPage.steps.extractQuestionInstructions(obj, index);
|
510
478
|
lrnPage.questionWrapper()
|
511
479
|
.eq(index)
|
512
480
|
.within(() => {
|
513
|
-
lrnPage.questionInstructions()
|
514
|
-
.then(($ins) => {
|
515
|
-
let text = $ins[0].innerText;
|
516
|
-
obj.previewQuestionInstructions = text;
|
517
|
-
});
|
518
481
|
lrnPage.questionContainerPreviewTab()
|
519
482
|
.then(($question) => {
|
520
483
|
let innerText = $question[0].innerText;
|
@@ -537,14 +500,10 @@ export const extractLrnQuestionData = {
|
|
537
500
|
cy.log(`Extracting the question instructions, question and response count from question ${index}`);
|
538
501
|
obj.questionIndex = index;
|
539
502
|
obj.questionType = 'figText';
|
503
|
+
lrnPage.steps.extractQuestionInstructions(obj, index);
|
540
504
|
lrnPage.questionWrapper()
|
541
505
|
.eq(index)
|
542
506
|
.within(() => {
|
543
|
-
lrnPage.questionInstructions()
|
544
|
-
.then(($ins) => {
|
545
|
-
let text = $ins[0].innerText;
|
546
|
-
obj.previewQuestionInstructions = text;
|
547
|
-
});
|
548
507
|
lrnPage.questionContainerPreviewTab()
|
549
508
|
.then(($question) => {
|
550
509
|
let innerText = $question[0].innerText;
|
@@ -0,0 +1,160 @@
|
|
1
|
+
import { autoScoredScoringPreviewTab } from "../../pages/components";
|
2
|
+
import utilities from "../../support/helpers/utilities";
|
3
|
+
import { extractLrnQuestionData, lrnPage } from "../../support/migrationHelpers/extractLrnQuestionData";
|
4
|
+
import lrnQuestionTypesENUM from "../../support/migrationHelpers/lrnQestionTypesENUM";
|
5
|
+
import { verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
|
6
|
+
import abortEarlySetup from "../../support/helpers/abortEarly";
|
7
|
+
|
8
|
+
const migrationQuestionTypes = ["essayResponse", "essayResponseBasic", "mcq", "textEntryMath"]//Cypress.env('migrationQuestionTypes');
|
9
|
+
const migrationQuestionTypesLrn = migrationQuestionTypes.map((questionType) => lrnQuestionTypesENUM[questionType]);
|
10
|
+
let lrnMcqTypesRegex = /Multiple choice – standard|Multiple choice – multiple response|True or false|Multiple choice – block layout/;
|
11
|
+
let lrnEssayResponseRegex = /Math essay with rich text|Essay with rich text/
|
12
|
+
|
13
|
+
|
14
|
+
let lrnQuestionDataArr = [];
|
15
|
+
let lrnGradingDataArr = [];
|
16
|
+
|
17
|
+
const extractLrnPreviewData = (currQuestionType, lrnQuestionDataArr, index) => {
|
18
|
+
switch (currQuestionType) {
|
19
|
+
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
|
20
|
+
case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMath(lrnQuestionDataArr, index);
|
21
|
+
case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImage(lrnQuestionDataArr, index);
|
22
|
+
case lrnQuestionTypesENUM.essayResponse: return extractLrnQuestionData.essayResponse(lrnQuestionDataArr, index);
|
23
|
+
case lrnQuestionTypesENUM.essayResponseBasic: return extractLrnQuestionData.essayResponseBasic(lrnQuestionDataArr, index);
|
24
|
+
case lrnQuestionTypesENUM.drawingResponse: return extractLrnQuestionData.drawingResponse(lrnQuestionDataArr, index);
|
25
|
+
case lrnQuestionTypesENUM.dndIntoCategories: return extractLrnQuestionData.dndIntoCategories(lrnQuestionDataArr, index);
|
26
|
+
case lrnQuestionTypesENUM.figText: return extractLrnQuestionData.figText(lrnQuestionDataArr, index);
|
27
|
+
default: throw new Error('Invalid lrn question type');
|
28
|
+
}
|
29
|
+
}
|
30
|
+
|
31
|
+
const verifyIePreviewData = (questionType, questionData, index) => {
|
32
|
+
switch (questionType) {
|
33
|
+
case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
|
34
|
+
case 'textEntryMath': return verifyIeQuestionData.textEntryMath(questionData, index);
|
35
|
+
case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImage(questionData, index);
|
36
|
+
case 'essayResponse': return verifyIeQuestionData.essayResponse(questionData, index);
|
37
|
+
case 'essayResponseBasic': return verifyIeQuestionData.essayResponseBasic(questionData, index);
|
38
|
+
case 'drawingResponse': return verifyIeQuestionData.drawingResponse(questionData, index);
|
39
|
+
case 'dndIntoCategories': return verifyIeQuestionData.dndIntoCategories(questionData, index);
|
40
|
+
case 'figText': return verifyIeQuestionData.figText(questionData, index);
|
41
|
+
default: throw new Error('Invalid ngie question type');
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
const extractLrnGradingData = (currQuestionType, lrnGradingDataArr, index) => {
|
46
|
+
if (currQuestionType === lrnQuestionTypesENUM.mcq) extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
|
47
|
+
else if (currQuestionType === lrnQuestionTypesENUM.textEntryMath) extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
|
48
|
+
else if (currQuestionType === lrnQuestionTypesENUM.textEntryMathImage) extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
|
49
|
+
else if (currQuestionType === lrnQuestionTypesENUM.dndIntoCategories) extractLrnQuestionData.dndIntoCategoriesGrading(lrnGradingDataArr, index);
|
50
|
+
else if (currQuestionType === lrnQuestionTypesENUM.figText) extractLrnQuestionData.figTextGrading(lrnGradingDataArr, index);
|
51
|
+
}
|
52
|
+
|
53
|
+
const verifyIeGradingData = (questionType, questionData, index) => {
|
54
|
+
switch (questionType) {
|
55
|
+
case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
|
56
|
+
case 'textEntryMath': return verifyIeQuestionData.textEntryMathGrading(questionData, index);
|
57
|
+
case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImageGrading(questionData, index);
|
58
|
+
case 'dndIntoCategories': return verifyIeQuestionData.dndIntoCategoriesGrading(questionData, index);
|
59
|
+
case 'figText': return verifyIeQuestionData.figTextGrading(questionData, index);
|
60
|
+
default: throw new Error('Invalid ngie question type');
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
export const migrationScript = (referenceIds) => {
|
65
|
+
if (referenceIds.length > 0) {
|
66
|
+
describe('Migration item check for MCQ questions', () => {
|
67
|
+
before(() => {
|
68
|
+
cy.loginAs('technicalTester');
|
69
|
+
});
|
70
|
+
|
71
|
+
referenceIds.forEach((referenceId) => {
|
72
|
+
describe(`Migration item check for item "${referenceId}"`, () => {
|
73
|
+
abortEarlySetup();
|
74
|
+
before(() => {
|
75
|
+
cy.interceptGraphql('getItemPreview');
|
76
|
+
cy.setGraphqlWait();
|
77
|
+
cy.visit(`/items-list/item/${utilities.base64Encoding(referenceId)}`);
|
78
|
+
cy.pageLoadWait('getItemPreview');
|
79
|
+
cy.get('@getItemPreview').then((req) => {
|
80
|
+
let questionCount = req.response.body.data.getItemPreview.item.questionParts.length;
|
81
|
+
cy.lazyLoadPreviewQuestions(questionCount);
|
82
|
+
});
|
83
|
+
});
|
84
|
+
|
85
|
+
after(() => {
|
86
|
+
console.log(lrnQuestionDataArr)
|
87
|
+
console.log(lrnGradingDataArr)
|
88
|
+
lrnQuestionDataArr = [];
|
89
|
+
lrnGradingDataArr = [];
|
90
|
+
});
|
91
|
+
|
92
|
+
it(`Extracting learnosity preview data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
93
|
+
lrnPage.questionTypeDiv()
|
94
|
+
.each(($el, index) => {
|
95
|
+
let currQuestionType = $el[0].innerText
|
96
|
+
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
97
|
+
currQuestionType = lrnQuestionTypesENUM.mcq;
|
98
|
+
}
|
99
|
+
if (lrnEssayResponseRegex.test(currQuestionType)) {
|
100
|
+
;
|
101
|
+
currQuestionType = lrnQuestionTypesENUM.essayResponse;
|
102
|
+
}
|
103
|
+
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
104
|
+
extractLrnPreviewData(currQuestionType, lrnQuestionDataArr, index)
|
105
|
+
}
|
106
|
+
});
|
107
|
+
});
|
108
|
+
|
109
|
+
it(`Verifying itemengine preview data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
110
|
+
migrationQuestionTypes.forEach((questionType) => {
|
111
|
+
cy.log(`Verifying data for all ${questionType} question type`);
|
112
|
+
let currQuestionTypeArr = lrnQuestionDataArr.filter((question) => question.questionType === questionType);
|
113
|
+
currQuestionTypeArr.forEach((questionData, index) => {
|
114
|
+
cy.log(`Verifying data for ${questionType} ${index}`);
|
115
|
+
verifyIePreviewData(questionType, questionData, index);
|
116
|
+
});
|
117
|
+
});
|
118
|
+
});
|
119
|
+
|
120
|
+
it(`Extracting learnosity grading data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
121
|
+
lrnPage.authorItemToolbarControlsWrapper()
|
122
|
+
.then(($element) => {
|
123
|
+
if ($element[0].innerHTML.includes('lrn-author-validate-questions-toggle')) {
|
124
|
+
lrnPage.steps.checkShowAnswersToggle();
|
125
|
+
lrnPage.questionTypeDiv()
|
126
|
+
.each(($el, index) => {
|
127
|
+
let currQuestionType = $el[0].innerText
|
128
|
+
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
129
|
+
currQuestionType = lrnQuestionTypesENUM.mcq
|
130
|
+
}
|
131
|
+
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
132
|
+
extractLrnGradingData(currQuestionType, lrnGradingDataArr, index);
|
133
|
+
}
|
134
|
+
});
|
135
|
+
}
|
136
|
+
});
|
137
|
+
});
|
138
|
+
|
139
|
+
it(`Verifying itemengine grading data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
140
|
+
if (lrnGradingDataArr.length > 0) {
|
141
|
+
autoScoredScoringPreviewTab.steps.switchToGradingView();
|
142
|
+
cy.wait(500);
|
143
|
+
migrationQuestionTypes.forEach((questionType) => {
|
144
|
+
cy.log(`Verifying grading data for all ${questionType} question type`);
|
145
|
+
let currQuestionTypeArr = lrnGradingDataArr.filter((question) => question.questionType === questionType);
|
146
|
+
currQuestionTypeArr.forEach((questionData, index) => {
|
147
|
+
cy.log(`Verifying grading data for ${questionType} ${index}`);
|
148
|
+
verifyIeGradingData(questionType, questionData, index);
|
149
|
+
});
|
150
|
+
});
|
151
|
+
}
|
152
|
+
});
|
153
|
+
});
|
154
|
+
});
|
155
|
+
});
|
156
|
+
}
|
157
|
+
}
|
158
|
+
|
159
|
+
|
160
|
+
//https://s3.console.aws.amazon.com/s3/object/itemengine-qa-bucket?region=us-west-2&bucketType=general&prefix=cypressAutomation/migrationFixtures.json
|
@@ -20,6 +20,16 @@ export const iePage = {
|
|
20
20
|
essayResponseFooter: () => cy.get('.essay-character-view-wrapper'),
|
21
21
|
drawingResponseToolbarButton: () => cy.get('[class*="DrawingToolButtonstyled__Container"] svg'),
|
22
22
|
drawingResponseLowerCanvas: () => cy.get('.lower-canvas'),
|
23
|
+
|
24
|
+
steps: {
|
25
|
+
verifyQuestionInstructions: (expectedQuestionData) => {
|
26
|
+
if (expectedQuestionData.previewQuestionInstructions) {
|
27
|
+
utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.previewQuestionInstructions);
|
28
|
+
} else {
|
29
|
+
utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), '');
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
23
33
|
};
|
24
34
|
|
25
35
|
export const verifyIeQuestionData = {
|
@@ -33,7 +43,7 @@ export const verifyIeQuestionData = {
|
|
33
43
|
cy.wrap($mcqQuestionWrappers)
|
34
44
|
.eq(index)
|
35
45
|
.within(() => {
|
36
|
-
|
46
|
+
iePage.steps.verifyQuestionInstructions(expectedQuestionData);
|
37
47
|
iePage.mcqOption()
|
38
48
|
.then(($elements) => {
|
39
49
|
expect($elements.length).to.be.eq(expectedQuestionData.previewOptionsText.length);
|
@@ -56,7 +66,7 @@ export const verifyIeQuestionData = {
|
|
56
66
|
cy.wrap($mcqQuestionWrappers)
|
57
67
|
.eq(index)
|
58
68
|
.within(() => {
|
59
|
-
|
69
|
+
iePage.steps.verifyQuestionInstructions(expectedQuestionData);
|
60
70
|
iePage.mcqOptionWrapper()
|
61
71
|
.then(($elements) => {
|
62
72
|
expect($elements.length).to.be.eq(expectedQuestionData.gradingOptionsText.length);
|
@@ -83,7 +93,7 @@ export const verifyIeQuestionData = {
|
|
83
93
|
cy.get('.cloze-math-preview-wrapper')
|
84
94
|
.eq(index)
|
85
95
|
.within(() => {
|
86
|
-
|
96
|
+
iePage.steps.verifyQuestionInstructions(expectedQuestionData);
|
87
97
|
utilities.verifyInnerText(iePage.previewQuestionTextWrapper(), expectedQuestionData.previewQuestion);
|
88
98
|
textEntryMathPage.answersInputField()
|
89
99
|
.then(($resposneWrapper) => {
|
@@ -97,7 +107,7 @@ export const verifyIeQuestionData = {
|
|
97
107
|
.eq(index)
|
98
108
|
.parents('.ngie-question-wrapper')
|
99
109
|
.within(() => {
|
100
|
-
|
110
|
+
iePage.steps.verifyQuestionInstructions(expectedQuestionData);
|
101
111
|
iePage.previewQuestionTextWrapper()
|
102
112
|
.should('exist');
|
103
113
|
//Not working due to numeration being displayed above responses in IE
|
@@ -124,7 +134,7 @@ export const verifyIeQuestionData = {
|
|
124
134
|
.eq(index)
|
125
135
|
.parents('.ngie-question-wrapper')
|
126
136
|
.within(() => {
|
127
|
-
|
137
|
+
iePage.steps.verifyQuestionInstructions(expectedQuestionData);
|
128
138
|
// Not working due to numeration being displayed above responses in IE
|
129
139
|
// utilities.verifyInnerText(iePage.previewQuestionTextWrapper(), expectedQuestionData.previewQuestion);
|
130
140
|
textEntryMathPage.answersInputField()
|
@@ -143,7 +153,7 @@ export const verifyIeQuestionData = {
|
|
143
153
|
.eq(index)
|
144
154
|
.parents('.ngie-question-wrapper')
|
145
155
|
.within(() => {
|
146
|
-
|
156
|
+
iePage.steps.verifyQuestionInstructions(expectedQuestionData);
|
147
157
|
textEntryMathPage.answersInputField()
|
148
158
|
.then(($resposneWrapper) => {
|
149
159
|
expect($resposneWrapper.length).to.be.eq(expectedQuestionData.gradingResponseCount);
|
@@ -167,7 +177,7 @@ export const verifyIeQuestionData = {
|
|
167
177
|
cy.get('[class*="ngie-essay-response"]')
|
168
178
|
.eq(index)
|
169
179
|
.within(() => {
|
170
|
-
|
180
|
+
iePage.steps.verifyQuestionInstructions(expectedQuestionData);
|
171
181
|
essayResponsePage.responseField()
|
172
182
|
.then(($element) => {
|
173
183
|
let textAreaPlaceholder = $element[0].attributes["data-cke-editorplaceholder"]?.nodeValue;
|
@@ -212,7 +222,7 @@ export const verifyIeQuestionData = {
|
|
212
222
|
cy.get('[class*="ngie-essay-response"]')
|
213
223
|
.eq(index)
|
214
224
|
.within(() => {
|
215
|
-
|
225
|
+
iePage.steps.verifyQuestionInstructions(expectedQuestionData);
|
216
226
|
essayResponsePage.responseField()
|
217
227
|
.then(($element) => {
|
218
228
|
let textAreaPlaceholder = $element[0].attributes["data-cke-editorplaceholder"]?.nodeValue;
|
@@ -236,7 +246,7 @@ export const verifyIeQuestionData = {
|
|
236
246
|
cy.get('[class*="DrawingResponsePreviewstyles__Question"]')
|
237
247
|
.eq(index)
|
238
248
|
.within(() => {
|
239
|
-
|
249
|
+
iePage.steps.verifyQuestionInstructions(expectedQuestionData);
|
240
250
|
let ieButtonsActual = [];
|
241
251
|
let ieButtonsExpected = expectedQuestionData.toolbarButtons.map((button) => {
|
242
252
|
return drawingToolbarOptionsENUM[button];
|
@@ -265,7 +275,7 @@ export const verifyIeQuestionData = {
|
|
265
275
|
cy.get('.ngie-drag-and-drop-into-categories')
|
266
276
|
.eq(index)
|
267
277
|
.within(() => {
|
268
|
-
|
278
|
+
iePage.steps.verifyQuestionInstructions(expectedQuestionData);
|
269
279
|
cy.get('.row')
|
270
280
|
.then(($rows) => {
|
271
281
|
expect($rows.length).to.be.eq(expectedQuestionData.tableMatrix.length);
|
@@ -312,7 +322,7 @@ export const verifyIeQuestionData = {
|
|
312
322
|
cy.get('.ngie-drag-and-drop-into-categories')
|
313
323
|
.eq(index)
|
314
324
|
.within(() => {
|
315
|
-
|
325
|
+
iePage.steps.verifyQuestionInstructions(expectedQuestionData);
|
316
326
|
cy.get('.row')
|
317
327
|
.then(($rows) => {
|
318
328
|
expect($rows.length).to.be.eq(expectedQuestionData.tableMatrix.length);
|
@@ -376,7 +386,7 @@ export const verifyIeQuestionData = {
|
|
376
386
|
cy.get('.ngie-cloze-with-text')
|
377
387
|
.eq(index)
|
378
388
|
.within(() => {
|
379
|
-
|
389
|
+
iePage.steps.verifyQuestionInstructions(expectedQuestionData);
|
380
390
|
fillInTheGapsTextPage.questionContainerPreviewTab()
|
381
391
|
.then(($question) => {
|
382
392
|
let innerText = $question[0].innerText;
|
@@ -397,7 +407,7 @@ export const verifyIeQuestionData = {
|
|
397
407
|
cy.get('.ngie-cloze-with-text')
|
398
408
|
.eq(index)
|
399
409
|
.within(() => {
|
400
|
-
|
410
|
+
iePage.steps.verifyQuestionInstructions(expectedQuestionData);
|
401
411
|
fillInTheGapsTextPage.questionContainerPreviewTab()
|
402
412
|
.then(($question) => {
|
403
413
|
let innerText = $question[0].innerText;
|