itemengine-cypress-automation 1.0.152-28th-March-fixes-6236e0e.0 → 1.0.152
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 +2 -2
@@ -1,157 +1,5 @@
|
|
1
|
-
import {
|
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";
|
1
|
+
import { migrationScript } from "../../support/migrationHelpers/migrationScript"
|
7
2
|
|
8
|
-
|
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/
|
3
|
+
let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(0, 91);//["5.NBT.A.4: Math: Number & Operations in Base Ten: G05_U06_GCT02_item02"]
|
12
4
|
|
13
|
-
|
14
|
-
let lrnQuestionDataArr = [];
|
15
|
-
let lrnGradingDataArr = [];
|
16
|
-
|
17
|
-
let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(0, 91);//["#36586 7.SP.C.7 Statistics Probability Statistics Probability Math 07", "b4e6a98c-4ec2-4045-acaf-44f024d0be89"]
|
18
|
-
|
19
|
-
const extractLrnPreviewData = (currQuestionType, lrnQuestionDataArr, index) => {
|
20
|
-
switch (currQuestionType) {
|
21
|
-
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
|
22
|
-
case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMath(lrnQuestionDataArr, index);
|
23
|
-
case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImage(lrnQuestionDataArr, index);
|
24
|
-
case lrnQuestionTypesENUM.essayResponse: return extractLrnQuestionData.essayResponse(lrnQuestionDataArr, index);
|
25
|
-
case lrnQuestionTypesENUM.essayResponseBasic: return extractLrnQuestionData.essayResponseBasic(lrnQuestionDataArr, index);
|
26
|
-
case lrnQuestionTypesENUM.drawingResponse: return extractLrnQuestionData.drawingResponse(lrnQuestionDataArr, index);
|
27
|
-
case lrnQuestionTypesENUM.dndIntoCategories: return extractLrnQuestionData.dndIntoCategories(lrnQuestionDataArr, index);
|
28
|
-
case lrnQuestionTypesENUM.figText: return extractLrnQuestionData.figText(lrnQuestionDataArr, index);
|
29
|
-
default: throw new Error('Invalid lrn question type');
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
const verifyIePreviewData = (questionType, questionData, index) => {
|
34
|
-
switch (questionType) {
|
35
|
-
case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
|
36
|
-
case 'textEntryMath': return verifyIeQuestionData.textEntryMath(questionData, index);
|
37
|
-
case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImage(questionData, index);
|
38
|
-
case 'essayResponse': return verifyIeQuestionData.essayResponse(questionData, index);
|
39
|
-
case 'essayResponseBasic': return verifyIeQuestionData.essayResponseBasic(questionData, index);
|
40
|
-
case 'drawingResponse': return verifyIeQuestionData.drawingResponse(questionData, index);
|
41
|
-
case 'dndIntoCategories': return verifyIeQuestionData.dndIntoCategories(questionData, index);
|
42
|
-
case 'figText': return verifyIeQuestionData.figText(questionData, index);
|
43
|
-
default: throw new Error('Invalid ngie question type');
|
44
|
-
}
|
45
|
-
}
|
46
|
-
|
47
|
-
const extractLrnGradingData = (currQuestionType, lrnGradingDataArr, index) => {
|
48
|
-
if (currQuestionType === lrnQuestionTypesENUM.mcq) extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
|
49
|
-
else if (currQuestionType === lrnQuestionTypesENUM.textEntryMath) extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
|
50
|
-
else if (currQuestionType === lrnQuestionTypesENUM.textEntryMathImage) extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
|
51
|
-
else if (currQuestionType === lrnQuestionTypesENUM.dndIntoCategories) extractLrnQuestionData.dndIntoCategoriesGrading(lrnGradingDataArr, index);
|
52
|
-
else if (currQuestionType === lrnQuestionTypesENUM.figText) extractLrnQuestionData.figTextGrading(lrnGradingDataArr, index);
|
53
|
-
}
|
54
|
-
|
55
|
-
const verifyIeGradingData = (questionType, questionData, index) => {
|
56
|
-
switch (questionType) {
|
57
|
-
case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
|
58
|
-
case 'textEntryMath': return verifyIeQuestionData.textEntryMathGrading(questionData, index);
|
59
|
-
case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImageGrading(questionData, index);
|
60
|
-
case 'dndIntoCategories': return verifyIeQuestionData.dndIntoCategoriesGrading(questionData, index);
|
61
|
-
case 'figText': return verifyIeQuestionData.figTextGrading(questionData, index);
|
62
|
-
default: throw new Error('Invalid ngie question type');
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
if (referenceIds.length > 0) {
|
67
|
-
describe('Migration item check for MCQ questions', () => {
|
68
|
-
before(() => {
|
69
|
-
cy.loginAs('technicalTester');
|
70
|
-
});
|
71
|
-
|
72
|
-
referenceIds.forEach((referenceId) => {
|
73
|
-
describe(`Migration item check for item "${referenceId}"`, () => {
|
74
|
-
abortEarlySetup();
|
75
|
-
before(() => {
|
76
|
-
cy.interceptGraphql('getItemPreview');
|
77
|
-
cy.setGraphqlWait();
|
78
|
-
cy.visit(`/items-list/item/${utilities.base64Encoding(referenceId)}`);
|
79
|
-
cy.pageLoadWait('getItemPreview');
|
80
|
-
cy.get('@getItemPreview').then((req) => {
|
81
|
-
let questionCount = req.response.body.data.getItemPreview.item.questionParts.length;
|
82
|
-
cy.lazyLoadPreviewQuestions(questionCount);
|
83
|
-
});
|
84
|
-
});
|
85
|
-
|
86
|
-
after(() => {
|
87
|
-
console.log(lrnQuestionDataArr)
|
88
|
-
console.log(lrnGradingDataArr)
|
89
|
-
lrnQuestionDataArr = [];
|
90
|
-
lrnGradingDataArr = [];
|
91
|
-
});
|
92
|
-
|
93
|
-
it(`Extracting learnosity preview data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
94
|
-
lrnPage.questionTypeDiv()
|
95
|
-
.each(($el, index) => {
|
96
|
-
let currQuestionType = $el[0].innerText
|
97
|
-
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
98
|
-
currQuestionType = lrnQuestionTypesENUM.mcq;
|
99
|
-
}
|
100
|
-
if (lrnEssayResponseRegex.test(currQuestionType)) {
|
101
|
-
;
|
102
|
-
currQuestionType = lrnQuestionTypesENUM.essayResponse;
|
103
|
-
}
|
104
|
-
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
105
|
-
extractLrnPreviewData(currQuestionType, lrnQuestionDataArr, index)
|
106
|
-
}
|
107
|
-
});
|
108
|
-
});
|
109
|
-
|
110
|
-
it(`Verifying itemengine preview data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
111
|
-
migrationQuestionTypes.forEach((questionType) => {
|
112
|
-
cy.log(`Verifying data for all ${questionType} question type`);
|
113
|
-
let currQuestionTypeArr = lrnQuestionDataArr.filter((question) => question.questionType === questionType);
|
114
|
-
currQuestionTypeArr.forEach((questionData, index) => {
|
115
|
-
cy.log(`Verifying data for ${questionType} ${index}`);
|
116
|
-
verifyIePreviewData(questionType, questionData, index);
|
117
|
-
});
|
118
|
-
});
|
119
|
-
});
|
120
|
-
|
121
|
-
it(`Extracting learnosity grading data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
122
|
-
lrnPage.authorItemToolbarControlsWrapper()
|
123
|
-
.then(($element) => {
|
124
|
-
if ($element[0].innerHTML.includes('lrn-author-validate-questions-toggle')) {
|
125
|
-
lrnPage.steps.checkShowAnswersToggle();
|
126
|
-
lrnPage.questionTypeDiv()
|
127
|
-
.each(($el, index) => {
|
128
|
-
let currQuestionType = $el[0].innerText
|
129
|
-
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
130
|
-
currQuestionType = lrnQuestionTypesENUM.mcq
|
131
|
-
}
|
132
|
-
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
133
|
-
extractLrnGradingData(currQuestionType, lrnGradingDataArr, index);
|
134
|
-
}
|
135
|
-
});
|
136
|
-
}
|
137
|
-
});
|
138
|
-
});
|
139
|
-
|
140
|
-
it(`Verifying itemengine grading data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
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
|
-
//https://s3.console.aws.amazon.com/s3/object/itemengine-qa-bucket?region=us-west-2&bucketType=general&prefix=cypressAutomation/migrationFixtures.json
|
5
|
+
migrationScript(referenceIds);
|
@@ -1,157 +1,5 @@
|
|
1
|
-
import {
|
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";
|
1
|
+
import { migrationScript } from "../../support/migrationHelpers/migrationScript"
|
7
2
|
|
8
|
-
|
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/
|
3
|
+
let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(819, 910);
|
12
4
|
|
13
|
-
|
14
|
-
let lrnQuestionDataArr = [];
|
15
|
-
let lrnGradingDataArr = [];
|
16
|
-
|
17
|
-
let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(819, 910);//["85f864fd-8ce9-4d9d-a326-afb13963d6bd", "6ff35364-0fb6-4cc4-b09c-426f6199e3d6", "d5644e39-1f23-4c4d-a6ad-f80fee66cb62"]
|
18
|
-
|
19
|
-
const extractLrnPreviewData = (currQuestionType, lrnQuestionDataArr, index) => {
|
20
|
-
switch (currQuestionType) {
|
21
|
-
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
|
22
|
-
case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMath(lrnQuestionDataArr, index);
|
23
|
-
case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImage(lrnQuestionDataArr, index);
|
24
|
-
case lrnQuestionTypesENUM.essayResponse: return extractLrnQuestionData.essayResponse(lrnQuestionDataArr, index);
|
25
|
-
case lrnQuestionTypesENUM.essayResponseBasic: return extractLrnQuestionData.essayResponseBasic(lrnQuestionDataArr, index);
|
26
|
-
case lrnQuestionTypesENUM.drawingResponse: return extractLrnQuestionData.drawingResponse(lrnQuestionDataArr, index);
|
27
|
-
case lrnQuestionTypesENUM.dndIntoCategories: return extractLrnQuestionData.dndIntoCategories(lrnQuestionDataArr, index);
|
28
|
-
case lrnQuestionTypesENUM.figText: return extractLrnQuestionData.figText(lrnQuestionDataArr, index);
|
29
|
-
default: throw new Error('Invalid lrn question type');
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
const verifyIePreviewData = (questionType, questionData, index) => {
|
34
|
-
switch (questionType) {
|
35
|
-
case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
|
36
|
-
case 'textEntryMath': return verifyIeQuestionData.textEntryMath(questionData, index);
|
37
|
-
case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImage(questionData, index);
|
38
|
-
case 'essayResponse': return verifyIeQuestionData.essayResponse(questionData, index);
|
39
|
-
case 'essayResponseBasic': return verifyIeQuestionData.essayResponseBasic(questionData, index);
|
40
|
-
case 'drawingResponse': return verifyIeQuestionData.drawingResponse(questionData, index);
|
41
|
-
case 'dndIntoCategories': return verifyIeQuestionData.dndIntoCategories(questionData, index);
|
42
|
-
case 'figText': return verifyIeQuestionData.figText(questionData, index);
|
43
|
-
default: throw new Error('Invalid ngie question type');
|
44
|
-
}
|
45
|
-
}
|
46
|
-
|
47
|
-
const extractLrnGradingData = (currQuestionType, lrnGradingDataArr, index) => {
|
48
|
-
if (currQuestionType === lrnQuestionTypesENUM.mcq) extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
|
49
|
-
else if (currQuestionType === lrnQuestionTypesENUM.textEntryMath) extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
|
50
|
-
else if (currQuestionType === lrnQuestionTypesENUM.textEntryMathImage) extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
|
51
|
-
else if (currQuestionType === lrnQuestionTypesENUM.dndIntoCategories) extractLrnQuestionData.dndIntoCategoriesGrading(lrnGradingDataArr, index);
|
52
|
-
else if (currQuestionType === lrnQuestionTypesENUM.figText) extractLrnQuestionData.figTextGrading(lrnGradingDataArr, index);
|
53
|
-
}
|
54
|
-
|
55
|
-
const verifyIeGradingData = (questionType, questionData, index) => {
|
56
|
-
switch (questionType) {
|
57
|
-
case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
|
58
|
-
case 'textEntryMath': return verifyIeQuestionData.textEntryMathGrading(questionData, index);
|
59
|
-
case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImageGrading(questionData, index);
|
60
|
-
case 'dndIntoCategories': return verifyIeQuestionData.dndIntoCategoriesGrading(questionData, index);
|
61
|
-
case 'figText': return verifyIeQuestionData.figTextGrading(questionData, index);
|
62
|
-
default: throw new Error('Invalid ngie question type');
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
if (referenceIds.length > 0) {
|
67
|
-
describe('Migration item check for MCQ questions', () => {
|
68
|
-
before(() => {
|
69
|
-
cy.loginAs('technicalTester');
|
70
|
-
});
|
71
|
-
|
72
|
-
referenceIds.forEach((referenceId) => {
|
73
|
-
describe(`Migration item check for item "${referenceId}"`, () => {
|
74
|
-
abortEarlySetup();
|
75
|
-
before(() => {
|
76
|
-
cy.interceptGraphql('getItemPreview');
|
77
|
-
cy.setGraphqlWait();
|
78
|
-
cy.visit(`/items-list/item/${utilities.base64Encoding(referenceId)}`);
|
79
|
-
cy.pageLoadWait('getItemPreview');
|
80
|
-
cy.get('@getItemPreview').then((req) => {
|
81
|
-
let questionCount = req.response.body.data.getItemPreview.item.questionParts.length;
|
82
|
-
cy.lazyLoadPreviewQuestions(questionCount);
|
83
|
-
});
|
84
|
-
});
|
85
|
-
|
86
|
-
after(() => {
|
87
|
-
console.log(lrnQuestionDataArr)
|
88
|
-
console.log(lrnGradingDataArr)
|
89
|
-
lrnQuestionDataArr = [];
|
90
|
-
lrnGradingDataArr = [];
|
91
|
-
});
|
92
|
-
|
93
|
-
it(`Extracting learnosity preview data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
94
|
-
lrnPage.questionTypeDiv()
|
95
|
-
.each(($el, index) => {
|
96
|
-
let currQuestionType = $el[0].innerText
|
97
|
-
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
98
|
-
currQuestionType = lrnQuestionTypesENUM.mcq;
|
99
|
-
}
|
100
|
-
if (lrnEssayResponseRegex.test(currQuestionType)) {
|
101
|
-
;
|
102
|
-
currQuestionType = lrnQuestionTypesENUM.essayResponse;
|
103
|
-
}
|
104
|
-
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
105
|
-
extractLrnPreviewData(currQuestionType, lrnQuestionDataArr, index)
|
106
|
-
}
|
107
|
-
});
|
108
|
-
});
|
109
|
-
|
110
|
-
it(`Verifying itemengine preview data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
111
|
-
migrationQuestionTypes.forEach((questionType) => {
|
112
|
-
cy.log(`Verifying data for all ${questionType} question type`);
|
113
|
-
let currQuestionTypeArr = lrnQuestionDataArr.filter((question) => question.questionType === questionType);
|
114
|
-
currQuestionTypeArr.forEach((questionData, index) => {
|
115
|
-
cy.log(`Verifying data for ${questionType} ${index}`);
|
116
|
-
verifyIePreviewData(questionType, questionData, index);
|
117
|
-
});
|
118
|
-
});
|
119
|
-
});
|
120
|
-
|
121
|
-
it(`Extracting learnosity grading data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
122
|
-
lrnPage.authorItemToolbarControlsWrapper()
|
123
|
-
.then(($element) => {
|
124
|
-
if ($element[0].innerHTML.includes('lrn-author-validate-questions-toggle')) {
|
125
|
-
lrnPage.steps.checkShowAnswersToggle();
|
126
|
-
lrnPage.questionTypeDiv()
|
127
|
-
.each(($el, index) => {
|
128
|
-
let currQuestionType = $el[0].innerText
|
129
|
-
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
130
|
-
currQuestionType = lrnQuestionTypesENUM.mcq
|
131
|
-
}
|
132
|
-
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
133
|
-
extractLrnGradingData(currQuestionType, lrnGradingDataArr, index);
|
134
|
-
}
|
135
|
-
});
|
136
|
-
}
|
137
|
-
});
|
138
|
-
});
|
139
|
-
|
140
|
-
it(`Verifying itemengine grading data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
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
|
-
//https://s3.console.aws.amazon.com/s3/object/itemengine-qa-bucket?region=us-west-2&bucketType=general&prefix=cypressAutomation/migrationFixtures.json
|
5
|
+
migrationScript(referenceIds);
|
@@ -1,157 +1,5 @@
|
|
1
|
-
import {
|
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";
|
1
|
+
import { migrationScript } from "../../support/migrationHelpers/migrationScript"
|
7
2
|
|
8
|
-
|
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/
|
3
|
+
let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(910, 1001);
|
12
4
|
|
13
|
-
|
14
|
-
let lrnQuestionDataArr = [];
|
15
|
-
let lrnGradingDataArr = [];
|
16
|
-
|
17
|
-
let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(910, 1001);//["85f864fd-8ce9-4d9d-a326-afb13963d6bd", "6ff35364-0fb6-4cc4-b09c-426f6199e3d6", "d5644e39-1f23-4c4d-a6ad-f80fee66cb62"]
|
18
|
-
|
19
|
-
const extractLrnPreviewData = (currQuestionType, lrnQuestionDataArr, index) => {
|
20
|
-
switch (currQuestionType) {
|
21
|
-
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
|
22
|
-
case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMath(lrnQuestionDataArr, index);
|
23
|
-
case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImage(lrnQuestionDataArr, index);
|
24
|
-
case lrnQuestionTypesENUM.essayResponse: return extractLrnQuestionData.essayResponse(lrnQuestionDataArr, index);
|
25
|
-
case lrnQuestionTypesENUM.essayResponseBasic: return extractLrnQuestionData.essayResponseBasic(lrnQuestionDataArr, index);
|
26
|
-
case lrnQuestionTypesENUM.drawingResponse: return extractLrnQuestionData.drawingResponse(lrnQuestionDataArr, index);
|
27
|
-
case lrnQuestionTypesENUM.dndIntoCategories: return extractLrnQuestionData.dndIntoCategories(lrnQuestionDataArr, index);
|
28
|
-
case lrnQuestionTypesENUM.figText: return extractLrnQuestionData.figText(lrnQuestionDataArr, index);
|
29
|
-
default: throw new Error('Invalid lrn question type');
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
const verifyIePreviewData = (questionType, questionData, index) => {
|
34
|
-
switch (questionType) {
|
35
|
-
case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
|
36
|
-
case 'textEntryMath': return verifyIeQuestionData.textEntryMath(questionData, index);
|
37
|
-
case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImage(questionData, index);
|
38
|
-
case 'essayResponse': return verifyIeQuestionData.essayResponse(questionData, index);
|
39
|
-
case 'essayResponseBasic': return verifyIeQuestionData.essayResponseBasic(questionData, index);
|
40
|
-
case 'drawingResponse': return verifyIeQuestionData.drawingResponse(questionData, index);
|
41
|
-
case 'dndIntoCategories': return verifyIeQuestionData.dndIntoCategories(questionData, index);
|
42
|
-
case 'figText': return verifyIeQuestionData.figText(questionData, index);
|
43
|
-
default: throw new Error('Invalid ngie question type');
|
44
|
-
}
|
45
|
-
}
|
46
|
-
|
47
|
-
const extractLrnGradingData = (currQuestionType, lrnGradingDataArr, index) => {
|
48
|
-
if (currQuestionType === lrnQuestionTypesENUM.mcq) extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
|
49
|
-
else if (currQuestionType === lrnQuestionTypesENUM.textEntryMath) extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
|
50
|
-
else if (currQuestionType === lrnQuestionTypesENUM.textEntryMathImage) extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
|
51
|
-
else if (currQuestionType === lrnQuestionTypesENUM.dndIntoCategories) extractLrnQuestionData.dndIntoCategoriesGrading(lrnGradingDataArr, index);
|
52
|
-
else if (currQuestionType === lrnQuestionTypesENUM.figText) extractLrnQuestionData.figTextGrading(lrnGradingDataArr, index);
|
53
|
-
}
|
54
|
-
|
55
|
-
const verifyIeGradingData = (questionType, questionData, index) => {
|
56
|
-
switch (questionType) {
|
57
|
-
case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
|
58
|
-
case 'textEntryMath': return verifyIeQuestionData.textEntryMathGrading(questionData, index);
|
59
|
-
case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImageGrading(questionData, index);
|
60
|
-
case 'dndIntoCategories': return verifyIeQuestionData.dndIntoCategoriesGrading(questionData, index);
|
61
|
-
case 'figText': return verifyIeQuestionData.figTextGrading(questionData, index);
|
62
|
-
default: throw new Error('Invalid ngie question type');
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
if (referenceIds.length > 0) {
|
67
|
-
describe('Migration item check for MCQ questions', () => {
|
68
|
-
before(() => {
|
69
|
-
cy.loginAs('technicalTester');
|
70
|
-
});
|
71
|
-
|
72
|
-
referenceIds.forEach((referenceId) => {
|
73
|
-
describe(`Migration item check for item "${referenceId}"`, () => {
|
74
|
-
abortEarlySetup();
|
75
|
-
before(() => {
|
76
|
-
cy.interceptGraphql('getItemPreview');
|
77
|
-
cy.setGraphqlWait();
|
78
|
-
cy.visit(`/items-list/item/${utilities.base64Encoding(referenceId)}`);
|
79
|
-
cy.pageLoadWait('getItemPreview');
|
80
|
-
cy.get('@getItemPreview').then((req) => {
|
81
|
-
let questionCount = req.response.body.data.getItemPreview.item.questionParts.length;
|
82
|
-
cy.lazyLoadPreviewQuestions(questionCount);
|
83
|
-
});
|
84
|
-
});
|
85
|
-
|
86
|
-
after(() => {
|
87
|
-
console.log(lrnQuestionDataArr)
|
88
|
-
console.log(lrnGradingDataArr)
|
89
|
-
lrnQuestionDataArr = [];
|
90
|
-
lrnGradingDataArr = [];
|
91
|
-
});
|
92
|
-
|
93
|
-
it(`Extracting learnosity preview data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
94
|
-
lrnPage.questionTypeDiv()
|
95
|
-
.each(($el, index) => {
|
96
|
-
let currQuestionType = $el[0].innerText
|
97
|
-
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
98
|
-
currQuestionType = lrnQuestionTypesENUM.mcq;
|
99
|
-
}
|
100
|
-
if (lrnEssayResponseRegex.test(currQuestionType)) {
|
101
|
-
;
|
102
|
-
currQuestionType = lrnQuestionTypesENUM.essayResponse;
|
103
|
-
}
|
104
|
-
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
105
|
-
extractLrnPreviewData(currQuestionType, lrnQuestionDataArr, index)
|
106
|
-
}
|
107
|
-
});
|
108
|
-
});
|
109
|
-
|
110
|
-
it(`Verifying itemengine preview data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
111
|
-
migrationQuestionTypes.forEach((questionType) => {
|
112
|
-
cy.log(`Verifying data for all ${questionType} question type`);
|
113
|
-
let currQuestionTypeArr = lrnQuestionDataArr.filter((question) => question.questionType === questionType);
|
114
|
-
currQuestionTypeArr.forEach((questionData, index) => {
|
115
|
-
cy.log(`Verifying data for ${questionType} ${index}`);
|
116
|
-
verifyIePreviewData(questionType, questionData, index);
|
117
|
-
});
|
118
|
-
});
|
119
|
-
});
|
120
|
-
|
121
|
-
it(`Extracting learnosity grading data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
122
|
-
lrnPage.authorItemToolbarControlsWrapper()
|
123
|
-
.then(($element) => {
|
124
|
-
if ($element[0].innerHTML.includes('lrn-author-validate-questions-toggle')) {
|
125
|
-
lrnPage.steps.checkShowAnswersToggle();
|
126
|
-
lrnPage.questionTypeDiv()
|
127
|
-
.each(($el, index) => {
|
128
|
-
let currQuestionType = $el[0].innerText
|
129
|
-
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
130
|
-
currQuestionType = lrnQuestionTypesENUM.mcq
|
131
|
-
}
|
132
|
-
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
133
|
-
extractLrnGradingData(currQuestionType, lrnGradingDataArr, index);
|
134
|
-
}
|
135
|
-
});
|
136
|
-
}
|
137
|
-
});
|
138
|
-
});
|
139
|
-
|
140
|
-
it(`Verifying itemengine grading data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
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
|
-
//https://s3.console.aws.amazon.com/s3/object/itemengine-qa-bucket?region=us-west-2&bucketType=general&prefix=cypressAutomation/migrationFixtures.json
|
5
|
+
migrationScript(referenceIds);
|
@@ -1,157 +1,5 @@
|
|
1
|
-
import {
|
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";
|
1
|
+
import { migrationScript } from "../../support/migrationHelpers/migrationScript"
|
7
2
|
|
8
|
-
|
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/
|
3
|
+
let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(91, 182);
|
12
4
|
|
13
|
-
|
14
|
-
let lrnQuestionDataArr = [];
|
15
|
-
let lrnGradingDataArr = [];
|
16
|
-
|
17
|
-
let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(91, 182);//["85f864fd-8ce9-4d9d-a326-afb13963d6bd", "6ff35364-0fb6-4cc4-b09c-426f6199e3d6", "d5644e39-1f23-4c4d-a6ad-f80fee66cb62"]
|
18
|
-
|
19
|
-
const extractLrnPreviewData = (currQuestionType, lrnQuestionDataArr, index) => {
|
20
|
-
switch (currQuestionType) {
|
21
|
-
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
|
22
|
-
case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMath(lrnQuestionDataArr, index);
|
23
|
-
case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImage(lrnQuestionDataArr, index);
|
24
|
-
case lrnQuestionTypesENUM.essayResponse: return extractLrnQuestionData.essayResponse(lrnQuestionDataArr, index);
|
25
|
-
case lrnQuestionTypesENUM.essayResponseBasic: return extractLrnQuestionData.essayResponseBasic(lrnQuestionDataArr, index);
|
26
|
-
case lrnQuestionTypesENUM.drawingResponse: return extractLrnQuestionData.drawingResponse(lrnQuestionDataArr, index);
|
27
|
-
case lrnQuestionTypesENUM.dndIntoCategories: return extractLrnQuestionData.dndIntoCategories(lrnQuestionDataArr, index);
|
28
|
-
case lrnQuestionTypesENUM.figText: return extractLrnQuestionData.figText(lrnQuestionDataArr, index);
|
29
|
-
default: throw new Error('Invalid lrn question type');
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
const verifyIePreviewData = (questionType, questionData, index) => {
|
34
|
-
switch (questionType) {
|
35
|
-
case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
|
36
|
-
case 'textEntryMath': return verifyIeQuestionData.textEntryMath(questionData, index);
|
37
|
-
case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImage(questionData, index);
|
38
|
-
case 'essayResponse': return verifyIeQuestionData.essayResponse(questionData, index);
|
39
|
-
case 'essayResponseBasic': return verifyIeQuestionData.essayResponseBasic(questionData, index);
|
40
|
-
case 'drawingResponse': return verifyIeQuestionData.drawingResponse(questionData, index);
|
41
|
-
case 'dndIntoCategories': return verifyIeQuestionData.dndIntoCategories(questionData, index);
|
42
|
-
case 'figText': return verifyIeQuestionData.figText(questionData, index);
|
43
|
-
default: throw new Error('Invalid ngie question type');
|
44
|
-
}
|
45
|
-
}
|
46
|
-
|
47
|
-
const extractLrnGradingData = (currQuestionType, lrnGradingDataArr, index) => {
|
48
|
-
if (currQuestionType === lrnQuestionTypesENUM.mcq) extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
|
49
|
-
else if (currQuestionType === lrnQuestionTypesENUM.textEntryMath) extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
|
50
|
-
else if (currQuestionType === lrnQuestionTypesENUM.textEntryMathImage) extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
|
51
|
-
else if (currQuestionType === lrnQuestionTypesENUM.dndIntoCategories) extractLrnQuestionData.dndIntoCategoriesGrading(lrnGradingDataArr, index);
|
52
|
-
else if (currQuestionType === lrnQuestionTypesENUM.figText) extractLrnQuestionData.figTextGrading(lrnGradingDataArr, index);
|
53
|
-
}
|
54
|
-
|
55
|
-
const verifyIeGradingData = (questionType, questionData, index) => {
|
56
|
-
switch (questionType) {
|
57
|
-
case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
|
58
|
-
case 'textEntryMath': return verifyIeQuestionData.textEntryMathGrading(questionData, index);
|
59
|
-
case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImageGrading(questionData, index);
|
60
|
-
case 'dndIntoCategories': return verifyIeQuestionData.dndIntoCategoriesGrading(questionData, index);
|
61
|
-
case 'figText': return verifyIeQuestionData.figTextGrading(questionData, index);
|
62
|
-
default: throw new Error('Invalid ngie question type');
|
63
|
-
}
|
64
|
-
}
|
65
|
-
|
66
|
-
if (referenceIds.length > 0) {
|
67
|
-
describe('Migration item check for MCQ questions', () => {
|
68
|
-
before(() => {
|
69
|
-
cy.loginAs('technicalTester');
|
70
|
-
});
|
71
|
-
|
72
|
-
referenceIds.forEach((referenceId) => {
|
73
|
-
describe(`Migration item check for item "${referenceId}"`, () => {
|
74
|
-
abortEarlySetup();
|
75
|
-
before(() => {
|
76
|
-
cy.interceptGraphql('getItemPreview');
|
77
|
-
cy.setGraphqlWait();
|
78
|
-
cy.visit(`/items-list/item/${utilities.base64Encoding(referenceId)}`);
|
79
|
-
cy.pageLoadWait('getItemPreview');
|
80
|
-
cy.get('@getItemPreview').then((req) => {
|
81
|
-
let questionCount = req.response.body.data.getItemPreview.item.questionParts.length;
|
82
|
-
cy.lazyLoadPreviewQuestions(questionCount);
|
83
|
-
});
|
84
|
-
});
|
85
|
-
|
86
|
-
after(() => {
|
87
|
-
console.log(lrnQuestionDataArr)
|
88
|
-
console.log(lrnGradingDataArr)
|
89
|
-
lrnQuestionDataArr = [];
|
90
|
-
lrnGradingDataArr = [];
|
91
|
-
});
|
92
|
-
|
93
|
-
it(`Extracting learnosity preview data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
94
|
-
lrnPage.questionTypeDiv()
|
95
|
-
.each(($el, index) => {
|
96
|
-
let currQuestionType = $el[0].innerText
|
97
|
-
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
98
|
-
currQuestionType = lrnQuestionTypesENUM.mcq;
|
99
|
-
}
|
100
|
-
if (lrnEssayResponseRegex.test(currQuestionType)) {
|
101
|
-
;
|
102
|
-
currQuestionType = lrnQuestionTypesENUM.essayResponse;
|
103
|
-
}
|
104
|
-
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
105
|
-
extractLrnPreviewData(currQuestionType, lrnQuestionDataArr, index)
|
106
|
-
}
|
107
|
-
});
|
108
|
-
});
|
109
|
-
|
110
|
-
it(`Verifying itemengine preview data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
111
|
-
migrationQuestionTypes.forEach((questionType) => {
|
112
|
-
cy.log(`Verifying data for all ${questionType} question type`);
|
113
|
-
let currQuestionTypeArr = lrnQuestionDataArr.filter((question) => question.questionType === questionType);
|
114
|
-
currQuestionTypeArr.forEach((questionData, index) => {
|
115
|
-
cy.log(`Verifying data for ${questionType} ${index}`);
|
116
|
-
verifyIePreviewData(questionType, questionData, index);
|
117
|
-
});
|
118
|
-
});
|
119
|
-
});
|
120
|
-
|
121
|
-
it(`Extracting learnosity grading data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
122
|
-
lrnPage.authorItemToolbarControlsWrapper()
|
123
|
-
.then(($element) => {
|
124
|
-
if ($element[0].innerHTML.includes('lrn-author-validate-questions-toggle')) {
|
125
|
-
lrnPage.steps.checkShowAnswersToggle();
|
126
|
-
lrnPage.questionTypeDiv()
|
127
|
-
.each(($el, index) => {
|
128
|
-
let currQuestionType = $el[0].innerText
|
129
|
-
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
130
|
-
currQuestionType = lrnQuestionTypesENUM.mcq
|
131
|
-
}
|
132
|
-
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
133
|
-
extractLrnGradingData(currQuestionType, lrnGradingDataArr, index);
|
134
|
-
}
|
135
|
-
});
|
136
|
-
}
|
137
|
-
});
|
138
|
-
});
|
139
|
-
|
140
|
-
it(`Verifying itemengine grading data for item "${Cypress.config().baseUrl}/items-list/item/${utilities.base64Encoding(referenceId)}"`, () => {
|
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
|
-
//https://s3.console.aws.amazon.com/s3/object/itemengine-qa-bucket?region=us-west-2&bucketType=general&prefix=cypressAutomation/migrationFixtures.json
|
5
|
+
migrationScript(referenceIds);
|