itemengine-cypress-automation 1.0.15 → 1.0.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (21) hide show
  1. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridAdditionalSettingsBasic.js +235 -0
  2. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridAutoScoredScoring.js +205 -0
  3. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridAutoScoredScoringWithAlternateAnswer.js +472 -0
  4. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridEditTabBasicSection.js +589 -0
  5. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridEditTabScoringSection.js +282 -0
  6. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridHeaderSection.js +97 -0
  7. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridManuallyAndNonScored.js +146 -0
  8. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridOptionsAdditionalSettings.js +345 -0
  9. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridPartialDifferentWeights.js +188 -0
  10. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridPartialDifferentWeightsWithAlternateAnswer.js +662 -0
  11. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridPartialEqualWeights.js +190 -0
  12. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridPartialEqualWeightsWIthAlternateAnswer.js +595 -0
  13. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridQuestionStemAdditionalSettings.js +258 -0
  14. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridRandomizeOptions.js +122 -0
  15. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridSetCorrectAnswerSection.js +183 -0
  16. package/cypress/e2e/ILC/UploadResponse/uploadResponseAdditionalSettings.js +185 -0
  17. package/cypress/e2e/ILC/UploadResponse/uploadResponseEditTabBasicSections.js +250 -0
  18. package/cypress/e2e/ILC/UploadResponse/uploadResponseHeaderSection.js +80 -0
  19. package/cypress/e2e/ILC/UploadResponse/uploadResponsePreview.js +651 -0
  20. package/cypress/e2e/ILC/UploadResponse/uploadResponseScoringSection.js +60 -0
  21. package/package.json +1 -1
@@ -0,0 +1,651 @@
1
+ import { uploadResponsePage, dialogBoxBase } from "../../../pages";
2
+ import { commonComponents } from "../../../pages/components";
3
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
4
+ let fileTypes = ['CSV', 'Excel', 'GIF', 'JPG', 'PDF', 'PNG', 'Powerpoint', 'Publisher', 'RTF', 'TXT', 'Word', 'XPS', 'ZIP'];
5
+ let fileTypesString = fileTypes.toString().replaceAll(',', ', ')
6
+ let infoIconTooltipText = 'Supported file formats: ' + fileTypesString + '.';
7
+ const css = Cypress.env('css');
8
+
9
+ describe('Create question page - Upload Response: Preview', () => {
10
+ before(() => {
11
+ cy.loginAs('admin');
12
+ });
13
+
14
+ describe('Preview tab contents', () => {
15
+ abortEarlySetup();
16
+ before(() => {
17
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
18
+ uploadResponsePage.steps.switchToPreviewTab();
19
+ });
20
+
21
+ it('In the Preview tab, the upload response area should have a Cloud icon and text \"Drag & Drop files here or browse files on your device, Google Drive or capture an image\" should be displayed', () => {
22
+ uploadResponsePage.uploadCloudIcon()
23
+ .should('be.visible');
24
+ uploadResponsePage.dragAndDropFilesText()
25
+ .verifyInnerText('Drag & Drop files here');
26
+ uploadResponsePage.fileUploadOptionsLabel()
27
+ .should('have.text', 'or browse files on your device, Google Drive or capture an image');
28
+ });
29
+
30
+ it('Computer and Google Drive icons should be displayed before link texts \'device\' and \'Google Drive\' respectively', () => {
31
+ //TODO: NEED to revisit, need to verify unicode
32
+ uploadResponsePage.deviceLink()
33
+ .verifyPseudoClassBeforeProperty('content', '""');
34
+ uploadResponsePage.googleDriveLink()
35
+ .find('svg')
36
+ .should('be.visible');
37
+ });
38
+
39
+ it('\'Supported file formats\' label should be displayed along with an info icon, hovering over the Supported file formats info icon a tooltip should be displayed with list of all the selected supported file types', () => {
40
+ uploadResponsePage.supportedFileFormatLabel()
41
+ .verifyInnerText('Supported file formats');
42
+ uploadResponsePage.supportedFileInfoIcon()
43
+ .should('be.visible');
44
+ uploadResponsePage.supportedFileInfoIcon()
45
+ .trigger('mouseover');
46
+ uploadResponsePage.supportedFilesTooltip()
47
+ .should('have.text', infoIconTooltipText);
48
+ });
49
+
50
+ it('Accessibility of \'Supported file formats\' tooltip', { tags: 'a11y' }, () => {
51
+ cy.checkAccessibility(uploadResponsePage.supportedFilesTooltip());
52
+ uploadResponsePage.supportedFileInfoIcon()
53
+ .trigger('mouseout');
54
+ });
55
+
56
+ it('Uploaded file count should be displayed on the bottom right corner of the response section and by default it should be 0', () => {
57
+ uploadResponsePage.uploadedFileCount()
58
+ .verifyInnerText('0/15 File Limit')
59
+ });
60
+
61
+ //Failing due to https://redmine.zeuslearning.com/issues/528358
62
+ it('CSS of Preview tab', { tags: 'css' }, () => {
63
+ uploadResponsePage.uploadCloudIcon()
64
+ .find('path')
65
+ .should('have.css', 'fill', css.color.cloudIconFill);
66
+ uploadResponsePage.dragAndDropFilesText()
67
+ .verifyCSS(css.color.text, css.fontSize.huge, css.fontWeight.bold);
68
+ uploadResponsePage.fileUploadOptionsLabel()
69
+ .verifyCSS(css.color.text, css.fontSize.heading, css.fontWeight.semibold);
70
+ uploadResponsePage.supportedFileFormatLabel()
71
+ .verifyCSS(css.color.text, css.fontSize.normal, css.fontWeight.regular);
72
+ uploadResponsePage.supportedFileInfoIcon()
73
+ .find('path')
74
+ .should('have.css', 'fill', css.color.activeButtons);
75
+ uploadResponsePage.supportedFileInfoIcon()
76
+ .trigger('mouseover');
77
+ uploadResponsePage.supportedFilesTooltip()
78
+ .verifyCSS(css.color.whiteText, css.fontSize.small, css.fontWeight.light)
79
+ .should('have.css', 'background-color', css.color.tooltipBg);
80
+ uploadResponsePage.supportedFileInfoIcon()
81
+ .trigger('mouseout');
82
+ uploadResponsePage.uploadedFileCount()
83
+ .verifyCSS(css.color.labels, css.fontSize.small, css.fontWeight.regular)
84
+ .should('have.css', 'background-color', css.color.fileLimitBg);
85
+ uploadResponsePage.deviceLink()
86
+ .verifyPseudoClassBeforeProperty('color', css.color.text);
87
+ uploadResponsePage.googleDriveLink()
88
+ .verifyPseudoClassBeforeProperty('color', css.color.text);
89
+ });
90
+
91
+ it('Accessibility of Preview tab', { tags: 'a11y' }, () => {
92
+ cy.checkAccessibility(commonComponents.previewTabQuestionWrapper());
93
+ });
94
+ });
95
+
96
+ describe('Uploading file', () => {
97
+ abortEarlySetup();
98
+ before(() => {
99
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
100
+ uploadResponsePage.steps.switchToPreviewTab();
101
+ });
102
+
103
+ it('User should be able to upload supported files in the upload section using link text \'device\' or the icon besides it and the file uploaded by the student should be listed below the upload area with the name of the file. Also, the uploaded file count should get updated in the file limit section', () => {
104
+ uploadResponsePage.steps.fileUploadAndVerify(['image.png']);
105
+ uploadResponsePage.uploadedFileCount()
106
+ .verifyInnerText('1/15 File Limit');
107
+ });
108
+
109
+ it('CSS of uploaded file wrapper contents', { tags: 'css' }, () => {
110
+ uploadResponsePage.uploadedFileLink()
111
+ .children()
112
+ .verifyCSS(css.color.linkText, css.fontSize.default, css.fontWeight.regular);
113
+ uploadResponsePage.editDisplayTextIcon()
114
+ .verifyPseudoClassBeforeProperty('color', css.color.activeButtons);
115
+ uploadResponsePage.addFileDescriptionIcon()
116
+ .verifyPseudoClassBeforeProperty('color', css.color.activeButtons);
117
+ uploadResponsePage.deleteButton()
118
+ .verifyPseudoClassBeforeProperty('color', css.color.deleteIcon);
119
+ });
120
+
121
+ it('Accessibility of uploaded file wrapper contents', { tags: 'a11y' }, () => {
122
+ cy.checkAccessibility(uploadResponsePage.uploadedFilesSectionWrapper());
123
+ });
124
+
125
+ it('\'Edit display text\', \'Add file description\', \'Delete\' icon buttons should be displayed next to the file name of the uploaded file', () => {
126
+ uploadResponsePage.uploadedFileWrapper()
127
+ .eq(0)
128
+ .within(() => {
129
+ uploadResponsePage.editDisplayTextIcon()
130
+ .should('be.visible');
131
+ uploadResponsePage.addFileDescriptionIcon()
132
+ .should('be.visible');
133
+ uploadResponsePage.deleteButton()
134
+ .should('be.visible');
135
+ });
136
+ });
137
+
138
+ it('User should also be able to upload supported files in the upload section using drag and drop feature', () => {
139
+ uploadResponsePage.inputTypeFile()
140
+ .attachFile('uploads/sample.jpg', { subjectType: 'drag-n-drop' });
141
+ uploadResponsePage.uploadedFileWrapper()
142
+ .eq(1)
143
+ .verifyInnerText('sample.jpg');
144
+ });
145
+
146
+ it('User should be able to upload multiple files at once and the uploaded file count should get updated in the file limit section', () => {
147
+ uploadResponsePage.inputTypeFile()
148
+ .attachFile(['uploads/sample.csv', 'uploads/sample.gif']);
149
+ uploadResponsePage.uploadedFileCount()
150
+ .verifyInnerText('4/15 File Limit');
151
+ });
152
+
153
+ it('When the user uploads a file that has already been added, then file upload error message \'Error: *File_name* has already been selected.\' should be displayed above the uploaded files', () => {
154
+ uploadResponsePage.inputTypeFile()
155
+ .attachFile('uploads/image.png');
156
+ commonComponents.errorMessage()
157
+ .verifyInnerText('Error: image.png has already been selected.');
158
+ });
159
+
160
+ it('CSS of file upload error message', { tags: 'css' }, () => {
161
+ commonComponents.errorMessage()
162
+ .verifyCSS(css.color.errorText, css.fontSize.small, css.fontWeight.regular);
163
+ });
164
+
165
+ it('Accessibility of file upload error message', { tags: 'a11y' }, () => {
166
+ cy.checkAccessibility(commonComponents.errorMessage());
167
+ });
168
+
169
+ uploadResponsePage.tests.verifyErrorMessageDisappear();
170
+
171
+ it('During file upload process, a progress bar, file name, file size, a cross icon to stop upload should be present, the file count should not change while the file is being uploaded, on clicking on the \'cross icon to stop upload\' button, the file should not get uploaded', () => {
172
+ uploadResponsePage.inputTypeFile()
173
+ .attachFile('uploads/sample1.zip');
174
+ uploadResponsePage.uploadingProgressBar()
175
+ .should('be.visible');
176
+ uploadResponsePage.uploadingFileName()
177
+ .verifyInnerText('sample1.zip')
178
+ .and('be.visible');
179
+ uploadResponsePage.stopUploadingButton()
180
+ .should('be.visible');
181
+ uploadResponsePage.uploadedFileCount()
182
+ .verifyInnerText('4/15 File Limit');
183
+ uploadResponsePage.stopUploadingButton()
184
+ .click();
185
+ uploadResponsePage.uploadedFileWrapper()
186
+ .eq(0)
187
+ .should('exist')
188
+ .verifyInnerText('image.png');
189
+ uploadResponsePage.uploadedFilesSectionWrapper()
190
+ .should('not.have.text', 'sample1.zip')
191
+ .children()
192
+ .should('have.length', 4);
193
+ uploadResponsePage.uploadedFileCount()
194
+ .verifyInnerText('4/15 File Limit');
195
+ });
196
+
197
+ it('CSS of File upload - In progress state', { tags: 'css' }, () => {
198
+ cy.log('switching to edit tab and again to preview tab')
199
+ uploadResponsePage.steps.switchToEditTab();
200
+ uploadResponsePage.steps.switchToPreviewTab();
201
+ cy.log('uploading a file to verify in progress CSS')
202
+ uploadResponsePage.inputTypeFile()
203
+ .attachFile('uploads/sample2.jpg')
204
+ uploadResponsePage.uploadingFileName()
205
+ .verifyCSS(css.color.text, css.fontSize.normal, css.fontWeight.regular);
206
+ uploadResponsePage.uploadingFileSize()
207
+ .verifyCSS(css.color.text, css.fontSize.small, css.fontWeight.regular);
208
+ uploadResponsePage.stopUploadingButton()
209
+ .find('svg')
210
+ .should('have.css', 'color', css.color.successBtn);
211
+ cy.log('Re-switching to edit tab and again to preview tab')
212
+ uploadResponsePage.steps.switchToEditTab();
213
+ uploadResponsePage.steps.switchToPreviewTab();
214
+ });
215
+
216
+ it('Accessibility of File upload - In progress state', { tags: 'a11y' }, () => {
217
+ cy.log('switching to edit tab and again to preview tab')
218
+ uploadResponsePage.steps.switchToEditTab();
219
+ uploadResponsePage.steps.switchToPreviewTab();
220
+ cy.log('uploading a file to verify in progress CSS')
221
+ uploadResponsePage.inputTypeFile()
222
+ .attachFile('uploads/sample2.jpg')
223
+ cy.checkAccessibility(uploadResponsePage.uploadingFileName().parents('.uploading-documents'));
224
+ cy.log('Re-switching to edit tab and again to preview tab')
225
+ uploadResponsePage.steps.switchToEditTab();
226
+ uploadResponsePage.steps.switchToPreviewTab();
227
+ });
228
+
229
+ it('On clicking on the file name, user should be able to download the file', () => {
230
+ uploadResponsePage.inputTypeFile()
231
+ .attachFile('uploads/image.png');
232
+ cy.verifyUploadFilePreviewDownload('image.png');
233
+ });
234
+ });
235
+
236
+ //TODO : testing this manually for now, need to work around this
237
+ describe.skip('Allow students to capture photos preview', () => {
238
+ abortEarlySetup();
239
+ before(() => {
240
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
241
+ cy.log('Selecting Allow students to capture photos checkbox');
242
+ multipleSelectionPO.steps.expandAdditonalSettings();
243
+ uploadResponsePage.steps.checkCapturePhotosCheckbox();
244
+ uploadResponsePage.steps.switchToPreviewTab();
245
+ });
246
+
247
+
248
+ it('Camera icon should be displayed before link text \'capture an image\'', () => {
249
+ });
250
+
251
+ it('When the user clicks on the link text \'capture an image\' a \'Capture image\' popup should open', () => {
252
+
253
+ });
254
+
255
+ it('CSS of \'Capture image\' popup', () => {
256
+
257
+ });
258
+
259
+ it('On \'Capture image\' popup following should be displayed - \'Capture image\' title text, Camera preview, Capture and Cancel buttons', () => {
260
+
261
+ });
262
+
263
+ it('When the user clicks on \'Cancel\' button the \'Capture image\' popup should close', () => {
264
+
265
+ });
266
+
267
+ it('When the user clicks on \'Capture\' button, then an image should get captured and a preview of the captured image should be displayed in place of the camera preview and also two buttons \'Retake\' and \'Save\' should be displayed in the popup and \'Cancel\' and \'Capture\' buttons should not be displayed in the popup', () => {
268
+
269
+ });
270
+
271
+ it('When the user clicks on \'Save\' button, it should upload the captured image in the response', () => {
272
+
273
+ });
274
+
275
+ it('The captured image should be saved in .jpeg format and the 1st image should be saved with the name \'Photo.jpeg\'', () => {
276
+
277
+ });
278
+
279
+ it('If the user uploads another image the name should be \'Photo-1.jpeg\' and so on', () => {
280
+ //check till Photo-2.jpeg
281
+
282
+ });
283
+
284
+ it('When the user clicks on \'Retake\' button, it should take the user back to the capture an image flow where the user should be able to capture another image', () => {
285
+ });
286
+ });
287
+
288
+ describe('File Upload error', () => {
289
+ abortEarlySetup();
290
+ before(() => {
291
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
292
+ uploadResponsePage.steps.switchToPreviewTab();
293
+ });
294
+
295
+ it('When the user uploads file exceeding max file size (more than 75 MB), file upload error message - \'Error: The file could not be uploaded. The file is *File size in MB* exceeding the maximum size of 75 MB.\'. should be displayed', () => {
296
+ uploadResponsePage.inputTypeFile()
297
+ .attachFile('uploads/80mbFile.pdf')
298
+ commonComponents.errorMessage()
299
+ .verifyInnerText('Error: The file could not be uploaded. The file is 80 MB exceeding the maximum size of 75 MB.');
300
+ });
301
+
302
+ it('CSS of File Upload error', { tags: 'css' }, () => {
303
+ commonComponents.errorMessage()
304
+ .verifyCSS(css.color.errorText, css.fontSize.small, css.fontWeight.regular);
305
+ });
306
+
307
+ //Todo: can be added to common for all error messages verifyAccessibilityOfErrorMessage
308
+ it('Accessibility of File Upload error', { tags: 'a11y' }, () => {
309
+ cy.checkAccessibility(commonComponents.errorMessage());
310
+ });
311
+
312
+ uploadResponsePage.tests.verifyErrorMessageDisappear();
313
+
314
+ it('When user uploads file type which is not selected from the \'Supported file types\' accordion menu, then file upload error message - \'The file type is not supported. Please upload files with the following supported formats: *file format separated by commas*\' should be displayed', () => {
315
+ uploadResponsePage.inputTypeFile()
316
+ .attachFile('uploads/sample.mp4');
317
+ commonComponents.errorMessage()
318
+ .verifyInnerText('Error: The file type is not supported. Please upload files with the following supported formats: CSV, Excel, GIF, JPG, PDF, PNG, Powerpoint, Publisher, RTF, TXT, Word, XPS, ZIP.');
319
+ });
320
+
321
+ uploadResponsePage.tests.verifyErrorMessageDisappear();
322
+ });
323
+
324
+ describe('Virus Scanning', () => {
325
+ abortEarlySetup();
326
+ before(() => {
327
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
328
+ uploadResponsePage.steps.switchToPreviewTab();
329
+ });
330
+
331
+ it('When user uploads any file without any virus, the system should scan the file for viruses and \'Scanning for viruses…\' message should be displayed along with a pre-loader', () => {
332
+ uploadResponsePage.inputTypeFile()
333
+ .attachFile('uploads/sample1.zip');
334
+ uploadResponsePage.uploadedFileWrapper()
335
+ .eq(0)
336
+ .within(() => {
337
+ uploadResponsePage.virusErrorMessageWrapper()
338
+ .verifyInnerText('Scanning for viruses...')
339
+ uploadResponsePage.scanningForVirusPreLoader()
340
+ .should('be.visible');
341
+ });
342
+ });
343
+
344
+ it('As long as the file is scanning for viruses, the users should not be able to download the file', () => {
345
+ uploadResponsePage.uploadedFileWrapper()
346
+ .eq(0)
347
+ .parents('.uploaded-document-wrapper')
348
+ .should('not.have.attr', 'href');
349
+ });
350
+
351
+ it('As soon as the scanning for viruses is complete, the preloader should disappear', () => {
352
+ uploadResponsePage.scanningForVirusPreLoader()
353
+ .should('not.be.visible');
354
+ });
355
+
356
+ it('When the user uploads a file containing virus \'Error: A virus was detected, please upload another file\' error message should be displayed inline with file name, the uploaded file count should increase after a virus file gets uploaded', () => {
357
+ uploadResponsePage.inputTypeFile()
358
+ .attachFile('uploads/sampleVirus.zip');
359
+ uploadResponsePage.uploadedFileWrapper()
360
+ .eq(1)
361
+ .within(() => {
362
+ uploadResponsePage.virusErrorMessageWrapper()
363
+ .verifyInnerText('Error: A virus was detected, please upload another file.')
364
+ .and('be.visible');
365
+ });
366
+ cy.log('checking if uploaded file count increases after a virus file gets uploaded')
367
+ uploadResponsePage.uploadedFileCount()
368
+ .verifyInnerText('2/15 File Limit');
369
+ });
370
+
371
+ it('CSS of virus error message', { tags: 'css' }, () => {
372
+ uploadResponsePage.uploadedFileWrapper()
373
+ .eq(1)
374
+ .within(() => {
375
+ uploadResponsePage.virusErrorMessageWrapper()
376
+ .verifyCSS(css.color.errorText, css.fontSize.small, css.fontWeight.regular);
377
+ });
378
+ });
379
+
380
+ it('User should not be able to download the file containing virus and the file name should be in disabled state', () => {
381
+ uploadResponsePage.uploadedFileWrapper()
382
+ .eq(1)
383
+ .parents('.uploaded-document-wrapper')
384
+ .should('not.have.attr', 'href');
385
+ });
386
+ });
387
+
388
+ describe('Supported file types- preview tab', () => {
389
+ abortEarlySetup();
390
+ before(() => {
391
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
392
+ });
393
+
394
+ it('When user modifies supported files types, then in preview tab on hovering over the Supported file formats info icon a tooltip with the modified list of selected supported file types should be displayed', () => {
395
+ cy.log('Pre-step: checking a new file type and unchecking a default selected file type')
396
+ uploadResponsePage.supportedFileTypesAccordionWrapper()
397
+ .click();
398
+ uploadResponsePage.steps.checkUncheckSupportedFileType(4, 'CSV', 'not.be.checked');
399
+ uploadResponsePage.steps.checkUncheckSupportedFileType(14, 'MP3', 'be.checked');
400
+ uploadResponsePage.supportedFileTypesCheckboxWrapper(14)
401
+ cy.log('Switching to Preview tab')
402
+ uploadResponsePage.steps.switchToPreviewTab()
403
+ uploadResponsePage.supportedFileInfoIcon()
404
+ .trigger('mouseover');
405
+ //https://redmine.zeuslearning.com/issues/533063
406
+ uploadResponsePage.supportedFilesTooltip()
407
+ .verifyInnerText('Supported file formats: Excel, GIF, JPG, MP3, PDF, PNG, Powerpoint, Publisher, RTF, TXT, Word, XPS, ZIP.');
408
+ });
409
+
410
+ it('User should be able to upload file of newly added supported file type', () => {
411
+ uploadResponsePage.steps.fileUploadAndVerify(['sample.mp3']);
412
+ });
413
+
414
+ it('When the user uploads file type which is now removed from supported file type, then file upload error message - \'Error: The file type is not supported. Please upload files with the following supported formats: *file format separated by commas*\' should be displayed', () => {
415
+ uploadResponsePage.inputTypeFile()
416
+ .attachFile('uploads/sample.csv');
417
+ //https://redmine.zeuslearning.com/issues/534957
418
+ commonComponents.errorMessage()
419
+ .verifyInnerText('Error: The file type is not supported. Please upload files with the following supported formats: Excel, GIF, JPG, MP3, PDF, PNG, Powerpoint, Publisher, RTF, TXT, Word, XPS, ZIP.');
420
+ });
421
+
422
+ uploadResponsePage.tests.verifyErrorMessageDisappear();
423
+ });
424
+
425
+ describe('Renaming an uploaded file', () => {
426
+ abortEarlySetup();
427
+ before(() => {
428
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
429
+ cy.log('Uploading a file in preview tab');
430
+ uploadResponsePage.steps.switchToPreviewTab();
431
+ uploadResponsePage.steps.fileUploadAndVerify(['image.png']);
432
+ });
433
+
434
+ it('On hovering over the \'Edit display text\' icon button, tooltip \'Edit display text\' should be displayed', () => {
435
+ uploadResponsePage.editDisplayTextIcon()
436
+ .realHover();
437
+ commonComponents.tooltipText()
438
+ .verifyInnerText('Edit display text');
439
+ });
440
+
441
+ it('Clicking on the \'Edit display text\' icon button should open the \'Display Text\' popup with label \'Display Text\' and the input field in the popup should be prefilled with the name of the file and the name text should be selected by default and \'Save\' and \'Cancel\' buttons should be displayed', () => {
442
+ uploadResponsePage.editDisplayTextIcon()
443
+ .click();
444
+ dialogBoxBase.dialogBox()
445
+ .should('be.visible');
446
+ dialogBoxBase.dialogBoxTitle()
447
+ .verifyInnerText('Display text')
448
+ uploadResponsePage.editDisplayTextPopupInputField()
449
+ .should('have.value', 'image.png')
450
+ .parent()
451
+ .and('have.class', 'Mui-focused');
452
+ uploadResponsePage.acceptButton()
453
+ .verifyInnerText('Save')
454
+ .and('be.visible');
455
+ uploadResponsePage.rejectButton()
456
+ .verifyInnerText('Cancel')
457
+ .and('be.visible');
458
+ });
459
+
460
+ it('CSS of the \'Display Text\' popup', { tags: 'css' }, () => {
461
+ dialogBoxBase.dialogBoxTitle()
462
+ .verifyCSS(css.color.questionHeading, css.fontSize.heading, css.fontWeight.semibold);
463
+ uploadResponsePage.editDisplayTextPopupInputField()
464
+ .verifyCSS(css.color.text, css.fontSize.heading, css.fontWeight.regular)
465
+ .should('have.css', 'background-color', css.color.defaultBackground);
466
+ uploadResponsePage.acceptButton()
467
+ .verifyCSS(css.color.primaryBtn, css.fontSize.default, css.fontWeight.semibold)
468
+ .should('have.css', 'background-color', css.color.primaryBtnBg);
469
+ uploadResponsePage.rejectButton()
470
+ .verifyCSS(css.color.secondaryBtn, css.fontSize.default, css.fontWeight.semibold)
471
+ .should('have.css', 'background-color', css.color.transparent);
472
+ });
473
+
474
+ it('Accessibility of the \'Display Text\' popup', { tags: 'a11y' }, () => {
475
+ cy.checkAccessibility(dialogBoxBase.dialogBox());
476
+ });
477
+
478
+ it('When the user removes the name of the file from the input field in the \'Display Text\' popup, then placeholder text \'Enter Display Text\' should be displayed', () => {
479
+ uploadResponsePage.editDisplayTextPopupInputField()
480
+ .clear()
481
+ .should('have.attr', 'placeholder', 'Enter display text')
482
+ .and('be.visible');
483
+ });
484
+
485
+ it('When the user clicks on \'Save\' button, a validation error text \'Display text is required.\' should be displayed below the input field', () => {
486
+ uploadResponsePage.acceptButton()
487
+ .click();
488
+ commonComponents.errorMessage()
489
+ .verifyInnerText('Error: Display text is required.')
490
+ });
491
+
492
+ it('When the user enters text in Display Text input field i.e. updates the file name, then the validation text should disappear and when user clicks on \'Save\' button, the name of the file should get updated', () => {
493
+ uploadResponsePage.editDisplayTextPopupInputField()
494
+ .type('imageEdited.png')
495
+ .should('have.value', 'imageEdited.png');
496
+ commonComponents.errorMessage()
497
+ .should('not.exist');
498
+ uploadResponsePage.acceptButton()
499
+ .click();
500
+ uploadResponsePage.uploadedFileWrapper()
501
+ .eq(0)
502
+ .verifyInnerText('imageEdited.png')
503
+ });
504
+
505
+ it('When the user updates the file name and clicks on the \'Cancel\' button, the latest changes should be reverted and the \'Display Text\' popup should close', () => {
506
+ cy.log('clicking on edit display text button')
507
+ uploadResponsePage.editDisplayTextIcon()
508
+ .click();
509
+ uploadResponsePage.editDisplayTextPopupInputField()
510
+ .clear()
511
+ .type('imageEdited2.png')
512
+ .should('have.value', 'imageEdited2.png');
513
+ uploadResponsePage.rejectButton()
514
+ .click();
515
+ uploadResponsePage.uploadedFileWrapper()
516
+ .eq(0)
517
+ .verifyInnerText('imageEdited.png')
518
+ .and('not.have.text', 'imageEdited2.png');
519
+ });
520
+
521
+ it('If the user tries to download file after renaming, the file should get downloaded with the original name', () => {
522
+ cy.verifyUploadFilePreviewDownload('image.png');
523
+ });
524
+ });
525
+
526
+ describe('Add a description for a file', () => {
527
+ abortEarlySetup();
528
+ before(() => {
529
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
530
+ cy.log('Uploading a file in preview tab');
531
+ uploadResponsePage.steps.switchToPreviewTab();
532
+ uploadResponsePage.steps.fileUploadAndVerify(['image.png']);
533
+ });
534
+
535
+ it('On hovering over the \'Add file description\' icon button, tooltip \'Add file description\' should be displayed', () => {
536
+ uploadResponsePage.addFileDescriptionIcon()
537
+ .realHover();
538
+ commonComponents.tooltipText()
539
+ .should('have.text', 'Add file description');
540
+ });
541
+
542
+ it('When the user clicks on the \'Add file description\' icon button, an input area should be displayed along with a placeholder text: \'Add file description\'', () => {
543
+ uploadResponsePage.addFileDescriptionIcon()
544
+ .click();
545
+ uploadResponsePage.addFileDescriptionInput()
546
+ .should('have.attr', 'placeholder', 'Add file description')
547
+ .and('be.visible');
548
+ });
549
+
550
+ it('CSS of \'Add file description\' input field', { tags: 'css' }, () => {
551
+ uploadResponsePage.addFileDescriptionInput()
552
+ .verifyCSS(css.color.optionsText, css.fontSize.default, css.fontWeight.regular);
553
+ });
554
+
555
+ it('Accessibility of \'Add file description\' input field', { tags: 'a11y' }, () => {
556
+ cy.checkAccessibility(uploadResponsePage.addFileDescriptionInput().parents('.placeholder'));
557
+ });
558
+
559
+ it('User should be able to add description text for uploaded file', () => {
560
+ uploadResponsePage.addFileDescriptionInput()
561
+ .type('This is an image')
562
+ .should('have.value', 'This is an image');
563
+ });
564
+
565
+ it('When user again clicks on the \'Add file description\' icon button, the \'Add file description\' input field section should get hidden', () => {
566
+ uploadResponsePage.addFileDescriptionIcon()
567
+ .click();
568
+ uploadResponsePage.addFileDescriptionInput()
569
+ .should('not.exist');
570
+ });
571
+ });
572
+
573
+ describe('Delete the uploaded file', () => {
574
+ abortEarlySetup();
575
+ before(() => {
576
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
577
+ cy.log('Uploading a file in preview tab');
578
+ uploadResponsePage.steps.switchToPreviewTab();
579
+ uploadResponsePage.steps.fileUploadAndVerify(['image.png']);
580
+ });
581
+
582
+ it('On hovering over the \'Delete\' icon button, tooltip \'Delete\' should be displayed', () => {
583
+ uploadResponsePage.deleteButton()
584
+ .realHover();
585
+ commonComponents.tooltipText()
586
+ .should('have.text', 'Delete');
587
+ });
588
+
589
+ it('When the user clicks on the \'Delete\' icon button, then \'Delete file\' popup with label \'Delete file\' and message \'Are you sure you want to delete this file?\' should be displayed and \'Delete File\' and \'Cancel\' buttons should be displayed', () => {
590
+ uploadResponsePage.deleteButton()
591
+ .click();
592
+ dialogBoxBase.dialogBox()
593
+ .should('be.visible');
594
+ dialogBoxBase.dialogBoxTitle()
595
+ .verifyInnerText('Delete file')
596
+ dialogBoxBase.dialogBoxContent()
597
+ .should('contain', 'Are you sure you want to delete this file?');
598
+ uploadResponsePage.rejectButton()
599
+ .should('be.visible')
600
+ .verifyInnerText('Cancel');
601
+ uploadResponsePage.acceptButton()
602
+ .should('be.visible')
603
+ .verifyInnerText('Delete file');
604
+ });
605
+
606
+ it('CSS of the \'Delete file\' popup', { tags: 'css' }, () => {
607
+ dialogBoxBase.dialogBoxTitle()
608
+ .find('span')
609
+ .verifyCSS(css.color.questionHeading, css.fontSize.heading, css.fontWeight.bold);
610
+ uploadResponsePage.rejectButton()
611
+ .verifyCSS(css.color.secondaryBtn, css.fontSize.default, css.fontWeight.semibold)
612
+ .should('have.css', 'background-color', css.color.transparent);
613
+ uploadResponsePage.acceptButton()
614
+ .verifyCSS(css.color.primaryBtn, css.fontSize.default, css.fontWeight.semibold)
615
+ .should('have.css', 'background-color', css.color.deleteBtn);
616
+ });
617
+
618
+ it('Accessibility of the \'Delete file\' popup', { tags: 'a11y' }, () => {
619
+ cy.checkAccessibility(dialogBoxBase.dialogBox());
620
+ });
621
+
622
+ it('When the user clicks on the \'Cancel\' button, then \'Delete File\' popup should close and file should not get deleted', () => {
623
+ cy.log('Clicking on Delete icon for popup to appear')
624
+ uploadResponsePage.deleteButton()
625
+ .click();
626
+ cy.log('Clicking on \'Cancel\' button')
627
+ uploadResponsePage.rejectButton()
628
+ .click();
629
+ dialogBoxBase.dialogBox()
630
+ .should('not.exist');
631
+ uploadResponsePage.uploadedFileWrapper()
632
+ .eq(0)
633
+ .should('exist');
634
+ });
635
+
636
+ it('When the user clicks on the \'Delete File\' button, the delete confirmation dialog box should disappear and the uploaded file should get deleted', () => {
637
+ uploadResponsePage.deleteButton()
638
+ .click();
639
+ uploadResponsePage.acceptButton()
640
+ .click();
641
+ dialogBoxBase.dialogBox()
642
+ .should('not.exist');
643
+ uploadResponsePage.uploadedFilesSectionWrapper()
644
+ .should('not.have.text', 'image.png')
645
+ .children()
646
+ .should('have.length', 0);
647
+ uploadResponsePage.uploadedFileCount()
648
+ .verifyInnerText('0/15 File Limit');
649
+ });
650
+ });
651
+ });