itemengine-cypress-automation 1.0.323-updateBumpVersion-82a2c50.0 → 1.0.324-updateBumpVersion-4da7a9c.0
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/dataApi/fetchItems.js +204 -0
- package/cypress/e2e/dataApi/fetchQuestion.js +408 -0
- package/cypress/e2e/dataApi/saveItems.js +216 -0
- package/cypress/e2e/dataApi/saveQuestions.js +214 -0
- package/cypress/e2e/dataApi/saveQuestionsMCQAlternateAnswers.js +145 -0
- package/cypress/e2e/dataApi/saveResourcesAndTools.js +186 -0
- package/cypress/pages/components/browseItemsPage.js +11 -0
- package/cypress/pages/createItemPage.js +7 -0
- package/cypress/pages/index.js +2 -1
- package/cypress/pages/menuBarPage.js +66 -0
- package/cypress/support/commands.js +38 -0
- package/cypress/support/helpers/createItem.js +428 -0
- package/package.json +1 -1
@@ -0,0 +1,428 @@
|
|
1
|
+
import uuid from 'react-uuid';
|
2
|
+
export var itemReferenceIds = [];
|
3
|
+
export var questionAndResourceReferenceIds = [];
|
4
|
+
export var createdAndUpdatedAtDate = [];
|
5
|
+
|
6
|
+
const domainName = `${Cypress.env('SANDBOX_SERVICES_URL')}`.slice(8);
|
7
|
+
const referenceIdsItem = ["f72bdb8-e6ad-64f-617b-fe40d2b0a7"];
|
8
|
+
|
9
|
+
Cypress.Commands.add('createItem', (itemName) => {
|
10
|
+
const token = window.localStorage.getItem('ngie_accessToken');
|
11
|
+
const firstName = window.localStorage.getItem('ngie_firstName');
|
12
|
+
const lastName = window.localStorage.getItem('ngie_lastName');
|
13
|
+
const userID = window.localStorage.getItem('ngie_userId');
|
14
|
+
var currentReferenceIds = [];
|
15
|
+
for (var i = 0; i < 42; i++) {
|
16
|
+
currentReferenceIds.push(uuid());
|
17
|
+
};
|
18
|
+
console.log(currentReferenceIds)
|
19
|
+
|
20
|
+
cy.request({
|
21
|
+
headers: {
|
22
|
+
Authorization: `${token}`,
|
23
|
+
'content-type': 'application/json',
|
24
|
+
},
|
25
|
+
method: 'POST',
|
26
|
+
url: `${Cypress.env('SANDBOX_GRAPHQL_SERVICES_URL')}/`,
|
27
|
+
body: [
|
28
|
+
{
|
29
|
+
"operationName": "generateSignedRequest",
|
30
|
+
"variables": {
|
31
|
+
"input": {
|
32
|
+
"service": "author",
|
33
|
+
"requestPacket": {
|
34
|
+
"mode": "itemEdit",
|
35
|
+
"config": {
|
36
|
+
"theme": "theme1",
|
37
|
+
"itemWidgetTemplates": {
|
38
|
+
"save": {
|
39
|
+
"show": true
|
40
|
+
}
|
41
|
+
},
|
42
|
+
"itemEdit": {
|
43
|
+
"item": {
|
44
|
+
"back": false,
|
45
|
+
"save": {
|
46
|
+
"show": false,
|
47
|
+
"autoSave": true
|
48
|
+
},
|
49
|
+
"reference": {
|
50
|
+
"edit": true,
|
51
|
+
"show": false
|
52
|
+
},
|
53
|
+
"duplicate": {
|
54
|
+
"show": false
|
55
|
+
},
|
56
|
+
"responseMode": "all",
|
57
|
+
"title": {
|
58
|
+
"edit": true,
|
59
|
+
"show": true
|
60
|
+
},
|
61
|
+
"settings": {
|
62
|
+
"show": true,
|
63
|
+
"showPrintPreview": true,
|
64
|
+
"showScoring": true,
|
65
|
+
"showTags": true
|
66
|
+
}
|
67
|
+
},
|
68
|
+
"widget": {
|
69
|
+
"showPreviewRadioButtonsAndScore": true
|
70
|
+
}
|
71
|
+
},
|
72
|
+
"loaderType": "full-screen",
|
73
|
+
"isCustomLoader": true,
|
74
|
+
"customLoaderId": "globalLoader"
|
75
|
+
},
|
76
|
+
"user": {
|
77
|
+
"firstName": firstName,
|
78
|
+
"lastName": lastName,
|
79
|
+
"id": userID
|
80
|
+
},
|
81
|
+
"systemGeneratedItems": {
|
82
|
+
"referenceIds": [
|
83
|
+
referenceIdsItem
|
84
|
+
]
|
85
|
+
}
|
86
|
+
},
|
87
|
+
"type": "item",
|
88
|
+
"userId": userID,
|
89
|
+
"domain": "sandbox.itemengine-staging.il-apps.com"
|
90
|
+
}
|
91
|
+
},
|
92
|
+
"query": "query generateSignedRequest($input: GenerateSignedRequest) {\n generateSignedRequest(input: $input) {\n success\n signedRequest {\n authentication {\n timestamp\n domain\n consumerKey\n signature\n userId\n __typename\n }\n request\n __typename\n }\n __typename\n }\n}\n"
|
93
|
+
}
|
94
|
+
]
|
95
|
+
}).then((resp) => {
|
96
|
+
if (resp.status.toString().startsWith('5') && retries > 0) {
|
97
|
+
cy.log('ENCOUNTERED A 5xx ERROR');
|
98
|
+
}
|
99
|
+
const request = resp.body[0].data.generateSignedRequest.signedRequest.request;
|
100
|
+
const authentication = {
|
101
|
+
consumerKey: resp.body[0].data.generateSignedRequest.signedRequest.authentication.consumerKey,
|
102
|
+
domain: domainName,
|
103
|
+
signature: resp.body[0].data.generateSignedRequest.signedRequest.authentication.signature,
|
104
|
+
timestamp: resp.body[0].data.generateSignedRequest.signedRequest.authentication.timestamp
|
105
|
+
};
|
106
|
+
delete authentication.userId;
|
107
|
+
delete authentication.__typename;
|
108
|
+
delete request.__typename;
|
109
|
+
cy.request({
|
110
|
+
headers: {
|
111
|
+
Authorization: `${token}`,
|
112
|
+
'content-type': 'application/json',
|
113
|
+
Origin: `${Cypress.env('SANDBOX_SERVICES_URL')}`
|
114
|
+
},
|
115
|
+
method: 'POST',
|
116
|
+
url: `${Cypress.env('SERVICES_URL')}${Cypress.env('GRAPHQL_URL')}/`,
|
117
|
+
body: {
|
118
|
+
"operationName": "setItem",
|
119
|
+
"variables": {
|
120
|
+
"input": {
|
121
|
+
"authentication": authentication,
|
122
|
+
"request": request,
|
123
|
+
"service": "author",
|
124
|
+
"userRequest": {
|
125
|
+
"referenceId": itemName,
|
126
|
+
"metadata": [],
|
127
|
+
"version": 1,
|
128
|
+
"questions": [
|
129
|
+
{
|
130
|
+
"serialNo": 1,
|
131
|
+
"referenceId": referenceIdsItem[0],
|
132
|
+
"correctResponse": [
|
133
|
+
{
|
134
|
+
"xmlIdentifier": "RESPONSE",
|
135
|
+
"mappedKey": "ChoiceA",
|
136
|
+
"isCaseSensitive": false,
|
137
|
+
"answerSetId": 0
|
138
|
+
},
|
139
|
+
{
|
140
|
+
"xmlIdentifier": "RESPONSE",
|
141
|
+
"mappedKey": "ChoiceB",
|
142
|
+
"isCaseSensitive": false,
|
143
|
+
"answerSetId": 0
|
144
|
+
}
|
145
|
+
],
|
146
|
+
"instruction": "",
|
147
|
+
"isAutoScored": true,
|
148
|
+
"mappedCorrectResponse": [],
|
149
|
+
"defaultResponse": [],
|
150
|
+
"points": 2,
|
151
|
+
"scoringTypeId": 1,
|
152
|
+
"questionXml": "<assessmentItem xmlns=\"http://www.imsglobal.org/xsd/imsqti_v2p2\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.imsglobal.org/xsd/imsqti_v2p2 http://www.imsglobal.org/xsd/qti/qtiv2p2/imsqti_v2p2p2.xsd\" identifier=\"choiceMultiple\" title=\"Welcome to Biodome\" timeDependent=\"false\"><responseDeclaration identifier=\"RESPONSE\" cardinality=\"multiple\" baseType=\"identifier\"><correctResponse><value>ChoiceA</value><value>ChoiceB</value></correctResponse></responseDeclaration><outcomeDeclaration identifier=\"SCORE\" cardinality=\"single\" baseType=\"float\"/><itemBody><choiceInteraction responseIdentifier=\"RESPONSE\" orientation=\"horizontal\"><prompt></prompt><simpleChoice identifier=\"ChoiceA\">1</simpleChoice><simpleChoice identifier=\"ChoiceB\">2</simpleChoice><simpleChoice identifier=\"ChoiceC\">3</simpleChoice><simpleChoice identifier=\"ChoiceD\">4</simpleChoice></choiceInteraction></itemBody><responseProcessing template=\"http://www.imsglobal.org/question/qti_v2p2/rptemplates/map_response\"/></assessmentItem>",
|
153
|
+
"typeId": 5,
|
154
|
+
"metadata": {
|
155
|
+
"acknowledgements": "",
|
156
|
+
"sampleAnswer": "",
|
157
|
+
"toolSettingsResourcesOrder": [
|
158
|
+
{
|
159
|
+
"resourceTypeId": 2,
|
160
|
+
"toolOrder": 3
|
161
|
+
},
|
162
|
+
{
|
163
|
+
"resourceTypeId": 3,
|
164
|
+
"toolOrder": 0
|
165
|
+
},
|
166
|
+
{
|
167
|
+
"resourceTypeId": 6,
|
168
|
+
"toolOrder": 2
|
169
|
+
},
|
170
|
+
{
|
171
|
+
"resourceTypeId": 7,
|
172
|
+
"toolOrder": 1
|
173
|
+
},
|
174
|
+
{
|
175
|
+
"resourceTypeId": 10,
|
176
|
+
"toolOrder": 4
|
177
|
+
},
|
178
|
+
{
|
179
|
+
"resourceTypeId": 21,
|
180
|
+
"toolOrder": 5
|
181
|
+
}
|
182
|
+
]
|
183
|
+
},
|
184
|
+
"settings": {
|
185
|
+
"optionStyleType": 1,
|
186
|
+
"optionNumeration": 2,
|
187
|
+
"optionOrientation": 2,
|
188
|
+
"optionColumns": 1,
|
189
|
+
"isCheckAnswerEnabled": false,
|
190
|
+
"nonAccessible": false,
|
191
|
+
"maxCheckAnswerAllowed": 0,
|
192
|
+
"minAnswersAllowed": null,
|
193
|
+
"maxAnswersAllowed": null,
|
194
|
+
"shuffleOption": false,
|
195
|
+
"positionLock": false,
|
196
|
+
"isRoundingEnabled": true,
|
197
|
+
"optionFontSize": 1,
|
198
|
+
"autoScoredViewMode": "defaultScoring",
|
199
|
+
"excludeFromPrint": false,
|
200
|
+
"disablePrevIncorrect": false,
|
201
|
+
"roundingType": 1,
|
202
|
+
"isMultipleColumns": false,
|
203
|
+
"optionAlignment": 1
|
204
|
+
},
|
205
|
+
"content": {
|
206
|
+
"correctResponses": [
|
207
|
+
{
|
208
|
+
"answerSetId": 0,
|
209
|
+
"correctAnswers": [
|
210
|
+
"ChoiceA",
|
211
|
+
"ChoiceB"
|
212
|
+
]
|
213
|
+
}
|
214
|
+
],
|
215
|
+
"instructionsForPrint": "",
|
216
|
+
"answerSets": [
|
217
|
+
{
|
218
|
+
"id": 0,
|
219
|
+
"points": 2
|
220
|
+
}
|
221
|
+
]
|
222
|
+
},
|
223
|
+
"penaltyPoints": null,
|
224
|
+
"minScoreIfAttempted": null,
|
225
|
+
"minScoreType": null,
|
226
|
+
"penaltyPointType": null,
|
227
|
+
"isAutoPenaltySetting": false,
|
228
|
+
"isNegativeRounded": true,
|
229
|
+
"specificPenaltyType": null,
|
230
|
+
"penaltyPointsForEach": null,
|
231
|
+
"teacherGuideline": "",
|
232
|
+
"scoringGuidance": "",
|
233
|
+
"sampleResponse": "",
|
234
|
+
"resources": [],
|
235
|
+
"answerSets": [
|
236
|
+
{
|
237
|
+
"id": 0,
|
238
|
+
"points": 2
|
239
|
+
}
|
240
|
+
]
|
241
|
+
}
|
242
|
+
],
|
243
|
+
"resources": [],
|
244
|
+
"statusId": 1,
|
245
|
+
"isNewVersion": false,
|
246
|
+
"settings": {
|
247
|
+
"selectedColumn": 1,
|
248
|
+
"tab1": false,
|
249
|
+
"enableScroll": false,
|
250
|
+
"itemScoringType": 1,
|
251
|
+
"verticalDivider": false,
|
252
|
+
"columns": [
|
253
|
+
{
|
254
|
+
"widgets": [
|
255
|
+
{
|
256
|
+
"referenceId": referenceIdsItem[0],
|
257
|
+
"itemType": 1
|
258
|
+
}
|
259
|
+
],
|
260
|
+
"id": referenceIdsItem[1]
|
261
|
+
}
|
262
|
+
],
|
263
|
+
"sections": {
|
264
|
+
"navigationOrientation": 1,
|
265
|
+
"navigationStyle": 1,
|
266
|
+
"navigationAlignment": 1
|
267
|
+
},
|
268
|
+
"spacingOptions": 1,
|
269
|
+
"enableMultiLanguage": false,
|
270
|
+
"enableNonAccessible": false,
|
271
|
+
"horizontalSeparatorLine": false,
|
272
|
+
"separatorStyle": 1,
|
273
|
+
"disableCutCopyPaste": false,
|
274
|
+
"enableRandomizeQuestions": false,
|
275
|
+
"alternateAccessibleItemId": "",
|
276
|
+
"enableSections": false,
|
277
|
+
"roundNegativeToZero": false
|
278
|
+
}
|
279
|
+
}
|
280
|
+
}
|
281
|
+
},
|
282
|
+
"query": "mutation setItem($input: SetItemInput) {\n setItem(input: $input) {\n success\n statusCode\n message\n data {\n settings\n id\n version\n contentVersion\n contentId\n title\n statusId\n instruction\n description\n authorName\n createdAt\n updatedAt\n createdBy\n referenceId\n questionId\n questionTags {\n id\n name\n type\n __typename\n }\n metadata {\n id\n metaKey\n metaKeyValue\n __typename\n }\n questions {\n id\n instruction\n points\n typeId\n questionXml\n referenceId\n updatedAt\n createdBy\n scoringTypeId\n teacherGuideline\n penaltyPoints\n minScoreIfAttempted\n minScoreType\n penaltyPointType\n isAutoPenaltySetting\n isNegativeRounded\n specificPenaltyType\n penaltyPointsForEach\n isAutoScored\n createdAt\n scoringGuidance\n sampleResponse\n resources {\n id\n name\n referenceId\n resourceTypeId\n metadata\n settings\n content\n type\n isCustomResource\n __typename\n }\n type {\n id\n name\n __typename\n }\n serialNo\n metadata\n correctResponse {\n id\n questionPartId\n xmlIdentifier\n mappedKey\n isCaseSensitive\n answerSetId\n alternateId\n __typename\n }\n mappedCorrectResponse {\n id\n questionPartId\n mappedKey\n mappedValue\n xmlIdentifier\n answerSetId\n alternateId\n __typename\n }\n defaultResponse {\n id\n questionPartId\n xmlIdentifier\n responseText\n __typename\n }\n answerSets {\n id\n points\n cellFillCount\n matchPositionOfSelectedCells\n __typename\n }\n __typename\n }\n resources {\n id\n name\n referenceId\n resourceTypeId\n serialNo\n metadata\n createdAt\n updatedAt\n createdBy\n resourceList {\n id\n name\n referenceId\n resourceTypeId\n metadata\n settings\n content\n type\n isCustomResource\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n}\n"
|
283
|
+
}
|
284
|
+
}).then((resp) => {
|
285
|
+
if (resp.status.toString().startsWith('5') && retries > 0) {
|
286
|
+
cy.log('ENCOUNTERED A 5xx ERROR');
|
287
|
+
}
|
288
|
+
var currCreatedAndUpdatedAtDate = [];
|
289
|
+
currCreatedAndUpdatedAtDate.push(resp.body.data.setItem.data.createdAt);
|
290
|
+
currCreatedAndUpdatedAtDate.push(resp.body.data.setItem.data.updatedAt);
|
291
|
+
createdAndUpdatedAtDate.push(currCreatedAndUpdatedAtDate);
|
292
|
+
questionAndResourceReferenceIds.push(currentReferenceIds);
|
293
|
+
itemReferenceIds.push(itemName);
|
294
|
+
console.log(createdAndUpdatedAtDate);
|
295
|
+
console.log(questionAndResourceReferenceIds);
|
296
|
+
console.log(itemReferenceIds);
|
297
|
+
});
|
298
|
+
});
|
299
|
+
});
|
300
|
+
|
301
|
+
Cypress.Commands.add('deleteItem', (itemReference) => {
|
302
|
+
const token = window.localStorage.getItem('ngie_accessToken');
|
303
|
+
const firstName = window.localStorage.getItem('ngie_firstName');
|
304
|
+
const lastName = window.localStorage.getItem('ngie_lastName');
|
305
|
+
const userID = window.localStorage.getItem('ngie_userId');
|
306
|
+
cy.request({
|
307
|
+
headers: {
|
308
|
+
Authorization: `${token}`,
|
309
|
+
'content-type': 'application/json',
|
310
|
+
},
|
311
|
+
method: 'POST',
|
312
|
+
url: `${Cypress.env('SANDBOX_GRAPHQL_SERVICES_URL')}/`,
|
313
|
+
body: [
|
314
|
+
{
|
315
|
+
"operationName": "generateSignedRequest",
|
316
|
+
"variables": {
|
317
|
+
"input": {
|
318
|
+
"service": "author",
|
319
|
+
"requestPacket": {
|
320
|
+
"mode": "itemList",
|
321
|
+
"config": {
|
322
|
+
"loaderType": "full-screen",
|
323
|
+
"itemList": {
|
324
|
+
"limit": 20,
|
325
|
+
"toolbar": {
|
326
|
+
"add": true
|
327
|
+
},
|
328
|
+
"filter": {
|
329
|
+
"enableFilter": true,
|
330
|
+
"filterBackdrop": "div"
|
331
|
+
},
|
332
|
+
"actions": {
|
333
|
+
"options": [
|
334
|
+
{
|
335
|
+
"id": "student",
|
336
|
+
"label": "Student View"
|
337
|
+
},
|
338
|
+
{
|
339
|
+
"id": "correct",
|
340
|
+
"label": "Correct Answer View"
|
341
|
+
},
|
342
|
+
{
|
343
|
+
"id": "grading",
|
344
|
+
"label": "Grading View"
|
345
|
+
},
|
346
|
+
{
|
347
|
+
"id": "delete",
|
348
|
+
"label": "Delete"
|
349
|
+
},
|
350
|
+
{
|
351
|
+
"id": "duplicate",
|
352
|
+
"label": "Duplicate/New Version"
|
353
|
+
},
|
354
|
+
{
|
355
|
+
"id": "live",
|
356
|
+
"label": "Live Item Demo"
|
357
|
+
}
|
358
|
+
]
|
359
|
+
}
|
360
|
+
},
|
361
|
+
"isCustomLoader": true,
|
362
|
+
"customLoaderId": "globalLoader"
|
363
|
+
},
|
364
|
+
"systemGeneratedItems": {
|
365
|
+
"referenceIds": [
|
366
|
+
referenceIdsItem
|
367
|
+
]
|
368
|
+
},
|
369
|
+
"user": {
|
370
|
+
"firstName": firstName,
|
371
|
+
"lastName": lastName,
|
372
|
+
"id": userID
|
373
|
+
}
|
374
|
+
},
|
375
|
+
"domain": domainName
|
376
|
+
}
|
377
|
+
},
|
378
|
+
"query": "query generateSignedRequest($input: GenerateSignedRequest) {\n generateSignedRequest(input: $input) {\n success\n signedRequest {\n authentication {\n timestamp\n domain\n consumerKey\n signature\n userId\n __typename\n }\n request\n __typename\n }\n __typename\n }\n}\n"
|
379
|
+
}
|
380
|
+
]
|
381
|
+
}).then((resp) => {
|
382
|
+
if (resp.status.toString().startsWith('5') && retries > 0) {
|
383
|
+
cy.log('ENCOUNTERED A 5xx ERROR');
|
384
|
+
}
|
385
|
+
const currRequest = resp.body[0].data.generateSignedRequest.signedRequest.request;
|
386
|
+
const currAuthentication = {
|
387
|
+
consumerKey: resp.body[0].data.generateSignedRequest.signedRequest.authentication.consumerKey,
|
388
|
+
domain: domainName,
|
389
|
+
signature: resp.body[0].data.generateSignedRequest.signedRequest.authentication.signature,
|
390
|
+
timestamp: resp.body[0].data.generateSignedRequest.signedRequest.authentication.timestamp
|
391
|
+
};
|
392
|
+
delete currAuthentication.userId;
|
393
|
+
delete currAuthentication.__typename;
|
394
|
+
delete currRequest.__typename;
|
395
|
+
cy.request({
|
396
|
+
headers: {
|
397
|
+
'content-type': "application/json",
|
398
|
+
Origin: `${Cypress.env('SANDBOX_SERVICES_URL')}`,
|
399
|
+
},
|
400
|
+
method: 'POST',
|
401
|
+
url: `${Cypress.env('SERVICES_URL')}${Cypress.env('GRAPHQL_URL')}/`,
|
402
|
+
body: {
|
403
|
+
"operationName": "deleteItem",
|
404
|
+
"variables": {
|
405
|
+
"input": {
|
406
|
+
"authentication": currAuthentication,
|
407
|
+
"request": currRequest,
|
408
|
+
"service": "author",
|
409
|
+
"userRequest": {
|
410
|
+
"itemReference": `${itemReference}`
|
411
|
+
}
|
412
|
+
}
|
413
|
+
},
|
414
|
+
"query": "mutation deleteItem($input: DeleteItemInput) {\n deleteItem(input: $input) {\n message\n success\n __typename\n }\n}\n"
|
415
|
+
},
|
416
|
+
}).then((resp) => {
|
417
|
+
if (resp.status.toString().startsWith('5') && retries > 0) {
|
418
|
+
cy.log('ENCOUNTERED A 5xx ERROR');
|
419
|
+
}
|
420
|
+
});
|
421
|
+
});
|
422
|
+
});
|
423
|
+
|
424
|
+
Cypress.Commands.add('deleteItems', () => {
|
425
|
+
itemReferenceIds.forEach((i) => {
|
426
|
+
cy.deleteItem(i);
|
427
|
+
});
|
428
|
+
});
|