itemengine-cypress-automation 1.0.96 → 1.0.98
Sign up to get free protection for your applications and to get access to all the features.
- package/cypress/e2e/migration/migration.js +216 -0
- package/cypress/e2e/migration/migration2.js +216 -0
- package/cypress/support/commands.js +4 -1
- package/cypress/support/migrationHelpers/extractLrnQuestionData.js +106 -0
- package/cypress/support/migrationHelpers/lrnQestionTypesENUM.js +6 -0
- package/cypress/support/migrationHelpers/verifyIeQuestionData.js +63 -0
- package/deploy/smoke/run.sh +1 -1
- package/package.json +2 -1
- package/scripts/migration.mjs +3 -0
- package/scripts/sorry-cypress.mjs +13 -1
@@ -0,0 +1,216 @@
|
|
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 { 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
|
+
cy.get('.question-instruction')
|
19
|
+
.then((elements) => {
|
20
|
+
if (retries <= 0) {
|
21
|
+
throw new Error('Element did not load in time')
|
22
|
+
};
|
23
|
+
if (elements.length < count) {
|
24
|
+
cy.get('.question-instruction')
|
25
|
+
.last()
|
26
|
+
.scrollIntoView()
|
27
|
+
.wait(1000);
|
28
|
+
cy.lazyLoadPreviewQuestions(count, retries - 1)
|
29
|
+
};
|
30
|
+
cy.log('All question parts loaded')
|
31
|
+
});
|
32
|
+
//cy.barsPreLoaderWait();
|
33
|
+
cy.get('[id="question-item-instruction-loader"]')
|
34
|
+
.should('not.exist');
|
35
|
+
cy.learnosityLoaderWait();
|
36
|
+
})
|
37
|
+
|
38
|
+
const migrationQuestionTypes = /* ['singleSelection', 'essayResponseMath']; */ Cypress.env('migrationQuestionTypes');
|
39
|
+
const migrationQuestionTypesLrn = migrationQuestionTypes.map((questionType) => lrnQuestionTypesENUM[questionType]);
|
40
|
+
|
41
|
+
console.log('migrationQuestionTypes', Cypress.env('migrationQuestionTypes'))
|
42
|
+
console.log('referenceIds', Cypress.env('referenceIds'))
|
43
|
+
|
44
|
+
let lrnQuestionDataArr = [];
|
45
|
+
let lrnGradingDataArr = [];
|
46
|
+
|
47
|
+
// let referenceIds = /* Cypress.env('referenceIds') */[
|
48
|
+
// '929f0262-f490-4c4d-af7c-365ff8ee514e',
|
49
|
+
// '7fcf5cf2-139d-4146-ad5e-b2a475c944ab',
|
50
|
+
// // '8ceccf29-1a55-47c1-9321-6fb0db787d70',
|
51
|
+
// // '5e62bdab-7f2d-4a3d-ab66-868e62c22626',
|
52
|
+
// // '514d8c3a-495b-4dcd-87d0-aa289a9f415d',
|
53
|
+
// // 'e582071d-e4c9-403b-beea-8ccff93b06ea',
|
54
|
+
// 'a98ad5c4-f70a-44ac-89bc-da72248fdba5',
|
55
|
+
// ]
|
56
|
+
|
57
|
+
let referenceIds = ["#1 1.NBT.B.2a Number Operations in Base Ten Number Operations in Base Ten Math 01","#2 2.OA.A.1 Operations Algebraic Thinking Operations Algebraic Thinking Math 02","#3 2.NBT.B.8 Number Operations in Base Ten Number Operations in Base Ten Math 02","#4 3.OA.A.2 Operations Algebraic Thinking Operations Algebraic Thinking Math 03","#5 3.NBT.A.2 Number Operations in Base Ten Number Operations in Base Ten Math 03","#6 2.NBT.A.3 Number Operations in Base Ten Number Operations in Base Ten Math 02","#7 2.OA.A.1 Operations Algebraic Thinking Operations Algebraic Thinking Math 02","#8 2.OA.A.1 Operations Algebraic Thinking Operations Algebraic Thinking Math 02","#9 2.MD.C.8 Measurement Data Measurement Data Math 02","#10 2.MD.C.7 Measurement Data Measurement Data Math 02","#11 1.OA.D.7 Operations Algebraic Thinking Operations Algebraic Thinking Math 01","#12 2.MD.D.10 Measurement Data Measurement Data Math 02","#13 2.NBT.A.1 Number Operations in Base Ten Number Operations in Base Ten Math 02","#14 4.MD.A.2 Measurement Data Measurement Data Math 04","#15 3.NF.A.3a Number Operations Fractions Number Operations Fractions Math 03","#16 3.NBT.A.2 Number Operations in Base Ten Number Operations in Base Ten Math 03","#17 4.MD.A.2 Measurement Data Measurement Data Math 04","#18 3.G.A.1 Geometry Geometry Math 03","#19 4.MD.A.3 Measurement Data Measurement Data Math 04","#20 4.MD.A.2 Measurement Data Measurement Data Math 04","#21 3.OA.A.4 Operations Algebraic Thinking Operations Algebraic Thinking Math 03","#22 4.NBT.A.2 Number Operations in Base Ten Number Operations in Base Ten Math 04","#23 3.NF.A.3 Number Operations Fractions Number Operations Fractions Math 03","#24 3.OA.D.8 Operations Algebraic Thinking Operations Algebraic Thinking Math 03","#25 3.NBT.A.2 Number Operations in Base Ten Number Operations in Base Ten Math 03","#26 3.OA.A.3 Operations Algebraic Thinking Operations Algebraic Thinking Math 03","#27 4.MD.A.2 Measurement Data Measurement Data Math 04","#28 4.OA.A.3 Operations Algebraic Thinking Operations Algebraic Thinking Math 04","#29 4.MD.A.2 Measurement Data Measurement Data Math 04","#30 4.OA.C.5 Operations Algebraic Thinking Operations Algebraic Thinking Math 04","#31 4.NBT.A.2 Number Operations in Base Ten Number Operations in Base Ten Math 04","#32 3.NF.A.3a Number Operations Fractions Number Operations Fractions Math 03","#33 4.MD.A.2 Measurement Data Measurement Data Math 04","#34 4.MD.A.2 Measurement Data Measurement Data Math 04","#35 4.OA.C.5 Operations Algebraic Thinking Operations Algebraic Thinking Math 04","#36 4.OA.C.5 Operations Algebraic Thinking Operations Algebraic Thinking Math 04","#37 2.NBT.B.7 Number Operations in Base Ten Number Operations in Base Ten Math 02","#38 2.MD.D.10 Measurement Data Measurement Data Math 02","#39 4.NBT.A.2 Number Operations in Base Ten Number Operations in Base Ten Math 04","#40 3.OA.A.2 Operations Algebraic Thinking Operations Algebraic Thinking Math 03","#41 4.NF.B.3 Number Operations Fractions Number Operations Fractions Math 04","#42 5.NBT.B.7 Number Operations in Base Ten Number Operations in Base Ten Math 05","#43 4.MD.A.3 Measurement Data Measurement Data Math 04","#44 4.OA.A.3 Operations Algebraic Thinking Operations Algebraic Thinking Math 04","#45 3.OA.A.3 Operations Algebraic Thinking Operations Algebraic Thinking Math 03","#46 4.OA.A.3 Operations Algebraic Thinking Operations Algebraic Thinking Math 04","#47 4.NF.A.1 Number Operations Fractions Number Operations Fractions Math 04","#48 4.NBT.B.4 Number Operations in Base Ten Number Operations in Base Ten Math 04","#49 3.NF.A.2b Number Operations Fractions Number Operations Fractions Math 03","#50 3.NF.A.3 3.NF.A.3d 4.NF.A.2 Number Operations Fractions Number Operations Fractions Math 03 04"];
|
58
|
+
|
59
|
+
|
60
|
+
describe('Migration item check for MCQ questions', () => {
|
61
|
+
before(() => {
|
62
|
+
cy.loginAs('technicalTester');
|
63
|
+
});
|
64
|
+
|
65
|
+
referenceIds.forEach((referenceId) => {
|
66
|
+
describe(`Migration item check for item "${referenceId}"`, () => {
|
67
|
+
before(() => {
|
68
|
+
cy.interceptGraphql('getItemPreview');
|
69
|
+
cy.setGraphqlWait();
|
70
|
+
cy.visit(`/items-list/item/${utilities.base64Encoding(referenceId)}`);
|
71
|
+
cy.pageLoadWait('getItemPreview');
|
72
|
+
cy.get('@getItemPreview').then((req) => {
|
73
|
+
let questionCount = req.response.body.data.getItemPreview.item.questionParts.length;
|
74
|
+
cy.lazyLoadPreviewQuestions(questionCount);
|
75
|
+
});
|
76
|
+
});
|
77
|
+
|
78
|
+
after(() => {
|
79
|
+
console.log(lrnQuestionDataArr)
|
80
|
+
lrnQuestionDataArr = [];
|
81
|
+
lrnGradingDataArr = [];
|
82
|
+
});
|
83
|
+
|
84
|
+
it(`Extracting learnosity preview data for item "${referenceId}"`, () => {
|
85
|
+
lrnPage.questionTypeDiv()
|
86
|
+
.each(($el, index) => {
|
87
|
+
let currQuestionType = $el[0].innerText
|
88
|
+
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
89
|
+
switch (currQuestionType) {
|
90
|
+
case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelection(lrnQuestionDataArr, index);
|
91
|
+
case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
92
|
+
default: throw new Error('Invalid lrn question type');
|
93
|
+
}
|
94
|
+
}
|
95
|
+
});
|
96
|
+
});
|
97
|
+
|
98
|
+
it(`Verifying itemengine preview data for item "${referenceId}"`, () => {
|
99
|
+
migrationQuestionTypes.forEach((questionType) => {
|
100
|
+
cy.log(`Verifying data for all ${questionType} question type`);
|
101
|
+
let currQuestionTypeArr = lrnQuestionDataArr.filter((question) => question.questionType === questionType);
|
102
|
+
currQuestionTypeArr.forEach((questionData, index) => {
|
103
|
+
cy.log(`Verifying data for ${questionType} ${index}`);
|
104
|
+
switch (questionType) {
|
105
|
+
case 'singleSelection': return verifyIeQuestionData.singleSelection(questionData, index);
|
106
|
+
case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
107
|
+
default: throw new Error('Invalid ngie question type');
|
108
|
+
}
|
109
|
+
});
|
110
|
+
});
|
111
|
+
});
|
112
|
+
|
113
|
+
it(`Extracting learnosity grading data for item "${referenceId}"`, () => {
|
114
|
+
lrnPage.steps.checkShowAnswersToggle();
|
115
|
+
lrnPage.questionTypeDiv()
|
116
|
+
.each(($el, index) => {
|
117
|
+
let currQuestionType = $el[0].innerText
|
118
|
+
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
119
|
+
switch (currQuestionType) {
|
120
|
+
case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelectionGrading(lrnGradingDataArr, index);
|
121
|
+
// case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
122
|
+
default: throw new Error('Invalid lrn question type');
|
123
|
+
}
|
124
|
+
}
|
125
|
+
});
|
126
|
+
});
|
127
|
+
|
128
|
+
it(`Verifying itemengine grading data for item "${referenceId}"`, () => {
|
129
|
+
autoScoredScoringPreviewTab.steps.switchToGradingView();
|
130
|
+
migrationQuestionTypes.forEach((questionType) => {
|
131
|
+
cy.log(`Verifying grading data for all ${questionType} question type`);
|
132
|
+
let currQuestionTypeArr = lrnGradingDataArr.filter((question) => question.questionType === questionType);
|
133
|
+
currQuestionTypeArr.forEach((questionData, index) => {
|
134
|
+
cy.log(`Verifying grading data for ${questionType} ${index}`);
|
135
|
+
switch (questionType) {
|
136
|
+
case 'singleSelection': return verifyIeQuestionData.singleSelectionGrading(questionData, index);
|
137
|
+
// case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
138
|
+
default: throw new Error('Invalid ngie question type');
|
139
|
+
}
|
140
|
+
});
|
141
|
+
});
|
142
|
+
});
|
143
|
+
});
|
144
|
+
});
|
145
|
+
});
|
146
|
+
|
147
|
+
|
148
|
+
//command:
|
149
|
+
//npx cypress open --env fileConfig=ilqa,migrationQuestionTypes='["singleSelection","essayResponseMath"]',referenceIds='["929f0262-f490-4c4d-af7c-365ff8ee514e","7fcf5cf2-139d-4146-ad5e-b2a475c944ab","a98ad5c4-f70a-44ac-89bc-da72248fdba5"]'
|
150
|
+
|
151
|
+
// Pending items:
|
152
|
+
// Lazy loading handling
|
153
|
+
// Testing it with large number of items and handle edge cases if any
|
154
|
+
// Discuss with Ankit/Ashish sir, the approach of getting the item ids
|
155
|
+
// Grading view approach: either collect in the same array or loop over second time to store in a different array this would prevent switching back and forth and save time
|
156
|
+
|
157
|
+
// const getMigratedItemListData = [];
|
158
|
+
// const extractReferenceId = getMigratedItemListData.map((question) => question.referenceId);
|
159
|
+
// console.log();
|
160
|
+
|
161
|
+
|
162
|
+
// npx cypress run --env fileConfig=ilqa,migrationQuestionTypes='["singleSelection"]',referenceIds='["eab77261-45f8-43e8-84a8-6633474c363c","cb6c9d86-b9a5-4e75-b243-81b3fcb99856","3a9a22ff-b56d-4f6f-8108-f371d133e4c9","b9dbe59f-825d-4798-beee-b3be07d874cd","87ff6039-0f65-4c9d-9317-1f4f59eaf624","644f52a2-06b6-47af-9590-f691ee67549e","484608db-8873-4172-a238-08eb7e665344","0bc19082-864e-4196-9b2b-3a62a43c17f3","ef643fa9-c0e0-470b-8144-00811c36f6ac","a9867ddf-2593-4ff4-8c4c-52729773fd29","0306ab22-ffdd-44bc-91bd-d62e81b542f6","c6522655-ed75-48ff-99a6-f0c48dd870d7","8e45365a-8d19-4688-9f31-b31035dbb9d4","ba416913-de16-4270-b779-e4aab0de36e7","c392ea6a-902f-42b1-911b-751e72c7d587","95b6c8fb-6766-4110-86d1-5f6bba6d9b59","a9e3aa75-47bb-42ab-9d9e-480384a6df56","7e42adcb-44a1-4747-8cef-6ddc375b9f03","c15481c8-442e-4ae9-a992-b5e4e41ba323","7432e4a4-32d6-4765-a39c-fa23ffaa2e1f","b972e944-e239-4a54-a34f-6bd414a250bc","0178e819-a746-4d85-8e98-356dc5ce8d27","71fe86b6-e4ff-4be5-b98a-91e169a599c7","7aa7e77e-c590-428f-b84b-34d28614dfb4","109d861a-f750-4c44-a7f4-294cde46f226","52dfb585-ea5b-4b78-9e92-ea2548e619e3","b1a9a551-0c75-49f9-a68d-1f7e40785d0b","bd8128ee-cd80-4c51-986c-09305b2d4980","231f883a-c82a-4ff7-87dc-acdff0043394","efe4c62f-e153-4304-86de-911c9eac422a","91f71b1d-6534-4690-997e-ddaa61ef18c7","d2fb979f-28f6-4280-902f-49e48b280d49","65febe0f-45d2-4979-a988-d6b7926bd393","7ef436de-9e98-4425-b057-c97ac861afff","d5cbe675-21f1-4db5-9f80-7fc8f330dc22","56eef654-01a3-4ce3-8e07-73e1dd65299a","8c21e186-511c-4e05-b383-a39bfa3da273","a804631e-34f7-4139-bc75-4b821d5dec04","ee650c83-b290-4233-8528-30ee43b180f7","14445082-344c-4d5d-a43b-48fc1fd2d3eb","ffa04e4a-e90f-41d2-80d8-7b5216619d42","eb8e3a31-4e16-42f2-a9df-12e2eda0b7f6","23eb3595-937f-42a0-9b86-197c25105903","ca003a60-7fb2-47e0-9ff4-09494541c05b","4a82815d-92b8-4d5a-be30-554743796f3a","23e05cec-2c0b-4c22-9568-449c970cd489","0daff0fa-8c0e-485b-83d1-f32391ab5083","1fa712c7-bfa8-468c-a4bb-a8a3c25302eb","2fd27b37-876f-44ef-9362-8c5057a79a13","7b2384ed-590b-4498-bde6-de3b6003bd61"]'
|
163
|
+
|
164
|
+
|
165
|
+
// let referenceIds = [
|
166
|
+
// '929f0262-f490-4c4d-af7c-365ff8ee514e',
|
167
|
+
// '7.6.16 Practice 2',
|
168
|
+
// 'a98ad5c4-f70a-44ac-89bc-da72248fdba5',
|
169
|
+
// 'cc57b793-bf86-4470-8072-4ed07feb7070',
|
170
|
+
// '165df947-062b-406f-8e6d-08c53022a550',
|
171
|
+
// '89c235d6-a88d-4cd4-b59c-4e1fc7511ab3',
|
172
|
+
// '8ceccf29-1a55-47c1-9321-6fb0db787d70',
|
173
|
+
// '4ec862d2-8a95-4312-afe8-6bf1e5540d7e',
|
174
|
+
// 'cb51935f-56a2-4ccd-824d-1c0c8a87536a',
|
175
|
+
// '98983ac9-0173-4c77-991a-17cdf26f453d',
|
176
|
+
// '02db5163-fd79-4168-8bbb-b9a0d3a44e57',
|
177
|
+
// 'a938e889-de77-441a-8154-5ebe516a70e2',
|
178
|
+
// '7052e792-d7ed-4638-82d4-29f7eb469f3d',
|
179
|
+
// 'e9669a50-4f11-4eb1-84c1-c9ee033de99b',
|
180
|
+
// 'eff66b69-8f25-4eb1-9af0-be4ef7b46038',
|
181
|
+
// 'c5cc91af-939d-4563-87da-28b01b64a765',
|
182
|
+
// '5a3209c7-f0eb-4ea3-aa99-fd6c62bd4e50',
|
183
|
+
// '62b8e8d8-6233-410b-9d42-4ff17c329a5d',
|
184
|
+
// '8621b80b-9822-4358-a0ae-cee36f23531f',
|
185
|
+
// '78a50137-c68d-47a9-856c-6cb2be0c89b6',
|
186
|
+
// '9487d671-d5b4-4282-bdc9-19844a386e6a',
|
187
|
+
// '58308047-4de2-4435-a2ca-3d2f02072a7b',
|
188
|
+
// '2b3030b2-2b3e-4871-8339-c36cb0efdc61',
|
189
|
+
// '5e62bdab-7f2d-4a3d-ab66-868e62c22626',
|
190
|
+
// '514d8c3a-495b-4dcd-87d0-aa289a9f415d',
|
191
|
+
// 'e582071d-e4c9-403b-beea-8ccff93b06ea',
|
192
|
+
// 'b2acb94b-70fb-4e4e-984d-cabc4e4b4f3a',
|
193
|
+
// 'f25f7cf4-8aab-43fb-a096-50e2e04fe7a0',
|
194
|
+
// '20e3f0fa-fb4c-4137-ae7f-25098dcf5345',
|
195
|
+
// 'b0aa7e34-827e-4a9c-868e-2ce43468cd41',
|
196
|
+
// '070eedce-66c9-46a3-abe9-9630acccc003',
|
197
|
+
// 'ffd83f44-1974-4c5d-a0c6-f09f7a571850',
|
198
|
+
// '1cee05d7-fd06-4bac-873e-7711f3a527f2',
|
199
|
+
// '8dd4a1e0-e857-4df0-9ce8-147e6ba2a792',
|
200
|
+
// '1acde35c-485f-4bfb-8f91-fd9c972e0b83',
|
201
|
+
// '7fcf5cf2-139d-4146-ad5e-b2a475c944ab',
|
202
|
+
// 'c62b526a-dba5-461b-b155-8c98187958bc',
|
203
|
+
// '7a60fbf5-4f48-4b0f-9e92-c5c1070ae485',
|
204
|
+
// 'GBQ_G4_AREV_S2/3_Q1',
|
205
|
+
// '721cd878-be7b-40f2-a67f-135bb54401e0',
|
206
|
+
// '00953073-19fd-4c46-91d7-5135f1423267',
|
207
|
+
// '66590794-e794-4fd7-b6d5-e949cc24f962',
|
208
|
+
// '6f9b2342-bbd5-4422-bf61-97c847f3f185',
|
209
|
+
// 'c6901952-a27d-4272-9fe8-75bbfb9cf79a',
|
210
|
+
// '490ab6b1-5150-458a-b8cb-4a8c4121b7b2',
|
211
|
+
// 'f7e1af87-c11b-4c15-81d8-0181cebc14d8',
|
212
|
+
// 'bc697246-4854-47d1-a285-4752b1472b3a',
|
213
|
+
// '2f3bf5b1-40be-4840-8bdd-e04cfcf3362e',
|
214
|
+
// '5c674576-edcf-474f-9885-0b68cce8aaf2',
|
215
|
+
// 'a4f3609e-9c98-43fa-a9b1-1f55e7d10423'
|
216
|
+
// ]
|
@@ -0,0 +1,216 @@
|
|
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 { 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
|
+
cy.get('.question-instruction')
|
19
|
+
.then((elements) => {
|
20
|
+
if (retries <= 0) {
|
21
|
+
throw new Error('Element did not load in time')
|
22
|
+
};
|
23
|
+
if (elements.length < count) {
|
24
|
+
cy.get('.question-instruction')
|
25
|
+
.last()
|
26
|
+
.scrollIntoView()
|
27
|
+
.wait(1000);
|
28
|
+
cy.lazyLoadPreviewQuestions(count, retries - 1)
|
29
|
+
};
|
30
|
+
cy.log('All question parts loaded')
|
31
|
+
});
|
32
|
+
//cy.barsPreLoaderWait();
|
33
|
+
cy.get('[id="question-item-instruction-loader"]')
|
34
|
+
.should('not.exist');
|
35
|
+
cy.learnosityLoaderWait();
|
36
|
+
})
|
37
|
+
|
38
|
+
const migrationQuestionTypes = /* ['singleSelection', 'essayResponseMath']; */ Cypress.env('migrationQuestionTypes');
|
39
|
+
const migrationQuestionTypesLrn = migrationQuestionTypes.map((questionType) => lrnQuestionTypesENUM[questionType]);
|
40
|
+
|
41
|
+
console.log('migrationQuestionTypes', Cypress.env('migrationQuestionTypes'))
|
42
|
+
console.log('referenceIds', Cypress.env('referenceIds'))
|
43
|
+
|
44
|
+
let lrnQuestionDataArr = [];
|
45
|
+
let lrnGradingDataArr = [];
|
46
|
+
|
47
|
+
// let referenceIds = /* Cypress.env('referenceIds') */[
|
48
|
+
// '929f0262-f490-4c4d-af7c-365ff8ee514e',
|
49
|
+
// '7fcf5cf2-139d-4146-ad5e-b2a475c944ab',
|
50
|
+
// // '8ceccf29-1a55-47c1-9321-6fb0db787d70',
|
51
|
+
// // '5e62bdab-7f2d-4a3d-ab66-868e62c22626',
|
52
|
+
// // '514d8c3a-495b-4dcd-87d0-aa289a9f415d',
|
53
|
+
// // 'e582071d-e4c9-403b-beea-8ccff93b06ea',
|
54
|
+
// 'a98ad5c4-f70a-44ac-89bc-da72248fdba5',
|
55
|
+
// ]
|
56
|
+
|
57
|
+
let referenceIds = ["#51 5.OA.A.2 Operations Algebraic Thinking Operations Algebraic Thinking Math 05","#52 4.MD.A.2 Measurement Data Measurement Data Math 04","#53 4.G.A.1 Geometry Geometry Math 04","#54 2.MD.D.10 Measurement Data Measurement Data Math 02","#55 3.OA.A.3 Operations Algebraic Thinking Operations Algebraic Thinking Math 03","#56 3.NF.A.1 Number Operations Fractions Number Operations Fractions Math 03","#57 4.MD.A.2 Measurement Data Measurement Data Math 04","#58 2.G.A.1 Geometry Geometry Math 02","#59 4.MD.A.2 Measurement Data Measurement Data Math 04","#60 5.OA.A.1 Operations Algebraic Thinking Operations Algebraic Thinking Math 05","#61 2.MD.D.10 Measurement Data Measurement Data Math 02","#62 6.SP.B.5c Statistics Probability Statistics Probability Math 06","#63 4.NBT.A.2 Number Operations in Base Ten Number Operations in Base Ten Math 04","#64 4.MD.B.4 Measurement Data Measurement Data Math 04","#65 4.OA.A.3 Operations Algebraic Thinking Operations Algebraic Thinking Math 04","#66 4.OA.B.4 Operations Algebraic Thinking Operations Algebraic Thinking Math 04","#67 5.G.B.3 Geometry Geometry Math 05","#68 3.G.A.1 Geometry Geometry Math 03","#69 6.G.A.1 Geometry Geometry Math 06","#70 6.SP.B.5 Statistics Probability Statistics Probability Math 06","#71 6.RP.A.3b Ratios Proportional Relationships Ratios Proportional Relationships Math 06","#72 6.SP.B.5 Statistics Probability Statistics Probability Math 06","#73 4.NF.B.3d Number Operations Fractions Number Operations Fractions Math 04","#74 4.NF.C.7 Number Operations Fractions Number Operations Fractions Math 04","#75 4.OA.A.3 Operations Algebraic Thinking Operations Algebraic Thinking Math 04","#76 5.NF.A.2 Number Operations Fractions Number Operations Fractions Math 05","#77 4.MD.A.2 Measurement Data Measurement Data Math 04","#78 4.MD.A.3 Measurement Data Measurement Data Math 04","#79 4.MD.A.3 Measurement Data Measurement Data Math 04","#80 5.MD.A.1 Measurement Data Measurement Data Math 05","#81 6.EE.B.5 Expressions Equations Expressions Equations Math 06","#82 6.EE.B.5 Expressions Equations Expressions Equations Math 06","#83 6.RP.A.3c Ratios Proportional Relationships Ratios Proportional Relationships Math 06","#84 6.RP.A.3b Ratios Proportional Relationships Ratios Proportional Relationships Math 06","#85 4.OA.A.3 Operations Algebraic Thinking Operations Algebraic Thinking Math 04","#86 5.NF.A.1 Number Operations Fractions Number Operations Fractions Math 05","#87 6.RP.A.3b Ratios Proportional Relationships Ratios Proportional Relationships Math 06","#88 3.G.A.1 Geometry Geometry Math 03","#89 6.RP.A.3a Ratios Proportional Relationships Ratios Proportional Relationships Math 06","#90 6.RP.A.3 Ratios Proportional Relationships Ratios Proportional Relationships Math 06","#91 6.RP.A.3 Ratios Proportional Relationships Ratios Proportional Relationships Math 06","#92 6.RP.A.3c Ratios Proportional Relationships Ratios Proportional Relationships Math 06","#93 5.NBT.A.3 Number Operations in Base Ten Number Operations in Base Ten Math 05","#94 3.MD.D.8 Measurement Data Measurement Data Math 03","#95 7.EE.B.3 Expressions Equations Expressions Equations Math 07","#96 6.EE.B.6 Expressions Equations Expressions Equations Math 06","#97 6.RP.A.3 6.RP.A.3a Ratios Proportional Relationships Ratios Proportional Relationships Math 06","#98 6.RP.A.2 Ratios Proportional Relationships Ratios Proportional Relationships Math 06","#99 6.EE.A.2 6.EE.A.2c Expressions Equations Expressions Equations Math 06","#100 5.OA.A.1 Operations Algebraic Thinking Operations Algebraic Thinking Math 05"];
|
58
|
+
|
59
|
+
|
60
|
+
describe('Migration item check for MCQ questions', () => {
|
61
|
+
before(() => {
|
62
|
+
cy.loginAs('technicalTester');
|
63
|
+
});
|
64
|
+
|
65
|
+
referenceIds.forEach((referenceId) => {
|
66
|
+
describe(`Migration item check for item "${referenceId}"`, () => {
|
67
|
+
before(() => {
|
68
|
+
cy.interceptGraphql('getItemPreview');
|
69
|
+
cy.setGraphqlWait();
|
70
|
+
cy.visit(`/items-list/item/${utilities.base64Encoding(referenceId)}`);
|
71
|
+
cy.pageLoadWait('getItemPreview');
|
72
|
+
cy.get('@getItemPreview').then((req) => {
|
73
|
+
let questionCount = req.response.body.data.getItemPreview.item.questionParts.length;
|
74
|
+
cy.lazyLoadPreviewQuestions(questionCount);
|
75
|
+
});
|
76
|
+
});
|
77
|
+
|
78
|
+
after(() => {
|
79
|
+
console.log(lrnQuestionDataArr)
|
80
|
+
lrnQuestionDataArr = [];
|
81
|
+
lrnGradingDataArr = [];
|
82
|
+
});
|
83
|
+
|
84
|
+
it(`Extracting learnosity preview data for item "${referenceId}"`, () => {
|
85
|
+
lrnPage.questionTypeDiv()
|
86
|
+
.each(($el, index) => {
|
87
|
+
let currQuestionType = $el[0].innerText
|
88
|
+
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
89
|
+
switch (currQuestionType) {
|
90
|
+
case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelection(lrnQuestionDataArr, index);
|
91
|
+
case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
92
|
+
default: throw new Error('Invalid lrn question type');
|
93
|
+
}
|
94
|
+
}
|
95
|
+
});
|
96
|
+
});
|
97
|
+
|
98
|
+
it(`Verifying itemengine preview data for item "${referenceId}"`, () => {
|
99
|
+
migrationQuestionTypes.forEach((questionType) => {
|
100
|
+
cy.log(`Verifying data for all ${questionType} question type`);
|
101
|
+
let currQuestionTypeArr = lrnQuestionDataArr.filter((question) => question.questionType === questionType);
|
102
|
+
currQuestionTypeArr.forEach((questionData, index) => {
|
103
|
+
cy.log(`Verifying data for ${questionType} ${index}`);
|
104
|
+
switch (questionType) {
|
105
|
+
case 'singleSelection': return verifyIeQuestionData.singleSelection(questionData, index);
|
106
|
+
case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
107
|
+
default: throw new Error('Invalid ngie question type');
|
108
|
+
}
|
109
|
+
});
|
110
|
+
});
|
111
|
+
});
|
112
|
+
|
113
|
+
it(`Extracting learnosity grading data for item "${referenceId}"`, () => {
|
114
|
+
lrnPage.steps.checkShowAnswersToggle();
|
115
|
+
lrnPage.questionTypeDiv()
|
116
|
+
.each(($el, index) => {
|
117
|
+
let currQuestionType = $el[0].innerText
|
118
|
+
if (migrationQuestionTypesLrn.includes(currQuestionType)) {
|
119
|
+
switch (currQuestionType) {
|
120
|
+
case lrnQuestionTypesENUM.singleSelection: return extractLrnQuestionData.singleSelectionGrading(lrnGradingDataArr, index);
|
121
|
+
// case lrnQuestionTypesENUM.essayResponseMath: return extractLrnQuestionData.essayResponseMath(lrnQuestionDataArr, index);
|
122
|
+
default: throw new Error('Invalid lrn question type');
|
123
|
+
}
|
124
|
+
}
|
125
|
+
});
|
126
|
+
});
|
127
|
+
|
128
|
+
it(`Verifying itemengine grading data for item "${referenceId}"`, () => {
|
129
|
+
autoScoredScoringPreviewTab.steps.switchToGradingView();
|
130
|
+
migrationQuestionTypes.forEach((questionType) => {
|
131
|
+
cy.log(`Verifying grading data for all ${questionType} question type`);
|
132
|
+
let currQuestionTypeArr = lrnGradingDataArr.filter((question) => question.questionType === questionType);
|
133
|
+
currQuestionTypeArr.forEach((questionData, index) => {
|
134
|
+
cy.log(`Verifying grading data for ${questionType} ${index}`);
|
135
|
+
switch (questionType) {
|
136
|
+
case 'singleSelection': return verifyIeQuestionData.singleSelectionGrading(questionData, index);
|
137
|
+
// case 'essayResponseMath': return verifyIeQuestionData.essayResponseMath(questionData, index);
|
138
|
+
default: throw new Error('Invalid ngie question type');
|
139
|
+
}
|
140
|
+
});
|
141
|
+
});
|
142
|
+
});
|
143
|
+
});
|
144
|
+
});
|
145
|
+
});
|
146
|
+
|
147
|
+
|
148
|
+
//command:
|
149
|
+
//npx cypress open --env fileConfig=ilqa,migrationQuestionTypes='["singleSelection","essayResponseMath"]',referenceIds='["929f0262-f490-4c4d-af7c-365ff8ee514e","7fcf5cf2-139d-4146-ad5e-b2a475c944ab","a98ad5c4-f70a-44ac-89bc-da72248fdba5"]'
|
150
|
+
|
151
|
+
// Pending items:
|
152
|
+
// Lazy loading handling
|
153
|
+
// Testing it with large number of items and handle edge cases if any
|
154
|
+
// Discuss with Ankit/Ashish sir, the approach of getting the item ids
|
155
|
+
// Grading view approach: either collect in the same array or loop over second time to store in a different array this would prevent switching back and forth and save time
|
156
|
+
|
157
|
+
// const getMigratedItemListData = [];
|
158
|
+
// const extractReferenceId = getMigratedItemListData.map((question) => question.referenceId);
|
159
|
+
// console.log();
|
160
|
+
|
161
|
+
|
162
|
+
// npx cypress run --env fileConfig=ilqa,migrationQuestionTypes='["singleSelection"]',referenceIds='["eab77261-45f8-43e8-84a8-6633474c363c","cb6c9d86-b9a5-4e75-b243-81b3fcb99856","3a9a22ff-b56d-4f6f-8108-f371d133e4c9","b9dbe59f-825d-4798-beee-b3be07d874cd","87ff6039-0f65-4c9d-9317-1f4f59eaf624","644f52a2-06b6-47af-9590-f691ee67549e","484608db-8873-4172-a238-08eb7e665344","0bc19082-864e-4196-9b2b-3a62a43c17f3","ef643fa9-c0e0-470b-8144-00811c36f6ac","a9867ddf-2593-4ff4-8c4c-52729773fd29","0306ab22-ffdd-44bc-91bd-d62e81b542f6","c6522655-ed75-48ff-99a6-f0c48dd870d7","8e45365a-8d19-4688-9f31-b31035dbb9d4","ba416913-de16-4270-b779-e4aab0de36e7","c392ea6a-902f-42b1-911b-751e72c7d587","95b6c8fb-6766-4110-86d1-5f6bba6d9b59","a9e3aa75-47bb-42ab-9d9e-480384a6df56","7e42adcb-44a1-4747-8cef-6ddc375b9f03","c15481c8-442e-4ae9-a992-b5e4e41ba323","7432e4a4-32d6-4765-a39c-fa23ffaa2e1f","b972e944-e239-4a54-a34f-6bd414a250bc","0178e819-a746-4d85-8e98-356dc5ce8d27","71fe86b6-e4ff-4be5-b98a-91e169a599c7","7aa7e77e-c590-428f-b84b-34d28614dfb4","109d861a-f750-4c44-a7f4-294cde46f226","52dfb585-ea5b-4b78-9e92-ea2548e619e3","b1a9a551-0c75-49f9-a68d-1f7e40785d0b","bd8128ee-cd80-4c51-986c-09305b2d4980","231f883a-c82a-4ff7-87dc-acdff0043394","efe4c62f-e153-4304-86de-911c9eac422a","91f71b1d-6534-4690-997e-ddaa61ef18c7","d2fb979f-28f6-4280-902f-49e48b280d49","65febe0f-45d2-4979-a988-d6b7926bd393","7ef436de-9e98-4425-b057-c97ac861afff","d5cbe675-21f1-4db5-9f80-7fc8f330dc22","56eef654-01a3-4ce3-8e07-73e1dd65299a","8c21e186-511c-4e05-b383-a39bfa3da273","a804631e-34f7-4139-bc75-4b821d5dec04","ee650c83-b290-4233-8528-30ee43b180f7","14445082-344c-4d5d-a43b-48fc1fd2d3eb","ffa04e4a-e90f-41d2-80d8-7b5216619d42","eb8e3a31-4e16-42f2-a9df-12e2eda0b7f6","23eb3595-937f-42a0-9b86-197c25105903","ca003a60-7fb2-47e0-9ff4-09494541c05b","4a82815d-92b8-4d5a-be30-554743796f3a","23e05cec-2c0b-4c22-9568-449c970cd489","0daff0fa-8c0e-485b-83d1-f32391ab5083","1fa712c7-bfa8-468c-a4bb-a8a3c25302eb","2fd27b37-876f-44ef-9362-8c5057a79a13","7b2384ed-590b-4498-bde6-de3b6003bd61"]'
|
163
|
+
|
164
|
+
|
165
|
+
// let referenceIds = [
|
166
|
+
// '929f0262-f490-4c4d-af7c-365ff8ee514e',
|
167
|
+
// '7.6.16 Practice 2',
|
168
|
+
// 'a98ad5c4-f70a-44ac-89bc-da72248fdba5',
|
169
|
+
// 'cc57b793-bf86-4470-8072-4ed07feb7070',
|
170
|
+
// '165df947-062b-406f-8e6d-08c53022a550',
|
171
|
+
// '89c235d6-a88d-4cd4-b59c-4e1fc7511ab3',
|
172
|
+
// '8ceccf29-1a55-47c1-9321-6fb0db787d70',
|
173
|
+
// '4ec862d2-8a95-4312-afe8-6bf1e5540d7e',
|
174
|
+
// 'cb51935f-56a2-4ccd-824d-1c0c8a87536a',
|
175
|
+
// '98983ac9-0173-4c77-991a-17cdf26f453d',
|
176
|
+
// '02db5163-fd79-4168-8bbb-b9a0d3a44e57',
|
177
|
+
// 'a938e889-de77-441a-8154-5ebe516a70e2',
|
178
|
+
// '7052e792-d7ed-4638-82d4-29f7eb469f3d',
|
179
|
+
// 'e9669a50-4f11-4eb1-84c1-c9ee033de99b',
|
180
|
+
// 'eff66b69-8f25-4eb1-9af0-be4ef7b46038',
|
181
|
+
// 'c5cc91af-939d-4563-87da-28b01b64a765',
|
182
|
+
// '5a3209c7-f0eb-4ea3-aa99-fd6c62bd4e50',
|
183
|
+
// '62b8e8d8-6233-410b-9d42-4ff17c329a5d',
|
184
|
+
// '8621b80b-9822-4358-a0ae-cee36f23531f',
|
185
|
+
// '78a50137-c68d-47a9-856c-6cb2be0c89b6',
|
186
|
+
// '9487d671-d5b4-4282-bdc9-19844a386e6a',
|
187
|
+
// '58308047-4de2-4435-a2ca-3d2f02072a7b',
|
188
|
+
// '2b3030b2-2b3e-4871-8339-c36cb0efdc61',
|
189
|
+
// '5e62bdab-7f2d-4a3d-ab66-868e62c22626',
|
190
|
+
// '514d8c3a-495b-4dcd-87d0-aa289a9f415d',
|
191
|
+
// 'e582071d-e4c9-403b-beea-8ccff93b06ea',
|
192
|
+
// 'b2acb94b-70fb-4e4e-984d-cabc4e4b4f3a',
|
193
|
+
// 'f25f7cf4-8aab-43fb-a096-50e2e04fe7a0',
|
194
|
+
// '20e3f0fa-fb4c-4137-ae7f-25098dcf5345',
|
195
|
+
// 'b0aa7e34-827e-4a9c-868e-2ce43468cd41',
|
196
|
+
// '070eedce-66c9-46a3-abe9-9630acccc003',
|
197
|
+
// 'ffd83f44-1974-4c5d-a0c6-f09f7a571850',
|
198
|
+
// '1cee05d7-fd06-4bac-873e-7711f3a527f2',
|
199
|
+
// '8dd4a1e0-e857-4df0-9ce8-147e6ba2a792',
|
200
|
+
// '1acde35c-485f-4bfb-8f91-fd9c972e0b83',
|
201
|
+
// '7fcf5cf2-139d-4146-ad5e-b2a475c944ab',
|
202
|
+
// 'c62b526a-dba5-461b-b155-8c98187958bc',
|
203
|
+
// '7a60fbf5-4f48-4b0f-9e92-c5c1070ae485',
|
204
|
+
// 'GBQ_G4_AREV_S2/3_Q1',
|
205
|
+
// '721cd878-be7b-40f2-a67f-135bb54401e0',
|
206
|
+
// '00953073-19fd-4c46-91d7-5135f1423267',
|
207
|
+
// '66590794-e794-4fd7-b6d5-e949cc24f962',
|
208
|
+
// '6f9b2342-bbd5-4422-bf61-97c847f3f185',
|
209
|
+
// 'c6901952-a27d-4272-9fe8-75bbfb9cf79a',
|
210
|
+
// '490ab6b1-5150-458a-b8cb-4a8c4121b7b2',
|
211
|
+
// 'f7e1af87-c11b-4c15-81d8-0181cebc14d8',
|
212
|
+
// 'bc697246-4854-47d1-a285-4752b1472b3a',
|
213
|
+
// '2f3bf5b1-40be-4840-8bdd-e04cfcf3362e',
|
214
|
+
// '5c674576-edcf-474f-9885-0b68cce8aaf2',
|
215
|
+
// 'a4f3609e-9c98-43fa-a9b1-1f55e7d10423'
|
216
|
+
// ]
|
@@ -32,7 +32,10 @@ Cypress.Commands.add('loginAs', (roleName = 'admin') => {
|
|
32
32
|
if (roleName == 'admin') {
|
33
33
|
var username = `${Cypress.env('admin_username')}`;
|
34
34
|
var password = `${Cypress.env('admin_password')}`
|
35
|
-
}
|
35
|
+
} else if (roleName === 'technicalTester') {
|
36
|
+
var username = `demo-technical-tester`;
|
37
|
+
var password = `SXYeokWOoTuwEg2w`
|
38
|
+
}
|
36
39
|
cy.logout();
|
37
40
|
cy.request({
|
38
41
|
method: 'POST',
|
@@ -0,0 +1,106 @@
|
|
1
|
+
export const lrnPage = {
|
2
|
+
questionTypeDiv: () => cy.get('.lrn-widget-drag-name'),
|
3
|
+
questionInstructions: () => cy.get('.lrn_question'),
|
4
|
+
questionWrapper: () => cy.get('.lrn-widget-drag-wrapper'),
|
5
|
+
mcqOptionWrapper: () => cy.get('.lrn-mcq-option'),
|
6
|
+
mcqOptionContent: () => cy.get('.lrn_contentWrapper'),
|
7
|
+
questionsLoader: () => cy.get('.lrn-spinner'),
|
8
|
+
showAnswersToggle: () => cy.get('.lrn-author-validate-questions-toggle'),
|
9
|
+
steps: {
|
10
|
+
checkShowAnswersToggle: () => {
|
11
|
+
lrnPage.showAnswersToggle()
|
12
|
+
.click()
|
13
|
+
.should('have.class', 'checked');
|
14
|
+
}
|
15
|
+
}
|
16
|
+
}
|
17
|
+
|
18
|
+
export const extractLrnQuestionData = {
|
19
|
+
singleSelection: (lrnQuestionDataArr, index) => {
|
20
|
+
let obj = {};
|
21
|
+
cy.log(`Extracting the question instructions and options from question ${index}`);
|
22
|
+
obj.questionIndex = index;
|
23
|
+
obj.questionType = 'singleSelection'
|
24
|
+
lrnPage.questionWrapper()
|
25
|
+
.eq(index)
|
26
|
+
.within(() => {
|
27
|
+
lrnPage.questionInstructions()
|
28
|
+
.then(($ins) => {
|
29
|
+
let text = $ins[0].innerText;
|
30
|
+
obj.previewQuestionInstructions = text;
|
31
|
+
});
|
32
|
+
|
33
|
+
let optionsText = [];
|
34
|
+
lrnPage.mcqOptionWrapper()
|
35
|
+
.each(($options) => {
|
36
|
+
cy.wrap($options)
|
37
|
+
.within(() => {
|
38
|
+
lrnPage.mcqOptionContent()
|
39
|
+
.then(($el) => {
|
40
|
+
let text = $el[0].innerText;
|
41
|
+
optionsText.push(text);
|
42
|
+
});
|
43
|
+
});
|
44
|
+
});
|
45
|
+
obj.previewOptionsText = optionsText;
|
46
|
+
})
|
47
|
+
lrnQuestionDataArr.push(obj);
|
48
|
+
},
|
49
|
+
|
50
|
+
singleSelectionGrading: (lrnGradingDataArr, index) => {
|
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
|
55
|
+
let obj = {};
|
56
|
+
cy.log(`Extracting the question instructions, options and correct answers from question ${index}`);
|
57
|
+
obj.questionIndex = index;
|
58
|
+
obj.questionType = 'singleSelection'
|
59
|
+
lrnPage.questionWrapper()
|
60
|
+
.eq(index)
|
61
|
+
.within(() => {
|
62
|
+
lrnPage.questionInstructions()
|
63
|
+
.then(($ins) => {
|
64
|
+
let text = $ins[0].innerText;
|
65
|
+
obj.gradingQuestionInstructions = text;
|
66
|
+
});
|
67
|
+
|
68
|
+
let optionsText = [];
|
69
|
+
let correctAnswersIndex = [];
|
70
|
+
lrnPage.mcqOptionWrapper()
|
71
|
+
.each(($optionWrapper, index) => {
|
72
|
+
console.log($optionWrapper[0].className)
|
73
|
+
if ($optionWrapper[0].className.includes('lrn_valid')) {
|
74
|
+
correctAnswersIndex.push(index)
|
75
|
+
}
|
76
|
+
cy.wrap($optionWrapper)
|
77
|
+
.within(() => {
|
78
|
+
lrnPage.mcqOptionContent()
|
79
|
+
.then(($el) => {
|
80
|
+
optionsText.push($el[0].innerText);
|
81
|
+
});
|
82
|
+
});
|
83
|
+
});
|
84
|
+
obj.gradingOptionsText = optionsText;
|
85
|
+
obj.correctAnswersIndex = correctAnswersIndex;
|
86
|
+
});
|
87
|
+
lrnGradingDataArr.push(obj);
|
88
|
+
},
|
89
|
+
|
90
|
+
essayResponseMath: (lrnQuestionDataArr, index) => {
|
91
|
+
let obj = {};
|
92
|
+
cy.log(`Extracting the question instructions and options from question ${index}`);
|
93
|
+
obj.questionIndex = index;
|
94
|
+
obj.questionType = 'essayResponseMath'
|
95
|
+
lrnPage.questionWrapper()
|
96
|
+
.eq(index)
|
97
|
+
.within(() => {
|
98
|
+
lrnPage.questionInstructions()
|
99
|
+
.then(($ins) => {
|
100
|
+
let text = $ins[0].innerText;
|
101
|
+
obj.previewQuestionInstructions = text;
|
102
|
+
});
|
103
|
+
})
|
104
|
+
lrnQuestionDataArr.push(obj);
|
105
|
+
}
|
106
|
+
}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import { singleSelectionPage } from "../../../pages/singleSelectionPage"
|
2
|
+
|
3
|
+
export const verifyIeQuestionData = {
|
4
|
+
singleSelection: (expectedQuestionData, index) => {
|
5
|
+
cy.get('.ngie-single-select')
|
6
|
+
.eq(index)
|
7
|
+
.within(() => {
|
8
|
+
singleSelectionPage.questionInstructionsText()
|
9
|
+
.verifyInnerText(expectedQuestionData.previewQuestionInstructions);
|
10
|
+
singleSelectionPage.optionTextPreviewTab()
|
11
|
+
.then(($elements) => {
|
12
|
+
expect($elements.length).to.be.eq(expectedQuestionData.previewOptionsText.length);
|
13
|
+
});
|
14
|
+
singleSelectionPage.optionTextPreviewTab()
|
15
|
+
.each((optionElem, optionIndex) => {
|
16
|
+
cy.wrap(optionElem)
|
17
|
+
.verifyInnerText(expectedQuestionData.previewOptionsText[optionIndex]);
|
18
|
+
});
|
19
|
+
});
|
20
|
+
},
|
21
|
+
|
22
|
+
singleSelectionGrading: (expectedQuestionData, index) => {
|
23
|
+
console.log('grading data', expectedQuestionData);
|
24
|
+
cy.get('.ngie-single-select')
|
25
|
+
.eq(index)
|
26
|
+
.within(() => {
|
27
|
+
singleSelectionPage.questionInstructionsText()
|
28
|
+
.verifyInnerText(expectedQuestionData.gradingQuestionInstructions);
|
29
|
+
singleSelectionPage.optionsWrapperGradingView()
|
30
|
+
.then(($elements) => {
|
31
|
+
expect($elements.length).to.be.eq(expectedQuestionData.gradingOptionsText.length);
|
32
|
+
});
|
33
|
+
singleSelectionPage.optionsWrapperGradingView()
|
34
|
+
.each(($optionWrapper, optionIndex) => {
|
35
|
+
cy.wrap($optionWrapper)
|
36
|
+
.within(() => {
|
37
|
+
if (expectedQuestionData.correctAnswersIndex.includes(optionIndex)) {
|
38
|
+
cy.get('.tick-icon-wrapper')
|
39
|
+
.should('exist');
|
40
|
+
} else {
|
41
|
+
cy.get('.tick-icon-wrapper')
|
42
|
+
.should('not.exist');
|
43
|
+
}
|
44
|
+
singleSelectionPage.optionTextPreviewTab()
|
45
|
+
.verifyInnerText(expectedQuestionData.gradingOptionsText[optionIndex])
|
46
|
+
});
|
47
|
+
});
|
48
|
+
});
|
49
|
+
},
|
50
|
+
|
51
|
+
textEntryMath: (expectedQuestionData, index) => {
|
52
|
+
|
53
|
+
},
|
54
|
+
|
55
|
+
essayResponseMath: (expectedQuestionData, index) => {
|
56
|
+
cy.get('.ngie-essay-response-math')
|
57
|
+
.eq(index)
|
58
|
+
.within(() => {
|
59
|
+
singleSelectionPage.questionInstructionsText()
|
60
|
+
.verifyInnerText(expectedQuestionData.previewQuestionInstructions);
|
61
|
+
});
|
62
|
+
}
|
63
|
+
}
|
package/deploy/smoke/run.sh
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "itemengine-cypress-automation",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.98",
|
4
4
|
"description": "",
|
5
5
|
"main": "index.js",
|
6
6
|
"scripts": {
|
@@ -12,6 +12,7 @@
|
|
12
12
|
"spinnaker": "node scripts/spinnaker.mjs --env theme=ilc",
|
13
13
|
"spinnaker:untagged": "node scripts/spinnaker.mjs --env theme=ilc,grepTags=-css+-a11y",
|
14
14
|
"spinnaker:smoke": "node scripts/spinnaker.mjs --env theme=ilc,grepTags=smoke+-css+-a11y",
|
15
|
+
"spinnaker:migration": "node scripts/migration.mjs --env theme=ilc",
|
15
16
|
"cy:ildev": "cypress open --env fileConfig=ildev",
|
16
17
|
"cy:ilprod": "cypress open --env fileConfig=ilprod",
|
17
18
|
"cy:ilqa": "cypress open --env fileConfig=ilqa",
|
@@ -82,6 +82,18 @@ export function runSorryCypressSpinnaker() {
|
|
82
82
|
startTime = process.env.START_TIME;
|
83
83
|
ciBuildId = setCiBuildId("spinnaker", startTime);
|
84
84
|
const envArgs = setCommandLineEnvArgs()
|
85
|
-
let command = `cy2 run --parallel --browser chrome --record --key imaginelearning/itemengine-cypress-automation --ci-build-id ${ciBuildId} ${envArgs},grepTags=-css+-a11y --spec "cypress/e2e/ILC/**/*.
|
85
|
+
let command = `cy2 run --parallel --browser chrome --record --key imaginelearning/itemengine-cypress-automation --ci-build-id ${ciBuildId} ${envArgs},grepTags=-css+-a11y --spec "cypress/e2e/ILC/**/*.js"`;
|
86
|
+
execSync(command, { stdio: "inherit" });
|
87
|
+
}
|
88
|
+
|
89
|
+
/**
|
90
|
+
* @method runSorryCypressSpinnakerMigration
|
91
|
+
*/
|
92
|
+
export function runSorryCypressSpinnakerMigration() {
|
93
|
+
process.env.CYPRESS_API_URL = "https://cypress-director.imaginelearning.engineering/";
|
94
|
+
startTime = process.env.START_TIME;
|
95
|
+
ciBuildId = setCiBuildId("spinnaker", `migration${startTime}`);
|
96
|
+
const envArgs = setCommandLineEnvArgs()
|
97
|
+
let command = `cy2 run --parallel --browser chrome --record --key imaginelearning/itemengine-cypress-automation --ci-build-id ${ciBuildId} ${envArgs} --spec "cypress/e2e/migration/*.js"`;
|
86
98
|
execSync(command, { stdio: "inherit" });
|
87
99
|
}
|