itemengine-cypress-automation 1.0.109 → 1.0.110
Sign up to get free protection for your applications and to get access to all the features.
- package/cypress/e2e/migration/migration.js +12 -1
- package/cypress/e2e/migration/migration2.js +10 -0
- package/cypress/e2e/migration/migration3.js +10 -0
- package/cypress/e2e/migration/migration4.js +10 -0
- package/cypress/e2e/migration/migration5.js +82 -70
- package/cypress/support/migrationHelpers/extractLrnQuestionData.js +132 -1
- package/cypress/support/migrationHelpers/lrnQestionTypesENUM.js +2 -0
- package/cypress/support/migrationHelpers/verifyIeQuestionData.js +91 -6
- package/package.json +1 -1
- package/scripts/awsHelper.mjs +1 -1
@@ -35,13 +35,14 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
|
|
35
35
|
cy.learnosityLoaderWait();
|
36
36
|
})
|
37
37
|
|
38
|
-
const migrationQuestionTypes = Cypress.env('migrationQuestionTypes'); /* ['singleSelection', '
|
38
|
+
const migrationQuestionTypes = Cypress.env('migrationQuestionTypes'); /* ['singleSelection', 'multipleSelection', 'trueOrFalse']; */
|
39
39
|
const migrationQuestionTypesLrn = migrationQuestionTypes.map((questionType) => lrnQuestionTypesENUM[questionType]);
|
40
40
|
|
41
41
|
let lrnQuestionDataArr = [];
|
42
42
|
let lrnGradingDataArr = [];
|
43
43
|
|
44
44
|
let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(0, 100);
|
45
|
+
/* ["c18e3a7d-d386-4765-a9d3-14b8ab7548bd", "6809707f-77bd-4e8d-8c3d-baf3d38611cf","ad5dd21c-50d5-4c20-8348-30000b7d911c",'c3100724-dbfc-4950-aeb4-e8d65dfbecf2'] */;
|
45
46
|
|
46
47
|
if (referenceIds.length > 0) {
|
47
48
|
describe('Migration item check for MCQ questions', () => {
|
@@ -64,6 +65,7 @@ if (referenceIds.length > 0) {
|
|
64
65
|
|
65
66
|
after(() => {
|
66
67
|
console.log(lrnQuestionDataArr)
|
68
|
+
console.log(lrnGradingDataArr)
|
67
69
|
lrnQuestionDataArr = [];
|
68
70
|
lrnGradingDataArr = [];
|
69
71
|
});
|
@@ -75,6 +77,8 @@ if (referenceIds.length > 0) {
|
|
75
77
|
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
76
78
|
switch (currQuestionType) {
|
77
79
|
case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelection(lrnQuestionDataArr, index);
|
80
|
+
case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelection(lrnQuestionDataArr, index);
|
81
|
+
case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalse(lrnQuestionDataArr, index);
|
78
82
|
case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
79
83
|
default: throw new Error('Invalid lrn question type');
|
80
84
|
}
|
@@ -90,6 +94,8 @@ if (referenceIds.length > 0) {
|
|
90
94
|
cy.log(`Verifying data for ${questionType} ${index}`);
|
91
95
|
switch (questionType) {
|
92
96
|
case 'singleSelection': return verifyIeQuestionData.singleSelection(questionData, index);
|
97
|
+
case 'multipleSelection': return verifyIeQuestionData.multipleSelection(questionData, index);
|
98
|
+
case 'trueOrFalse': return verifyIeQuestionData.trueOrFalse(questionData, index);
|
93
99
|
case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
94
100
|
default: throw new Error('Invalid ngie question type');
|
95
101
|
}
|
@@ -105,6 +111,8 @@ if (referenceIds.length > 0) {
|
|
105
111
|
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
106
112
|
switch (currQuestionType) {
|
107
113
|
case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelectionGrading(lrnGradingDataArr, index);
|
114
|
+
case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelectionGrading(lrnGradingDataArr, index);
|
115
|
+
case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalseGrading(lrnGradingDataArr, index);
|
108
116
|
// case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
109
117
|
default: throw new Error('Invalid lrn question type');
|
110
118
|
}
|
@@ -114,6 +122,7 @@ if (referenceIds.length > 0) {
|
|
114
122
|
|
115
123
|
it(`Verifying itemengine grading data for item "${referenceId}"`, () => {
|
116
124
|
autoScoredScoringPreviewTab.steps.switchToGradingView();
|
125
|
+
cy.wait(500);
|
117
126
|
migrationQuestionTypes.forEach((questionType) => {
|
118
127
|
cy.log(`Verifying grading data for all ${questionType} question type`);
|
119
128
|
let currQuestionTypeArr = lrnGradingDataArr.filter((question) => question.questionType === questionType);
|
@@ -121,6 +130,8 @@ if (referenceIds.length > 0) {
|
|
121
130
|
cy.log(`Verifying grading data for ${questionType} ${index}`);
|
122
131
|
switch (questionType) {
|
123
132
|
case 'singleSelection': return verifyIeQuestionData.singleSelectionGrading(questionData, index);
|
133
|
+
case 'multipleSelection': return verifyIeQuestionData.multipleSelectionGrading(questionData, index);
|
134
|
+
case 'trueOrFalse': return verifyIeQuestionData.trueOrFalseGrading(questionData, index);
|
124
135
|
// case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
125
136
|
default: throw new Error('Invalid ngie question type');
|
126
137
|
}
|
@@ -67,6 +67,7 @@ if (referenceIds.length > 0) {
|
|
67
67
|
|
68
68
|
after(() => {
|
69
69
|
console.log(lrnQuestionDataArr)
|
70
|
+
console.log(lrnGradingDataArr)
|
70
71
|
lrnQuestionDataArr = [];
|
71
72
|
lrnGradingDataArr = [];
|
72
73
|
});
|
@@ -78,6 +79,8 @@ if (referenceIds.length > 0) {
|
|
78
79
|
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
79
80
|
switch (currQuestionType) {
|
80
81
|
case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelection(lrnQuestionDataArr, index);
|
82
|
+
case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelection(lrnQuestionDataArr, index);
|
83
|
+
case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalse(lrnQuestionDataArr, index);
|
81
84
|
case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
82
85
|
default: throw new Error('Invalid lrn question type');
|
83
86
|
}
|
@@ -93,6 +96,8 @@ if (referenceIds.length > 0) {
|
|
93
96
|
cy.log(`Verifying data for ${questionType} ${index}`);
|
94
97
|
switch (questionType) {
|
95
98
|
case 'singleSelection': return verifyIeQuestionData.singleSelection(questionData, index);
|
99
|
+
case 'multipleSelection': return verifyIeQuestionData.multipleSelection(questionData, index);
|
100
|
+
case 'trueOrFalse': return verifyIeQuestionData.trueOrFalse(questionData, index);
|
96
101
|
case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
97
102
|
default: throw new Error('Invalid ngie question type');
|
98
103
|
}
|
@@ -108,6 +113,8 @@ if (referenceIds.length > 0) {
|
|
108
113
|
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
109
114
|
switch (currQuestionType) {
|
110
115
|
case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelectionGrading(lrnGradingDataArr, index);
|
116
|
+
case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelectionGrading(lrnGradingDataArr, index);
|
117
|
+
case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalseGrading(lrnGradingDataArr, index);
|
111
118
|
// case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
112
119
|
default: throw new Error('Invalid lrn question type');
|
113
120
|
}
|
@@ -117,6 +124,7 @@ if (referenceIds.length > 0) {
|
|
117
124
|
|
118
125
|
it(`Verifying itemengine grading data for item "${referenceId}"`, () => {
|
119
126
|
autoScoredScoringPreviewTab.steps.switchToGradingView();
|
127
|
+
cy.wait(500);
|
120
128
|
migrationQuestionTypes.forEach((questionType) => {
|
121
129
|
cy.log(`Verifying grading data for all ${questionType} question type`);
|
122
130
|
let currQuestionTypeArr = lrnGradingDataArr.filter((question) => question.questionType === questionType);
|
@@ -124,6 +132,8 @@ if (referenceIds.length > 0) {
|
|
124
132
|
cy.log(`Verifying grading data for ${questionType} ${index}`);
|
125
133
|
switch (questionType) {
|
126
134
|
case 'singleSelection': return verifyIeQuestionData.singleSelectionGrading(questionData, index);
|
135
|
+
case 'multipleSelection': return verifyIeQuestionData.multipleSelectionGrading(questionData, index);
|
136
|
+
case 'trueOrFalse': return verifyIeQuestionData.trueOrFalseGrading(questionData, index);
|
127
137
|
// case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
128
138
|
default: throw new Error('Invalid ngie question type');
|
129
139
|
}
|
@@ -64,6 +64,7 @@ if (referenceIds.length > 0) {
|
|
64
64
|
|
65
65
|
after(() => {
|
66
66
|
console.log(lrnQuestionDataArr)
|
67
|
+
console.log(lrnGradingDataArr)
|
67
68
|
lrnQuestionDataArr = [];
|
68
69
|
lrnGradingDataArr = [];
|
69
70
|
});
|
@@ -75,6 +76,8 @@ if (referenceIds.length > 0) {
|
|
75
76
|
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
76
77
|
switch (currQuestionType) {
|
77
78
|
case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelection(lrnQuestionDataArr, index);
|
79
|
+
case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelection(lrnQuestionDataArr, index);
|
80
|
+
case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalse(lrnQuestionDataArr, index);
|
78
81
|
case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
79
82
|
default: throw new Error('Invalid lrn question type');
|
80
83
|
}
|
@@ -90,6 +93,8 @@ if (referenceIds.length > 0) {
|
|
90
93
|
cy.log(`Verifying data for ${questionType} ${index}`);
|
91
94
|
switch (questionType) {
|
92
95
|
case 'singleSelection': return verifyIeQuestionData.singleSelection(questionData, index);
|
96
|
+
case 'multipleSelection': return verifyIeQuestionData.multipleSelection(questionData, index);
|
97
|
+
case 'trueOrFalse': return verifyIeQuestionData.trueOrFalse(questionData, index);
|
93
98
|
case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
94
99
|
default: throw new Error('Invalid ngie question type');
|
95
100
|
}
|
@@ -105,6 +110,8 @@ if (referenceIds.length > 0) {
|
|
105
110
|
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
106
111
|
switch (currQuestionType) {
|
107
112
|
case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelectionGrading(lrnGradingDataArr, index);
|
113
|
+
case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelectionGrading(lrnGradingDataArr, index);
|
114
|
+
case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalseGrading(lrnGradingDataArr, index);
|
108
115
|
// case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
109
116
|
default: throw new Error('Invalid lrn question type');
|
110
117
|
}
|
@@ -114,6 +121,7 @@ if (referenceIds.length > 0) {
|
|
114
121
|
|
115
122
|
it(`Verifying itemengine grading data for item "${referenceId}"`, () => {
|
116
123
|
autoScoredScoringPreviewTab.steps.switchToGradingView();
|
124
|
+
cy.wait(500);
|
117
125
|
migrationQuestionTypes.forEach((questionType) => {
|
118
126
|
cy.log(`Verifying grading data for all ${questionType} question type`);
|
119
127
|
let currQuestionTypeArr = lrnGradingDataArr.filter((question) => question.questionType === questionType);
|
@@ -121,6 +129,8 @@ if (referenceIds.length > 0) {
|
|
121
129
|
cy.log(`Verifying grading data for ${questionType} ${index}`);
|
122
130
|
switch (questionType) {
|
123
131
|
case 'singleSelection': return verifyIeQuestionData.singleSelectionGrading(questionData, index);
|
132
|
+
case 'multipleSelection': return verifyIeQuestionData.multipleSelectionGrading(questionData, index);
|
133
|
+
case 'trueOrFalse': return verifyIeQuestionData.trueOrFalseGrading(questionData, index);
|
124
134
|
// case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
125
135
|
default: throw new Error('Invalid ngie question type');
|
126
136
|
}
|
@@ -64,6 +64,7 @@ if (referenceIds.length > 0) {
|
|
64
64
|
|
65
65
|
after(() => {
|
66
66
|
console.log(lrnQuestionDataArr)
|
67
|
+
console.log(lrnGradingDataArr)
|
67
68
|
lrnQuestionDataArr = [];
|
68
69
|
lrnGradingDataArr = [];
|
69
70
|
});
|
@@ -75,6 +76,8 @@ if (referenceIds.length > 0) {
|
|
75
76
|
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
76
77
|
switch (currQuestionType) {
|
77
78
|
case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelection(lrnQuestionDataArr, index);
|
79
|
+
case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelection(lrnQuestionDataArr, index);
|
80
|
+
case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalse(lrnQuestionDataArr, index);
|
78
81
|
case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
79
82
|
default: throw new Error('Invalid lrn question type');
|
80
83
|
}
|
@@ -90,6 +93,8 @@ if (referenceIds.length > 0) {
|
|
90
93
|
cy.log(`Verifying data for ${questionType} ${index}`);
|
91
94
|
switch (questionType) {
|
92
95
|
case 'singleSelection': return verifyIeQuestionData.singleSelection(questionData, index);
|
96
|
+
case 'multipleSelection': return verifyIeQuestionData.multipleSelection(questionData, index);
|
97
|
+
case 'trueOrFalse': return verifyIeQuestionData.trueOrFalse(questionData, index);
|
93
98
|
case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
94
99
|
default: throw new Error('Invalid ngie question type');
|
95
100
|
}
|
@@ -105,6 +110,8 @@ if (referenceIds.length > 0) {
|
|
105
110
|
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
106
111
|
switch (currQuestionType) {
|
107
112
|
case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelectionGrading(lrnGradingDataArr, index);
|
113
|
+
case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelectionGrading(lrnGradingDataArr, index);
|
114
|
+
case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalseGrading(lrnGradingDataArr, index);
|
108
115
|
// case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
109
116
|
default: throw new Error('Invalid lrn question type');
|
110
117
|
}
|
@@ -114,6 +121,7 @@ if (referenceIds.length > 0) {
|
|
114
121
|
|
115
122
|
it(`Verifying itemengine grading data for item "${referenceId}"`, () => {
|
116
123
|
autoScoredScoringPreviewTab.steps.switchToGradingView();
|
124
|
+
cy.wait(500);
|
117
125
|
migrationQuestionTypes.forEach((questionType) => {
|
118
126
|
cy.log(`Verifying grading data for all ${questionType} question type`);
|
119
127
|
let currQuestionTypeArr = lrnGradingDataArr.filter((question) => question.questionType === questionType);
|
@@ -121,6 +129,8 @@ if (referenceIds.length > 0) {
|
|
121
129
|
cy.log(`Verifying grading data for ${questionType} ${index}`);
|
122
130
|
switch (questionType) {
|
123
131
|
case 'singleSelection': return verifyIeQuestionData.singleSelectionGrading(questionData, index);
|
132
|
+
case 'multipleSelection': return verifyIeQuestionData.multipleSelectionGrading(questionData, index);
|
133
|
+
case 'trueOrFalse': return verifyIeQuestionData.trueOrFalseGrading(questionData, index);
|
124
134
|
// case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
125
135
|
default: throw new Error('Invalid ngie question type');
|
126
136
|
}
|
@@ -43,89 +43,101 @@ let lrnGradingDataArr = [];
|
|
43
43
|
|
44
44
|
let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(400, 500);
|
45
45
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
46
|
+
if (referenceIds.length > 0) {
|
47
|
+
describe('Migration item check for MCQ questions', () => {
|
48
|
+
before(() => {
|
49
|
+
cy.loginAs('technicalTester');
|
50
|
+
});
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
52
|
+
referenceIds.forEach((referenceId) => {
|
53
|
+
describe(`Migration item check for item "${referenceId}"`, () => {
|
54
|
+
before(() => {
|
55
|
+
cy.interceptGraphql('getItemPreview');
|
56
|
+
cy.setGraphqlWait();
|
57
|
+
cy.visit(`/items-list/item/${utilities.base64Encoding(referenceId)}`);
|
58
|
+
cy.pageLoadWait('getItemPreview');
|
59
|
+
cy.get('@getItemPreview').then((req) => {
|
60
|
+
let questionCount = req.response.body.data.getItemPreview.item.questionParts.length;
|
61
|
+
cy.lazyLoadPreviewQuestions(questionCount);
|
62
|
+
});
|
61
63
|
});
|
62
|
-
});
|
63
64
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
65
|
+
after(() => {
|
66
|
+
console.log(lrnQuestionDataArr)
|
67
|
+
console.log(lrnGradingDataArr)
|
68
|
+
lrnQuestionDataArr = [];
|
69
|
+
lrnGradingDataArr = [];
|
70
|
+
});
|
69
71
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
72
|
+
it(`Extracting learnosity preview data for item "${referenceId}"`, () => {
|
73
|
+
lrnPage.questionTypeDiv()
|
74
|
+
.each(($el, index) => {
|
75
|
+
let currQuestionType = $el[0].innerText
|
76
|
+
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
77
|
+
switch (currQuestionType) {
|
78
|
+
case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelection(lrnQuestionDataArr, index);
|
79
|
+
case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelection(lrnQuestionDataArr, index);
|
80
|
+
case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalse(lrnQuestionDataArr, index);
|
81
|
+
case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
82
|
+
default: throw new Error('Invalid lrn question type');
|
83
|
+
}
|
79
84
|
}
|
80
|
-
}
|
81
|
-
|
82
|
-
});
|
85
|
+
});
|
86
|
+
});
|
83
87
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
88
|
+
it(`Verifying itemengine preview data for item "${referenceId}"`, () => {
|
89
|
+
migrationQuestionTypes.forEach((questionType) => {
|
90
|
+
cy.log(`Verifying data for all ${questionType} question type`);
|
91
|
+
let currQuestionTypeArr = lrnQuestionDataArr.filter((question) => question.questionType === questionType);
|
92
|
+
currQuestionTypeArr.forEach((questionData, index) => {
|
93
|
+
cy.log(`Verifying data for ${questionType} ${index}`);
|
94
|
+
switch (questionType) {
|
95
|
+
case 'singleSelection': return verifyIeQuestionData.singleSelection(questionData, index);
|
96
|
+
case 'multipleSelection': return verifyIeQuestionData.multipleSelection(questionData, index);
|
97
|
+
case 'trueOrFalse': return verifyIeQuestionData.trueOrFalse(questionData, index);
|
98
|
+
case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
99
|
+
default: throw new Error('Invalid ngie question type');
|
100
|
+
}
|
101
|
+
});
|
95
102
|
});
|
96
103
|
});
|
97
|
-
});
|
98
104
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
105
|
+
it(`Extracting learnosity grading data for item "${referenceId}"`, () => {
|
106
|
+
lrnPage.steps.checkShowAnswersToggle();
|
107
|
+
lrnPage.questionTypeDiv()
|
108
|
+
.each(($el, index) => {
|
109
|
+
let currQuestionType = $el[0].innerText
|
110
|
+
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
111
|
+
switch (currQuestionType) {
|
112
|
+
case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelectionGrading(lrnGradingDataArr, index);
|
113
|
+
case lrnQuestionTypesENUM.multipleSelection: return extractLrnQuestionData.multipleSelectionGrading(lrnGradingDataArr, index);
|
114
|
+
case lrnQuestionTypesENUM.trueOrFalse: return extractLrnQuestionData.trueOrFalseGrading(lrnGradingDataArr, index);
|
115
|
+
// case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
116
|
+
default: throw new Error('Invalid lrn question type');
|
117
|
+
}
|
109
118
|
}
|
110
|
-
}
|
111
|
-
|
112
|
-
});
|
119
|
+
});
|
120
|
+
});
|
113
121
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
122
|
+
it(`Verifying itemengine grading data for item "${referenceId}"`, () => {
|
123
|
+
autoScoredScoringPreviewTab.steps.switchToGradingView();
|
124
|
+
cy.wait(500);
|
125
|
+
migrationQuestionTypes.forEach((questionType) => {
|
126
|
+
cy.log(`Verifying grading data for all ${questionType} question type`);
|
127
|
+
let currQuestionTypeArr = lrnGradingDataArr.filter((question) => question.questionType === questionType);
|
128
|
+
currQuestionTypeArr.forEach((questionData, index) => {
|
129
|
+
cy.log(`Verifying grading data for ${questionType} ${index}`);
|
130
|
+
switch (questionType) {
|
131
|
+
case 'singleSelection': return verifyIeQuestionData.singleSelectionGrading(questionData, index);
|
132
|
+
case 'multipleSelection': return verifyIeQuestionData.multipleSelectionGrading(questionData, index);
|
133
|
+
case 'trueOrFalse': return verifyIeQuestionData.trueOrFalseGrading(questionData, index);
|
134
|
+
// case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
135
|
+
default: throw new Error('Invalid ngie question type');
|
136
|
+
}
|
137
|
+
});
|
126
138
|
});
|
127
139
|
});
|
128
140
|
});
|
129
141
|
});
|
130
142
|
});
|
131
|
-
}
|
143
|
+
}
|
@@ -69,7 +69,138 @@ export const extractLrnQuestionData = {
|
|
69
69
|
let correctAnswersIndex = [];
|
70
70
|
lrnPage.mcqOptionWrapper()
|
71
71
|
.each(($optionWrapper, index) => {
|
72
|
-
|
72
|
+
if ($optionWrapper[0].className.includes('lrn_valid')) {
|
73
|
+
correctAnswersIndex.push(index)
|
74
|
+
}
|
75
|
+
cy.wrap($optionWrapper)
|
76
|
+
.within(() => {
|
77
|
+
lrnPage.mcqOptionContent()
|
78
|
+
.then(($el) => {
|
79
|
+
optionsText.push($el[0].innerText);
|
80
|
+
});
|
81
|
+
});
|
82
|
+
});
|
83
|
+
obj.gradingOptionsText = optionsText;
|
84
|
+
obj.correctAnswersIndex = correctAnswersIndex;
|
85
|
+
});
|
86
|
+
lrnGradingDataArr.push(obj);
|
87
|
+
},
|
88
|
+
|
89
|
+
multipleSelection: (lrnQuestionDataArr, index) => {
|
90
|
+
let obj = {};
|
91
|
+
cy.log(`Extracting the question instructions and options from question ${index}`);
|
92
|
+
obj.questionIndex = index;
|
93
|
+
obj.questionType = 'multipleSelection'
|
94
|
+
lrnPage.questionWrapper()
|
95
|
+
.eq(index)
|
96
|
+
.within(() => {
|
97
|
+
lrnPage.questionInstructions()
|
98
|
+
.then(($ins) => {
|
99
|
+
let text = $ins[0].innerText;
|
100
|
+
obj.previewQuestionInstructions = text;
|
101
|
+
});
|
102
|
+
|
103
|
+
let optionsText = [];
|
104
|
+
lrnPage.mcqOptionWrapper()
|
105
|
+
.each(($options) => {
|
106
|
+
cy.wrap($options)
|
107
|
+
.within(() => {
|
108
|
+
lrnPage.mcqOptionContent()
|
109
|
+
.then(($el) => {
|
110
|
+
let text = $el[0].innerText;
|
111
|
+
optionsText.push(text);
|
112
|
+
});
|
113
|
+
});
|
114
|
+
});
|
115
|
+
obj.previewOptionsText = optionsText;
|
116
|
+
})
|
117
|
+
lrnQuestionDataArr.push(obj);
|
118
|
+
},
|
119
|
+
|
120
|
+
multipleSelectionGrading: (lrnGradingDataArr, index) => {
|
121
|
+
let obj = {};
|
122
|
+
cy.log(`Extracting the question instructions, options and correct answers from question ${index}`);
|
123
|
+
obj.questionIndex = index;
|
124
|
+
obj.questionType = 'multipleSelection'
|
125
|
+
lrnPage.questionWrapper()
|
126
|
+
.eq(index)
|
127
|
+
.within(() => {
|
128
|
+
lrnPage.questionInstructions()
|
129
|
+
.then(($ins) => {
|
130
|
+
let text = $ins[0].innerText;
|
131
|
+
obj.gradingQuestionInstructions = text;
|
132
|
+
});
|
133
|
+
|
134
|
+
let optionsText = [];
|
135
|
+
let correctAnswersIndex = [];
|
136
|
+
lrnPage.mcqOptionWrapper()
|
137
|
+
.each(($optionWrapper, index) => {
|
138
|
+
if ($optionWrapper[0].className.includes('lrn_valid')) {
|
139
|
+
correctAnswersIndex.push(index)
|
140
|
+
}
|
141
|
+
cy.wrap($optionWrapper)
|
142
|
+
.within(() => {
|
143
|
+
lrnPage.mcqOptionContent()
|
144
|
+
.then(($el) => {
|
145
|
+
optionsText.push($el[0].innerText);
|
146
|
+
});
|
147
|
+
});
|
148
|
+
});
|
149
|
+
obj.gradingOptionsText = optionsText;
|
150
|
+
obj.correctAnswersIndex = correctAnswersIndex;
|
151
|
+
});
|
152
|
+
lrnGradingDataArr.push(obj);
|
153
|
+
},
|
154
|
+
|
155
|
+
trueOrFalse: (lrnQuestionDataArr, index) => {
|
156
|
+
let obj = {};
|
157
|
+
cy.log(`Extracting the question instructions and options from question ${index}`);
|
158
|
+
obj.questionIndex = index;
|
159
|
+
obj.questionType = 'trueOrFalse';
|
160
|
+
lrnPage.questionWrapper()
|
161
|
+
.eq(index)
|
162
|
+
.within(() => {
|
163
|
+
lrnPage.questionInstructions()
|
164
|
+
.then(($ins) => {
|
165
|
+
let text = $ins[0].innerText;
|
166
|
+
obj.previewQuestionInstructions = text;
|
167
|
+
});
|
168
|
+
|
169
|
+
let optionsText = [];
|
170
|
+
lrnPage.mcqOptionWrapper()
|
171
|
+
.each(($options) => {
|
172
|
+
cy.wrap($options)
|
173
|
+
.within(() => {
|
174
|
+
lrnPage.mcqOptionContent()
|
175
|
+
.then(($el) => {
|
176
|
+
let text = $el[0].innerText;
|
177
|
+
optionsText.push(text);
|
178
|
+
});
|
179
|
+
});
|
180
|
+
});
|
181
|
+
obj.previewOptionsText = optionsText;
|
182
|
+
})
|
183
|
+
lrnQuestionDataArr.push(obj);
|
184
|
+
},
|
185
|
+
|
186
|
+
trueOrFalseGrading: (lrnGradingDataArr, index) => {
|
187
|
+
let obj = {};
|
188
|
+
cy.log(`Extracting the question instructions, options and correct answers from question ${index}`);
|
189
|
+
obj.questionIndex = index;
|
190
|
+
obj.questionType = 'trueOrFalse'
|
191
|
+
lrnPage.questionWrapper()
|
192
|
+
.eq(index)
|
193
|
+
.within(() => {
|
194
|
+
lrnPage.questionInstructions()
|
195
|
+
.then(($ins) => {
|
196
|
+
let text = $ins[0].innerText;
|
197
|
+
obj.gradingQuestionInstructions = text;
|
198
|
+
});
|
199
|
+
|
200
|
+
let optionsText = [];
|
201
|
+
let correctAnswersIndex = [];
|
202
|
+
lrnPage.mcqOptionWrapper()
|
203
|
+
.each(($optionWrapper, index) => {
|
73
204
|
if ($optionWrapper[0].className.includes('lrn_valid')) {
|
74
205
|
correctAnswersIndex.push(index)
|
75
206
|
}
|
@@ -1,26 +1,25 @@
|
|
1
|
+
import { multipleSelectionPage } from "../../pages";
|
1
2
|
import { singleSelectionPage } from "../../pages/singleSelectionPage"
|
3
|
+
import utilities from "../helpers/utilities";
|
2
4
|
|
3
5
|
export const verifyIeQuestionData = {
|
4
6
|
singleSelection: (expectedQuestionData, index) => {
|
5
7
|
cy.get('.ngie-single-select')
|
6
8
|
.eq(index)
|
7
9
|
.within(() => {
|
8
|
-
singleSelectionPage.questionInstructionsText()
|
9
|
-
.verifyInnerText(expectedQuestionData.previewQuestionInstructions);
|
10
|
+
utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.previewQuestionInstructions);
|
10
11
|
singleSelectionPage.optionTextPreviewTab()
|
11
12
|
.then(($elements) => {
|
12
13
|
expect($elements.length).to.be.eq(expectedQuestionData.previewOptionsText.length);
|
13
14
|
});
|
14
15
|
singleSelectionPage.optionTextPreviewTab()
|
15
16
|
.each((optionElem, optionIndex) => {
|
16
|
-
cy.wrap(optionElem)
|
17
|
-
.verifyInnerText(expectedQuestionData.previewOptionsText[optionIndex]);
|
17
|
+
utilities.verifyInnerText(cy.wrap(optionElem), expectedQuestionData.previewOptionsText[optionIndex]);
|
18
18
|
});
|
19
19
|
});
|
20
20
|
},
|
21
|
-
|
21
|
+
|
22
22
|
singleSelectionGrading: (expectedQuestionData, index) => {
|
23
|
-
console.log('grading data', expectedQuestionData);
|
24
23
|
cy.get('.ngie-single-select')
|
25
24
|
.eq(index)
|
26
25
|
.within(() => {
|
@@ -48,6 +47,92 @@ export const verifyIeQuestionData = {
|
|
48
47
|
});
|
49
48
|
},
|
50
49
|
|
50
|
+
multipleSelection: (expectedQuestionData, index) => {
|
51
|
+
cy.get('.ngie-mcq')
|
52
|
+
.eq(index)
|
53
|
+
.within(() => {
|
54
|
+
utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.previewQuestionInstructions);
|
55
|
+
singleSelectionPage.optionTextPreviewTab()
|
56
|
+
.then(($elements) => {
|
57
|
+
expect($elements.length).to.be.eq(expectedQuestionData.previewOptionsText.length);
|
58
|
+
});
|
59
|
+
singleSelectionPage.optionTextPreviewTab()
|
60
|
+
.each((optionElem, optionIndex) => {
|
61
|
+
utilities.verifyInnerText(cy.wrap(optionElem), expectedQuestionData.previewOptionsText[optionIndex]);
|
62
|
+
});
|
63
|
+
});
|
64
|
+
},
|
65
|
+
|
66
|
+
multipleSelectionGrading: (expectedQuestionData, index) => {
|
67
|
+
cy.get('.ngie-mcq')
|
68
|
+
.eq(index)
|
69
|
+
.within(() => {
|
70
|
+
utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.gradingQuestionInstructions);
|
71
|
+
multipleSelectionPage.optionsWrapperGradingView()
|
72
|
+
.then(($elements) => {
|
73
|
+
expect($elements.length).to.be.eq(expectedQuestionData.gradingOptionsText.length);
|
74
|
+
});
|
75
|
+
multipleSelectionPage.optionsWrapperGradingView()
|
76
|
+
.each(($optionWrapper, optionIndex) => {
|
77
|
+
cy.wrap($optionWrapper)
|
78
|
+
.within(() => {
|
79
|
+
if (expectedQuestionData.correctAnswersIndex.includes(optionIndex)) {
|
80
|
+
cy.get('.tick-icon-wrapper')
|
81
|
+
.should('exist');
|
82
|
+
} else {
|
83
|
+
cy.get('.tick-icon-wrapper')
|
84
|
+
.should('not.exist');
|
85
|
+
}
|
86
|
+
utilities.verifyInnerText(singleSelectionPage.optionTextPreviewTab(), expectedQuestionData.gradingOptionsText[optionIndex]);
|
87
|
+
});
|
88
|
+
});
|
89
|
+
});
|
90
|
+
},
|
91
|
+
|
92
|
+
trueOrFalse: (expectedQuestionData, index) => {
|
93
|
+
cy.get('.ngie-true-or-false')
|
94
|
+
.eq(index)
|
95
|
+
.within(() => {
|
96
|
+
utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.previewQuestionInstructions);
|
97
|
+
singleSelectionPage.optionTextPreviewTab()
|
98
|
+
.then(($elements) => {
|
99
|
+
expect($elements.length).to.be.eq(expectedQuestionData.previewOptionsText.length);
|
100
|
+
});
|
101
|
+
singleSelectionPage.optionTextPreviewTab()
|
102
|
+
.each((optionElem, optionIndex) => {
|
103
|
+
utilities.verifyInnerText(cy.wrap(optionElem), expectedQuestionData.previewOptionsText[optionIndex]);
|
104
|
+
});
|
105
|
+
});
|
106
|
+
},
|
107
|
+
|
108
|
+
trueOrFalseGrading: (expectedQuestionData, index) => {
|
109
|
+
cy.get('.ngie-true-or-false')
|
110
|
+
.eq(index)
|
111
|
+
.within(() => {
|
112
|
+
singleSelectionPage.questionInstructionsText()
|
113
|
+
.verifyInnerText(expectedQuestionData.gradingQuestionInstructions);
|
114
|
+
singleSelectionPage.optionsWrapperGradingView()
|
115
|
+
.then(($elements) => {
|
116
|
+
expect($elements.length).to.be.eq(expectedQuestionData.gradingOptionsText.length);
|
117
|
+
});
|
118
|
+
singleSelectionPage.optionsWrapperGradingView()
|
119
|
+
.each(($optionWrapper, optionIndex) => {
|
120
|
+
cy.wrap($optionWrapper)
|
121
|
+
.within(() => {
|
122
|
+
if (expectedQuestionData.correctAnswersIndex.includes(optionIndex)) {
|
123
|
+
cy.get('.tick-icon-wrapper')
|
124
|
+
.should('exist');
|
125
|
+
} else {
|
126
|
+
cy.get('.tick-icon-wrapper')
|
127
|
+
.should('not.exist');
|
128
|
+
}
|
129
|
+
singleSelectionPage.optionTextPreviewTab()
|
130
|
+
.verifyInnerText(expectedQuestionData.gradingOptionsText[optionIndex])
|
131
|
+
});
|
132
|
+
});
|
133
|
+
});
|
134
|
+
},
|
135
|
+
|
51
136
|
textEntryMath: (expectedQuestionData, index) => {
|
52
137
|
|
53
138
|
},
|
package/package.json
CHANGED
package/scripts/awsHelper.mjs
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import fetch from "node-fetch";
|
2
2
|
export async function getS3Object() {
|
3
3
|
try {
|
4
|
-
const objectUrl = 'https://namespace-itemengine-qa-integration-tests-artifacts.s3.us-west-2.amazonaws.com/migrationFixtures.json?response-content-disposition=inline&X-Amz-Security-Token=
|
4
|
+
const objectUrl = 'https://namespace-itemengine-qa-integration-tests-artifacts.s3.us-west-2.amazonaws.com/migrationFixtures.json?response-content-disposition=inline&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEOD%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCmFwLXNvdXRoLTEiRzBFAiEAhJBdPZO2qmuQeXUMq50Ck%2B%2Fddrk6GFjKmCAe95RGPNsCIFDpqSL7cAONDj28pYxCRNaaukvNPiBA%2BpmoxTe9%2B0nFKv8DCLn%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEQAxoMOTY1MzMxMTExMTY2Igz1SVrd3atKQhdexv8q0wNlVxmXpHIEFFXmikuMJHdyUGwYFh8Uw3WSq7zoHtC2Oq7dZ6rhbERSttG25Xx6Lpw3LE%2FkEQ0URKZLaIo7WXgAvmmnc%2F5EFFFyOejBE2R7xmBHFrgdoAYpMQlZEnF4kE9Y1OQhkyygLSIyqyOxLzdDHJ8gcwouezC6UuXMc0BMMzzHL5oWE1VaY71uVVignBOQ%2Brmw%2BziuiyFiczzFy3GxUV7RfFqGjDOcuwDGqEpcmd5CDYu1Q3mJFmoeoNKSAWib%2BJcZLt6%2F7zxjwVA9kcrhQOrd5S6zoVZyPePCWCHVjku8itUiJkOR2LSBcvWYp17AIC7fUgPoLA0l%2BshNzo13TyP71QPOnGHHezkGf4kh82bXPmieTN2ydyoDh1N9urgQsFmI%2ByXky6awPjgjofwKN3xhZXBZhVWMWql74cUNjgonKZD4o9DqDpNWc1D4En7LJT9%2BnTiw7%2BOSrUIa5GFsbLJsucWP%2FWmEPZoGNxLf%2F13smSCLPdUIK3VpmbxB5Wjg89mmiyyV8xrtOGmjStKP0DWBZAr%2BRt2AyHaChT4AxCAOiLdQB59vinaVHezK411MPzvDbymdKa6bDsYF4IztVatTHAGasiNYXp1khcGo0OR%2FqDDos7yuBjqUAmVKtLrz6Ms7MxUrmj%2FRAJWEDmqXDq2lri6nKc6jaf6rq56OoqOZf5PlYvJCRXoyjgcMbBGEwy9r0X1AioMFmdE5iB%2BUTP4joFhcekcBol5%2F1X85RXtPAbh7%2FqYTybaz59jLROl1uB8DB3IgM1mgd%2F0fV0pSl6KNNjmpd50FFGRlDVBaOhRce6430x%2F2GX2KSuWBRsVol0H5wAKhZtQXrDxKy2pn7JVc0JDKEgfJPNppyOJAH3KtR2ZQGzgp9IN2M1lhTgUnDMRME6xo649lFV8D%2B4hAkCPhoa18ljlRlD1WTb3FPBhOOIWgJjgudvGV5LRIrfg9xTGnggk3OQvLCo%2BH%2FoZOyeclEqMnmikJL2mTi7NIEQ%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240216T081731Z&X-Amz-SignedHeaders=host&X-Amz-Expires=43200&X-Amz-Credential=ASIA6BQRXZT7DHXURHQ6%2F20240216%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Signature=b7d5e57eea218d685e0aff74fd3222b0c1c9716a2d0485e9c9ac24e0c464ff7e';
|
5
5
|
const res = await fetch(objectUrl);
|
6
6
|
if (!res.ok) {
|
7
7
|
throw new Error(`Failed to fetch JSON file (${objectUrl}): ${res.statusText}`);
|