itemengine-cypress-automation 1.0.109 → 1.0.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cypress/e2e/migration/migration.js +18 -14
- package/cypress/e2e/migration/migration2.js +18 -17
- package/cypress/e2e/migration/migration3.js +18 -14
- package/cypress/e2e/migration/migration4.js +17 -13
- package/cypress/e2e/migration/migration5.js +81 -75
- package/cypress/support/migrationHelpers/extractLrnQuestionData.js +203 -10
- package/cypress/support/migrationHelpers/lrnQestionTypesENUM.js +3 -0
- package/cypress/support/migrationHelpers/verifyIeQuestionData.js +188 -39
- package/package.json +1 -1
- package/scripts/awsHelper.mjs +1 -1
@@ -2,7 +2,7 @@ import { autoScoredScoringPreviewTab } from "../../pages/components";
|
|
2
2
|
import utilities from "../../support/helpers/utilities";
|
3
3
|
import { extractLrnQuestionData, lrnPage } from "../../support/migrationHelpers/extractLrnQuestionData";
|
4
4
|
import lrnQuestionTypesENUM from "../../support/migrationHelpers/lrnQestionTypesENUM";
|
5
|
-
import { verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
|
5
|
+
import { iePage, verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
|
6
6
|
|
7
7
|
Cypress.Commands.add('learnosityLoaderWait', () => {
|
8
8
|
// cy.get('.lrn-spinner')
|
@@ -15,13 +15,13 @@ Cypress.Commands.add('learnosityLoaderWait', () => {
|
|
15
15
|
});
|
16
16
|
|
17
17
|
Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
|
18
|
-
|
18
|
+
iePage.questionWrapper()
|
19
19
|
.then((elements) => {
|
20
20
|
if (retries <= 0) {
|
21
21
|
throw new Error('Element did not load in time')
|
22
22
|
};
|
23
23
|
if (elements.length < count) {
|
24
|
-
|
24
|
+
iePage.questionWrapper()
|
25
25
|
.last()
|
26
26
|
.scrollIntoView()
|
27
27
|
.wait(1000);
|
@@ -29,14 +29,14 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
|
|
29
29
|
};
|
30
30
|
cy.log('All question parts loaded')
|
31
31
|
});
|
32
|
-
|
33
|
-
cy.get('[id="question-item-instruction-loader"]')
|
32
|
+
iePage.barsPreloader()
|
34
33
|
.should('not.exist');
|
35
34
|
cy.learnosityLoaderWait();
|
36
35
|
})
|
37
36
|
|
38
|
-
const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');
|
37
|
+
const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');
|
39
38
|
const migrationQuestionTypesLrn = migrationQuestionTypes.map((questionType) => lrnQuestionTypesENUM[questionType]);
|
39
|
+
let lrnMcqTypesRegex = /Multiple choice – standard|Multiple choice – multiple response|True or false|Multiple choice – block layout/;
|
40
40
|
|
41
41
|
let lrnQuestionDataArr = [];
|
42
42
|
let lrnGradingDataArr = [];
|
@@ -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
|
});
|
@@ -72,10 +73,12 @@ if (referenceIds.length > 0) {
|
|
72
73
|
lrnPage.questionTypeDiv()
|
73
74
|
.each(($el, index) => {
|
74
75
|
let currQuestionType = $el[0].innerText
|
76
|
+
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
77
|
+
currQuestionType = lrnQuestionTypesENUM.mcq
|
78
|
+
}
|
75
79
|
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
76
80
|
switch (currQuestionType) {
|
77
|
-
case lrnQuestionTypesENUM.
|
78
|
-
case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
81
|
+
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
|
79
82
|
default: throw new Error('Invalid lrn question type');
|
80
83
|
}
|
81
84
|
}
|
@@ -89,8 +92,7 @@ if (referenceIds.length > 0) {
|
|
89
92
|
currQuestionTypeArr.forEach((questionData, index) => {
|
90
93
|
cy.log(`Verifying data for ${questionType} ${index}`);
|
91
94
|
switch (questionType) {
|
92
|
-
case '
|
93
|
-
case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
95
|
+
case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
|
94
96
|
default: throw new Error('Invalid ngie question type');
|
95
97
|
}
|
96
98
|
});
|
@@ -102,10 +104,12 @@ if (referenceIds.length > 0) {
|
|
102
104
|
lrnPage.questionTypeDiv()
|
103
105
|
.each(($el, index) => {
|
104
106
|
let currQuestionType = $el[0].innerText
|
107
|
+
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
108
|
+
currQuestionType = lrnQuestionTypesENUM.mcq
|
109
|
+
}
|
105
110
|
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
106
111
|
switch (currQuestionType) {
|
107
|
-
case lrnQuestionTypesENUM.
|
108
|
-
// case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
112
|
+
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
|
109
113
|
default: throw new Error('Invalid lrn question type');
|
110
114
|
}
|
111
115
|
}
|
@@ -114,14 +118,14 @@ if (referenceIds.length > 0) {
|
|
114
118
|
|
115
119
|
it(`Verifying itemengine grading data for item "${referenceId}"`, () => {
|
116
120
|
autoScoredScoringPreviewTab.steps.switchToGradingView();
|
121
|
+
cy.wait(500);
|
117
122
|
migrationQuestionTypes.forEach((questionType) => {
|
118
123
|
cy.log(`Verifying grading data for all ${questionType} question type`);
|
119
124
|
let currQuestionTypeArr = lrnGradingDataArr.filter((question) => question.questionType === questionType);
|
120
125
|
currQuestionTypeArr.forEach((questionData, index) => {
|
121
126
|
cy.log(`Verifying grading data for ${questionType} ${index}`);
|
122
127
|
switch (questionType) {
|
123
|
-
case '
|
124
|
-
// case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
128
|
+
case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
|
125
129
|
default: throw new Error('Invalid ngie question type');
|
126
130
|
}
|
127
131
|
});
|
@@ -2,7 +2,7 @@ import { autoScoredScoringPreviewTab } from "../../pages/components";
|
|
2
2
|
import utilities from "../../support/helpers/utilities";
|
3
3
|
import { extractLrnQuestionData, lrnPage } from "../../support/migrationHelpers/extractLrnQuestionData";
|
4
4
|
import lrnQuestionTypesENUM from "../../support/migrationHelpers/lrnQestionTypesENUM";
|
5
|
-
import { verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
|
5
|
+
import { iePage, verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
|
6
6
|
|
7
7
|
Cypress.Commands.add('learnosityLoaderWait', () => {
|
8
8
|
// cy.get('.lrn-spinner')
|
@@ -15,13 +15,13 @@ Cypress.Commands.add('learnosityLoaderWait', () => {
|
|
15
15
|
});
|
16
16
|
|
17
17
|
Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
|
18
|
-
|
18
|
+
iePage.questionWrapper()
|
19
19
|
.then((elements) => {
|
20
20
|
if (retries <= 0) {
|
21
21
|
throw new Error('Element did not load in time')
|
22
22
|
};
|
23
23
|
if (elements.length < count) {
|
24
|
-
|
24
|
+
iePage.questionWrapper()
|
25
25
|
.last()
|
26
26
|
.scrollIntoView()
|
27
27
|
.wait(1000);
|
@@ -29,17 +29,14 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
|
|
29
29
|
};
|
30
30
|
cy.log('All question parts loaded')
|
31
31
|
});
|
32
|
-
|
33
|
-
cy.get('[id="question-item-instruction-loader"]')
|
32
|
+
iePage.barsPreloader()
|
34
33
|
.should('not.exist');
|
35
34
|
cy.learnosityLoaderWait();
|
36
35
|
})
|
37
36
|
|
38
|
-
const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');
|
37
|
+
const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');
|
39
38
|
const migrationQuestionTypesLrn = migrationQuestionTypes.map((questionType) => lrnQuestionTypesENUM[questionType]);
|
40
|
-
|
41
|
-
console.log('migrationQuestionTypes', Cypress.env('migrationQuestionTypes'))
|
42
|
-
console.log('referenceIds', Cypress.env('referenceIds'))
|
39
|
+
let lrnMcqTypesRegex = /Multiple choice – standard|Multiple choice – multiple response|True or false|Multiple choice – block layout/;
|
43
40
|
|
44
41
|
let lrnQuestionDataArr = [];
|
45
42
|
let lrnGradingDataArr = [];
|
@@ -67,6 +64,7 @@ if (referenceIds.length > 0) {
|
|
67
64
|
|
68
65
|
after(() => {
|
69
66
|
console.log(lrnQuestionDataArr)
|
67
|
+
console.log(lrnGradingDataArr)
|
70
68
|
lrnQuestionDataArr = [];
|
71
69
|
lrnGradingDataArr = [];
|
72
70
|
});
|
@@ -75,10 +73,12 @@ if (referenceIds.length > 0) {
|
|
75
73
|
lrnPage.questionTypeDiv()
|
76
74
|
.each(($el, index) => {
|
77
75
|
let currQuestionType = $el[0].innerText
|
76
|
+
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
77
|
+
currQuestionType = lrnQuestionTypesENUM.mcq
|
78
|
+
}
|
78
79
|
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
79
80
|
switch (currQuestionType) {
|
80
|
-
case lrnQuestionTypesENUM.
|
81
|
-
case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
81
|
+
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
|
82
82
|
default: throw new Error('Invalid lrn question type');
|
83
83
|
}
|
84
84
|
}
|
@@ -92,8 +92,7 @@ if (referenceIds.length > 0) {
|
|
92
92
|
currQuestionTypeArr.forEach((questionData, index) => {
|
93
93
|
cy.log(`Verifying data for ${questionType} ${index}`);
|
94
94
|
switch (questionType) {
|
95
|
-
case '
|
96
|
-
case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
95
|
+
case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
|
97
96
|
default: throw new Error('Invalid ngie question type');
|
98
97
|
}
|
99
98
|
});
|
@@ -105,10 +104,12 @@ if (referenceIds.length > 0) {
|
|
105
104
|
lrnPage.questionTypeDiv()
|
106
105
|
.each(($el, index) => {
|
107
106
|
let currQuestionType = $el[0].innerText
|
107
|
+
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
108
|
+
currQuestionType = lrnQuestionTypesENUM.mcq
|
109
|
+
}
|
108
110
|
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
109
111
|
switch (currQuestionType) {
|
110
|
-
case lrnQuestionTypesENUM.
|
111
|
-
// case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
112
|
+
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
|
112
113
|
default: throw new Error('Invalid lrn question type');
|
113
114
|
}
|
114
115
|
}
|
@@ -117,14 +118,14 @@ if (referenceIds.length > 0) {
|
|
117
118
|
|
118
119
|
it(`Verifying itemengine grading data for item "${referenceId}"`, () => {
|
119
120
|
autoScoredScoringPreviewTab.steps.switchToGradingView();
|
121
|
+
cy.wait(500);
|
120
122
|
migrationQuestionTypes.forEach((questionType) => {
|
121
123
|
cy.log(`Verifying grading data for all ${questionType} question type`);
|
122
124
|
let currQuestionTypeArr = lrnGradingDataArr.filter((question) => question.questionType === questionType);
|
123
125
|
currQuestionTypeArr.forEach((questionData, index) => {
|
124
126
|
cy.log(`Verifying grading data for ${questionType} ${index}`);
|
125
127
|
switch (questionType) {
|
126
|
-
case '
|
127
|
-
// case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
128
|
+
case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
|
128
129
|
default: throw new Error('Invalid ngie question type');
|
129
130
|
}
|
130
131
|
});
|
@@ -2,7 +2,7 @@ import { autoScoredScoringPreviewTab } from "../../pages/components";
|
|
2
2
|
import utilities from "../../support/helpers/utilities";
|
3
3
|
import { extractLrnQuestionData, lrnPage } from "../../support/migrationHelpers/extractLrnQuestionData";
|
4
4
|
import lrnQuestionTypesENUM from "../../support/migrationHelpers/lrnQestionTypesENUM";
|
5
|
-
import { verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
|
5
|
+
import { iePage, verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
|
6
6
|
|
7
7
|
Cypress.Commands.add('learnosityLoaderWait', () => {
|
8
8
|
// cy.get('.lrn-spinner')
|
@@ -15,13 +15,13 @@ Cypress.Commands.add('learnosityLoaderWait', () => {
|
|
15
15
|
});
|
16
16
|
|
17
17
|
Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
|
18
|
-
|
18
|
+
iePage.questionWrapper()
|
19
19
|
.then((elements) => {
|
20
20
|
if (retries <= 0) {
|
21
21
|
throw new Error('Element did not load in time')
|
22
22
|
};
|
23
23
|
if (elements.length < count) {
|
24
|
-
|
24
|
+
iePage.questionWrapper()
|
25
25
|
.last()
|
26
26
|
.scrollIntoView()
|
27
27
|
.wait(1000);
|
@@ -29,14 +29,14 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
|
|
29
29
|
};
|
30
30
|
cy.log('All question parts loaded')
|
31
31
|
});
|
32
|
-
|
33
|
-
cy.get('[id="question-item-instruction-loader"]')
|
32
|
+
iePage.barsPreloader()
|
34
33
|
.should('not.exist');
|
35
34
|
cy.learnosityLoaderWait();
|
36
35
|
})
|
37
36
|
|
38
|
-
const migrationQuestionTypes =
|
37
|
+
const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');
|
39
38
|
const migrationQuestionTypesLrn = migrationQuestionTypes.map((questionType) => lrnQuestionTypesENUM[questionType]);
|
39
|
+
let lrnMcqTypesRegex = /Multiple choice – standard|Multiple choice – multiple response|True or false|Multiple choice – block layout/;
|
40
40
|
|
41
41
|
let lrnQuestionDataArr = [];
|
42
42
|
let lrnGradingDataArr = [];
|
@@ -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
|
});
|
@@ -72,10 +73,12 @@ if (referenceIds.length > 0) {
|
|
72
73
|
lrnPage.questionTypeDiv()
|
73
74
|
.each(($el, index) => {
|
74
75
|
let currQuestionType = $el[0].innerText
|
76
|
+
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
77
|
+
currQuestionType = lrnQuestionTypesENUM.mcq
|
78
|
+
}
|
75
79
|
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
76
80
|
switch (currQuestionType) {
|
77
|
-
case lrnQuestionTypesENUM.
|
78
|
-
case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
81
|
+
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
|
79
82
|
default: throw new Error('Invalid lrn question type');
|
80
83
|
}
|
81
84
|
}
|
@@ -89,8 +92,7 @@ if (referenceIds.length > 0) {
|
|
89
92
|
currQuestionTypeArr.forEach((questionData, index) => {
|
90
93
|
cy.log(`Verifying data for ${questionType} ${index}`);
|
91
94
|
switch (questionType) {
|
92
|
-
case '
|
93
|
-
case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
95
|
+
case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
|
94
96
|
default: throw new Error('Invalid ngie question type');
|
95
97
|
}
|
96
98
|
});
|
@@ -102,10 +104,12 @@ if (referenceIds.length > 0) {
|
|
102
104
|
lrnPage.questionTypeDiv()
|
103
105
|
.each(($el, index) => {
|
104
106
|
let currQuestionType = $el[0].innerText
|
107
|
+
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
108
|
+
currQuestionType = lrnQuestionTypesENUM.mcq
|
109
|
+
}
|
105
110
|
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
106
111
|
switch (currQuestionType) {
|
107
|
-
case lrnQuestionTypesENUM.
|
108
|
-
// case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
112
|
+
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
|
109
113
|
default: throw new Error('Invalid lrn question type');
|
110
114
|
}
|
111
115
|
}
|
@@ -114,14 +118,14 @@ if (referenceIds.length > 0) {
|
|
114
118
|
|
115
119
|
it(`Verifying itemengine grading data for item "${referenceId}"`, () => {
|
116
120
|
autoScoredScoringPreviewTab.steps.switchToGradingView();
|
121
|
+
cy.wait(500);
|
117
122
|
migrationQuestionTypes.forEach((questionType) => {
|
118
123
|
cy.log(`Verifying grading data for all ${questionType} question type`);
|
119
124
|
let currQuestionTypeArr = lrnGradingDataArr.filter((question) => question.questionType === questionType);
|
120
125
|
currQuestionTypeArr.forEach((questionData, index) => {
|
121
126
|
cy.log(`Verifying grading data for ${questionType} ${index}`);
|
122
127
|
switch (questionType) {
|
123
|
-
case '
|
124
|
-
// case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
128
|
+
case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
|
125
129
|
default: throw new Error('Invalid ngie question type');
|
126
130
|
}
|
127
131
|
});
|
@@ -2,7 +2,7 @@ import { autoScoredScoringPreviewTab } from "../../pages/components";
|
|
2
2
|
import utilities from "../../support/helpers/utilities";
|
3
3
|
import { extractLrnQuestionData, lrnPage } from "../../support/migrationHelpers/extractLrnQuestionData";
|
4
4
|
import lrnQuestionTypesENUM from "../../support/migrationHelpers/lrnQestionTypesENUM";
|
5
|
-
import { verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
|
5
|
+
import { iePage, verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
|
6
6
|
|
7
7
|
Cypress.Commands.add('learnosityLoaderWait', () => {
|
8
8
|
// cy.get('.lrn-spinner')
|
@@ -15,13 +15,13 @@ Cypress.Commands.add('learnosityLoaderWait', () => {
|
|
15
15
|
});
|
16
16
|
|
17
17
|
Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
|
18
|
-
|
18
|
+
iePage.questionWrapper()
|
19
19
|
.then((elements) => {
|
20
20
|
if (retries <= 0) {
|
21
21
|
throw new Error('Element did not load in time')
|
22
22
|
};
|
23
23
|
if (elements.length < count) {
|
24
|
-
|
24
|
+
iePage.questionWrapper()
|
25
25
|
.last()
|
26
26
|
.scrollIntoView()
|
27
27
|
.wait(1000);
|
@@ -29,14 +29,14 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
|
|
29
29
|
};
|
30
30
|
cy.log('All question parts loaded')
|
31
31
|
});
|
32
|
-
|
33
|
-
cy.get('[id="question-item-instruction-loader"]')
|
32
|
+
iePage.barsPreloader()
|
34
33
|
.should('not.exist');
|
35
34
|
cy.learnosityLoaderWait();
|
36
35
|
})
|
37
36
|
|
38
37
|
const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');
|
39
38
|
const migrationQuestionTypesLrn = migrationQuestionTypes.map((questionType) => lrnQuestionTypesENUM[questionType]);
|
39
|
+
let lrnMcqTypesRegex = /Multiple choice – standard|Multiple choice – multiple response|True or false|Multiple choice – block layout/;
|
40
40
|
|
41
41
|
let lrnQuestionDataArr = [];
|
42
42
|
let lrnGradingDataArr = [];
|
@@ -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
|
});
|
@@ -72,10 +73,12 @@ if (referenceIds.length > 0) {
|
|
72
73
|
lrnPage.questionTypeDiv()
|
73
74
|
.each(($el, index) => {
|
74
75
|
let currQuestionType = $el[0].innerText
|
76
|
+
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
77
|
+
currQuestionType = lrnQuestionTypesENUM.mcq
|
78
|
+
}
|
75
79
|
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
76
80
|
switch (currQuestionType) {
|
77
|
-
case lrnQuestionTypesENUM.
|
78
|
-
case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
81
|
+
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
|
79
82
|
default: throw new Error('Invalid lrn question type');
|
80
83
|
}
|
81
84
|
}
|
@@ -89,8 +92,7 @@ if (referenceIds.length > 0) {
|
|
89
92
|
currQuestionTypeArr.forEach((questionData, index) => {
|
90
93
|
cy.log(`Verifying data for ${questionType} ${index}`);
|
91
94
|
switch (questionType) {
|
92
|
-
case '
|
93
|
-
case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
95
|
+
case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
|
94
96
|
default: throw new Error('Invalid ngie question type');
|
95
97
|
}
|
96
98
|
});
|
@@ -102,10 +104,12 @@ if (referenceIds.length > 0) {
|
|
102
104
|
lrnPage.questionTypeDiv()
|
103
105
|
.each(($el, index) => {
|
104
106
|
let currQuestionType = $el[0].innerText
|
107
|
+
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
108
|
+
currQuestionType = lrnQuestionTypesENUM.mcq
|
109
|
+
}
|
105
110
|
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
106
111
|
switch (currQuestionType) {
|
107
|
-
case lrnQuestionTypesENUM.
|
108
|
-
// case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
112
|
+
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
|
109
113
|
default: throw new Error('Invalid lrn question type');
|
110
114
|
}
|
111
115
|
}
|
@@ -114,14 +118,14 @@ if (referenceIds.length > 0) {
|
|
114
118
|
|
115
119
|
it(`Verifying itemengine grading data for item "${referenceId}"`, () => {
|
116
120
|
autoScoredScoringPreviewTab.steps.switchToGradingView();
|
121
|
+
cy.wait(500);
|
117
122
|
migrationQuestionTypes.forEach((questionType) => {
|
118
123
|
cy.log(`Verifying grading data for all ${questionType} question type`);
|
119
124
|
let currQuestionTypeArr = lrnGradingDataArr.filter((question) => question.questionType === questionType);
|
120
125
|
currQuestionTypeArr.forEach((questionData, index) => {
|
121
126
|
cy.log(`Verifying grading data for ${questionType} ${index}`);
|
122
127
|
switch (questionType) {
|
123
|
-
case '
|
124
|
-
// case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
128
|
+
case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
|
125
129
|
default: throw new Error('Invalid ngie question type');
|
126
130
|
}
|
127
131
|
});
|
@@ -2,7 +2,7 @@ import { autoScoredScoringPreviewTab } from "../../pages/components";
|
|
2
2
|
import utilities from "../../support/helpers/utilities";
|
3
3
|
import { extractLrnQuestionData, lrnPage } from "../../support/migrationHelpers/extractLrnQuestionData";
|
4
4
|
import lrnQuestionTypesENUM from "../../support/migrationHelpers/lrnQestionTypesENUM";
|
5
|
-
import { verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
|
5
|
+
import { iePage, verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
|
6
6
|
|
7
7
|
Cypress.Commands.add('learnosityLoaderWait', () => {
|
8
8
|
// cy.get('.lrn-spinner')
|
@@ -15,13 +15,13 @@ Cypress.Commands.add('learnosityLoaderWait', () => {
|
|
15
15
|
});
|
16
16
|
|
17
17
|
Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
|
18
|
-
|
18
|
+
iePage.questionWrapper()
|
19
19
|
.then((elements) => {
|
20
20
|
if (retries <= 0) {
|
21
21
|
throw new Error('Element did not load in time')
|
22
22
|
};
|
23
23
|
if (elements.length < count) {
|
24
|
-
|
24
|
+
iePage.questionWrapper()
|
25
25
|
.last()
|
26
26
|
.scrollIntoView()
|
27
27
|
.wait(1000);
|
@@ -29,103 +29,109 @@ Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
|
|
29
29
|
};
|
30
30
|
cy.log('All question parts loaded')
|
31
31
|
});
|
32
|
-
|
33
|
-
cy.get('[id="question-item-instruction-loader"]')
|
32
|
+
iePage.barsPreloader()
|
34
33
|
.should('not.exist');
|
35
34
|
cy.learnosityLoaderWait();
|
36
35
|
})
|
37
36
|
|
38
37
|
const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');
|
39
38
|
const migrationQuestionTypesLrn = migrationQuestionTypes.map((questionType) => lrnQuestionTypesENUM[questionType]);
|
39
|
+
let lrnMcqTypesRegex = /Multiple choice – standard|Multiple choice – multiple response|True or false|Multiple choice – block layout/;
|
40
40
|
|
41
41
|
let lrnQuestionDataArr = [];
|
42
42
|
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
|
-
case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelection(lrnQuestionDataArr, index);
|
77
|
-
case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
78
|
-
default: throw new Error('Invalid lrn question type');
|
72
|
+
it(`Extracting learnosity preview data for item "${referenceId}"`, () => {
|
73
|
+
lrnPage.questionTypeDiv()
|
74
|
+
.each(($el, index) => {
|
75
|
+
let currQuestionType = $el[0].innerText
|
76
|
+
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
77
|
+
currQuestionType = lrnQuestionTypesENUM.mcq
|
79
78
|
}
|
80
|
-
|
81
|
-
|
82
|
-
|
79
|
+
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
80
|
+
switch (currQuestionType) {
|
81
|
+
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
|
82
|
+
default: throw new Error('Invalid lrn question type');
|
83
|
+
}
|
84
|
+
}
|
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 'mcq': return verifyIeQuestionData.mcq(questionData, index);
|
96
|
+
default: throw new Error('Invalid ngie question type');
|
97
|
+
}
|
98
|
+
});
|
95
99
|
});
|
96
100
|
});
|
97
|
-
});
|
98
101
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelectionGrading(lrnGradingDataArr, index);
|
107
|
-
// case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
108
|
-
default: throw new Error('Invalid lrn question type');
|
102
|
+
it(`Extracting learnosity grading data for item "${referenceId}"`, () => {
|
103
|
+
lrnPage.steps.checkShowAnswersToggle();
|
104
|
+
lrnPage.questionTypeDiv()
|
105
|
+
.each(($el, index) => {
|
106
|
+
let currQuestionType = $el[0].innerText
|
107
|
+
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
108
|
+
currQuestionType = lrnQuestionTypesENUM.mcq
|
109
109
|
}
|
110
|
-
|
111
|
-
|
112
|
-
|
110
|
+
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
111
|
+
switch (currQuestionType) {
|
112
|
+
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
|
113
|
+
default: throw new Error('Invalid lrn question type');
|
114
|
+
}
|
115
|
+
}
|
116
|
+
});
|
117
|
+
});
|
113
118
|
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
119
|
+
it(`Verifying itemengine grading data for item "${referenceId}"`, () => {
|
120
|
+
autoScoredScoringPreviewTab.steps.switchToGradingView();
|
121
|
+
cy.wait(500);
|
122
|
+
migrationQuestionTypes.forEach((questionType) => {
|
123
|
+
cy.log(`Verifying grading data for all ${questionType} question type`);
|
124
|
+
let currQuestionTypeArr = lrnGradingDataArr.filter((question) => question.questionType === questionType);
|
125
|
+
currQuestionTypeArr.forEach((questionData, index) => {
|
126
|
+
cy.log(`Verifying grading data for ${questionType} ${index}`);
|
127
|
+
switch (questionType) {
|
128
|
+
case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
|
129
|
+
default: throw new Error('Invalid ngie question type');
|
130
|
+
}
|
131
|
+
});
|
126
132
|
});
|
127
133
|
});
|
128
134
|
});
|
129
135
|
});
|
130
136
|
});
|
131
|
-
}
|
137
|
+
}
|
@@ -16,11 +16,11 @@ export const lrnPage = {
|
|
16
16
|
}
|
17
17
|
|
18
18
|
export const extractLrnQuestionData = {
|
19
|
-
|
19
|
+
mcq: (lrnQuestionDataArr, index) => {
|
20
20
|
let obj = {};
|
21
21
|
cy.log(`Extracting the question instructions and options from question ${index}`);
|
22
22
|
obj.questionIndex = index;
|
23
|
-
obj.questionType = '
|
23
|
+
obj.questionType = 'mcq'
|
24
24
|
lrnPage.questionWrapper()
|
25
25
|
.eq(index)
|
26
26
|
.within(() => {
|
@@ -47,15 +47,11 @@ export const extractLrnQuestionData = {
|
|
47
47
|
lrnQuestionDataArr.push(obj);
|
48
48
|
},
|
49
49
|
|
50
|
-
|
51
|
-
//get the option main div, check for the isvalid class and store the index
|
52
|
-
//store blank array if there isn't any option that would imply that the question is manual scored
|
53
|
-
//verify the respective option in the itemengine if blank then no option should have tickmark
|
54
|
-
//if index then at that index there should be a tick mark but also check in other options for no tickmark
|
50
|
+
mcqGrading: (lrnGradingDataArr, index) => {
|
55
51
|
let obj = {};
|
56
52
|
cy.log(`Extracting the question instructions, options and correct answers from question ${index}`);
|
57
53
|
obj.questionIndex = index;
|
58
|
-
obj.questionType = '
|
54
|
+
obj.questionType = 'mcq'
|
59
55
|
lrnPage.questionWrapper()
|
60
56
|
.eq(index)
|
61
57
|
.within(() => {
|
@@ -69,7 +65,6 @@ export const extractLrnQuestionData = {
|
|
69
65
|
let correctAnswersIndex = [];
|
70
66
|
lrnPage.mcqOptionWrapper()
|
71
67
|
.each(($optionWrapper, index) => {
|
72
|
-
console.log($optionWrapper[0].className)
|
73
68
|
if ($optionWrapper[0].className.includes('lrn_valid')) {
|
74
69
|
correctAnswersIndex.push(index)
|
75
70
|
}
|
@@ -102,5 +97,203 @@ export const extractLrnQuestionData = {
|
|
102
97
|
});
|
103
98
|
})
|
104
99
|
lrnQuestionDataArr.push(obj);
|
105
|
-
}
|
100
|
+
},
|
101
|
+
|
102
|
+
/* singleSelection: (lrnQuestionDataArr, index) => {
|
103
|
+
let obj = {};
|
104
|
+
cy.log(`Extracting the question instructions and options from question ${index}`);
|
105
|
+
obj.questionIndex = index;
|
106
|
+
obj.questionType = 'singleSelection'
|
107
|
+
lrnPage.questionWrapper()
|
108
|
+
.eq(index)
|
109
|
+
.within(() => {
|
110
|
+
lrnPage.questionInstructions()
|
111
|
+
.then(($ins) => {
|
112
|
+
let text = $ins[0].innerText;
|
113
|
+
obj.previewQuestionInstructions = text;
|
114
|
+
});
|
115
|
+
|
116
|
+
let optionsText = [];
|
117
|
+
lrnPage.mcqOptionWrapper()
|
118
|
+
.each(($options) => {
|
119
|
+
cy.wrap($options)
|
120
|
+
.within(() => {
|
121
|
+
lrnPage.mcqOptionContent()
|
122
|
+
.then(($el) => {
|
123
|
+
let text = $el[0].innerText;
|
124
|
+
optionsText.push(text);
|
125
|
+
});
|
126
|
+
});
|
127
|
+
});
|
128
|
+
obj.previewOptionsText = optionsText;
|
129
|
+
})
|
130
|
+
lrnQuestionDataArr.push(obj);
|
131
|
+
},
|
132
|
+
|
133
|
+
singleSelectionGrading: (lrnGradingDataArr, index) => {
|
134
|
+
let obj = {};
|
135
|
+
cy.log(`Extracting the question instructions, options and correct answers from question ${index}`);
|
136
|
+
obj.questionIndex = index;
|
137
|
+
obj.questionType = 'singleSelection'
|
138
|
+
lrnPage.questionWrapper()
|
139
|
+
.eq(index)
|
140
|
+
.within(() => {
|
141
|
+
lrnPage.questionInstructions()
|
142
|
+
.then(($ins) => {
|
143
|
+
let text = $ins[0].innerText;
|
144
|
+
obj.gradingQuestionInstructions = text;
|
145
|
+
});
|
146
|
+
|
147
|
+
let optionsText = [];
|
148
|
+
let correctAnswersIndex = [];
|
149
|
+
lrnPage.mcqOptionWrapper()
|
150
|
+
.each(($optionWrapper, index) => {
|
151
|
+
if ($optionWrapper[0].className.includes('lrn_valid')) {
|
152
|
+
correctAnswersIndex.push(index)
|
153
|
+
}
|
154
|
+
cy.wrap($optionWrapper)
|
155
|
+
.within(() => {
|
156
|
+
lrnPage.mcqOptionContent()
|
157
|
+
.then(($el) => {
|
158
|
+
optionsText.push($el[0].innerText);
|
159
|
+
});
|
160
|
+
});
|
161
|
+
});
|
162
|
+
obj.gradingOptionsText = optionsText;
|
163
|
+
obj.correctAnswersIndex = correctAnswersIndex;
|
164
|
+
});
|
165
|
+
lrnGradingDataArr.push(obj);
|
166
|
+
},
|
167
|
+
|
168
|
+
multipleSelection: (lrnQuestionDataArr, index) => {
|
169
|
+
let obj = {};
|
170
|
+
cy.log(`Extracting the question instructions and options from question ${index}`);
|
171
|
+
obj.questionIndex = index;
|
172
|
+
obj.questionType = 'multipleSelection'
|
173
|
+
lrnPage.questionWrapper()
|
174
|
+
.eq(index)
|
175
|
+
.within(() => {
|
176
|
+
lrnPage.questionInstructions()
|
177
|
+
.then(($ins) => {
|
178
|
+
let text = $ins[0].innerText;
|
179
|
+
obj.previewQuestionInstructions = text;
|
180
|
+
});
|
181
|
+
|
182
|
+
let optionsText = [];
|
183
|
+
lrnPage.mcqOptionWrapper()
|
184
|
+
.each(($options) => {
|
185
|
+
cy.wrap($options)
|
186
|
+
.within(() => {
|
187
|
+
lrnPage.mcqOptionContent()
|
188
|
+
.then(($el) => {
|
189
|
+
let text = $el[0].innerText;
|
190
|
+
optionsText.push(text);
|
191
|
+
});
|
192
|
+
});
|
193
|
+
});
|
194
|
+
obj.previewOptionsText = optionsText;
|
195
|
+
})
|
196
|
+
lrnQuestionDataArr.push(obj);
|
197
|
+
},
|
198
|
+
|
199
|
+
multipleSelectionGrading: (lrnGradingDataArr, index) => {
|
200
|
+
let obj = {};
|
201
|
+
cy.log(`Extracting the question instructions, options and correct answers from question ${index}`);
|
202
|
+
obj.questionIndex = index;
|
203
|
+
obj.questionType = 'multipleSelection'
|
204
|
+
lrnPage.questionWrapper()
|
205
|
+
.eq(index)
|
206
|
+
.within(() => {
|
207
|
+
lrnPage.questionInstructions()
|
208
|
+
.then(($ins) => {
|
209
|
+
let text = $ins[0].innerText;
|
210
|
+
obj.gradingQuestionInstructions = text;
|
211
|
+
});
|
212
|
+
|
213
|
+
let optionsText = [];
|
214
|
+
let correctAnswersIndex = [];
|
215
|
+
lrnPage.mcqOptionWrapper()
|
216
|
+
.each(($optionWrapper, index) => {
|
217
|
+
if ($optionWrapper[0].className.includes('lrn_valid')) {
|
218
|
+
correctAnswersIndex.push(index)
|
219
|
+
}
|
220
|
+
cy.wrap($optionWrapper)
|
221
|
+
.within(() => {
|
222
|
+
lrnPage.mcqOptionContent()
|
223
|
+
.then(($el) => {
|
224
|
+
optionsText.push($el[0].innerText);
|
225
|
+
});
|
226
|
+
});
|
227
|
+
});
|
228
|
+
obj.gradingOptionsText = optionsText;
|
229
|
+
obj.correctAnswersIndex = correctAnswersIndex;
|
230
|
+
});
|
231
|
+
lrnGradingDataArr.push(obj);
|
232
|
+
},
|
233
|
+
|
234
|
+
trueOrFalse: (lrnQuestionDataArr, index) => {
|
235
|
+
let obj = {};
|
236
|
+
cy.log(`Extracting the question instructions and options from question ${index}`);
|
237
|
+
obj.questionIndex = index;
|
238
|
+
obj.questionType = 'trueOrFalse';
|
239
|
+
lrnPage.questionWrapper()
|
240
|
+
.eq(index)
|
241
|
+
.within(() => {
|
242
|
+
lrnPage.questionInstructions()
|
243
|
+
.then(($ins) => {
|
244
|
+
let text = $ins[0].innerText;
|
245
|
+
obj.previewQuestionInstructions = text;
|
246
|
+
});
|
247
|
+
|
248
|
+
let optionsText = [];
|
249
|
+
lrnPage.mcqOptionWrapper()
|
250
|
+
.each(($options) => {
|
251
|
+
cy.wrap($options)
|
252
|
+
.within(() => {
|
253
|
+
lrnPage.mcqOptionContent()
|
254
|
+
.then(($el) => {
|
255
|
+
let text = $el[0].innerText;
|
256
|
+
optionsText.push(text);
|
257
|
+
});
|
258
|
+
});
|
259
|
+
});
|
260
|
+
obj.previewOptionsText = optionsText;
|
261
|
+
})
|
262
|
+
lrnQuestionDataArr.push(obj);
|
263
|
+
},
|
264
|
+
|
265
|
+
trueOrFalseGrading: (lrnGradingDataArr, index) => {
|
266
|
+
let obj = {};
|
267
|
+
cy.log(`Extracting the question instructions, options and correct answers from question ${index}`);
|
268
|
+
obj.questionIndex = index;
|
269
|
+
obj.questionType = 'trueOrFalse'
|
270
|
+
lrnPage.questionWrapper()
|
271
|
+
.eq(index)
|
272
|
+
.within(() => {
|
273
|
+
lrnPage.questionInstructions()
|
274
|
+
.then(($ins) => {
|
275
|
+
let text = $ins[0].innerText;
|
276
|
+
obj.gradingQuestionInstructions = text;
|
277
|
+
});
|
278
|
+
|
279
|
+
let optionsText = [];
|
280
|
+
let correctAnswersIndex = [];
|
281
|
+
lrnPage.mcqOptionWrapper()
|
282
|
+
.each(($optionWrapper, index) => {
|
283
|
+
if ($optionWrapper[0].className.includes('lrn_valid')) {
|
284
|
+
correctAnswersIndex.push(index)
|
285
|
+
}
|
286
|
+
cy.wrap($optionWrapper)
|
287
|
+
.within(() => {
|
288
|
+
lrnPage.mcqOptionContent()
|
289
|
+
.then(($el) => {
|
290
|
+
optionsText.push($el[0].innerText);
|
291
|
+
});
|
292
|
+
});
|
293
|
+
});
|
294
|
+
obj.gradingOptionsText = optionsText;
|
295
|
+
obj.correctAnswersIndex = correctAnswersIndex;
|
296
|
+
});
|
297
|
+
lrnGradingDataArr.push(obj);
|
298
|
+
}, */
|
106
299
|
}
|
@@ -1,53 +1,72 @@
|
|
1
|
+
import { multipleSelectionPage } from "../../pages";
|
1
2
|
import { singleSelectionPage } from "../../pages/singleSelectionPage"
|
3
|
+
import utilities from "../helpers/utilities";
|
4
|
+
|
5
|
+
export const iePage = {
|
6
|
+
mcqOption: () => cy.get('.mcq_Label'),
|
7
|
+
mcqOptionWrapper: () => cy.get('div[class*="option-wrapper"]'),
|
8
|
+
questionWrapper: () => cy.get('.ngie-question-wrapper'),
|
9
|
+
barsPreloader: () => cy.get('[id="question-item-instruction-loader"]'),
|
10
|
+
};
|
2
11
|
|
3
12
|
export const verifyIeQuestionData = {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
.
|
8
|
-
|
9
|
-
.
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
mcq: (expectedQuestionData, index) => {
|
14
|
+
let ieMcqQuestionWrapperClassRegex = /ngie-single-select|ngie-mcq|ngie-true-or-false|ngie-mcq-block|ngie-single-select-block/i;
|
15
|
+
iePage.questionWrapper()
|
16
|
+
.then(($questionWrappers) => {
|
17
|
+
const $mcqQuestionWrappers = $questionWrappers.filter((index, element) => {
|
18
|
+
return ieMcqQuestionWrapperClassRegex.test(element.className);
|
19
|
+
});
|
20
|
+
cy.wrap($mcqQuestionWrappers)
|
21
|
+
.eq(index)
|
22
|
+
.within(() => {
|
23
|
+
utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.previewQuestionInstructions);
|
24
|
+
iePage.mcqOption()
|
25
|
+
.then(($elements) => {
|
26
|
+
expect($elements.length).to.be.eq(expectedQuestionData.previewOptionsText.length);
|
27
|
+
});
|
28
|
+
iePage.mcqOption()
|
29
|
+
.each((optionElem, optionIndex) => {
|
30
|
+
utilities.verifyInnerText(cy.wrap(optionElem), expectedQuestionData.previewOptionsText[optionIndex]);
|
31
|
+
});
|
18
32
|
});
|
19
33
|
});
|
20
34
|
},
|
21
35
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
.
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
.
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
36
|
+
mcqGrading: (expectedQuestionData, index) => {
|
37
|
+
let ieMcqQuestionWrapperClassRegex = /ngie-single-select|ngie-mcq|ngie-true-or-false|ngie-mcq-block|ngie-single-select-block/i;
|
38
|
+
iePage.questionWrapper()
|
39
|
+
.then(($questionWrappers) => {
|
40
|
+
const $mcqQuestionWrappers = $questionWrappers.filter((index, element) => {
|
41
|
+
return ieMcqQuestionWrapperClassRegex.test(element.className);
|
42
|
+
});
|
43
|
+
cy.wrap($mcqQuestionWrappers)
|
44
|
+
.eq(index)
|
45
|
+
.within(() => {
|
46
|
+
utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.gradingQuestionInstructions);
|
47
|
+
iePage.mcqOptionWrapper()
|
48
|
+
.then(($elements) => {
|
49
|
+
expect($elements.length).to.be.eq(expectedQuestionData.gradingOptionsText.length);
|
50
|
+
});
|
51
|
+
iePage.mcqOptionWrapper()
|
52
|
+
.each(($optionWrapper, optionIndex) => {
|
53
|
+
cy.wrap($optionWrapper)
|
54
|
+
.within(() => {
|
55
|
+
if (expectedQuestionData.correctAnswersIndex.includes(optionIndex)) {
|
56
|
+
cy.get('.tick-icon-wrapper')
|
57
|
+
.should('exist');
|
58
|
+
} else {
|
59
|
+
cy.get('.tick-icon-wrapper')
|
60
|
+
.should('not.exist');
|
61
|
+
}
|
62
|
+
utilities.verifyInnerText(iePage.mcqOption(), expectedQuestionData.gradingOptionsText[optionIndex]);
|
63
|
+
});
|
46
64
|
});
|
47
65
|
});
|
48
66
|
});
|
49
67
|
},
|
50
68
|
|
69
|
+
|
51
70
|
textEntryMath: (expectedQuestionData, index) => {
|
52
71
|
|
53
72
|
},
|
@@ -59,5 +78,135 @@ export const verifyIeQuestionData = {
|
|
59
78
|
singleSelectionPage.questionInstructionsText()
|
60
79
|
.verifyInnerText(expectedQuestionData.previewQuestionInstructions);
|
61
80
|
});
|
62
|
-
}
|
81
|
+
},
|
82
|
+
|
83
|
+
/* singleSelection: (expectedQuestionData, index) => {
|
84
|
+
cy.get('.ngie-single-select')
|
85
|
+
.eq(index)
|
86
|
+
.within(() => {
|
87
|
+
utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.previewQuestionInstructions);
|
88
|
+
singleSelectionPage.optionTextPreviewTab()
|
89
|
+
.then(($elements) => {
|
90
|
+
expect($elements.length).to.be.eq(expectedQuestionData.previewOptionsText.length);
|
91
|
+
});
|
92
|
+
singleSelectionPage.optionTextPreviewTab()
|
93
|
+
.each((optionElem, optionIndex) => {
|
94
|
+
utilities.verifyInnerText(cy.wrap(optionElem), expectedQuestionData.previewOptionsText[optionIndex]);
|
95
|
+
});
|
96
|
+
});
|
97
|
+
},
|
98
|
+
|
99
|
+
singleSelectionGrading: (expectedQuestionData, index) => {
|
100
|
+
cy.get('.ngie-single-select')
|
101
|
+
.eq(index)
|
102
|
+
.within(() => {
|
103
|
+
singleSelectionPage.questionInstructionsText()
|
104
|
+
.verifyInnerText(expectedQuestionData.gradingQuestionInstructions);
|
105
|
+
singleSelectionPage.optionsWrapperGradingView()
|
106
|
+
.then(($elements) => {
|
107
|
+
expect($elements.length).to.be.eq(expectedQuestionData.gradingOptionsText.length);
|
108
|
+
});
|
109
|
+
singleSelectionPage.optionsWrapperGradingView()
|
110
|
+
.each(($optionWrapper, optionIndex) => {
|
111
|
+
cy.wrap($optionWrapper)
|
112
|
+
.within(() => {
|
113
|
+
if (expectedQuestionData.correctAnswersIndex.includes(optionIndex)) {
|
114
|
+
cy.get('.tick-icon-wrapper')
|
115
|
+
.should('exist');
|
116
|
+
} else {
|
117
|
+
cy.get('.tick-icon-wrapper')
|
118
|
+
.should('not.exist');
|
119
|
+
}
|
120
|
+
singleSelectionPage.optionTextPreviewTab()
|
121
|
+
.verifyInnerText(expectedQuestionData.gradingOptionsText[optionIndex])
|
122
|
+
});
|
123
|
+
});
|
124
|
+
});
|
125
|
+
},
|
126
|
+
|
127
|
+
multipleSelection: (expectedQuestionData, index) => {
|
128
|
+
cy.get('.ngie-mcq')
|
129
|
+
.eq(index)
|
130
|
+
.within(() => {
|
131
|
+
utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.previewQuestionInstructions);
|
132
|
+
singleSelectionPage.optionTextPreviewTab()
|
133
|
+
.then(($elements) => {
|
134
|
+
expect($elements.length).to.be.eq(expectedQuestionData.previewOptionsText.length);
|
135
|
+
});
|
136
|
+
singleSelectionPage.optionTextPreviewTab()
|
137
|
+
.each((optionElem, optionIndex) => {
|
138
|
+
utilities.verifyInnerText(cy.wrap(optionElem), expectedQuestionData.previewOptionsText[optionIndex]);
|
139
|
+
});
|
140
|
+
});
|
141
|
+
},
|
142
|
+
|
143
|
+
multipleSelectionGrading: (expectedQuestionData, index) => {
|
144
|
+
cy.get('.ngie-mcq')
|
145
|
+
.eq(index)
|
146
|
+
.within(() => {
|
147
|
+
utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.gradingQuestionInstructions);
|
148
|
+
multipleSelectionPage.optionsWrapperGradingView()
|
149
|
+
.then(($elements) => {
|
150
|
+
expect($elements.length).to.be.eq(expectedQuestionData.gradingOptionsText.length);
|
151
|
+
});
|
152
|
+
multipleSelectionPage.optionsWrapperGradingView()
|
153
|
+
.each(($optionWrapper, optionIndex) => {
|
154
|
+
cy.wrap($optionWrapper)
|
155
|
+
.within(() => {
|
156
|
+
if (expectedQuestionData.correctAnswersIndex.includes(optionIndex)) {
|
157
|
+
cy.get('.tick-icon-wrapper')
|
158
|
+
.should('exist');
|
159
|
+
} else {
|
160
|
+
cy.get('.tick-icon-wrapper')
|
161
|
+
.should('not.exist');
|
162
|
+
}
|
163
|
+
utilities.verifyInnerText(singleSelectionPage.optionTextPreviewTab(), expectedQuestionData.gradingOptionsText[optionIndex]);
|
164
|
+
});
|
165
|
+
});
|
166
|
+
});
|
167
|
+
},
|
168
|
+
|
169
|
+
trueOrFalse: (expectedQuestionData, index) => {
|
170
|
+
cy.get('.ngie-true-or-false')
|
171
|
+
.eq(index)
|
172
|
+
.within(() => {
|
173
|
+
utilities.verifyInnerText(singleSelectionPage.questionInstructionsText(), expectedQuestionData.previewQuestionInstructions);
|
174
|
+
singleSelectionPage.optionTextPreviewTab()
|
175
|
+
.then(($elements) => {
|
176
|
+
expect($elements.length).to.be.eq(expectedQuestionData.previewOptionsText.length);
|
177
|
+
});
|
178
|
+
singleSelectionPage.optionTextPreviewTab()
|
179
|
+
.each((optionElem, optionIndex) => {
|
180
|
+
utilities.verifyInnerText(cy.wrap(optionElem), expectedQuestionData.previewOptionsText[optionIndex]);
|
181
|
+
});
|
182
|
+
});
|
183
|
+
},
|
184
|
+
|
185
|
+
trueOrFalseGrading: (expectedQuestionData, index) => {
|
186
|
+
cy.get('.ngie-true-or-false')
|
187
|
+
.eq(index)
|
188
|
+
.within(() => {
|
189
|
+
singleSelectionPage.questionInstructionsText()
|
190
|
+
.verifyInnerText(expectedQuestionData.gradingQuestionInstructions);
|
191
|
+
singleSelectionPage.optionsWrapperGradingView()
|
192
|
+
.then(($elements) => {
|
193
|
+
expect($elements.length).to.be.eq(expectedQuestionData.gradingOptionsText.length);
|
194
|
+
});
|
195
|
+
singleSelectionPage.optionsWrapperGradingView()
|
196
|
+
.each(($optionWrapper, optionIndex) => {
|
197
|
+
cy.wrap($optionWrapper)
|
198
|
+
.within(() => {
|
199
|
+
if (expectedQuestionData.correctAnswersIndex.includes(optionIndex)) {
|
200
|
+
cy.get('.tick-icon-wrapper')
|
201
|
+
.should('exist');
|
202
|
+
} else {
|
203
|
+
cy.get('.tick-icon-wrapper')
|
204
|
+
.should('not.exist');
|
205
|
+
}
|
206
|
+
singleSelectionPage.optionTextPreviewTab()
|
207
|
+
.verifyInnerText(expectedQuestionData.gradingOptionsText[optionIndex])
|
208
|
+
});
|
209
|
+
});
|
210
|
+
});
|
211
|
+
}, */
|
63
212
|
}
|
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=IQoJb3JpZ2luX2VjEC4aCmFwLXNvdXRoLTEiRjBEAiAzs3p3Eb38xTURyy%2BzGkMsV1nxANOptrrzd7pZ6iAapwIgHpZVw9VcuNpA87fURgmnZrVWII5dWALIJp4Us2R9wVkq9gMIFxADGgw5NjUzMzExMTExNjYiDGMP8gRDAsGnzcR3NCrTA%2FFUSCHiht9CU6cpIRyJksnWvlGdYzaVxsoBnYC2S1NtWdO8PY4ENIiHWry6LuXFRmKwF6wzYlSog18nbxzni4R5F8uBxlcQv1iTFuu8ROpBrimbsx3tqtnY9nRr%2FbXeOb9tAAAVJY1M6irQnyOwDnUc58Yt%2BiPGWlXrrgn6BVYnsfN8w5mIXiWi7NZQ8PYYKEuH8yytwkQtmF%2F5j5RT%2FQh%2BQvEFucXu1WADo90gW4jZzATOcBDr5%2FIWmggbM0KE1ARBr3plDe3Z3x8j8dLi0VvMbqP9iFR4Y1%2FGaoEEIrM8Bk8JC5UwHbqFz6dtQYotM4GKxFYc21VwcIHv6SC%2FMWla1LLfAaiNFGaSDruK3tLBngwnH0x8R4pqhmd0NI2fig4s9hCOFtXUS%2FtCUUTEVszEwUSyarcPQfGggODAdy84rpZ2UDhU%2FUL5anKGCX8NfeohqCdlQ7eLpfs0K0nv6O9gsebo1Z4Ij5BS%2B1GjiZ1pciLjebMLEr7C%2BUqEZNakqOSmZJn9wveDkEnZxYEr0poMidMvIR9LiCNoJP8faUIGX1qm2yUVpJWsMqbTt70u%2FvwMbtPtWJ2FFKsK5DxA%2FYgPtM6OIYWBtdHul71IllpY4eqVMPu2za4GOpUCGvF12jUa6Tnnu6pQK0tUwWt8Ae7O3TCbalKXGq%2BOppcblsba43WTBVpM6Qzunb68aYGIepwVET6yMp87JwP52lh51ZFOvC8ow%2FIYSZmx9VW2gnVrCr6cQ0VT5F4t1m7ouLwjJxILBhyzKRgW%2FWfYiLjrYBLnVVJkba7j5uOemH%2BogTHyuzlLqEq%2F%2BS%2F5jqc8Lt4e%2BsBmVfl1Glz7iRwWSqYUGabIVm6fmviXjOGuLPnw%2BsztvMDQAxuOOyjgmAgIz1U%2Fzkzxa%2BcrtpZHeMQKS1bsrc7Tl4xTE63mqlMDMjOaZdqNd6xGzj1%2FzZX7gapwTfJXGxBYE6Pp3%2BruHVzNKOy9mtCT07Wnf%2BR1uU5yoM4cxVg5Zw%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240219T134827Z&X-Amz-SignedHeaders=host&X-Amz-Expires=43200&X-Amz-Credential=ASIA6BQRXZT7HUVETSNV%2F20240219%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Signature=dc72c12ca4740b4206e02cc3e3ebbac0ea0bc04b030b2015493c371be92b0211';
|
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}`);
|