itemengine-cypress-automation 1.0.122-updateILCRepo28Feb-2c3e0e3.0 → 1.0.123
Sign up to get free protection for your applications and to get access to all the features.
- package/cypress/e2e/ILC/AudioResponseNew/compactRecorderStyle.smoke.js +1 -1
- package/cypress/e2e/ILC/DrawingResponse/drawingResponseBackground.js +1 -1
- package/cypress/e2e/ILC/DrawingResponse/drawingResponseGradingViewAndCorrectAnswerViewContents.smoke.js +1 -1
- package/cypress/e2e/ILC/EssayResponse/essayResponseCustomizeFormattingOptions1.smoke.js +4 -2
- package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/previewContentsForAllViews.smoke.js +1 -1
- package/cypress/e2e/ILC/TextEntryMath/allOrNothingBasicForAllViews.smoke.js +11 -12
- package/cypress/e2e/ILC/TextEntryMathWithImage/previewTabContentsForAllViews.smoke.js +1 -1
- package/cypress/e2e/ILC/UploadResponse/previewContentsForAllViews.smoke.js +4 -3
- package/cypress/e2e/migration/migration.js +32 -19
- package/cypress/e2e/migration/migration10.js +160 -0
- package/cypress/e2e/migration/migration2.js +34 -19
- package/cypress/e2e/migration/migration3.js +34 -19
- package/cypress/e2e/migration/migration4.js +34 -19
- package/cypress/e2e/migration/migration5.js +34 -19
- package/cypress/e2e/migration/migration6.js +160 -0
- package/cypress/e2e/migration/migration7.js +160 -0
- package/cypress/e2e/migration/migration8.js +160 -0
- package/cypress/e2e/migration/migration9.js +160 -0
- package/cypress/fixtures/drawingToolbarOptionsAdditionalOptionsAndSpecialAndMathCharacters.js +1 -1
- package/cypress/pages/drawingResponsePage.js +6 -5
- package/cypress/pages/fillInTheGapsOverImageDropdownPage.js +1 -1
- package/cypress/pages/textEntryMathPage.js +15 -7
- package/cypress/pages/uploadResponsePage.js +10 -1
- package/cypress/support/migrationHelpers/essayResponseToolbarOptionsENUM.js +30 -0
- package/cypress/support/migrationHelpers/extractLrnQuestionData.js +24 -2
- package/cypress/support/migrationHelpers/lrnQestionTypesENUM.js +1 -1
- package/cypress/support/migrationHelpers/verifyIeQuestionData.js +21 -5
- package/deploy/migration/deploy.yaml +2 -2
- package/package.json +2 -2
@@ -0,0 +1,160 @@
|
|
1
|
+
import { autoScoredScoringPreviewTab } from "../../pages/components";
|
2
|
+
import utilities from "../../support/helpers/utilities";
|
3
|
+
import { extractLrnQuestionData, lrnPage } from "../../support/migrationHelpers/extractLrnQuestionData";
|
4
|
+
import lrnQuestionTypesENUM from "../../support/migrationHelpers/lrnQestionTypesENUM";
|
5
|
+
import { iePage, verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
|
6
|
+
|
7
|
+
Cypress.Commands.add('learnosityLoaderWait', () => {
|
8
|
+
// cy.get('.lrn-spinner')
|
9
|
+
// .should('be.visible');
|
10
|
+
lrnPage.questionsLoader()
|
11
|
+
.should('not.be.visible');
|
12
|
+
lrnPage.questionWrapper()
|
13
|
+
.eq(0)
|
14
|
+
.should('be.visible');
|
15
|
+
});
|
16
|
+
|
17
|
+
Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
|
18
|
+
iePage.questionWrapper()
|
19
|
+
.then((elements) => {
|
20
|
+
if (retries <= 0) {
|
21
|
+
throw new Error('Itemengine questions did not lazy load in time');
|
22
|
+
};
|
23
|
+
if (elements.length < count) {
|
24
|
+
iePage.questionWrapper()
|
25
|
+
.last()
|
26
|
+
.scrollIntoView()
|
27
|
+
.wait(1000);
|
28
|
+
cy.lazyLoadPreviewQuestions(count, retries - 1)
|
29
|
+
};
|
30
|
+
cy.log('All question parts loaded');
|
31
|
+
});
|
32
|
+
iePage.barsPreloader()
|
33
|
+
.should('not.exist');
|
34
|
+
cy.learnosityLoaderWait();
|
35
|
+
})
|
36
|
+
|
37
|
+
const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');//["essayResponse"]
|
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
|
+
let lrnEssayResponseRegex = /Math essay with rich text|Essay with rich text/
|
41
|
+
|
42
|
+
|
43
|
+
let lrnQuestionDataArr = [];
|
44
|
+
let lrnGradingDataArr = [];
|
45
|
+
|
46
|
+
let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(600, 700);//["0715a48c-4c1f-4eed-8058-793ad9402f89", "c476e9ca-2ac6-4ebc-b548-241ef3cd13bb"]
|
47
|
+
|
48
|
+
if (referenceIds.length > 0) {
|
49
|
+
describe('Migration item check for MCQ questions', () => {
|
50
|
+
before(() => {
|
51
|
+
cy.loginAs('technicalTester');
|
52
|
+
});
|
53
|
+
|
54
|
+
referenceIds.forEach((referenceId) => {
|
55
|
+
describe(`Migration item check for item "${referenceId}"`, () => {
|
56
|
+
before(() => {
|
57
|
+
cy.interceptGraphql('getItemPreview');
|
58
|
+
cy.setGraphqlWait();
|
59
|
+
cy.visit(`/items-list/item/${utilities.base64Encoding(referenceId)}`);
|
60
|
+
cy.pageLoadWait('getItemPreview');
|
61
|
+
cy.get('@getItemPreview').then((req) => {
|
62
|
+
let questionCount = req.response.body.data.getItemPreview.item.questionParts.length;
|
63
|
+
cy.lazyLoadPreviewQuestions(questionCount);
|
64
|
+
});
|
65
|
+
});
|
66
|
+
|
67
|
+
after(() => {
|
68
|
+
console.log(lrnQuestionDataArr)
|
69
|
+
console.log(lrnGradingDataArr)
|
70
|
+
lrnQuestionDataArr = [];
|
71
|
+
lrnGradingDataArr = [];
|
72
|
+
});
|
73
|
+
|
74
|
+
it(`Extracting learnosity preview data for item "${referenceId}"`, () => {
|
75
|
+
lrnPage.questionTypeDiv()
|
76
|
+
.each(($el, index) => {
|
77
|
+
let currQuestionType = $el[0].innerText
|
78
|
+
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
79
|
+
currQuestionType = lrnQuestionTypesENUM.mcq;
|
80
|
+
}
|
81
|
+
if (lrnEssayResponseRegex.test(currQuestionType)) {
|
82
|
+
;
|
83
|
+
currQuestionType = lrnQuestionTypesENUM.essayResponse;
|
84
|
+
}
|
85
|
+
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
86
|
+
switch (currQuestionType) {
|
87
|
+
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
|
88
|
+
case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMath(lrnQuestionDataArr, index);
|
89
|
+
case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImage(lrnQuestionDataArr, index);
|
90
|
+
case lrnQuestionTypesENUM.essayResponse: return extractLrnQuestionData.essayResponse(lrnQuestionDataArr, index);
|
91
|
+
default: throw new Error('Invalid lrn question type');
|
92
|
+
}
|
93
|
+
}
|
94
|
+
});
|
95
|
+
});
|
96
|
+
|
97
|
+
it(`Verifying itemengine preview data for item "${referenceId}"`, () => {
|
98
|
+
migrationQuestionTypes.forEach((questionType) => {
|
99
|
+
cy.log(`Verifying data for all ${questionType} question type`);
|
100
|
+
let currQuestionTypeArr = lrnQuestionDataArr.filter((question) => question.questionType === questionType);
|
101
|
+
currQuestionTypeArr.forEach((questionData, index) => {
|
102
|
+
cy.log(`Verifying data for ${questionType} ${index}`);
|
103
|
+
switch (questionType) {
|
104
|
+
case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
|
105
|
+
case 'textEntryMath': return verifyIeQuestionData.textEntryMath(questionData, index);
|
106
|
+
case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImage(questionData, index);
|
107
|
+
case 'essayResponse': return verifyIeQuestionData.essayResponse(questionData, index);
|
108
|
+
default: throw new Error('Invalid ngie question type');
|
109
|
+
}
|
110
|
+
});
|
111
|
+
});
|
112
|
+
});
|
113
|
+
|
114
|
+
it(`Extracting learnosity grading data for item "${referenceId}"`, () => {
|
115
|
+
lrnPage.authorItemToolbarControlsWrapper()
|
116
|
+
.then(($element) => {
|
117
|
+
if ($element[0].innerHTML.includes('lrn-author-validate-questions-toggle')) {
|
118
|
+
lrnPage.steps.checkShowAnswersToggle();
|
119
|
+
lrnPage.questionTypeDiv()
|
120
|
+
.each(($el, index) => {
|
121
|
+
let currQuestionType = $el[0].innerText
|
122
|
+
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
123
|
+
currQuestionType = lrnQuestionTypesENUM.mcq
|
124
|
+
}
|
125
|
+
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
126
|
+
switch (currQuestionType) {
|
127
|
+
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
|
128
|
+
case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
|
129
|
+
case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
|
130
|
+
default: throw new Error('Invalid lrn question type');
|
131
|
+
}
|
132
|
+
}
|
133
|
+
});
|
134
|
+
}
|
135
|
+
});
|
136
|
+
});
|
137
|
+
|
138
|
+
it(`Verifying itemengine grading data for item "${referenceId}"`, () => {
|
139
|
+
autoScoredScoringPreviewTab.steps.switchToGradingView();
|
140
|
+
cy.wait(500);
|
141
|
+
migrationQuestionTypes.forEach((questionType) => {
|
142
|
+
cy.log(`Verifying grading data for all ${questionType} question type`);
|
143
|
+
let currQuestionTypeArr = lrnGradingDataArr.filter((question) => question.questionType === questionType);
|
144
|
+
currQuestionTypeArr.forEach((questionData, index) => {
|
145
|
+
cy.log(`Verifying grading data for ${questionType} ${index}`);
|
146
|
+
switch (questionType) {
|
147
|
+
case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
|
148
|
+
case 'textEntryMath': return verifyIeQuestionData.textEntryMathGrading(questionData, index);
|
149
|
+
case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImageGrading(questionData, index);
|
150
|
+
default: throw new Error('Invalid ngie question type');
|
151
|
+
}
|
152
|
+
});
|
153
|
+
});
|
154
|
+
});
|
155
|
+
});
|
156
|
+
});
|
157
|
+
});
|
158
|
+
}
|
159
|
+
|
160
|
+
//https://s3.console.aws.amazon.com/s3/object/itemengine-qa-bucket?region=us-west-2&bucketType=general&prefix=cypressAutomation/migrationFixtures.json
|
@@ -0,0 +1,160 @@
|
|
1
|
+
import { autoScoredScoringPreviewTab } from "../../pages/components";
|
2
|
+
import utilities from "../../support/helpers/utilities";
|
3
|
+
import { extractLrnQuestionData, lrnPage } from "../../support/migrationHelpers/extractLrnQuestionData";
|
4
|
+
import lrnQuestionTypesENUM from "../../support/migrationHelpers/lrnQestionTypesENUM";
|
5
|
+
import { iePage, verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
|
6
|
+
|
7
|
+
Cypress.Commands.add('learnosityLoaderWait', () => {
|
8
|
+
// cy.get('.lrn-spinner')
|
9
|
+
// .should('be.visible');
|
10
|
+
lrnPage.questionsLoader()
|
11
|
+
.should('not.be.visible');
|
12
|
+
lrnPage.questionWrapper()
|
13
|
+
.eq(0)
|
14
|
+
.should('be.visible');
|
15
|
+
});
|
16
|
+
|
17
|
+
Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
|
18
|
+
iePage.questionWrapper()
|
19
|
+
.then((elements) => {
|
20
|
+
if (retries <= 0) {
|
21
|
+
throw new Error('Itemengine questions did not lazy load in time');
|
22
|
+
};
|
23
|
+
if (elements.length < count) {
|
24
|
+
iePage.questionWrapper()
|
25
|
+
.last()
|
26
|
+
.scrollIntoView()
|
27
|
+
.wait(1000);
|
28
|
+
cy.lazyLoadPreviewQuestions(count, retries - 1)
|
29
|
+
};
|
30
|
+
cy.log('All question parts loaded');
|
31
|
+
});
|
32
|
+
iePage.barsPreloader()
|
33
|
+
.should('not.exist');
|
34
|
+
cy.learnosityLoaderWait();
|
35
|
+
})
|
36
|
+
|
37
|
+
const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');//["essayResponse"]
|
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
|
+
let lrnEssayResponseRegex = /Math essay with rich text|Essay with rich text/
|
41
|
+
|
42
|
+
|
43
|
+
let lrnQuestionDataArr = [];
|
44
|
+
let lrnGradingDataArr = [];
|
45
|
+
|
46
|
+
let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(700, 800);//["0715a48c-4c1f-4eed-8058-793ad9402f89", "c476e9ca-2ac6-4ebc-b548-241ef3cd13bb"]
|
47
|
+
|
48
|
+
if (referenceIds.length > 0) {
|
49
|
+
describe('Migration item check for MCQ questions', () => {
|
50
|
+
before(() => {
|
51
|
+
cy.loginAs('technicalTester');
|
52
|
+
});
|
53
|
+
|
54
|
+
referenceIds.forEach((referenceId) => {
|
55
|
+
describe(`Migration item check for item "${referenceId}"`, () => {
|
56
|
+
before(() => {
|
57
|
+
cy.interceptGraphql('getItemPreview');
|
58
|
+
cy.setGraphqlWait();
|
59
|
+
cy.visit(`/items-list/item/${utilities.base64Encoding(referenceId)}`);
|
60
|
+
cy.pageLoadWait('getItemPreview');
|
61
|
+
cy.get('@getItemPreview').then((req) => {
|
62
|
+
let questionCount = req.response.body.data.getItemPreview.item.questionParts.length;
|
63
|
+
cy.lazyLoadPreviewQuestions(questionCount);
|
64
|
+
});
|
65
|
+
});
|
66
|
+
|
67
|
+
after(() => {
|
68
|
+
console.log(lrnQuestionDataArr)
|
69
|
+
console.log(lrnGradingDataArr)
|
70
|
+
lrnQuestionDataArr = [];
|
71
|
+
lrnGradingDataArr = [];
|
72
|
+
});
|
73
|
+
|
74
|
+
it(`Extracting learnosity preview data for item "${referenceId}"`, () => {
|
75
|
+
lrnPage.questionTypeDiv()
|
76
|
+
.each(($el, index) => {
|
77
|
+
let currQuestionType = $el[0].innerText
|
78
|
+
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
79
|
+
currQuestionType = lrnQuestionTypesENUM.mcq;
|
80
|
+
}
|
81
|
+
if (lrnEssayResponseRegex.test(currQuestionType)) {
|
82
|
+
;
|
83
|
+
currQuestionType = lrnQuestionTypesENUM.essayResponse;
|
84
|
+
}
|
85
|
+
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
86
|
+
switch (currQuestionType) {
|
87
|
+
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
|
88
|
+
case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMath(lrnQuestionDataArr, index);
|
89
|
+
case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImage(lrnQuestionDataArr, index);
|
90
|
+
case lrnQuestionTypesENUM.essayResponse: return extractLrnQuestionData.essayResponse(lrnQuestionDataArr, index);
|
91
|
+
default: throw new Error('Invalid lrn question type');
|
92
|
+
}
|
93
|
+
}
|
94
|
+
});
|
95
|
+
});
|
96
|
+
|
97
|
+
it(`Verifying itemengine preview data for item "${referenceId}"`, () => {
|
98
|
+
migrationQuestionTypes.forEach((questionType) => {
|
99
|
+
cy.log(`Verifying data for all ${questionType} question type`);
|
100
|
+
let currQuestionTypeArr = lrnQuestionDataArr.filter((question) => question.questionType === questionType);
|
101
|
+
currQuestionTypeArr.forEach((questionData, index) => {
|
102
|
+
cy.log(`Verifying data for ${questionType} ${index}`);
|
103
|
+
switch (questionType) {
|
104
|
+
case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
|
105
|
+
case 'textEntryMath': return verifyIeQuestionData.textEntryMath(questionData, index);
|
106
|
+
case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImage(questionData, index);
|
107
|
+
case 'essayResponse': return verifyIeQuestionData.essayResponse(questionData, index);
|
108
|
+
default: throw new Error('Invalid ngie question type');
|
109
|
+
}
|
110
|
+
});
|
111
|
+
});
|
112
|
+
});
|
113
|
+
|
114
|
+
it(`Extracting learnosity grading data for item "${referenceId}"`, () => {
|
115
|
+
lrnPage.authorItemToolbarControlsWrapper()
|
116
|
+
.then(($element) => {
|
117
|
+
if ($element[0].innerHTML.includes('lrn-author-validate-questions-toggle')) {
|
118
|
+
lrnPage.steps.checkShowAnswersToggle();
|
119
|
+
lrnPage.questionTypeDiv()
|
120
|
+
.each(($el, index) => {
|
121
|
+
let currQuestionType = $el[0].innerText
|
122
|
+
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
123
|
+
currQuestionType = lrnQuestionTypesENUM.mcq
|
124
|
+
}
|
125
|
+
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
126
|
+
switch (currQuestionType) {
|
127
|
+
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
|
128
|
+
case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
|
129
|
+
case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
|
130
|
+
default: throw new Error('Invalid lrn question type');
|
131
|
+
}
|
132
|
+
}
|
133
|
+
});
|
134
|
+
}
|
135
|
+
});
|
136
|
+
});
|
137
|
+
|
138
|
+
it(`Verifying itemengine grading data for item "${referenceId}"`, () => {
|
139
|
+
autoScoredScoringPreviewTab.steps.switchToGradingView();
|
140
|
+
cy.wait(500);
|
141
|
+
migrationQuestionTypes.forEach((questionType) => {
|
142
|
+
cy.log(`Verifying grading data for all ${questionType} question type`);
|
143
|
+
let currQuestionTypeArr = lrnGradingDataArr.filter((question) => question.questionType === questionType);
|
144
|
+
currQuestionTypeArr.forEach((questionData, index) => {
|
145
|
+
cy.log(`Verifying grading data for ${questionType} ${index}`);
|
146
|
+
switch (questionType) {
|
147
|
+
case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
|
148
|
+
case 'textEntryMath': return verifyIeQuestionData.textEntryMathGrading(questionData, index);
|
149
|
+
case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImageGrading(questionData, index);
|
150
|
+
default: throw new Error('Invalid ngie question type');
|
151
|
+
}
|
152
|
+
});
|
153
|
+
});
|
154
|
+
});
|
155
|
+
});
|
156
|
+
});
|
157
|
+
});
|
158
|
+
}
|
159
|
+
|
160
|
+
//https://s3.console.aws.amazon.com/s3/object/itemengine-qa-bucket?region=us-west-2&bucketType=general&prefix=cypressAutomation/migrationFixtures.json
|
@@ -0,0 +1,160 @@
|
|
1
|
+
import { autoScoredScoringPreviewTab } from "../../pages/components";
|
2
|
+
import utilities from "../../support/helpers/utilities";
|
3
|
+
import { extractLrnQuestionData, lrnPage } from "../../support/migrationHelpers/extractLrnQuestionData";
|
4
|
+
import lrnQuestionTypesENUM from "../../support/migrationHelpers/lrnQestionTypesENUM";
|
5
|
+
import { iePage, verifyIeQuestionData } from "../../support/migrationHelpers/verifyIeQuestionData";
|
6
|
+
|
7
|
+
Cypress.Commands.add('learnosityLoaderWait', () => {
|
8
|
+
// cy.get('.lrn-spinner')
|
9
|
+
// .should('be.visible');
|
10
|
+
lrnPage.questionsLoader()
|
11
|
+
.should('not.be.visible');
|
12
|
+
lrnPage.questionWrapper()
|
13
|
+
.eq(0)
|
14
|
+
.should('be.visible');
|
15
|
+
});
|
16
|
+
|
17
|
+
Cypress.Commands.add('lazyLoadPreviewQuestions', (count, retries = 5) => {
|
18
|
+
iePage.questionWrapper()
|
19
|
+
.then((elements) => {
|
20
|
+
if (retries <= 0) {
|
21
|
+
throw new Error('Itemengine questions did not lazy load in time');
|
22
|
+
};
|
23
|
+
if (elements.length < count) {
|
24
|
+
iePage.questionWrapper()
|
25
|
+
.last()
|
26
|
+
.scrollIntoView()
|
27
|
+
.wait(1000);
|
28
|
+
cy.lazyLoadPreviewQuestions(count, retries - 1)
|
29
|
+
};
|
30
|
+
cy.log('All question parts loaded');
|
31
|
+
});
|
32
|
+
iePage.barsPreloader()
|
33
|
+
.should('not.exist');
|
34
|
+
cy.learnosityLoaderWait();
|
35
|
+
})
|
36
|
+
|
37
|
+
const migrationQuestionTypes = Cypress.env('migrationQuestionTypes');//["essayResponse"]
|
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
|
+
let lrnEssayResponseRegex = /Math essay with rich text|Essay with rich text/
|
41
|
+
|
42
|
+
|
43
|
+
let lrnQuestionDataArr = [];
|
44
|
+
let lrnGradingDataArr = [];
|
45
|
+
|
46
|
+
let referenceIds = JSON.parse(Cypress.env('referenceIds')).slice(800, 900);//["0715a48c-4c1f-4eed-8058-793ad9402f89", "c476e9ca-2ac6-4ebc-b548-241ef3cd13bb"]
|
47
|
+
|
48
|
+
if (referenceIds.length > 0) {
|
49
|
+
describe('Migration item check for MCQ questions', () => {
|
50
|
+
before(() => {
|
51
|
+
cy.loginAs('technicalTester');
|
52
|
+
});
|
53
|
+
|
54
|
+
referenceIds.forEach((referenceId) => {
|
55
|
+
describe(`Migration item check for item "${referenceId}"`, () => {
|
56
|
+
before(() => {
|
57
|
+
cy.interceptGraphql('getItemPreview');
|
58
|
+
cy.setGraphqlWait();
|
59
|
+
cy.visit(`/items-list/item/${utilities.base64Encoding(referenceId)}`);
|
60
|
+
cy.pageLoadWait('getItemPreview');
|
61
|
+
cy.get('@getItemPreview').then((req) => {
|
62
|
+
let questionCount = req.response.body.data.getItemPreview.item.questionParts.length;
|
63
|
+
cy.lazyLoadPreviewQuestions(questionCount);
|
64
|
+
});
|
65
|
+
});
|
66
|
+
|
67
|
+
after(() => {
|
68
|
+
console.log(lrnQuestionDataArr)
|
69
|
+
console.log(lrnGradingDataArr)
|
70
|
+
lrnQuestionDataArr = [];
|
71
|
+
lrnGradingDataArr = [];
|
72
|
+
});
|
73
|
+
|
74
|
+
it(`Extracting learnosity preview data for item "${referenceId}"`, () => {
|
75
|
+
lrnPage.questionTypeDiv()
|
76
|
+
.each(($el, index) => {
|
77
|
+
let currQuestionType = $el[0].innerText
|
78
|
+
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
79
|
+
currQuestionType = lrnQuestionTypesENUM.mcq;
|
80
|
+
}
|
81
|
+
if (lrnEssayResponseRegex.test(currQuestionType)) {
|
82
|
+
;
|
83
|
+
currQuestionType = lrnQuestionTypesENUM.essayResponse;
|
84
|
+
}
|
85
|
+
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
86
|
+
switch (currQuestionType) {
|
87
|
+
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcq(lrnQuestionDataArr, index);
|
88
|
+
case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMath(lrnQuestionDataArr, index);
|
89
|
+
case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImage(lrnQuestionDataArr, index);
|
90
|
+
case lrnQuestionTypesENUM.essayResponse: return extractLrnQuestionData.essayResponse(lrnQuestionDataArr, index);
|
91
|
+
default: throw new Error('Invalid lrn question type');
|
92
|
+
}
|
93
|
+
}
|
94
|
+
});
|
95
|
+
});
|
96
|
+
|
97
|
+
it(`Verifying itemengine preview data for item "${referenceId}"`, () => {
|
98
|
+
migrationQuestionTypes.forEach((questionType) => {
|
99
|
+
cy.log(`Verifying data for all ${questionType} question type`);
|
100
|
+
let currQuestionTypeArr = lrnQuestionDataArr.filter((question) => question.questionType === questionType);
|
101
|
+
currQuestionTypeArr.forEach((questionData, index) => {
|
102
|
+
cy.log(`Verifying data for ${questionType} ${index}`);
|
103
|
+
switch (questionType) {
|
104
|
+
case 'mcq': return verifyIeQuestionData.mcq(questionData, index);
|
105
|
+
case 'textEntryMath': return verifyIeQuestionData.textEntryMath(questionData, index);
|
106
|
+
case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImage(questionData, index);
|
107
|
+
case 'essayResponse': return verifyIeQuestionData.essayResponse(questionData, index);
|
108
|
+
default: throw new Error('Invalid ngie question type');
|
109
|
+
}
|
110
|
+
});
|
111
|
+
});
|
112
|
+
});
|
113
|
+
|
114
|
+
it(`Extracting learnosity grading data for item "${referenceId}"`, () => {
|
115
|
+
lrnPage.authorItemToolbarControlsWrapper()
|
116
|
+
.then(($element) => {
|
117
|
+
if ($element[0].innerHTML.includes('lrn-author-validate-questions-toggle')) {
|
118
|
+
lrnPage.steps.checkShowAnswersToggle();
|
119
|
+
lrnPage.questionTypeDiv()
|
120
|
+
.each(($el, index) => {
|
121
|
+
let currQuestionType = $el[0].innerText
|
122
|
+
if (lrnMcqTypesRegex.test(currQuestionType)) {
|
123
|
+
currQuestionType = lrnQuestionTypesENUM.mcq
|
124
|
+
}
|
125
|
+
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
126
|
+
switch (currQuestionType) {
|
127
|
+
case lrnQuestionTypesENUM.mcq: return extractLrnQuestionData.mcqGrading(lrnGradingDataArr, index);
|
128
|
+
case lrnQuestionTypesENUM.textEntryMath: return extractLrnQuestionData.textEntryMathGrading(lrnGradingDataArr, index);
|
129
|
+
case lrnQuestionTypesENUM.textEntryMathImage: return extractLrnQuestionData.textEntryMathImageGrading(lrnGradingDataArr, index);
|
130
|
+
default: throw new Error('Invalid lrn question type');
|
131
|
+
}
|
132
|
+
}
|
133
|
+
});
|
134
|
+
}
|
135
|
+
});
|
136
|
+
});
|
137
|
+
|
138
|
+
it(`Verifying itemengine grading data for item "${referenceId}"`, () => {
|
139
|
+
autoScoredScoringPreviewTab.steps.switchToGradingView();
|
140
|
+
cy.wait(500);
|
141
|
+
migrationQuestionTypes.forEach((questionType) => {
|
142
|
+
cy.log(`Verifying grading data for all ${questionType} question type`);
|
143
|
+
let currQuestionTypeArr = lrnGradingDataArr.filter((question) => question.questionType === questionType);
|
144
|
+
currQuestionTypeArr.forEach((questionData, index) => {
|
145
|
+
cy.log(`Verifying grading data for ${questionType} ${index}`);
|
146
|
+
switch (questionType) {
|
147
|
+
case 'mcq': return verifyIeQuestionData.mcqGrading(questionData, index);
|
148
|
+
case 'textEntryMath': return verifyIeQuestionData.textEntryMathGrading(questionData, index);
|
149
|
+
case 'textEntryMathImage': return verifyIeQuestionData.textEntryMathImageGrading(questionData, index);
|
150
|
+
default: throw new Error('Invalid ngie question type');
|
151
|
+
}
|
152
|
+
});
|
153
|
+
});
|
154
|
+
});
|
155
|
+
});
|
156
|
+
});
|
157
|
+
});
|
158
|
+
}
|
159
|
+
|
160
|
+
//https://s3.console.aws.amazon.com/s3/object/itemengine-qa-bucket?region=us-west-2&bucketType=general&prefix=cypressAutomation/migrationFixtures.json
|
@@ -649,7 +649,7 @@ const steps = {
|
|
649
649
|
drawingResponsePage.charactersPopupCharactersCategoryWrapper()
|
650
650
|
.eq(categoryIndex)
|
651
651
|
.within(() => {
|
652
|
-
categorySymbolsArray
|
652
|
+
categorySymbolsArray.forEach((symbolARIALabel, index) => {
|
653
653
|
drawingResponsePage.charactersPopupCharacterSymbol()
|
654
654
|
.eq(index)
|
655
655
|
.find('svg')
|
@@ -676,6 +676,7 @@ const steps = {
|
|
676
676
|
categoryListArray.forEach((category, index) => {
|
677
677
|
utilities.verifyInnerText(drawingResponsePage.specialCharactersPopupCategoryTitle().eq(index), `${category.categoryName}`);
|
678
678
|
utilities.verifyElementVisibilityState(drawingResponsePage.specialCharactersPopupCategoryTitle().eq(index), 'visible');
|
679
|
+
utilities.scrollIntoView(drawingResponsePage.specialCharactersPopupCategoryAccordionIcon().eq(index));
|
679
680
|
utilities.verifyElementVisibilityState(drawingResponsePage.specialCharactersPopupCategoryAccordionIcon().eq(index), 'visible');
|
680
681
|
});
|
681
682
|
},
|
@@ -687,8 +688,8 @@ const steps = {
|
|
687
688
|
verifySpecialCharactersPopupCategoryAccordionIsExpanded: (index) => {
|
688
689
|
drawingResponsePage.specialCharactersPopupCategoryTitle()
|
689
690
|
.eq(index)
|
690
|
-
.within(() => {
|
691
|
-
cy.wrap()
|
691
|
+
.within(($element) => {
|
692
|
+
cy.wrap($element)
|
692
693
|
.find('span[class*="icon-open"]')
|
693
694
|
.should('exist');
|
694
695
|
});
|
@@ -702,8 +703,8 @@ const steps = {
|
|
702
703
|
verifySpecialCharactersPopupCategoryAccordionIsCollapsed: (index) => {
|
703
704
|
drawingResponsePage.specialCharactersPopupCategoryTitle()
|
704
705
|
.eq(index)
|
705
|
-
.within(() => {
|
706
|
-
cy.wrap()
|
706
|
+
.within(($element) => {
|
707
|
+
cy.wrap($element)
|
707
708
|
.find('span[class*="icon-open"]')
|
708
709
|
.should('not.exist');
|
709
710
|
});
|
@@ -13,7 +13,7 @@ const selectors = {
|
|
13
13
|
...optionsWrapperComponent,
|
14
14
|
...randomizeOptionsComponent,
|
15
15
|
...backgroundImageUploadComponent,
|
16
|
-
dropdownWrapperPreviewTab: () => cy.get('[class*="question-preview-wrapper"] [class
|
16
|
+
dropdownWrapperPreviewTab: () => cy.get('[class*="question-preview-wrapper"] [class*="Canvasstyle__DropzoneWrapper"]'),
|
17
17
|
correctAnswerSectionWrapper: () => cy.get('.dnd-correct-answer-wrapper'),
|
18
18
|
correctAnswerResponseWrapper: () => cy.get('[class*="LabelImageWithDropdownPreviewstyles__AnswerCell"]'),
|
19
19
|
correctAnswerResponse: () => cy.get('[class*="LabelImageWithDropdownPreviewstyles__AnswerWrapper"]'),
|
@@ -12,6 +12,7 @@ const selectors = {
|
|
12
12
|
...autoScoredSpecifyCorrectAnswerSection,
|
13
13
|
|
14
14
|
addStructureTab: () => cy.get('[data-ngie-testid="add-structure-tab"]'),
|
15
|
+
responseToken: () => cy.get('.cke_button__addresponse'),
|
15
16
|
|
16
17
|
//TODO: Update below selectors after https://redmine.zeuslearning.com/issues/557945 is resolved
|
17
18
|
//Response accordion
|
@@ -84,7 +85,7 @@ const selectors = {
|
|
84
85
|
responseFieldWrapperPreviewTab: () => cy.get('.cloze-response-wrapper'),
|
85
86
|
responseFieldNumerationPreviewTab: () => cy.get('.preview-question-text-wrapper .response-input-adornment'),
|
86
87
|
questionContainerPreviewTab: () => cy.get('[class*="ClozeWithTextPreviewstyle__QuestionPreviewWrapper"]'),
|
87
|
-
tickIcon: () => cy.get('.
|
88
|
+
tickIcon: () => cy.get('.tick-icon-wrapper'),
|
88
89
|
correctAnswersContainerResponse: () => cy.get('.cloze-with-text-correct-response-wrapper .response-input-field'),
|
89
90
|
correctAnswersContainerResponseNumeration: () => cy.get('.cloze-with-text-correct-response-wrapper .response-input-adornment'),
|
90
91
|
correctAnswersLabel: () => cy.get('.cloze-with-text-correct-answer-label'),
|
@@ -111,6 +112,13 @@ const steps = {
|
|
111
112
|
.should('have.attr', 'aria-selected', 'true');
|
112
113
|
},
|
113
114
|
|
115
|
+
addResponseToken: () => {
|
116
|
+
questionInputFieldComponent.questionInputField()
|
117
|
+
.click();
|
118
|
+
textEntryMathPage.responseToken()
|
119
|
+
.click();
|
120
|
+
},
|
121
|
+
|
114
122
|
/**
|
115
123
|
* @description Verify response accordion is collapsed in specify correct answer section
|
116
124
|
* @param {number} responseIndex index of response accordion
|
@@ -653,8 +661,8 @@ const steps = {
|
|
653
661
|
verifyCorrectAnswerResponsesAriaLabel: (index, correctAnswerAriaLabel) => {
|
654
662
|
textEntryMathPage.correctAnswersContainerResponse()
|
655
663
|
.eq(index)
|
656
|
-
.
|
657
|
-
.should('
|
664
|
+
.invoke('attr', 'value')
|
665
|
+
.should('include', correctAnswerAriaLabel);
|
658
666
|
},
|
659
667
|
|
660
668
|
verifyResponseFieldNumerationPreviewTab: () => {
|
@@ -784,8 +792,8 @@ const tests = {
|
|
784
792
|
});
|
785
793
|
|
786
794
|
it('When user adds response tokens in the question section they should be displayed in the \'Specify correct answer\' section in collapsed state', () => {
|
787
|
-
textEntryMathPage.steps.
|
788
|
-
textEntryMathPage.steps.
|
795
|
+
textEntryMathPage.steps.addResponseAreaInQuestionField();
|
796
|
+
textEntryMathPage.steps.addResponseAreaInQuestionField();
|
789
797
|
utilities.verifyElementCount(textEntryMathPage.responseAccordion(), 2);
|
790
798
|
textEntryMathPage.steps.verifyResponseAccordionIsCollapsed(0);
|
791
799
|
textEntryMathPage.steps.verifyResponseAccordionIsCollapsed(1);
|
@@ -841,8 +849,8 @@ const tests = {
|
|
841
849
|
});
|
842
850
|
|
843
851
|
it('When user adds response tokens in question input field, then response accordions should be displayed in collapsed state in the \'Specify correct answer section\' with appropriate numeration', () => {
|
844
|
-
textEntryMathPage.steps.
|
845
|
-
textEntryMathPage.steps.
|
852
|
+
textEntryMathPage.steps.addResponseAreaInQuestionField();
|
853
|
+
textEntryMathPage.steps.addResponseAreaInQuestionField();
|
846
854
|
utilities.verifyElementCount(textEntryMathPage.responseAccordion(), 2);
|
847
855
|
textEntryMathPage.steps.verifyResponseAccordionIsCollapsed(0);
|
848
856
|
textEntryMathPage.steps.verifyResponseAccordionIsCollapsed(1);
|
@@ -160,6 +160,15 @@ const steps = {
|
|
160
160
|
utilities.verifyInnerText(utilities.getNthElement(uploadResponsePage.fileName(), fileIndex), fileName);
|
161
161
|
},
|
162
162
|
|
163
|
+
/**
|
164
|
+
* @param {string} fileName - The expected name of the uploaded file.
|
165
|
+
* Verifies the displayed name of an uploaded file
|
166
|
+
*/
|
167
|
+
verifyUploadedFileNameVisible: (fileName) => {
|
168
|
+
uploadResponsePage.uploadedFilesSectionWrapper()
|
169
|
+
.contains(fileName);
|
170
|
+
},
|
171
|
+
|
163
172
|
stopUploadingFile: () => {
|
164
173
|
uploadResponsePage.stopUploadingButton()
|
165
174
|
.click();
|
@@ -360,7 +369,7 @@ const steps = {
|
|
360
369
|
uploadFile: (file) => {
|
361
370
|
uploadResponsePage.inputTypeFile()
|
362
371
|
.attachFile(file);
|
363
|
-
|
372
|
+
cy.wait(2000);
|
364
373
|
},
|
365
374
|
|
366
375
|
verifyDefaultSelectedFileTypes: () => {
|