itemengine-cypress-automation 1.0.178-figDndMigration-78c8415.0 → 1.0.179-figDndMigration-118c15c.0
Sign up to get free protection for your applications and to get access to all the features.
- package/cypress/support/commands.js +2 -2
- package/cypress/support/migrationHelpers/extractLrnQuestionData.js +15 -0
- package/cypress/support/migrationHelpers/lrnQestionTypesENUM.js +1 -0
- package/cypress/support/migrationHelpers/migrationScript.js +5 -1
- package/cypress/support/migrationHelpers/verifyIeQuestionData.js +18 -1
- package/package.json +1 -1
@@ -155,13 +155,13 @@ Cypress.Commands.add('learnosityLoaderWait', () => {
|
|
155
155
|
});
|
156
156
|
|
157
157
|
Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
|
158
|
-
iePage.
|
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.
|
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
|
figDragAndDrop: (lrnQuestionDataArr, index) => {
|
634
649
|
let obj = {};
|
635
650
|
cy.log(`Extracting the question instructions, question, response areas count, draggable option container position, drag handle visibility, draggable options from question ${index}`);
|
@@ -27,6 +27,7 @@ const extractLrnPreviewData = (currQuestionType, lrnQuestionDataArr, index) => {
|
|
27
27
|
case lrnQuestionTypesENUM.shortTextResponse: return extractLrnQuestionData.shortTextResponse(lrnQuestionDataArr, index);
|
28
28
|
case lrnQuestionTypesENUM.uploadResponse: return extractLrnQuestionData.uploadResponse(lrnQuestionDataArr, index);
|
29
29
|
case lrnQuestionTypesENUM.figDragAndDrop: return extractLrnQuestionData.figDragAndDrop(lrnQuestionDataArr, index);
|
30
|
+
case lrnQuestionTypesENUM.contentBlocks: return extractLrnQuestionData.contentBlocks(lrnQuestionDataArr, index);
|
30
31
|
default: throw new Error('Invalid lrn question type');
|
31
32
|
}
|
32
33
|
}
|
@@ -44,6 +45,7 @@ const verifyIePreviewData = (questionType, questionData, index) => {
|
|
44
45
|
case 'shortTextResponse': return verifyIeQuestionData.shortTextResponse(questionData, index);
|
45
46
|
case 'uploadResponse': return verifyIeQuestionData.uploadResponse(questionData, index);
|
46
47
|
case 'figDragAndDrop': return verifyIeQuestionData.figDragAndDrop(questionData, index);
|
48
|
+
case 'contentBlocks': return verifyIeQuestionData.contentBlocks(questionData, index);
|
47
49
|
default: throw new Error('Invalid ngie question type');
|
48
50
|
}
|
49
51
|
}
|
@@ -58,6 +60,7 @@ const extractLrnGradingData = (currQuestionType, lrnGradingDataArr, index) => {
|
|
58
60
|
case lrnQuestionTypesENUM.shortTextResponse: return extractLrnQuestionData.shortTextResponseGrading(lrnGradingDataArr, index);
|
59
61
|
case lrnQuestionTypesENUM.uploadResponse: return cy.log('Manually Graded Question Type');
|
60
62
|
case lrnQuestionTypesENUM.figDragAndDrop: return extractLrnQuestionData.figDragAndDropGrading(lrnGradingDataArr, index);
|
63
|
+
case lrnQuestionTypesENUM.contentBlocks: return cy.log('Resource and tool');
|
61
64
|
default: throw new Error('Invalid lrn question type');
|
62
65
|
}
|
63
66
|
}
|
@@ -72,6 +75,7 @@ const verifyIeGradingData = (questionType, questionData, index) => {
|
|
72
75
|
case 'shortTextResponse': return verifyIeQuestionData.shortTextResponseGrading(questionData, index);
|
73
76
|
case 'uploadResponse': return cy.log('Manually Graded Question Type');
|
74
77
|
case 'figDragAndDrop': return verifyIeQuestionData.figDragAndDropGrading(questionData, index);
|
78
|
+
case 'contentBlocks': return cy.log('Resource and tool');
|
75
79
|
default: throw new Error('Invalid ngie question type');
|
76
80
|
}
|
77
81
|
}
|
@@ -92,7 +96,7 @@ export const migrationScript = (referenceIds) => {
|
|
92
96
|
cy.visit(`/items-list/item/${utilities.base64Encoding(referenceId)}`);
|
93
97
|
cy.pageLoadWait('getItemPreview');
|
94
98
|
cy.get('@getItemPreview').then((req) => {
|
95
|
-
let questionCount = req.response.body.data.getItemPreview.item.questionParts.length;
|
99
|
+
let questionCount = req.response.body.data.getItemPreview.item.questionParts.length + req.response.body.data.getItemPreview.item.resources.length;
|
96
100
|
cy.lazyLoadPreviewQuestions(questionCount);
|
97
101
|
});
|
98
102
|
});
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { essayResponsePage, fillInTheGapsDragAndDropPage, fillInTheGapsTextPage, multipleSelectionPage, textEntryMathPage, uploadResponsePage } from "../../pages";
|
1
|
+
import { essayResponsePage, fillInTheGapsDragAndDropPage, contentBlocksPage, fillInTheGapsTextPage, multipleSelectionPage, textEntryMathPage, uploadResponsePage } from "../../pages";
|
2
2
|
import { draggableOptionContainer, fillInTheGapsDragAndDropCommonComponents } 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) => {
|
@@ -595,6 +603,15 @@ export const verifyIeQuestionData = {
|
|
595
603
|
});
|
596
604
|
},
|
597
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
|
+
});
|
613
|
+
},
|
614
|
+
|
598
615
|
figDragAndDrop: (expectedQuestionData, index) => {
|
599
616
|
cy.get('.ngie-cloze-with-drag-and-drop')
|
600
617
|
.eq(index)
|