itemengine-cypress-automation 1.0.69 → 1.0.70

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. package/cypress/e2e/ILC/EssayResponse/essayResponseAdditionalSettings.js +2 -2
  2. package/cypress/e2e/ILC/EssayResponse/essayResponseAdditionalSettingsBasic.js +1 -1
  3. package/cypress/e2e/ILC/EssayResponse/essayResponseScoringSection.js +2 -2
  4. package/cypress/e2e/ILC/FeedbackScale/feedbackScaleAdditionalSettingsBasic.js +8 -9
  5. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropGroupedOptionsPartialEqualWeightsWithAlternateAnswer.js +0 -4
  6. package/cypress/e2e/ILC/Highlight/HighlightScoring/allOrNothingCorrectPointsEqualToAlternatePoints.js +2 -0
  7. package/cypress/e2e/ILC/Highlight/HighlightScoring/allOrNothingScoring.js +2 -0
  8. package/cypress/e2e/ILC/Highlight/{highlightBasicScoringForTextSelectionTypes.js → HighlightScoring/highlightBasicScoringForTextSelectionTypes.js} +1 -1
  9. package/cypress/e2e/ILC/Highlight/HighlightScoring/{manualAndNonScored.js → manuallyAndNonScored.js} +1 -1
  10. package/cypress/e2e/ILC/Highlight/HighlightScoring/{partialDifferentWeightsCorrectEqualToAlternatePoints.js → partialDifferentWeightsCorrectPointsEqualToAlternatePoints.js} +2 -0
  11. package/cypress/e2e/ILC/Highlight/HighlightScoring/partialDifferentWeightsScoring.js +7 -2
  12. package/cypress/e2e/ILC/Highlight/HighlightScoring/partialEqualWeightsCorrectPointEqualToAlternatePoints.js +2 -0
  13. package/cypress/e2e/ILC/Highlight/HighlightScoring/partialEqualWeightsScoring.js +6 -1
  14. package/cypress/e2e/ILC/Highlight/highlightAdditionalSettingsBasic.js +2 -3
  15. package/cypress/e2e/ILC/Highlight/highlightAdditionalSettingsMaximumNumberOfAnswers.js +0 -2
  16. package/cypress/e2e/ILC/Highlight/highlightEditTabScoringSection.js +4 -3
  17. package/cypress/e2e/ILC/HighlightImage/highlightImageAdditionalSettings.js +4 -4
  18. package/cypress/e2e/ILC/HighlightImage/highlightImageAdditionalSettingsBasic.js +4 -10
  19. package/cypress/e2e/ILC/HighlightImage/highlightImageAllOrNothingScoring.js +3 -3
  20. package/cypress/e2e/ILC/HighlightImage/highlightImageEditTabScoring.js +9 -5
  21. package/cypress/e2e/ILC/HighlightImage/highlightImageManuallyAndNonScoredScoring.js +1 -1
  22. package/cypress/e2e/ILC/HighlightImage/highlightImagePartialDifferentWeightsScoring.js +14 -15
  23. package/cypress/e2e/ILC/HighlightImage/highlightImagePartialDifferentWeightsWithAlternateAnswer.js +0 -3
  24. package/cypress/e2e/ILC/HighlightImage/highlightImagePartialEqualWeightsScoring.js +14 -14
  25. package/cypress/e2e/ILC/UploadResponse/uploadResponseAdditionalSettings.js +60 -66
  26. package/cypress/e2e/ILC/UploadResponse/uploadResponseEditTabBasicSections.js +84 -109
  27. package/cypress/e2e/ILC/UploadResponse/uploadResponseHeaderSection.js +4 -18
  28. package/cypress/e2e/ILC/UploadResponse/uploadResponsePreview.js +119 -150
  29. package/cypress/e2e/ILC/UploadResponse/uploadResponseScoringSection.js +2 -2
  30. package/cypress/e2e/ILC/UploadResponse/uplodResponsePreviewUploadedFileProperties.js +110 -164
  31. package/cypress/e2e/ILC/VideoResponse/videoResponseAdditionalSettings.js +1 -1
  32. package/cypress/e2e/ILC/VideoResponse/videoResponseAdditionalSettingsBasic.js +11 -12
  33. package/cypress/e2e/ILC/VideoResponse/videoResponsePreviewTab.js +6 -5
  34. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
1
  import abortEarlySetup from "../../../support/helpers/abortEarly";
2
2
  import { uploadResponsePage } from "../../../pages";
3
+ import utilities from "../../../support/helpers/utilities";
3
4
  const css = Cypress.env('css');
4
5
 
5
6
  describe('Create question page - Upload Response: Additional Settings', () => {
@@ -16,14 +17,16 @@ describe('Create question page - Upload Response: Additional Settings', () => {
16
17
  uploadResponsePage.tests.verifyAdditonalSettingsAccordionProperties();
17
18
 
18
19
  it('\'File settings and layout\' label should be displayed', () => {
19
- uploadResponsePage.fileSettingsAndLayoutLabel()
20
- .verifyInnerText('File settings and layout')
21
- .and('be.visible');
20
+ utilities.verifyInnerText(uploadResponsePage.fileSettingsAndLayoutLabel(), 'File settings and layout');
21
+ utilities.verifyElementVisibilityState(uploadResponsePage.fileSettingsAndLayoutLabel(), 'visible');
22
22
  });
23
23
 
24
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);
25
+ utilities.verifyCSS(uploadResponsePage.fileSettingsAndLayoutLabel(), {
26
+ 'color': css.color.sectionHeading,
27
+ 'font-size': css.fontSize.default,
28
+ 'font-weight': css.fontWeight.semibold
29
+ });
27
30
  });
28
31
 
29
32
  it('Accessibility of \'File settings and layout\' section', { tags: 'a11y' }, () => {
@@ -41,21 +44,19 @@ describe('Create question page - Upload Response: Additional Settings', () => {
41
44
  });
42
45
 
43
46
  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');
47
+ utilities.verifyInnerText(uploadResponsePage.allowStudentsToCapturePhotosLabel(), 'Allow students to capture photos');
48
+ uploadResponsePage.steps.verifyCapturePhotosCheckboxIsCheckedAndVisible();
50
49
  });
51
50
 
52
51
  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);
52
+ utilities.verifyCSS(uploadResponsePage.allowStudentsToCapturePhotosLabel(), {
53
+ 'color': css.color.labelText,
54
+ 'font-size': css.fontSize.normal,
55
+ 'font-weight': css.fontWeight.regular
56
+ });
57
+ utilities.verifyCSS(uploadResponsePage.allowStudentsToCapturePhotosCheckbox().parent().find('svg'), {
58
+ 'color': css.color.activeButtons
59
+ });
59
60
  });
60
61
 
61
62
  it('Accessibility of \'Allow students to capture photos\' section - checked state', { tags: 'a11y' }, () => {
@@ -64,37 +65,32 @@ describe('Create question page - Upload Response: Additional Settings', () => {
64
65
 
65
66
  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
67
  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');
68
+ utilities.verifyElementVisibilityState(uploadResponsePage.uploadCloudIcon(), 'visible');
69
+ utilities.verifyInnerText(uploadResponsePage.dragAndDropFilesText(), 'Drag & Drop files here');
70
+ uploadResponsePage.steps.verifyTextInUploadResponseArea('or browse files on your device, Google Drive or capture an image')
73
71
  });
74
72
 
75
73
  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
74
  cy.log('Switching to Edit tab.');
77
75
  uploadResponsePage.steps.switchToEditTab();
78
- uploadResponsePage.allowStudentsToCapturePhotosCheckbox()
79
- .click()
80
- .should('not.be.checked');
76
+ uploadResponsePage.steps.uncheckCapturePhotosCheckbox();
81
77
  cy.log('Switching to Preview tab.');
82
78
  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 ');
79
+ utilities.verifyInnerText(uploadResponsePage.dragAndDropFilesText(), 'Drag & Drop files here');
80
+ uploadResponsePage.steps.verifyTextInUploadResponseArea('or browse files on your device or Google Drive ')
87
81
  });
88
82
 
89
83
  it('CSS of \'Allow students to capture photos\' section - unchecked state', { tags: 'css' }, () => {
90
84
  cy.log('Pre-step: Switching back to Edit tab.');
91
85
  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);
86
+ utilities.verifyCSS(uploadResponsePage.allowStudentsToCapturePhotosLabel(), {
87
+ 'color': css.color.labelText,
88
+ 'font-size': css.fontSize.normal,
89
+ 'font-weight': css.fontWeight.regular
90
+ });
91
+ utilities.verifyCSS(uploadResponsePage.allowStudentsToCapturePhotosCheckbox().parent().find('svg'), {
92
+ 'fill': css.color.uncheckedCheckbox
93
+ });
98
94
  uploadResponsePage.steps.switchToPreviewTab();
99
95
  });
100
96
 
@@ -108,17 +104,13 @@ describe('Create question page - Upload Response: Additional Settings', () => {
108
104
  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
105
  cy.log('Pre-step: Switching back to Edit tab.');
110
106
  uploadResponsePage.steps.switchToEditTab();
111
- uploadResponsePage.allowStudentsToCapturePhotosCheckbox()
112
- .click()
113
- .should('be.checked');
107
+ uploadResponsePage.steps.checkCapturePhotosCheckbox();
114
108
  cy.log('Switching to Preview tab.');
115
109
  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');
110
+ utilities.verifyInnerText(uploadResponsePage.dragAndDropFilesText(), 'Drag & Drop files here');
111
+ utilities.verifyElementVisibilityState(uploadResponsePage.dragAndDropFilesText(), 'visible');
112
+ uploadResponsePage.steps.verifyTextInUploadResponseArea('or browse files on your device, Google Drive or capture an image');
113
+ utilities.verifyElementVisibilityState(uploadResponsePage.fileUploadOptionsLabel(), 'visible');
122
114
  });
123
115
  });
124
116
 
@@ -131,9 +123,9 @@ describe('Create question page - Upload Response: Additional Settings', () => {
131
123
  uploadResponsePage.steps.expandAdditonalSettings();
132
124
  });
133
125
 
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' };
126
+ const fontsizes = ['Tiny', 'Small', 'Default', 'Normal', 'Big', 'Huge'];
127
+ const font = ['12px', '14px', '16px', '18px', '22px', '26px'];
128
+ const questionInstructionsTextFontSizes = { 'Tiny': '12px', 'Small': '14px','Default': '16px', 'Normal': '18px', 'Big': '22px', 'Huge': '26px' };
137
129
  const dragAndDropFilesTextFontSizes = { 'Default': '24px', 'Small': '18px', 'Normal': '21px', 'Large': '25.5px', 'Extra large': '30px', 'Huge': '36px' };
138
130
  const fileUploadOptionsLabelFontSizes = { 'Default': '18px', 'Small': '13.5px', 'Normal': '15.75px', 'Large': '19.125px', 'Extra large': '22.5px', 'Huge': '27px' };
139
131
  const supportedFileFormatLabelFontSizes = { 'Default': '14px', 'Small': '10.5px', 'Normal': '12.25px', 'Large': '14.875px', 'Extra large': '17.5px', 'Huge': '21px' };
@@ -143,28 +135,30 @@ describe('Create question page - Upload Response: Additional Settings', () => {
143
135
 
144
136
  fontsizes.forEach((option, count) => {
145
137
  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}`);
138
+ uploadResponsePage.steps.selectFontSizeOptionFromFontSizeDropdown(count);
139
+ utilities.verifyInnerText(uploadResponsePage.fontSizeDropdown(), `${option}`);
152
140
  cy.log('Switching to Preview tab.');
153
141
  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]);
142
+ utilities.verifyCSS(uploadResponsePage.questionInstructionsText(), {
143
+ 'font-size': questionInstructionsTextFontSizes[option]
144
+ });
145
+ utilities.verifyCSS(uploadResponsePage.dragAndDropFilesText(), {
146
+ 'font-size': dragAndDropFilesTextFontSizes[option]
147
+ });
148
+ utilities.verifyCSS(uploadResponsePage.fileUploadOptionsLabel(), {
149
+ 'font-size': fileUploadOptionsLabelFontSizes[option]
150
+ });
151
+ utilities.verifyCSS(uploadResponsePage.supportedFileFormatLabel(), {
152
+ 'font-size': supportedFileFormatLabelFontSizes[option]
153
+ });
154
+ utilities.verifyCSS(uploadResponsePage.uploadedFileCount(), {
155
+ 'font-size': uploadedFileCountFontSizes[option]
156
+ });
164
157
  cy.log('Uploading file to check font-size of the file name.')
165
158
  uploadResponsePage.steps.fileUploadAndVerify(['sample.zip']);
166
- uploadResponsePage.uploadedFileLink()
167
- .should('have.css', 'font-size', font[0]);
159
+ utilities.verifyCSS(uploadResponsePage.uploadedFileLink(), {
160
+ 'font-size': font[0]
161
+ });
168
162
  cy.log('Post step: switching to edit tab to select another font size option')
169
163
  uploadResponsePage.steps.switchToEditTab();
170
164
  });
@@ -1,10 +1,10 @@
1
1
  import abortEarlySetup from "../../../support/helpers/abortEarly";
2
2
  import { uploadResponsePage } from "../../../pages";
3
3
  import { commonComponents } from "../../../pages/components";
4
+ import utilities from "../../../support/helpers/utilities";
4
5
  const css = Cypress.env('css');
5
6
 
6
7
  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
8
 
9
9
  describe('Create question page - Upload Response: Question Instructions, Supported file types, Max Files dropdown', () => {
10
10
  before(() => {
@@ -40,27 +40,28 @@ describe('Create question page - Upload Response: Question Instructions, Support
40
40
  });
41
41
 
42
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');
43
+ utilities.verifyInnerText(uploadResponsePage.supportedFileTypesAccordion(), 'Supported file types');
44
+ uploadResponsePage.steps.verifySupportedFilesTypesAccordionCollapsedState();
45
+ utilities.verifyInnerText(uploadResponsePage.selectedFileTypeCount(), '(13 selected)');
46
+ utilities.verifyElementVisibilityState(uploadResponsePage.selectedFileTypeCount(), 'visible');
50
47
  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');
48
+ uploadResponsePage.steps.clickOnSupportedFilesTypesAccordion();
49
+ uploadResponsePage.steps.verifySupportedFilesTypesAccordionExpandedState();
50
+ uploadResponsePage.steps.clickOnSupportedFilesTypesAccordion();
51
+ uploadResponsePage.steps.verifySupportedFilesTypesAccordionCollapsedState();
57
52
  });
58
53
 
59
54
  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);
55
+ utilities.verifyCSS(uploadResponsePage.supportedFileTypesAccordion(), {
56
+ 'color': css.color.accordionLabel,
57
+ 'font-size': css.fontSize.default,
58
+ 'font-weight': css.fontWeight.bold
59
+ });
60
+ utilities.verifyCSS(uploadResponsePage.selectedFileTypeCount(), {
61
+ 'color': css.color.labels,
62
+ 'font-size': css.fontSize.normal,
63
+ 'font-weight': css.fontWeight.regular
64
+ });
64
65
  });
65
66
 
66
67
  it('Accessibility of Supported file types section', { tags: 'a11y' }, () => {
@@ -70,33 +71,23 @@ describe('Create question page - Upload Response: Question Instructions, Support
70
71
 
71
72
  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
73
  cy.log('Pre-step: Expanding supported file types accordion');
73
- uploadResponsePage.supportedFileTypesAccordionWrapper()
74
- .click();
74
+ uploadResponsePage.steps.clickOnSupportedFilesTypesAccordion();
75
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
- });
76
+ utilities.verifyInnerText(uploadResponsePage.supportedFileTypesCheckboxLabel(count), fileType);
77
+ utilities.verifyElementVisibilityState(uploadResponsePage.supportedFileTypesCheckboxLabel(count), 'visible');
90
78
  });
79
+ uploadResponsePage.steps.verifyDefaultSelectedFileTypes();
91
80
  });
92
81
 
93
82
  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);
83
+ utilities.verifyCSS(uploadResponsePage.supportedFileTypesCheckboxWrapper(4).find('svg g g'), {
84
+ 'fill': css.color.activeButtons
85
+ });
86
+ utilities.verifyCSS(uploadResponsePage.supportedFileTypesCheckboxWrapper(0).find('.MuiFormControlLabel-label'), {
87
+ 'color': css.color.labelText,
88
+ 'font-size': css.fontSize.normal,
89
+ 'font-weight': css.fontWeight.regular
90
+ });
100
91
  });
101
92
 
102
93
  it('Accessibility of supported files accordion contents in expanded state', { tags: 'a11y' }, () => {
@@ -105,37 +96,16 @@ describe('Create question page - Upload Response: Question Instructions, Support
105
96
 
106
97
  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
98
  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');
99
+ uploadResponsePage.steps.uncheckDefaultSelectedFileTypes();
100
+ utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: Please select a file type.');
101
+ utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'visible');
119
102
  });
120
103
 
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
- });
104
+ uploadResponsePage.tests.verifyCSSAnda11yOfErrorMessage();
125
105
 
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');
106
+ it('When the user re-selects any file type from the \'Supported file types\' accordion menu, then the validation text \'Error: Please select a file type\' should disappear', () => {
107
+ uploadResponsePage.steps.checkSupportedFileTypeCheckbox(0);
108
+ utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'notExist');
139
109
  });
140
110
  });
141
111
 
@@ -149,14 +119,23 @@ describe('Create question page - Upload Response: Question Instructions, Support
149
119
 
150
120
  it('CSS of Max Files dropdown in default state', { tags: 'css' }, () => {
151
121
  cy.log('Max files label')
152
- uploadResponsePage.maxFilesLabel()
153
- .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
122
+ utilities.verifyCSS(uploadResponsePage.maxFilesLabel(), {
123
+ 'color': css.color.labels,
124
+ 'font-size': css.fontSize.normal,
125
+ 'font-weight': css.fontWeight.semibold
126
+ });
154
127
  cy.log('default state of max file dropdown, default selected list option and chevron icon')
128
+ utilities.verifyCSS(uploadResponsePage.maxFilesDropdown(), {
129
+ 'background-color': css.color.secondaryBtnBg,
130
+ 'border': `1px solid ${css.color.defaultDropdownBorder}`
131
+ });
132
+ utilities.verifyCSS(uploadResponsePage.maxFilesDropdown().find('.dropdown-label-text'), {
133
+ 'color': css.color.liText,
134
+ 'font-size': css.fontSize.default,
135
+ 'font-weight': css.fontWeight.regular
136
+ });
155
137
  uploadResponsePage.maxFilesDropdown()
156
- .should('have.css', 'background-color', css.color.secondaryBtnBg)
157
- .and('have.css', 'border', `1px solid ${css.color.defaultDropdownBorder}`)
158
138
  .find('.dropdown-label-text')
159
- .verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular)
160
139
  .verifyPseudoClassBeforeProperty('color', css.color.secondaryBtn);
161
140
  });
162
141
 
@@ -166,33 +145,34 @@ describe('Create question page - Upload Response: Question Instructions, Support
166
145
  });
167
146
 
168
147
  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');
148
+ utilities.verifyInnerText(uploadResponsePage.maxFilesLabel(), 'Maximum number of files');
149
+ utilities.verifyElementVisibilityState(uploadResponsePage.maxFilesLabel(), 'visible');
150
+ utilities.verifyInnerText(uploadResponsePage.maxFilesDropdown(), '15');
151
+ utilities.verifyElementVisibilityState(uploadResponsePage.maxFilesDropdown(), 'visible');
175
152
  });
176
153
 
177
154
  it('Clicking on Max files dropdown should open a list of options from 1 to 15', () => {
178
155
  cy.log('Opening the max files dropdown list');
179
- uploadResponsePage.maxFilesDropdown()
180
- .click();
156
+ uploadResponsePage.steps.expandMaxFilesDropdown();
181
157
  for (let maxFilesIndex = 1; maxFilesIndex < 16; maxFilesIndex++) {
182
- uploadResponsePage.maxFilesDropdownListOptions(maxFilesIndex - 1)
183
- .should('have.text', maxFilesIndex);
158
+ utilities.verifyInnerText(uploadResponsePage.maxFilesDropdownListOptions(maxFilesIndex - 1), `${maxFilesIndex}`)
184
159
  };
185
160
  });
186
161
 
187
162
  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);
163
+ utilities.verifyCSS(uploadResponsePage.maxFilesDropdown(), {
164
+ 'background-color': css.color.secondaryBtnBg,
165
+ 'border': `1px solid ${css.color.secondaryBtnActive}`
166
+ });
167
+ utilities.verifyCSS(uploadResponsePage.maxFilesDropdownListOptions(13), {
168
+ 'background-color': css.color.transparent
169
+ });
170
+ utilities.verifyCSS(uploadResponsePage.maxFilesDropdownListOptions(14), {
171
+ 'color': css.color.liText,
172
+ 'font-size': css.fontSize.default,
173
+ 'font-weight': css.fontWeight.regular,
174
+ 'background-color': css.color.liTextSelectedBg
175
+ });
196
176
  });
197
177
 
198
178
  it('Accessibility of Max files dropdown and dropdown content in active state', { tags: 'a11y' }, () => {
@@ -201,26 +181,25 @@ describe('Create question page - Upload Response: Question Instructions, Support
201
181
  });
202
182
 
203
183
  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();
184
+ uploadResponsePage.steps.selectOptionFromMaxFilesDropdown(14);
206
185
  cy.log(`Switching to preview tab and uploading 15 files`);
207
186
  uploadResponsePage.steps.switchToPreviewTab();
208
187
  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');
188
+ utilities.verifyInnerText(uploadResponsePage.uploadedFileCount(), '15/15 File Limit');
211
189
  });
212
190
 
213
191
  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
192
  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.');
193
+ uploadResponsePage.steps.uploadFile('uploads/sample.jpg')
194
+ utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: You have reached the maximum number of files that can be uploaded.');
219
195
  });
220
196
 
221
197
  it('CSS of \'File limit error\' message', { tags: 'css' }, () => {
222
- commonComponents.errorMessage()
223
- .verifyCSS(css.color.errorText, css.fontSize.small, css.fontWeight.regular);
198
+ utilities.verifyCSS(commonComponents.errorMessage(), {
199
+ 'color': css.color.errorText,
200
+ 'font-size': css.fontSize.small,
201
+ 'font-weight': css.fontWeight.regular
202
+ });
224
203
  });
225
204
 
226
205
  it('Accessibility of \'File limit error\' message', { tags: 'a11y' }, () => {
@@ -232,17 +211,13 @@ describe('Create question page - Upload Response: Question Instructions, Support
232
211
  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
212
  cy.log('Pre-step: Switching to Edit Tab, opening max files dropdown and selecting 1 as Max File Limit.');
234
213
  uploadResponsePage.steps.switchToEditTab();
235
- uploadResponsePage.maxFilesDropdown()
236
- .click();
237
- uploadResponsePage.maxFilesDropdownListOptions(0)
238
- .click();
214
+ uploadResponsePage.steps.expandMaxFilesDropdown();
215
+ uploadResponsePage.steps.selectOptionFromMaxFilesDropdown(0);
239
216
  cy.log('Switching to preview tab')
240
217
  uploadResponsePage.steps.switchToPreviewTab();
241
218
  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.');
219
+ uploadResponsePage.steps.uploadFile('uploads/sample1.jpg')
220
+ utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: You have reached the maximum number of files that can be uploaded.');
246
221
  });
247
222
 
248
223
  uploadResponsePage.tests.verifyErrorMessageDisappear();
@@ -1,6 +1,6 @@
1
1
  import abortEarlySetup from "../../../support/helpers/abortEarly";
2
2
  import { uploadResponsePage, dialogBoxBase } from "../../../pages";
3
- import { commonComponents } from "../../../pages/components";
3
+ import utilities from "../../../support/helpers/utilities";
4
4
 
5
5
  describe('Create question page - Upload Response: Header section and Saving question', () => {
6
6
  before(() => {
@@ -45,28 +45,14 @@ describe('Create question page - Upload Response: Header section and Saving ques
45
45
  dialogBoxBase.tests.verifyRequiredFieldsWarningPopupOnClickingSaveButton();
46
46
 
47
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.');
48
+ uploadResponsePage.steps.verifyQuestionInstructionsErrorMessage();
49
+ utilities.verifyInnerText(uploadResponsePage.pleaseEnterPointsErrorMessage(), 'Error: Please enter points.');
57
50
  });
58
51
 
59
52
  it('Validation error messages should disappear when required input fields are filled', () => {
60
53
  uploadResponsePage.steps.addQuestionInstructions();
61
- uploadResponsePage.questionInstructionsLabelEditTab()
62
- .parents('.edit-question-instruction-wrapper')
63
- .within(() => {
64
- commonComponents.errorMessage()
65
- .should('not.exist');
66
- });
67
54
  uploadResponsePage.steps.allotPoints(20);
68
- uploadResponsePage.pleaseEnterPointsErrorMessage()
69
- .should('not.exist');
55
+ uploadResponsePage.steps.verifyErrorMessageIsNotDisplayed();
70
56
  });
71
57
  });
72
58