itemengine-cypress-automation 1.0.585-IEI-7048-de16dee.0 → 1.0.585-IEI-7161-main-9d7019b.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.
@@ -1,9 +1,10 @@
1
1
  import abortEarlySetup from "../../../support/helpers/abortEarly";
2
- import { uploadResponsePage } from "../../../pages";
2
+ import { uploadResponsePage, itemPreviewPage } from "../../../pages";
3
3
  import utilities from "../../../support/helpers/utilities";
4
4
  import { supportedFileType } from "../../../fixtures/uploadResponseFileType";
5
5
  import { commonComponents } from "../../../pages/components";
6
6
  const css = Cypress.env('css');
7
+ let itemReferenceID;
7
8
 
8
9
  const fileSizeLimitOptions = ['5', '10', '15', '20', '100'];
9
10
 
@@ -407,4 +408,57 @@ describe('Create question page - Upload Response: Question Instructions, Support
407
408
  utilities.verifyElementVisibilityState(uploadResponsePage.warningIcon(), 'notExist');
408
409
  });
409
410
  });
411
+
412
+
413
+ describe('Print layout settings accordion', () => {
414
+ abortEarlySetup();
415
+ before(() => {
416
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
417
+ cy.barsPreLoaderWait();
418
+ });
419
+
420
+ uploadResponsePage.tests.verifyPrintLayoutSettingsAccordionProperties();
421
+ uploadResponsePage.tests.verifyPrintLayoutSettingsAccordionContents();
422
+ uploadResponsePage.tests.verifyPrintLayoutSettingsAccordionAdditionalContent();
423
+ });
424
+
425
+ describe('Print layout settings: Default state', () => {
426
+ abortEarlySetup();
427
+ before(() => {
428
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
429
+ cy.barsPreLoaderWait();
430
+ uploadResponsePage.steps.expandPrintLayoutSettings();
431
+ uploadResponsePage.steps.addTextInQuestionInstructionsInputField('upload response instructions.');
432
+ uploadResponsePage.steps.checkDisplayLinesForTheResponseCheckbox();
433
+ });
434
+
435
+ it('When the user navigates to the print view, then instructions and number of lines with 32px height should be displayed correctly', () => {
436
+ uploadResponsePage.steps.clickOnSaveQuestionButton();
437
+ utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
438
+ cy.wrap(itemPreviewPage.steps.getItemReferenceID()).then((referenceId) => {
439
+ itemReferenceID = referenceId;
440
+ cy.visit(`/item-engine/demo/render-item/print-view/${utilities.base64Encoding(itemReferenceID)}`);
441
+ utilities.verifyInnerText(uploadResponsePage.questionInstructionsPrintPreviewText(), 'upload response instructions.');
442
+ uploadResponsePage.steps.verifyNumberOfLinesInPrintView(5, '32px');
443
+ });
444
+ });
445
+
446
+ it('When the modified number of lines and line spacing are applied, then instructions and number of lines with modified line spacing should be displayed correctly', () => {
447
+ cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
448
+ uploadResponsePage.steps.clickOnEditQuestionButton();
449
+ uploadResponsePage.steps.expandPrintLayoutSettings();
450
+ uploadResponsePage.steps.addTextInQuestionInstructionsInputFieldForPrint('upload response modify instructions.');
451
+ uploadResponsePage.steps.addValueInNumberOfLinesInputField('5');
452
+ uploadResponsePage.steps.expandLineSpacingDropdown();
453
+ uploadResponsePage.steps.selectLineSpacingDropdownOption('Double');
454
+ uploadResponsePage.steps.clickOnSaveQuestionButton();
455
+ utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
456
+ cy.wrap(itemPreviewPage.steps.getItemReferenceID()).then((referenceId) => {
457
+ itemReferenceID = referenceId;
458
+ cy.visit(`/item-engine/demo/render-item/print-view/${utilities.base64Encoding(itemReferenceID)}`);
459
+ utilities.verifyInnerText(uploadResponsePage.questionInstructionsPrintPreviewText(), 'upload response modify instructions.');
460
+ uploadResponsePage.steps.verifyNumberOfLinesInPrintView(5, '48px');
461
+ });
462
+ });
463
+ });
410
464
  });
@@ -1,9 +1,12 @@
1
1
  import abortEarlySetup from "../../../support/helpers/abortEarly";
2
- import { uploadResponsePage } from "../../../pages";
2
+ import { uploadResponsePage, itemPreviewPage } from "../../../pages";
3
3
  import utilities from "../../../support/helpers/utilities";
4
4
  const css = Cypress.env('css');
5
+ let correctAnswerViews = ['Question preview', 'Item preview', 'Student view'];
6
+ const views = utilities.getViews(correctAnswerViews);
7
+ let itemReferenceID = "";
5
8
 
6
- const labels =[uploadResponsePage.allowStudentToAddFileDescriptionLabel, uploadResponsePage.allowStudentToEditFileNameLabel, uploadResponsePage.displayPerFileSizeLimitToStudentLabel];
9
+ const labels = [uploadResponsePage.allowStudentToAddFileDescriptionLabel, uploadResponsePage.allowStudentToEditFileNameLabel, uploadResponsePage.displayPerFileSizeLimitToStudentLabel];
7
10
 
8
11
  describe('Create question page - Upload Response: Additional Settings', () => {
9
12
  before(() => {
@@ -43,7 +46,7 @@ describe('Create question page - Upload Response: Additional Settings', () => {
43
46
  uploadResponsePage.steps.uncheckDisplayPerFileSizeLimitToStudentCheckbox();
44
47
  });
45
48
 
46
- /*it('\'Allow student to edit file name\' label and checkbox should be displayed and by default checkbox should be checked', () => {
49
+ it('\'Allow student to edit file name\' label and checkbox should be displayed and by default checkbox should be checked', () => {
47
50
  utilities.verifyInnerText(uploadResponsePage.allowStudentToEditFileNameLabel(), 'Allow student to edit file name');
48
51
  utilities.verifyElementVisibilityState(uploadResponsePage.allowStudentToEditFileNameLabel(), 'visible');
49
52
  utilities.verifyElementVisibilityState(uploadResponsePage.allowStudentToEditFileNameCheckbox(), 'exist');
@@ -87,7 +90,7 @@ describe('Create question page - Upload Response: Additional Settings', () => {
87
90
 
88
91
  it('Accessibility of \'Student view settings\' section', { tags: 'a11y' }, () => {
89
92
  cy.checkAccessibility(uploadResponsePage.uploadControlsLabel().parents('.student-view-settings-container'))
90
- });*/
93
+ });
91
94
  });
92
95
 
93
96
  describe('Upload controls - Preview tab', () => {
@@ -150,7 +153,7 @@ describe('Create question page - Upload Response: Additional Settings', () => {
150
153
  });
151
154
  });
152
155
 
153
- /*describe('Allow student to edit file name - Preview tab', () => {
156
+ describe('Allow student to edit file name - Preview tab', () => {
154
157
  abortEarlySetup();
155
158
  before(() => {
156
159
  uploadResponsePage.steps.navigateToCreateQuestion('upload response');
@@ -170,9 +173,9 @@ describe('Create question page - Upload Response: Additional Settings', () => {
170
173
  uploadResponsePage.steps.uncheckAllowStudentToEditFileNameCheckbox();
171
174
  uploadResponsePage.steps.switchToPreviewTab();
172
175
  uploadResponsePage.steps.uploadFile('uploads/highlightImage.jpg');
173
- utilities.verifyElementVisibilityState(uploadResponsePage.editDisplayTextIcon(), 'hidden');
176
+ utilities.verifyElementVisibilityState(uploadResponsePage.editDisplayTextIcon(), 'notExist');
174
177
  });
175
- });*/
178
+ });
176
179
 
177
180
  describe('Allow student to add file description - Preview tab', () => {
178
181
  abortEarlySetup();
@@ -180,9 +183,9 @@ describe('Create question page - Upload Response: Additional Settings', () => {
180
183
  uploadResponsePage.steps.navigateToCreateQuestion('upload response');
181
184
  cy.barsPreLoaderWait();
182
185
  });
183
-
186
+
184
187
  it('When the \'Allow student to add file description\' checkbox is checked then in the preview tab, then add description icon should be displayed', () => {
185
- uploadResponsePage.steps.verifyAllowStudentToEditFileNameCheckboxChecked();
188
+ uploadResponsePage.steps.verifyAllowStudentToAddFileDescriptionCheckboxChecked();
186
189
  uploadResponsePage.steps.switchToPreviewTab();
187
190
  uploadResponsePage.steps.uploadFile('uploads/highlightImage.jpg');
188
191
  utilities.verifyElementVisibilityState(uploadResponsePage.addFileDescriptionIcon(), 'visible');
@@ -197,4 +200,174 @@ describe('Create question page - Upload Response: Additional Settings', () => {
197
200
  utilities.verifyElementVisibilityState(uploadResponsePage.addFileDescriptionIcon(), 'notExist');
198
201
  });
199
202
  });
203
+
204
+ views.forEach((view) => {
205
+ describe(`${view}: Student view settings default state`, () => {
206
+ abortEarlySetup();
207
+ before(() => {
208
+ switch (view) {
209
+ case 'Question preview':
210
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
211
+ cy.barsPreLoaderWait();
212
+ uploadResponsePage.steps.addTextInQuestionInstructionsInputField('upload response instructions.');
213
+ uploadResponsePage.steps.verifyAllowStudentToEditFileNameCheckboxChecked();
214
+ uploadResponsePage.steps.verifyAllowStudentToAddFileDescriptionCheckboxChecked();
215
+ uploadResponsePage.steps.verifyDisplayPerFileSizeLimitToStudentCheckboxChecked();
216
+ uploadResponsePage.steps.switchToPreviewTab();
217
+ break;
218
+ case 'Item preview':
219
+ cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
220
+ itemPreviewPage.steps.switchToPreviewTab();
221
+ break;
222
+ case 'Student view':
223
+ cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
224
+ break;
225
+ };
226
+ });
227
+
228
+ beforeEach(() => {
229
+ switch (view) {
230
+ case 'Question preview':
231
+ break;
232
+ case 'Item preview':
233
+ break;
234
+ case 'Student view':
235
+ break;
236
+ }
237
+ });
238
+
239
+ if (view === 'Question preview') {
240
+ after(() => {
241
+ uploadResponsePage.steps.clickOnSaveQuestionButton();
242
+ utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
243
+ itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
244
+ });
245
+ };
246
+
247
+ it(`When the 'Allow student to edit file name' checkbox ,then edit icon should be displayed in the ${view}`, () => {
248
+ uploadResponsePage.steps.uploadFile('uploads/highlightImage.jpg');
249
+ utilities.verifyElementVisibilityState(utilities.getNthElement(uploadResponsePage.editDisplayTextIcon(), 0), 'visible');
250
+ });
251
+
252
+ it(`When the 'Allow student to add file description' checkbox is checked, then add description icon should be displayed in the ${view}`, () => {
253
+ uploadResponsePage.steps.uploadFile('uploads/highlightImage.jpg');
254
+ utilities.verifyElementVisibilityState(uploadResponsePage.addFileDescriptionIcon(), 'visible');
255
+ });
256
+
257
+ it(`When the 'Display per file size limit to student' checkbox is checked then, then 'Maximum file size: #MB' should be displayed in the ${view}`, () => {
258
+ utilities.verifyElementVisibilityState(uploadResponsePage.maximumFileSize(), 'visible');
259
+ uploadResponsePage.steps.verifyMaximumFileSizePreviewTab('20MB');
260
+ });
261
+
262
+ it('When the \'Capture photos\' option is selected then in the preview tab, the upload response area text should have \'Capture an image\' option', () => {
263
+ uploadResponsePage.steps.verifyUploadOptionVisibleInUploadResponseArea('Capture photo');
264
+ });
265
+
266
+ it('When the \'Drag and drop files\' option is selected then in the preview tab, the upload response area text should be \'Drag and drop files here\'', () => {
267
+ utilities.verifyElementVisibilityState(uploadResponsePage.uploadCloudIcon(), 'visible');
268
+ utilities.verifyInnerText(uploadResponsePage.dragAndDropFilesText(), 'Drag & Drop files here');
269
+ });
270
+
271
+ it('When the user clicks on the link text \'capture an image\' a \'Capture image\' popup should open', () => {
272
+ uploadResponsePage.steps.captureImage();
273
+ utilities.verifyElementVisibilityState(uploadResponsePage.dialogBox(), 'visible');
274
+ });
275
+
276
+ it('On \'Capture image\' popup following should be displayed - \'Capture image\' title text, Camera preview, Capture and Cancel buttons', () => {
277
+ uploadResponsePage.steps.verifyCaptureImagePopup();
278
+ utilities.verifyElementVisibilityState(uploadResponsePage.acceptButton(), 'visible');
279
+ utilities.verifyElementVisibilityState(uploadResponsePage.cancelButton(), 'visible');
280
+ utilities.verifyInnerText(uploadResponsePage.cancelButton(), 'Cancel');
281
+ utilities.verifyInnerText(uploadResponsePage.acceptButton(), 'Capture');
282
+ });
283
+
284
+ it('When the user clicks on \'Cancel\' button the \'Capture image\' popup should close', () => {
285
+ uploadResponsePage.steps.clickCancelButtonInPopup();
286
+ utilities.verifyElementVisibilityState(uploadResponsePage.dialogBox(), 'notExist');
287
+ });
288
+
289
+ 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', () => {
290
+ uploadResponsePage.steps.captureImage();
291
+ uploadResponsePage.steps.clickAcceptButtonInPopup();
292
+ utilities.verifyInnerText(uploadResponsePage.cancelButton(), 'Retake');
293
+ utilities.verifyInnerText(uploadResponsePage.acceptButton(), 'Save');
294
+ });
295
+
296
+ it('When the user clicks on \'Save\' button, it should upload the captured image in the response', () => {
297
+ uploadResponsePage.steps.clickAcceptButtonInPopup();
298
+ utilities.verifyElementVisibilityState(uploadResponsePage.uploadingProgressBar(), 'notExist');
299
+ });
300
+ });
301
+ });
302
+
303
+ views.forEach((view) => {
304
+ describe.only(`${view}: Student view settings modified state`, () => {
305
+ abortEarlySetup();
306
+ before(() => {
307
+ switch (view) {
308
+ case 'Question preview':
309
+ uploadResponsePage.steps.navigateToCreateQuestion('upload response');
310
+ cy.barsPreLoaderWait();
311
+ uploadResponsePage.steps.addTextInQuestionInstructionsInputField('upload response instructions.');
312
+ uploadResponsePage.steps.uncheckAllowStudentToEditFileNameCheckbox();
313
+ uploadResponsePage.steps.uncheckAllowStudentToAddFileDescriptionCheckbox();
314
+ uploadResponsePage.steps.uncheckDisplayPerFileSizeLimitToStudentCheckbox();
315
+ uploadResponsePage.steps.unselectUploadControlsOption(0);
316
+ uploadResponsePage.steps.unselectUploadControlsOption(1);
317
+ uploadResponsePage.steps.switchToPreviewTab();
318
+ break;
319
+ case 'Item preview':
320
+ cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
321
+ itemPreviewPage.steps.switchToPreviewTab();
322
+ break;
323
+ case 'Student view':
324
+ cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
325
+ break;
326
+ };
327
+ });
328
+
329
+ beforeEach(() => {
330
+ switch (view) {
331
+ case 'Question preview':
332
+ break;
333
+ case 'Item preview':
334
+ break;
335
+ case 'Student view':
336
+ cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
337
+ break;
338
+ }
339
+ });
340
+
341
+ if (view === 'Question preview') {
342
+ after(() => {
343
+ uploadResponsePage.steps.clickOnSaveQuestionButton();
344
+ utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
345
+ itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
346
+ });
347
+ };
348
+
349
+ it(`When the user unchecks \'Allow student to edit file name\' checkbox, then edit icon should be not be displayed in the ${view}`, () => {
350
+ uploadResponsePage.steps.uploadFile('uploads/highlightImage.jpg');
351
+ utilities.verifyElementVisibilityState(uploadResponsePage.editDisplayTextIcon(), 'notExist');
352
+ });
353
+
354
+ it(`When the user unchecks 'Allow student to add file description' checkbox, then in the Preview tab add description icon should be not be displayed in the ${view}`, () => {
355
+ uploadResponsePage.steps.uploadFile('uploads/highlightImage.jpg');
356
+ utilities.verifyElementVisibilityState(uploadResponsePage.addFileDescriptionIcon(), 'notExist');
357
+ });
358
+
359
+ it(`When the user unchecks 'Display per file size limit to student' checkbox, then in the Preview tab Maximum file size: #MB should not be displayed in the ${view}`, () => {
360
+ utilities.verifyElementVisibilityState(uploadResponsePage.maximumFileSize(), 'notExist');
361
+ });
362
+
363
+ it(`When the user unselects the 'Capture photos' option, then the upload response area text should not have 'capture an image' option in the ${view}`, () => {
364
+ uploadResponsePage.steps.verifyUploadOptionNotVisibleInUploadResponseArea('Capture photo');
365
+ });
366
+
367
+ it(`When the user unselects the 'Drag and drop files' option, then the upload response area text should be 'Upload file here' in the ${view}`, () => {
368
+ utilities.verifyElementVisibilityState(uploadResponsePage.uploadCloudIcon(), 'visible');
369
+ utilities.verifyInnerText(uploadResponsePage.dragAndDropFilesText(), 'Upload file here');
370
+ });
371
+ });
372
+ });
200
373
  });
@@ -22,7 +22,7 @@ describe('Create question page - Upload Response: Preview', () => {
22
22
  });
23
23
 
24
24
  it('CSS of uploaded file wrapper contents', { tags: 'css' }, () => {
25
- utilities.verifyCSS(uploadResponsePage.uploadedFileLink().children(), {
25
+ utilities.verifyCSS(uploadResponsePage.uploadedFileDownloadLinkText(), {
26
26
  'color': css.color.linkText,
27
27
  'font-size': css.fontSize.default,
28
28
  'font-weight': css.fontWeight.regular
@@ -105,7 +105,7 @@ describe('Create question page - Upload Response: Preview', () => {
105
105
 
106
106
  it('On clicking on the file name, user should be able to download the file', () => {
107
107
  uploadResponsePage.steps.uploadFile('uploads/image.png');
108
- cy.verifyUploadFilePreviewDownload('image.png');
108
+ uploadResponsePage.steps.verifyDownloadedFilename('image.png', 0);
109
109
  cy.wait(5000);
110
110
  });
111
111
  });
@@ -131,6 +131,10 @@ describe('Create question page - Upload Response: Preview', () => {
131
131
 
132
132
  it('On \'Capture image\' popup following should be displayed - \'Capture image\' title text, Camera preview, Capture and Cancel buttons', () => {
133
133
  uploadResponsePage.steps.verifyCaptureImagePopup();
134
+ utilities.verifyElementVisibilityState(uploadResponsePage.acceptButton(), 'visible');
135
+ utilities.verifyElementVisibilityState(uploadResponsePage.cancelButton(), 'visible');
136
+ utilities.verifyInnerText(uploadResponsePage.cancelButton(), 'Cancel');
137
+ utilities.verifyInnerText(uploadResponsePage.acceptButton(), 'Capture');
134
138
  });
135
139
 
136
140
  it('CSS of \'Capture image\' popup', { tags: 'css' }, () => {
@@ -67,9 +67,10 @@ describe('Create question page - Upload Response: Preview', () => {
67
67
  utilities.verifyInnerText(commonComponents.tooltipText(), 'Add file description');
68
68
  });
69
69
 
70
- 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\'', () => {
70
+ it('When the user clicks on the \'Add file description\' icon button, an input area should be displayed along with a label text: \'Add file description\'', () => {
71
71
  uploadResponsePage.steps.clickOnAddFileDescriptionIcon();
72
- uploadResponsePage.steps.verifyAddFileDescriptionInputFieldPlaceholderText();
72
+ utilities.verifyInnerText(uploadResponsePage.addFileDescriptionLabel(), 'Add file description');
73
+ utilities.verifyElementVisibilityState(uploadResponsePage.addFileDescriptionInput(), 'visible');
73
74
  });
74
75
 
75
76
  it('CSS of \'Add file description\' input field', { tags: 'css' }, () => {
@@ -81,7 +82,7 @@ describe('Create question page - Upload Response: Preview', () => {
81
82
  });
82
83
 
83
84
  it('Accessibility of \'Add file description\' input field', { tags: 'a11y' }, () => {
84
- cy.checkAccessibility(uploadResponsePage.addFileDescriptionInput().parents('.placeholder'));
85
+ cy.checkAccessibility(uploadResponsePage.addFileDescriptionInput());
85
86
  });
86
87
 
87
88
  it('User should be able to add description text for uploaded file', () => {
@@ -244,7 +245,7 @@ describe('Create question page - Upload Response: Preview', () => {
244
245
  });
245
246
 
246
247
  it('If the user tries to download file after renaming, the file should get downloaded with the original name', () => {
247
- cy.verifyUploadFilePreviewDownload('image.png');
248
+ uploadResponsePage.steps.verifyDownloadedFilename('imageEdited.png', 0);
248
249
  });
249
250
  });
250
251
  });
@@ -1,4 +1,4 @@
1
- import { commonComponents, questionInstructionsComponent, scoringSectionBaseEditTab, createQuestionBasePage, additionalSettingsPanel, autoScoredScoringPreviewTab, studentViewSettingsLabelComponent, additionalSettingsAccessibilitySectionComponent, autoScoredStudentViewSettings } from "./components";
1
+ import { commonComponents, questionInstructionsComponent, scoringSectionBaseEditTab, createQuestionBasePage, additionalSettingsPanel, autoScoredScoringPreviewTab, studentViewSettingsLabelComponent, additionalSettingsAccessibilitySectionComponent, autoScoredStudentViewSettings, printPreviewComponent } from "./components";
2
2
  import { createItemPage, dialogBoxBase } from ".";
3
3
  import utilities from "../support/helpers/utilities";
4
4
  import { supportedFileType } from "../fixtures/uploadResponseFileType";
@@ -15,6 +15,7 @@ const selectors = {
15
15
  ...questionInstructionsComponent,
16
16
  ...commonComponents,
17
17
  ...dialogBoxBase,
18
+ ...printPreviewComponent,
18
19
 
19
20
  maximumNumberOfFilesInputField: () => cy.get('.input-stepper-textfield'),
20
21
  maximumNumberOfFilesLabel: () => cy.get('.input-stepper-label'),
@@ -73,10 +74,11 @@ const selectors = {
73
74
  inputTypeFile: () => cy.get('input[type="file"]'),
74
75
  uploadedFilesSectionWrapper: () => cy.get('.uploaded-document-wrapper'),
75
76
  uploadedFileWrapper: () => cy.get('.uploaded-document'),
76
- editDisplayTextIcon: () => cy.get('.icon-pencil'),
77
+ editDisplayTextIcon: () => cy.get('[class*="UploadedDocumentsstyle__DocumentEditIconWrapper"]'),
77
78
  fileName: () => cy.get('.studentResponse'),
78
- addFileDescriptionInput: () => cy.get('[placeholder="Add file description"]'),
79
+ addFileDescriptionInput: () => cy.get('.uploaded-documents-file-description-input input'),
79
80
  addFileDescriptionIcon: () => cy.get('.icon-File-description'),
81
+ addFileDescriptionLabel: () => cy.get('[class*="UploadedDocumentsstyle__FileDescriptionLabel"]'),
80
82
  scanningForVirusPreLoader: () => cy.get('[alt="loader"]'),
81
83
  virusErrorMessageWrapper: () => cy.get('.FileUploadStatementLarge'),
82
84
  uploadedFileLink: () => cy.get('img[src*="/files/document?key=freeResponse/"]'),
@@ -99,6 +101,25 @@ const selectors = {
99
101
  downloadIconOfPopUp: () => cy.get('.download-icon'),
100
102
  downloadTextOfPopUp: () => cy.get('[class*="UploadedDocumentsstyle__DownloadTextWrapper"]'),
101
103
  closePopUpButton: () => cy.get('.close-popup-btn'),
104
+
105
+ //Print layout settings additional content selectors
106
+ displayLinesForTheResponseLabel: () => cy.get('label[aria-label*="Display lines for the response"]'),
107
+ displayLinesForTheResponseCheckbox: () => cy.get('input[aria-label*="Display lines for the response"]'),
108
+ numberOfLinesInputField: () => cy.get('[aria-labelledby*="number-of-lines"]'),
109
+ numberOfLinesLabel: () => cy.get('.number-of-lines-label'),
110
+ lineSpacingLabel: () => cy.get('[id="Line-Spacing-dropdown-label"]'),
111
+ lineSpacingDropdown: () => cy.get('.print-layout-settings-detail-wrapper [aria-label*="Line Spacing"]'),
112
+ lineSpacingDropdownListOptions: (ariaLabel = null) => {
113
+ if (ariaLabel) {
114
+ return cy.get(`[aria-labelledby*="Line-Spacing-dropdown-label Line-Spacing-placeholder"] [role="option"][aria-label*="${ariaLabel}"]`)
115
+ } else {
116
+ return cy.get('[aria-labelledby*="Line-Spacing-dropdown-label Line-Spacing-placeholder"] [role="option"]')
117
+ }
118
+ },
119
+ numberOfLinesInPrintView: () => cy.get('[class*="UploadResponsePrintPreviewstyles__Line"]'),
120
+ uploadedFileButton: () => cy.get('[class*="UploadedDocumentsstyle__UploadedDocumentNameContainer"] button'),
121
+ uploadedFileDownloadButton: () => cy.get('[class*="UploadedDocumentsstyle__DownloadTextWrapper"]'),
122
+ uploadedFileDownloadLinkText: () => cy.get('[class*="DocumentNameWrapper studentResponse"]'),
102
123
  }
103
124
 
104
125
  const steps = {
@@ -109,7 +130,7 @@ const steps = {
109
130
  ...commonComponents.steps,
110
131
  ...autoScoredScoringPreviewTab.steps,
111
132
  ...createItemPage.steps,
112
-
133
+ ...printPreviewComponent.steps,
113
134
  /**
114
135
  * @param {number} maxValue value of maximum number of files
115
136
  * @description function enters value in maximum number of files input field
@@ -655,7 +676,82 @@ const steps = {
655
676
  utilities.verifyElementVisibilityState(uploadResponsePage.cancelButton(), 'visible');
656
677
  utilities.verifyInnerText(uploadResponsePage.acceptButton(), 'Capture');
657
678
  utilities.verifyElementVisibilityState(uploadResponsePage.acceptButton(), 'visible');
658
- }
679
+ },
680
+
681
+ verifyDisplayLinesForTheResponseCheckboxUnchecked: () => {
682
+ uploadResponsePage.displayLinesForTheResponseCheckbox()
683
+ .should('not.be.checked');
684
+ },
685
+
686
+ verifyDisplayLinesForTheResponseCheckboxChecked: () => {
687
+ uploadResponsePage.displayLinesForTheResponseCheckbox()
688
+ .should('be.checked');
689
+ },
690
+
691
+ checkDisplayLinesForTheResponseCheckbox: () => {
692
+ uploadResponsePage.displayLinesForTheResponseCheckbox()
693
+ .click()
694
+ steps.verifyDisplayLinesForTheResponseCheckboxChecked();
695
+ },
696
+
697
+ uncheckDisplayLinesForTheResponseCheckbox: () => {
698
+ uploadResponsePage.displayLinesForTheResponseCheckbox()
699
+ .click();
700
+ steps.verifyDisplayLinesForTheResponseCheckboxUnchecked();
701
+ },
702
+
703
+ expandLineSpacingDropdown: () => {
704
+ uploadResponsePage.lineSpacingDropdown()
705
+ .click();
706
+ },
707
+
708
+ /**
709
+ * @description this function is select option from line spacing dropdown
710
+ * @param {number} option is to be selected from the dropdown
711
+ */
712
+ selectLineSpacingDropdownOption: (option) => {
713
+ uploadResponsePage.lineSpacingDropdownListOptions(option)
714
+ .click();
715
+ utilities.verifyInnerText(uploadResponsePage.lineSpacingDropdown(), option);
716
+ },
717
+
718
+ /**
719
+ * @description this function is to add value in number of lines input field
720
+ * @param {number} value need to add in the input field
721
+ */
722
+ addValueInNumberOfLinesInputField: (value) => {
723
+ uploadResponsePage.numberOfLinesInputField()
724
+ .clear()
725
+ .type(value)
726
+ .should('have.value', value);
727
+ },
728
+
729
+ /**
730
+ * @description this function verifies the number of lines and their height in the print view
731
+ * @param {number} expectedLines number of lines in the print view
732
+ * @param {number} expectedLineHeight height of each line in the print view
733
+ */
734
+ verifyNumberOfLinesInPrintView: (expectedLines, expectedLineHeight) => {
735
+ uploadResponsePage.numberOfLinesInPrintView()
736
+ .should('have.length', expectedLines)
737
+ .each(($line) => {
738
+ cy.wrap($line).should('have.css', 'height', expectedLineHeight);
739
+ });
740
+ },
741
+
742
+ /**
743
+ * @description this function verifies the downloaded filename
744
+ * @param {string} fileName for the uploaded file
745
+ * @param {number} index of the file type option to be click
746
+ */
747
+ verifyDownloadedFilename: (fileName, index) => {
748
+ uploadResponsePage.uploadedFileButton()
749
+ .eq(index)
750
+ .click();
751
+ uploadResponsePage.uploadedFileDownloadButton()
752
+ .click();
753
+ cy.verifyDownload(fileName);
754
+ },
659
755
  }
660
756
 
661
757
  const tests = {
@@ -668,6 +764,7 @@ const tests = {
668
764
  ...additionalSettingsAccessibilitySectionComponent.tests,
669
765
  ...studentViewSettingsLabelComponent.tests,
670
766
  ...autoScoredStudentViewSettings.tests,
767
+ ...printPreviewComponent.tests,
671
768
  verifyWarningMessageDisappear: () => {
672
769
  it('The error message should disappear if the user clicks anywhere in the upload file content wrapper', () => {
673
770
  uploadResponsePage.inputTypeFile()
@@ -676,7 +773,69 @@ const tests = {
676
773
  uploadResponsePage.warningMessage()
677
774
  .should('not.exist');
678
775
  });
679
- }
776
+ },
777
+
778
+ verifyPrintLayoutSettingsAccordionAdditionalContent: () => {
779
+ const lineSpacingDropdownOptions = ['Single', 'Double'];
780
+ it('\'Display lines for the response\' label should be displayed', () => {
781
+ utilities.verifyInnerText(uploadResponsePage.displayLinesForTheResponseLabel(), 'Display lines for the response');
782
+ utilities.verifyElementVisibilityState(uploadResponsePage.displayLinesForTheResponseLabel(), 'visible');
783
+ });
784
+
785
+ it('Display lines for the response checkbox should be displayed and by default unchecked', () => {
786
+ utilities.verifyElementVisibilityState(uploadResponsePage.displayLinesForTheResponseCheckbox(), 'exist');
787
+ steps.verifyDisplayLinesForTheResponseCheckboxUnchecked();
788
+ });
789
+
790
+ it('CSS of \'Display lines for the response\' section', { tags: 'css' }, () => {
791
+ utilities.verifyCSS(uploadResponsePage.displayLinesForTheResponseLabel(), {
792
+ 'color': css.color.labelText,
793
+ 'font-size': css.fontSize.normal,
794
+ 'font-weight': css.fontWeight.regular
795
+ });
796
+ });
797
+
798
+ it('Accessibility of \'Display lines for the response\' section', { tags: 'a11y' }, () => {
799
+ cy.checkAccessibility(uploadResponsePage.displayLinesForTheResponseLabel().parents('.print-layout-settings-container'));
800
+ });
801
+
802
+ it('User should be able to check and uncheck the \'Display lines for the response\' checkbox', () => {
803
+ steps.checkDisplayLinesForTheResponseCheckbox();
804
+ steps.uncheckDisplayLinesForTheResponseCheckbox();
805
+ });
806
+
807
+ it('Number of lines label and input field should be displayed when \'Display lines for the response\' checkbox is checked', () => {
808
+ steps.checkDisplayLinesForTheResponseCheckbox();
809
+ utilities.verifyInnerText(uploadResponsePage.numberOfLinesLabel(), 'Number of lines');
810
+ utilities.verifyElementVisibilityState(uploadResponsePage.numberOfLinesLabel(), 'visible');
811
+ utilities.verifyElementVisibilityState(uploadResponsePage.numberOfLinesInputField(), 'exist');
812
+ });
813
+
814
+ it('User should be able to enter value in Number of lines input field', () => {
815
+ uploadResponsePage.steps.addValueInNumberOfLinesInputField('5');
816
+ });
817
+
818
+ it(`\'Line Spacing\' label should be displayed and \'Line Spacing\' dropdown should be displayed and in \'Line Spacing\' dropdown \'${lineSpacingDropdownOptions[0]}\' option should be selected by default`, () => {
819
+ utilities.verifyInnerText(uploadResponsePage.lineSpacingLabel(), 'Line spacing');
820
+ utilities.verifyElementVisibilityState(uploadResponsePage.lineSpacingDropdown(), 'visible');
821
+ utilities.verifyInnerText(uploadResponsePage.lineSpacingDropdown(), lineSpacingDropdownOptions[0]);
822
+ });
823
+
824
+ it(`\'Line Spacing\' dropdown should have the following options: ${lineSpacingDropdownOptions.join(', ')}`, () => {
825
+ steps.expandLineSpacingDropdown()
826
+ lineSpacingDropdownOptions.forEach((option, count) => {
827
+ utilities.verifyInnerText(uploadResponsePage.lineSpacingDropdownListOptions().eq(count), option)
828
+ });
829
+ uploadResponsePage.steps.selectLineSpacingDropdownOption('Double')
830
+ });
831
+
832
+ it('User should be able to select options from Line Spacing dropdown', () => {
833
+ lineSpacingDropdownOptions.forEach((option) => {
834
+ uploadResponsePage.steps.expandLineSpacingDropdown();
835
+ uploadResponsePage.steps.selectLineSpacingDropdownOption(option)
836
+ });
837
+ });
838
+ },
680
839
  }
681
840
 
682
841
  export const uploadResponsePage = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.585-IEI-7048-de16dee.0",
3
+ "version": "1.0.585-IEI-7161-main-9d7019b.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {