itemengine-cypress-automation 1.0.16 → 1.0.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,185 @@
1
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
2
+ import { uploadResponsePage } from "../../../pages";
3
+ const css = Cypress.env('css');
4
+
5
+ describe('Create question page - Upload Response: Additional Settings', () => {
6
+ before(() => {
7
+ cy.loginAs('admin');
8
+ });
9
+
10
+ describe('Additional Settings accordion', () => {
11
+ abortEarlySetup();
12
+ before(() => {
13
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
14
+ });
15
+
16
+ uploadResponsePage.tests.verifyAdditonalSettingsAccordionProperties();
17
+
18
+ it('\'File settings and layout\' label should be displayed', () => {
19
+ uploadResponsePage.fileSettingsAndLayoutLabel()
20
+ .verifyInnerText('File settings and layout')
21
+ .and('be.visible');
22
+ });
23
+
24
+ it('CSS of \'File settings and layout\' section', { tags: 'css' }, () => {
25
+ uploadResponsePage.fileSettingsAndLayoutLabel()
26
+ .verifyCSS(css.color.sectionHeading, css.fontSize.default, css.fontWeight.semibold);
27
+ });
28
+
29
+ it('Accessibility of \'File settings and layout\' section', { tags: 'a11y' }, () => {
30
+ cy.checkAccessibility(uploadResponsePage.fileSettingsAndLayoutLabel())
31
+ });
32
+ });
33
+
34
+ describe('Additional Settings: Allow students to capture photos', () => {
35
+ abortEarlySetup();
36
+ before(() => {
37
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
38
+ cy.log('Adding question instructions and expanding Additional Settings accordian.');
39
+ uploadResponsePage.steps.addQuestionInstructions();
40
+ uploadResponsePage.steps.expandAdditonalSettings();
41
+ });
42
+
43
+ it('\'Allow students to capture photos\' checkbox label and checkbox should be displayed and by default it should be checked', () => {
44
+ uploadResponsePage.allowStudentsToCapturePhotosLabel()
45
+ .verifyInnerText('Allow students to capture photos');
46
+ uploadResponsePage.allowStudentsToCapturePhotosCheckbox()
47
+ .should('be.checked')
48
+ .parent()
49
+ .should('be.visible');
50
+ });
51
+
52
+ it('CSS of \'Allow students to capture photos\' section - checked state', { tags: 'css' }, () => {
53
+ uploadResponsePage.allowStudentsToCapturePhotosLabel()
54
+ .verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.regular);
55
+ uploadResponsePage.allowStudentsToCapturePhotosCheckbox()
56
+ .parent()
57
+ .find('svg')
58
+ .should('have.css', 'color', css.color.activeButtons);
59
+ });
60
+
61
+ it('Accessibility of \'Allow students to capture photos\' section - checked state', { tags: 'a11y' }, () => {
62
+ cy.checkAccessibility(uploadResponsePage.allowStudentsToCapturePhotosLabel());
63
+ });
64
+
65
+ it('When the \'Allow students to capture photos\' checkbox is checked then in the preview tab, the upload response area text should be \"Drag & Drop files here or browse files on your device, Google Drive or capture an image\"', () => {
66
+ uploadResponsePage.steps.switchToPreviewTab();
67
+ uploadResponsePage.uploadCloudIcon()
68
+ .should('be.visible');
69
+ uploadResponsePage.dragAndDropFilesText()
70
+ .verifyInnerText('Drag & Drop files here');
71
+ uploadResponsePage.fileUploadOptionsLabel()
72
+ .should('have.text', 'or browse files on your device, Google Drive or capture an image');
73
+ });
74
+
75
+ it('When the user unchecks the \'Allow students to capture photos\' checkbox, then in the Preview tab the upload response area text should be \"Drag & Drop files here or browse files on your device or Google Drive\"', () => {
76
+ cy.log('Switching to Edit tab.');
77
+ uploadResponsePage.steps.switchToEditTab();
78
+ uploadResponsePage.allowStudentsToCapturePhotosCheckbox()
79
+ .click()
80
+ .should('not.be.checked');
81
+ cy.log('Switching to Preview tab.');
82
+ uploadResponsePage.steps.switchToPreviewTab();
83
+ uploadResponsePage.dragAndDropFilesText()
84
+ .verifyInnerText('Drag & Drop files here');
85
+ uploadResponsePage.fileUploadOptionsLabel()
86
+ .should('have.text', 'or browse files on your device or Google Drive ');
87
+ });
88
+
89
+ it('CSS of \'Allow students to capture photos\' section - unchecked state', { tags: 'css' }, () => {
90
+ cy.log('Pre-step: Switching back to Edit tab.');
91
+ uploadResponsePage.steps.switchToEditTab();
92
+ uploadResponsePage.allowStudentsToCapturePhotosLabel()
93
+ .verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.regular);
94
+ uploadResponsePage.allowStudentsToCapturePhotosCheckbox()
95
+ .parent()
96
+ .find('svg')
97
+ .should('have.css', 'fill', css.color.uncheckedCheckbox);
98
+ uploadResponsePage.steps.switchToPreviewTab();
99
+ });
100
+
101
+ it('Accessibility of \'Allow students to capture photos\' section - unchecked state', { tags: 'a11y' }, () => {
102
+ cy.log('Pre-step: Switching back to Edit tab.');
103
+ uploadResponsePage.steps.switchToEditTab();
104
+ cy.checkAccessibility(uploadResponsePage.allowStudentsToCapturePhotosLabel());
105
+ uploadResponsePage.steps.switchToPreviewTab();
106
+ });
107
+
108
+ it('When the user checks the \'Allow students to capture photos\' checkbox again, then in the Preview tab the upload response area text should be \"Drag & Drop files here or browse files on your device or Google Drive or capture an image\"', () => {
109
+ cy.log('Pre-step: Switching back to Edit tab.');
110
+ uploadResponsePage.steps.switchToEditTab();
111
+ uploadResponsePage.allowStudentsToCapturePhotosCheckbox()
112
+ .click()
113
+ .should('be.checked');
114
+ cy.log('Switching to Preview tab.');
115
+ uploadResponsePage.steps.switchToPreviewTab();
116
+ uploadResponsePage.dragAndDropFilesText()
117
+ .verifyInnerText('Drag & Drop files here')
118
+ .and('be.visible');
119
+ uploadResponsePage.fileUploadOptionsLabel()
120
+ .should('have.text', 'or browse files on your device, Google Drive or capture an image')
121
+ .and('be.visible');
122
+ });
123
+ });
124
+
125
+ describe('Additional Settings: Font Size dropdown', () => {
126
+ abortEarlySetup();
127
+ before(() => {
128
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
129
+ cy.log('Adding question instructions and expanding Additional Settings accordion.');
130
+ uploadResponsePage.steps.addQuestionInstructions();
131
+ uploadResponsePage.steps.expandAdditonalSettings();
132
+ });
133
+
134
+ const fontsizes = ['Default', 'Small', 'Normal', 'Large', 'Extra large', 'Huge'];
135
+ const font = ['16px', '12px', '14px', '17px', '20px', '24px'];
136
+ const questionInstructionsTextFontSizes = { 'Default': '16px', 'Small': '12px', 'Normal': '14px', 'Large': '17px', 'Extra large': '20px', 'Huge': '24px' };
137
+ const dragAndDropFilesTextFontSizes = { 'Default': '24px', 'Small': '18px', 'Normal': '21px', 'Large': '25.5px', 'Extra large': '30px', 'Huge': '36px' };
138
+ const fileUploadOptionsLabelFontSizes = { 'Default': '18px', 'Small': '13.5px', 'Normal': '15.75px', 'Large': '19.125px', 'Extra large': '22.5px', 'Huge': '27px' };
139
+ const supportedFileFormatLabelFontSizes = { 'Default': '14px', 'Small': '10.5px', 'Normal': '12.25px', 'Large': '14.875px', 'Extra large': '17.5px', 'Huge': '21px' };
140
+ const uploadedFileCountFontSizes = { 'Default': '12px', 'Small': '9px', 'Normal': '10.5px', 'Large': '12.75px', 'Extra large': '15px', 'Huge': '18px' };
141
+
142
+ uploadResponsePage.tests.verifyFontSizeSectionContents();
143
+
144
+ fontsizes.forEach((option, count) => {
145
+ it(`When the user selects \'${option}\' option from the Font Size dropdown, then font size for the entire question in the student player should be changed to ${option} in the \'Preview\' tab`, () => {
146
+ uploadResponsePage.fontSizeDropdown()
147
+ .click();
148
+ uploadResponsePage.fontSizeListOptions(count)
149
+ .click();
150
+ uploadResponsePage.fontSizeDropdown()
151
+ .verifyInnerText(`${option}`);
152
+ cy.log('Switching to Preview tab.');
153
+ uploadResponsePage.steps.switchToPreviewTab();
154
+ uploadResponsePage.questionInstructionsText()
155
+ .should('have.css', 'font-size', questionInstructionsTextFontSizes[option]);
156
+ uploadResponsePage.dragAndDropFilesText()
157
+ .should('have.css', 'font-size', dragAndDropFilesTextFontSizes[option]);
158
+ uploadResponsePage.fileUploadOptionsLabel()
159
+ .should('have.css', 'font-size', fileUploadOptionsLabelFontSizes[option]);
160
+ uploadResponsePage.supportedFileFormatLabel()
161
+ .should('have.css', 'font-size', supportedFileFormatLabelFontSizes[option]);
162
+ uploadResponsePage.uploadedFileCount()
163
+ .should('have.css', 'font-size', uploadedFileCountFontSizes[option]);
164
+ cy.log('Uploading file to check font-size of the file name.')
165
+ uploadResponsePage.steps.fileUploadAndVerify(['sample.zip']);
166
+ uploadResponsePage.uploadedFileLink()
167
+ .should('have.css', 'font-size', font[0]);
168
+ cy.log('Post step: switching to edit tab to select another font size option')
169
+ uploadResponsePage.steps.switchToEditTab();
170
+ });
171
+ });
172
+ });
173
+
174
+ describe('Additional Settings: Details section', () => {
175
+ abortEarlySetup();
176
+ before(() => {
177
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
178
+ cy.log('Adding question instructions and expanding Additional Settings accordian.');
179
+ uploadResponsePage.steps.addQuestionInstructions();
180
+ uploadResponsePage.steps.expandAdditonalSettings();
181
+ });
182
+
183
+ uploadResponsePage.tests.verifyDetailsSection();
184
+ });
185
+ });
@@ -0,0 +1,250 @@
1
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
2
+ import { uploadResponsePage } from "../../../pages";
3
+ import { commonComponents } from "../../../pages/components";
4
+ const css = Cypress.env('css');
5
+
6
+ let fileTypeList = ['Access', 'Assembly', 'C', 'C++', 'CSV', 'Excel', 'GIF', 'H', 'HEIC', 'HEIF', 'HEVC', 'JPG', 'LabVIEW', 'MATLAB', 'MP3', 'MP4', 'Open Office', 'PDF', 'PNG', 'Powerpoint', 'Publisher', 'Quartus', 'RTF', 'S', 'TXT', 'V', 'Verilog', 'Word', 'XPS', 'ZIP'];
7
+ let indexOfDefaultSelectedFileTypes = [4, 5, 6, 11, 17, 18, 19, 20, 22, 24, 27, 28, 29];
8
+
9
+ describe('Create question page - Upload Response: Question Instructions, Supported file types, Max Files dropdown', () => {
10
+ before(() => {
11
+ cy.loginAs('admin');
12
+ });
13
+
14
+ describe('Question Instructions input field - Edit tab', () => {
15
+ abortEarlySetup();
16
+ before(() => {
17
+ cy.log('Navigating to upload response question type');
18
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
19
+ });
20
+
21
+ uploadResponsePage.tests.verifyQuestionInstructionsInputFieldEditTab();
22
+
23
+ });
24
+
25
+ describe('Question Instructions input field - Preview tab', () => {
26
+ abortEarlySetup();
27
+ before(() => {
28
+ cy.log('Navigating to upload response question type');
29
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
30
+ });
31
+
32
+ uploadResponsePage.tests.verifyQuestionInstructionsInputFieldPreviewTab();
33
+
34
+ });
35
+
36
+ describe('Supported file types section', () => {
37
+ abortEarlySetup();
38
+ before(() => {
39
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
40
+ });
41
+
42
+ it('\'Supported file types\' accordion should be displayed and it should be collapsed by default and next to \'Supported file types\' accordion menu, text \'13 selected\' should be displayed indicating number of selected file types and user should be able to expand and collapse this accordion', () => {
43
+ uploadResponsePage.supportedFileTypesAccordion()
44
+ .verifyInnerText('Supported file types');
45
+ uploadResponsePage.supportedFileTypesAccordionWrapper()
46
+ .should('have.attr', 'aria-expanded', 'false');
47
+ uploadResponsePage.selectedFileTypeCount()
48
+ .verifyInnerText('(13 selected)')
49
+ .and('be.visible');
50
+ cy.log('verifying if user is able to expand and collapse the \'Supported file types\' accordion')
51
+ uploadResponsePage.supportedFileTypesAccordionWrapper()
52
+ .click()
53
+ .should('have.attr', 'aria-expanded', 'true');
54
+ uploadResponsePage.supportedFileTypesAccordionWrapper()
55
+ .click()
56
+ .should('have.attr', 'aria-expanded', 'false');
57
+ });
58
+
59
+ it('CSS of Supported file types section', { tags: 'css' }, () => {
60
+ uploadResponsePage.supportedFileTypesAccordion()
61
+ .verifyCSS(css.color.accordionLabel, css.fontSize.default, css.fontWeight.bold);
62
+ uploadResponsePage.selectedFileTypeCount()
63
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.regular);
64
+ });
65
+
66
+ it('Accessibility of Supported file types section', { tags: 'a11y' }, () => {
67
+ cy.checkAccessibility(uploadResponsePage.supportedFileTypesAccordionWrapper());
68
+ cy.checkAccessibility(uploadResponsePage.selectedFileTypeCount());
69
+ });
70
+
71
+ it('When user expands the \'Supported file types\' accordion menu, all the file types should be listed and following file types should be selected - CSV, Excel, GIF, JPG, PDF, PNG, Powerpoint, Publisher, RTF, TXT, Word, XPS, ZIP', () => {
72
+ cy.log('Pre-step: Expanding supported file types accordion');
73
+ uploadResponsePage.supportedFileTypesAccordionWrapper()
74
+ .click();
75
+ fileTypeList.forEach((fileType, count) => {
76
+ uploadResponsePage.supportedFileTypesCheckboxWrapper(count)
77
+ .find('.MuiFormControlLabel-label')
78
+ .verifyInnerText(fileType)
79
+ .and('be.visible');
80
+ });
81
+ indexOfDefaultSelectedFileTypes.forEach((selectedFileTypeIndex) => {
82
+ uploadResponsePage.supportedFileTypesCheckboxWrapper(selectedFileTypeIndex)
83
+ .within(($element) => {
84
+ uploadResponsePage.supportedFileTypeCheckbox()
85
+ .should('be.checked');
86
+ cy.wrap($element)
87
+ .find('.MuiFormControlLabel-label')
88
+ .verifyInnerText(fileTypeList[selectedFileTypeIndex])
89
+ });
90
+ });
91
+ });
92
+
93
+ it('CSS of supported files accordion contents in expanded state', { tags: 'css' }, () => {
94
+ uploadResponsePage.supportedFileTypesCheckboxWrapper(4)
95
+ .find('svg g g')
96
+ .should('have.css', 'fill', css.color.activeButtons);
97
+ uploadResponsePage.supportedFileTypesCheckboxWrapper(0)
98
+ .find('.MuiFormControlLabel-label')
99
+ .verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.regular);
100
+ });
101
+
102
+ it('Accessibility of supported files accordion contents in expanded state', { tags: 'a11y' }, () => {
103
+ cy.checkAccessibility(uploadResponsePage.supportedFileTypeCheckbox().parents('.edit-question-supported-files-wrapper'));
104
+ });
105
+
106
+ it('When the user deselects all the file types from the \'Supported file types\' accordion menu, then a validation text \'Error: Please select a file type.\' should be displayed', () => {
107
+ cy.log('Deselecting all file types to get error message.');
108
+ indexOfDefaultSelectedFileTypes.forEach((selectedFileTypeIndex) => {
109
+ uploadResponsePage.supportedFileTypesCheckboxWrapper(selectedFileTypeIndex)
110
+ .within(() => {
111
+ uploadResponsePage.supportedFileTypeCheckbox()
112
+ .uncheck()
113
+ .should('not.be.checked');
114
+ });
115
+ });
116
+ commonComponents.errorMessage()
117
+ .verifyInnerText('Error: Please select a file type.')
118
+ .and('be.visible');
119
+ });
120
+
121
+ it('CSS of \'Error: Please select a file type.\' error message', { tags: 'css' }, () => {
122
+ commonComponents.errorMessage()
123
+ .verifyCSS(css.color.errorText, css.fontSize.small, css.fontWeight.regular);
124
+ });
125
+
126
+ it('Accessibility of \'Error: Please select a file type.\' error message', { tags: 'a11y' }, () => {
127
+ cy.checkAccessibility(commonComponents.errorMessage());
128
+ });
129
+
130
+ it('When the user reselects any file type from the \'Supported file types\' accordion menu, then the validation text \'Error: Please select a file type\' should disappear', () => {
131
+ uploadResponsePage.supportedFileTypesCheckboxWrapper(0)
132
+ .within(() => {
133
+ uploadResponsePage.supportedFileTypeCheckbox()
134
+ .check()
135
+ .should('be.checked');
136
+ });
137
+ commonComponents.errorMessage()
138
+ .should('not.exist');
139
+ });
140
+ });
141
+
142
+ describe('Max Files dropdown', () => {
143
+ abortEarlySetup();
144
+ before(() => {
145
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
146
+ cy.log('Adding question instructions');
147
+ uploadResponsePage.steps.addQuestionInstructions();
148
+ });
149
+
150
+ it('CSS of Max Files dropdown in default state', { tags: 'css' }, () => {
151
+ cy.log('Max files label')
152
+ uploadResponsePage.maxFilesLabel()
153
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
154
+ cy.log('default state of max file dropdown, default selected list option and chevron icon')
155
+ uploadResponsePage.maxFilesDropdown()
156
+ .should('have.css', 'background-color', css.color.secondaryBtnBg)
157
+ .and('have.css', 'border', `1px solid ${css.color.defaultDropdownBorder}`)
158
+ .find('.dropdown-label-text')
159
+ .verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular)
160
+ .verifyPseudoClassBeforeProperty('color', css.color.secondaryBtn);
161
+ });
162
+
163
+ it('Accessibility of Max Files dropdown in default state', { tags: 'a11y' }, () => {
164
+ cy.checkAccessibility(uploadResponsePage.maxFilesLabel());
165
+ cy.checkAccessibility(uploadResponsePage.maxFilesDropdown());
166
+ });
167
+
168
+ it('\'Max files\' label and dropdown should be displayed and in \'Max files\' dropdown option \'15\' should be selected by default', () => {
169
+ uploadResponsePage.maxFilesLabel()
170
+ .verifyInnerText('Maximum number of files')
171
+ .and('be.visible');
172
+ uploadResponsePage.maxFilesDropdown()
173
+ .verifyInnerText('15')
174
+ .and('be.visible');
175
+ });
176
+
177
+ it('Clicking on Max files dropdown should open a list of options from 1 to 15', () => {
178
+ cy.log('Opening the max files dropdown list');
179
+ uploadResponsePage.maxFilesDropdown()
180
+ .click();
181
+ for (let maxFilesIndex = 1; maxFilesIndex < 16; maxFilesIndex++) {
182
+ uploadResponsePage.maxFilesDropdownListOptions(maxFilesIndex - 1)
183
+ .should('have.text', maxFilesIndex);
184
+ };
185
+ });
186
+
187
+ it('CSS of Max files dropdown and dropdown content in active state', { tags: 'css' }, () => {
188
+ uploadResponsePage.maxFilesDropdown()
189
+ .should('have.css', 'background-color', css.color.secondaryBtnBg)
190
+ .and('have.css', 'border', `1px solid ${css.color.secondaryBtnActive}`);
191
+ uploadResponsePage.maxFilesDropdownListOptions(13)
192
+ .should('have.css', 'background-color', css.color.transparent);
193
+ uploadResponsePage.maxFilesDropdownListOptions(14)
194
+ .verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular)
195
+ .should('have.css', 'background-color', css.color.liTextSelectedBg);
196
+ });
197
+
198
+ it('Accessibility of Max files dropdown and dropdown content in active state', { tags: 'a11y' }, () => {
199
+ cy.checkAccessibility(uploadResponsePage.maxFilesDropdown());
200
+ cy.checkAccessibility(commonComponents.dropdownList());
201
+ });
202
+
203
+ it('When user selects option \'15\' from the Max files dropdown, then in the Preview tab user should be able to upload maximum 15 files and count in the file limit section should update accordingly', () => {
204
+ uploadResponsePage.maxFilesDropdownListOptions(14)
205
+ .click();
206
+ cy.log(`Switching to preview tab and uploading 15 files`);
207
+ uploadResponsePage.steps.switchToPreviewTab();
208
+ uploadResponsePage.steps.fileUploadAndVerify(['sample.csv', 'sample.xlsx', 'sample.gif', 'sample.jpg', 'sample.pdf', 'image.png', 'sample.ppt', 'sample.pub', 'sample.rtf', 'sample.txt', 'sample.doc', 'sample.xps', 'sample.zip', 'sample1.jpg', 'sample2.jpg'])
209
+ uploadResponsePage.uploadedFileCount()
210
+ .verifyInnerText('15/15 File Limit');
211
+ });
212
+
213
+ it('When the user tries to add more files than max file limit, file limit error message - \'Error: You have reached the maximum number of files that can be uploaded.\ should be displayed', () => {
214
+ cy.log('Pre-step: Uploading one more file above limit');
215
+ uploadResponsePage.inputTypeFile()
216
+ .attachFile('uploads/sample.jpg');
217
+ commonComponents.errorMessage()
218
+ .verifyInnerText('Error: You have reached the maximum number of files that can be uploaded.');
219
+ });
220
+
221
+ it('CSS of \'File limit error\' message', { tags: 'css' }, () => {
222
+ commonComponents.errorMessage()
223
+ .verifyCSS(css.color.errorText, css.fontSize.small, css.fontWeight.regular);
224
+ });
225
+
226
+ it('Accessibility of \'File limit error\' message', { tags: 'a11y' }, () => {
227
+ cy.checkAccessibility(commonComponents.errorMessage());
228
+ });
229
+
230
+ uploadResponsePage.tests.verifyErrorMessageDisappear();
231
+
232
+ it('When user selects option \'1\' from the Max files dropdown, then in the Preview tab user should be able to upload only 1 file and when user tries to upload more than permitted number of files, then the user should get file limit error message', () => {
233
+ cy.log('Pre-step: Switching to Edit Tab, opening max files dropdown and selecting 1 as Max File Limit.');
234
+ uploadResponsePage.steps.switchToEditTab();
235
+ uploadResponsePage.maxFilesDropdown()
236
+ .click();
237
+ uploadResponsePage.maxFilesDropdownListOptions(0)
238
+ .click();
239
+ cy.log('Switching to preview tab')
240
+ uploadResponsePage.steps.switchToPreviewTab();
241
+ uploadResponsePage.steps.fileUploadAndVerify(['sample.csv']);
242
+ uploadResponsePage.inputTypeFile()
243
+ .attachFile('uploads/sample1.jpg');
244
+ commonComponents.errorMessage()
245
+ .verifyInnerText('Error: You have reached the maximum number of files that can be uploaded.');
246
+ });
247
+
248
+ uploadResponsePage.tests.verifyErrorMessageDisappear();
249
+ });
250
+ });
@@ -0,0 +1,80 @@
1
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
2
+ import { uploadResponsePage, dialogBoxBase } from "../../../pages";
3
+ import { commonComponents } from "../../../pages/components";
4
+
5
+ describe('Create question page - Upload Response: Header section and Saving question', () => {
6
+ before(() => {
7
+ cy.loginAs('admin');
8
+ });
9
+
10
+ describe('Header section contents', () => {
11
+ abortEarlySetup();
12
+ before(() => {
13
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
14
+ });
15
+
16
+ uploadResponsePage.tests.verifyCreateQuestionPageQuestionTypeHeader('Upload response');
17
+ });
18
+
19
+ describe('Tabs section', () => {
20
+ abortEarlySetup();
21
+ before(() => {
22
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
23
+ });
24
+
25
+ uploadResponsePage.tests.verifyTabsSection();
26
+ });
27
+
28
+ describe('Cancel button', () => {
29
+ abortEarlySetup();
30
+ before(() => {
31
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
32
+ });
33
+
34
+ uploadResponsePage.tests.verifyCancelButton('upload response');
35
+ });
36
+
37
+ describe('Save Question button', () => {
38
+ abortEarlySetup();
39
+ before(() => {
40
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
41
+ cy.barsPreLoaderWait();
42
+ });
43
+
44
+ describe('Validation error messages', () => {
45
+ dialogBoxBase.tests.verifyRequiredFieldsWarningPopupOnClickingSaveButton();
46
+
47
+ it('Validation error messages should be displayed below required input fields', () => {
48
+ uploadResponsePage.questionInstructionsLabelEditTab()
49
+ .parents('.edit-question-instruction-wrapper')
50
+ .within(() => {
51
+ commonComponents.errorMessage()
52
+ .verifyInnerText('Error: Question instructions are required.')
53
+ .and('be.visible');
54
+ });
55
+ uploadResponsePage.pleaseEnterPointsErrorMessage()
56
+ .verifyInnerText('Error: Please enter points.');
57
+ });
58
+
59
+ it('Validation error messages should disappear when required input fields are filled', () => {
60
+ uploadResponsePage.steps.addQuestionInstructions();
61
+ uploadResponsePage.questionInstructionsLabelEditTab()
62
+ .parents('.edit-question-instruction-wrapper')
63
+ .within(() => {
64
+ commonComponents.errorMessage()
65
+ .should('not.exist');
66
+ });
67
+ uploadResponsePage.steps.allotPoints(20);
68
+ uploadResponsePage.pleaseEnterPointsErrorMessage()
69
+ .should('not.exist');
70
+ });
71
+ });
72
+
73
+ describe('Saving a question', () => {
74
+ it('When user has filled all the mandatory fields then on clicking on Save Question button the question should get saved and a snackbar with text \'Saved successfully!\' should be displayed', () => {
75
+ uploadResponsePage.steps.saveAQuestionAndVerifySnackbar();
76
+ });
77
+ uploadResponsePage.tests.verifySavedSuccessfullySnackbarCSSanda11y();
78
+ });
79
+ });
80
+ });
@@ -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
+ });
@@ -0,0 +1,60 @@
1
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
2
+ import { uploadResponsePage, } from "../../../pages";
3
+
4
+ describe('Create question page - Upload Response: Scoring', () => {
5
+ before(() => {
6
+ cy.loginAs('admin');
7
+ });
8
+
9
+ describe('Scoring Section contents', () => {
10
+ abortEarlySetup();
11
+ before(() => {
12
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
13
+ });
14
+
15
+ uploadResponsePage.tests.verifyScoringTypeLabelAndDropdown('manuallyScored');
16
+ });
17
+
18
+ describe('Manually scored scoring type - Question creation page', () => {
19
+ abortEarlySetup();
20
+ before(() => {
21
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
22
+ });
23
+
24
+ it('When the user selects \'Manually scored\' option from the Scoring Type dropdown, then the \'Points\' and \'Minimum score awarded (if attempted)\' labels and input fields should be displayed', () => {
25
+ cy.log('Pre-step: Opening the scoring type dropdown.');
26
+ uploadResponsePage.steps.selectAScoringTypeFromScoringTypeDropdown('Manually scored');
27
+ uploadResponsePage.steps.verifyDefaultPointsLabelAndInputField();
28
+ uploadResponsePage.steps.verifyDefaultMinimumScoreIfAttemptedLabelAndPointsField();
29
+ });
30
+
31
+ uploadResponsePage.tests.verifyPointsFieldErrorState(10);
32
+ uploadResponsePage.tests.verifyMinimumScoreIfAttemptedFieldErrorState(10, 20, 10);
33
+
34
+ it('Pre step: Switching to Preview tab', () => {
35
+ uploadResponsePage.steps.switchToPreviewTab();
36
+ });
37
+
38
+ uploadResponsePage.tests.verifyShowCorrectAnswerAndPointsNotDisplayedInPreviewTab()
39
+ });
40
+
41
+ describe('Non Scored scoring type - Question creation page', () => {
42
+ abortEarlySetup();
43
+ before(() => {
44
+ cy.log('Navigating to Upload Response question type');
45
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
46
+ });
47
+
48
+ it('When the user selects \'Non Scored\' option from the Scoring Type dropdown, then the \'Points\' input field should be displayed in disabled state with prefilled \'0\' points and \'Minimum score awarded (if attempted)\' input field should not be displayed', () => {
49
+ cy.log('Pre-step: Opening the scoring type dropdown.');
50
+ uploadResponsePage.steps.selectAScoringTypeFromScoringTypeDropdown('Non scored');
51
+ uploadResponsePage.steps.verifyNonScoredPointsField();
52
+ });
53
+
54
+ it('Pre step: Switching to Preview tab', () => {
55
+ uploadResponsePage.steps.switchToPreviewTab();
56
+ });
57
+
58
+ uploadResponsePage.tests.verifyShowCorrectAnswerAndPointsNotDisplayedInPreviewTab()
59
+ });
60
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {