itemengine-cypress-automation 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. package/.build_wna +4 -0
  2. package/README.md +3 -0
  3. package/currents.config.js +6 -0
  4. package/cypress/API/createItem/toggleItemMode.js +15 -0
  5. package/cypress/config-files/ildev.json +15 -0
  6. package/cypress/config-files/ilprod.json +15 -0
  7. package/cypress/config-files/ilqa.json +15 -0
  8. package/cypress/config-files/ilstage.json +15 -0
  9. package/cypress/e2e/ILC/sorry-cypress-test/spec1.js +18 -0
  10. package/cypress/e2e/ILC/sorry-cypress-test/spec2.js +18 -0
  11. package/cypress/e2e/ILC/sorry-cypress-test/spec3.js +18 -0
  12. package/cypress/fixtures/accessibilityConfig.json +6 -0
  13. package/cypress/fixtures/constants.js +18 -0
  14. package/cypress/fixtures/equationEditorCategoriesAndSymbols .js +2271 -0
  15. package/cypress/fixtures/specialAndMathCharacters.js +118 -0
  16. package/cypress/fixtures/theme/ilc.json +150 -0
  17. package/cypress/fixtures/theme/ngie.json +26 -0
  18. package/cypress/fixtures/uploads/20mbFile.png +0 -0
  19. package/cypress/fixtures/uploads/80mbFile.pdf +0 -0
  20. package/cypress/fixtures/uploads/highlightImage.jpg +0 -0
  21. package/cypress/fixtures/uploads/image.png +0 -0
  22. package/cypress/fixtures/uploads/sample.aac +0 -0
  23. package/cypress/fixtures/uploads/sample.accdb +0 -0
  24. package/cypress/fixtures/uploads/sample.csv +100 -0
  25. package/cypress/fixtures/uploads/sample.doc +0 -0
  26. package/cypress/fixtures/uploads/sample.gif +0 -0
  27. package/cypress/fixtures/uploads/sample.heic +0 -0
  28. package/cypress/fixtures/uploads/sample.heif +0 -0
  29. package/cypress/fixtures/uploads/sample.hevc +0 -0
  30. package/cypress/fixtures/uploads/sample.jpeg +0 -0
  31. package/cypress/fixtures/uploads/sample.jpg +0 -0
  32. package/cypress/fixtures/uploads/sample.mp3 +0 -0
  33. package/cypress/fixtures/uploads/sample.mp4 +0 -0
  34. package/cypress/fixtures/uploads/sample.pdf +0 -0
  35. package/cypress/fixtures/uploads/sample.ppt +0 -0
  36. package/cypress/fixtures/uploads/sample.pub +0 -0
  37. package/cypress/fixtures/uploads/sample.rtf +7902 -0
  38. package/cypress/fixtures/uploads/sample.svg +10 -0
  39. package/cypress/fixtures/uploads/sample.txt +1 -0
  40. package/cypress/fixtures/uploads/sample.wav +0 -0
  41. package/cypress/fixtures/uploads/sample.xlsx +0 -0
  42. package/cypress/fixtures/uploads/sample.xps +0 -0
  43. package/cypress/fixtures/uploads/sample.zip +0 -0
  44. package/cypress/fixtures/uploads/sample1.jpg +0 -0
  45. package/cypress/fixtures/uploads/sample1.mp3 +0 -0
  46. package/cypress/fixtures/uploads/sample1.zip +0 -0
  47. package/cypress/fixtures/uploads/sample10Sec.mp3 +0 -0
  48. package/cypress/fixtures/uploads/sample2.jpg +0 -0
  49. package/cypress/fixtures/uploads/sample2.mp3 +0 -0
  50. package/cypress/fixtures/uploads/sampleVirus.zip +0 -0
  51. package/cypress/pages/audioPlayerPage.js +628 -0
  52. package/cypress/pages/audioResponsePage.js +264 -0
  53. package/cypress/pages/components/additionalSettingsPanel.js +174 -0
  54. package/cypress/pages/components/answerNumerationComponent.js +109 -0
  55. package/cypress/pages/components/autoScoredAdditionalSettings.js +183 -0
  56. package/cypress/pages/components/autoScoredPreviewBase.js +94 -0
  57. package/cypress/pages/components/autoScoredScoringSection.js +195 -0
  58. package/cypress/pages/components/autoScoredScoringSectionMultipleResponsesType.js +268 -0
  59. package/cypress/pages/components/autoScoredSetCorrectAnswerSection.js +291 -0
  60. package/cypress/pages/components/ckEditorToolbar.js +64 -0
  61. package/cypress/pages/components/colorPopupComponent.js +293 -0
  62. package/cypress/pages/components/commonComponents.js +93 -0
  63. package/cypress/pages/components/componentsFlowChart/figFlowChart.png +0 -0
  64. package/cypress/pages/components/createCustomCategoryFlyout.js +138 -0
  65. package/cypress/pages/components/createQuestionBasePage.js +225 -0
  66. package/cypress/pages/components/customizeHighlightPropertiesComponent.js +318 -0
  67. package/cypress/pages/components/dragAndDropResponseOptions.js +738 -0
  68. package/cypress/pages/components/dragAndDropSetCorrectAnswerCheckboxComponents.js +124 -0
  69. package/cypress/pages/components/draggableOptionsContainer.js +857 -0
  70. package/cypress/pages/components/editCategoryFlyout.js +40 -0
  71. package/cypress/pages/components/equationEditorFlyout.js +158 -0
  72. package/cypress/pages/components/essayResponseCommonComponents.js +86 -0
  73. package/cypress/pages/components/figOverImageCommonComponent.js +924 -0
  74. package/cypress/pages/components/fillInTheGapsCommonComponents.js +687 -0
  75. package/cypress/pages/components/fillInTheGapsDropdownCommonComponent.js +442 -0
  76. package/cypress/pages/components/fillInTheGapsTextCommonComponent.js +884 -0
  77. package/cypress/pages/components/gridCommonComponents.js +951 -0
  78. package/cypress/pages/components/index.js +38 -0
  79. package/cypress/pages/components/listSortingAndOrderingBase.js +401 -0
  80. package/cypress/pages/components/maximumRecorderLengthComponent.js +116 -0
  81. package/cypress/pages/components/mcqAdditionalSettingsBase.js +390 -0
  82. package/cypress/pages/components/mcqOptionsComponent.js +263 -0
  83. package/cypress/pages/components/mcqPreviewComponents.js +78 -0
  84. package/cypress/pages/components/mcqQuestionCommonComponents.js +265 -0
  85. package/cypress/pages/components/mcqScoringComponent.js +120 -0
  86. package/cypress/pages/components/mcqSetCorrectAnswerSection.js +143 -0
  87. package/cypress/pages/components/optionsWrapperComponent.js +221 -0
  88. package/cypress/pages/components/playbackControlsBaseComponent.js +163 -0
  89. package/cypress/pages/components/previewScoringAndShowCorrectAnswerComponent.js +90 -0
  90. package/cypress/pages/components/questionInstructionsComponent.js +112 -0
  91. package/cypress/pages/components/scoringSectionBase.js +308 -0
  92. package/cypress/pages/components/setPointsPopupBase.js +79 -0
  93. package/cypress/pages/components/specialAndCustomSpecialCharactersComponent.js +79 -0
  94. package/cypress/pages/components/specialCharactersFlyoutComponent.js +58 -0
  95. package/cypress/pages/components/studentResponseAreaAndLayoutComponent.js +28 -0
  96. package/cypress/pages/components/uploadImageSectionComponent.js +594 -0
  97. package/cypress/pages/createItemPage.js +28 -0
  98. package/cypress/pages/dialogBoxBase.js +111 -0
  99. package/cypress/pages/dragAndDropIntoCategoriesAllOrNothingScoring.js +1161 -0
  100. package/cypress/pages/dragAndDropIntoCategoriesCellsScoring.js +1559 -0
  101. package/cypress/pages/dragAndDropIntoCategoriesPage.js +1556 -0
  102. package/cypress/pages/dragAndDropIntoCategoriesResponseScoring.js +1396 -0
  103. package/cypress/pages/essayResponseBasicPage.js +57 -0
  104. package/cypress/pages/essayResponseMathPage.js +47 -0
  105. package/cypress/pages/essayResponsePage.js +385 -0
  106. package/cypress/pages/feedbackScalePage.js +698 -0
  107. package/cypress/pages/fillInTheGapsDragAndDropPage.js +742 -0
  108. package/cypress/pages/fillInTheGapsDropdownPage.js +99 -0
  109. package/cypress/pages/fillInTheGapsOverImageDropdownPage.js +232 -0
  110. package/cypress/pages/fillInTheGapsOverImageTextPage.js +135 -0
  111. package/cypress/pages/fillInTheGapsScoring.js +5974 -0
  112. package/cypress/pages/fillInTheGapsSetCorrectAnswerSection.js +260 -0
  113. package/cypress/pages/fillInTheGapsTextPage.js +225 -0
  114. package/cypress/pages/highlightImagePage.js +1316 -0
  115. package/cypress/pages/highlightPage.js +870 -0
  116. package/cypress/pages/index.js +30 -0
  117. package/cypress/pages/listMatchingPage.js +1330 -0
  118. package/cypress/pages/listMatchingScoring.js +2635 -0
  119. package/cypress/pages/listOrderingPage.js +751 -0
  120. package/cypress/pages/listSortingPage.js +1201 -0
  121. package/cypress/pages/multipleSelectionGridPage.js +359 -0
  122. package/cypress/pages/multipleSelectionPage.js +88 -0
  123. package/cypress/pages/passagePage.js +426 -0
  124. package/cypress/pages/readingRulerPage.js +302 -0
  125. package/cypress/pages/selectQuestionResourceToolPage.js +64 -0
  126. package/cypress/pages/shortTextResponsePage.js +197 -0
  127. package/cypress/pages/singleSelectionGridPage.js +370 -0
  128. package/cypress/pages/singleSelectionPage.js +65 -0
  129. package/cypress/pages/uploadResponsePage.js +110 -0
  130. package/cypress/pages/videoResponsePage.js +375 -0
  131. package/cypress/support/commands.js +140 -0
  132. package/cypress/support/e2e.js +14 -0
  133. package/cypress/support/helpers/abortEarly.js +19 -0
  134. package/cypress/support/helpers/accessibility.js +34 -0
  135. package/cypress/support/helpers/cypressUtilities.js +64 -0
  136. package/cypress/support/helpers/localStorage.js +13 -0
  137. package/cypress/support/helpers/selectText.js +77 -0
  138. package/cypress/support/helpers/utilities.js +126 -0
  139. package/cypress.config.js +76 -0
  140. package/il.yaml +14 -0
  141. package/language +1 -0
  142. package/package.json +26 -0
@@ -0,0 +1,293 @@
1
+ import utilities from "../../support/helpers/utilities";
2
+ const css = Cypress.env('css');
3
+
4
+ const selectors = {
5
+ colorBlock: () => cy.get('.color-picker-block'),
6
+ colorSaturationPalette: () => cy.get('.react-colorful__saturation'),
7
+ colorSaturationPicker: () => cy.get('.react-colorful__saturation-pointer .react-colorful__pointer-fill'),
8
+ colorHuePalette: () => cy.get('.react-colorful__hue'),
9
+ colorHuePicker: () => cy.get('.react-colorful__hue-pointer .react-colorful__pointer-fill'),
10
+ selectedColorLabel: () => cy.get('[class*="ColorPickerstyles__SelectedColorWrapper"]'),
11
+ selectedColorBlock: () => cy.get('.color-wrapper'),
12
+ hexLabel: () => cy.get('.hex-settings-wrapper .inline-text-property-label'),
13
+ hexInputField: () => cy.get('.hex-settings-wrapper input'),
14
+ opacityLabel: () => cy.get('[class*="ColorPickerstyles__SliderWrapper"]'),
15
+ opacitySlider: () => cy.get('[class*="ColorPickerstyles__SliderWrapper"] .color-slider'),
16
+ opacityInputField: () => cy.get('.opacity-wrapper [aria-label="Opacity"]'),
17
+ recommendedColorsLabel: () => cy.get('.color-picker-footer-wrapper'),
18
+ recommendedColorBlock: () => cy.get('[class*="ColorPickerstyles__ColorBlockWrapper"] .color-picker-block'),
19
+ recommendedColorBlockSelectedIcon: () => cy.get('.selected-button-icon'),
20
+ recommendedColorBlockLabel: () => cy.get('[class*="ColorPickerstyles__ColorLabel"]'),
21
+ cancelButton: () => cy.get('.compact-popup-action-button-wrapper button').eq(0),
22
+ okButton: () => cy.get('.compact-popup-action-button-wrapper button').eq(1),
23
+ dialogBox: () => cy.get('[aria-describedby="alert-dialog-description"]'),
24
+ dialogBoxTitle: () => cy.get('#alert-dialog-title')
25
+ }
26
+
27
+ const steps = {
28
+ /**
29
+ * @param {string} color on the saturation palette in rgb format
30
+ * @description this function is used to verify color on the saturation palette
31
+ */
32
+ verifySaturationPaletteColor: (color) => {
33
+ utilities.verifyCSS(colorPopupComponent.colorSaturationPicker(), {
34
+ 'background-color': color
35
+ });
36
+ },
37
+
38
+ /**
39
+ * @param {string} color on the hue palette in rgb format
40
+ * @description this function is used to verify color on the hue palette
41
+ */
42
+ verifyHuePaletteColor: (color) => {
43
+ utilities.verifyCSS(colorPopupComponent.colorHuePicker(), {
44
+ 'background-color': color
45
+ });
46
+ },
47
+
48
+ /**
49
+ * @param {string} hexValue value of the color in hex code format
50
+ * @description this function is used to verify the hex code value in the hex input field of the color popup
51
+ */
52
+ verifyHexValue: (hexValue) => {
53
+ colorPopupComponent.hexInputField()
54
+ .should('have.value', hexValue)
55
+ },
56
+
57
+ /**
58
+ * @param {string} color in the selected color block in rgb/rgba format
59
+ * @description this function is used to verify in the selected color block of the color popup
60
+ */
61
+ verifySelectedColorBlock: (color) => {
62
+ utilities.verifyCSS(colorPopupComponent.selectedColorBlock(), {
63
+ 'background-color': color
64
+ });
65
+ },
66
+
67
+ /**
68
+ * @param {string} opacityValue value of opacity of the selected color
69
+ * @description this function is used to verify the opacity value in the opacity input field
70
+ */
71
+ verifyOpacityInputFieldValue: (opacityValue) => {
72
+ colorPopupComponent.opacityInputField()
73
+ .should('have.value', opacityValue)
74
+ },
75
+
76
+ /**
77
+ * @param {string} opacityValue value of opacity of the selected color on the opacity slider
78
+ * @description this function is used to verify the opacity value on the opacity slider
79
+ */
80
+ verifyOpacitySliderValue: (opacityValue) => {
81
+ colorPopupComponent.opacitySlider()
82
+ .find('input')
83
+ .should('have.value', opacityValue)
84
+ },
85
+
86
+ clickOnColorBlock: (optionAccordionIndex) => {
87
+ colorPopupComponent.colorBlock()
88
+ .eq(optionAccordionIndex)
89
+ .click();
90
+ },
91
+
92
+ clickInColorSaturationPalette: () => {
93
+ colorPopupComponent.colorSaturationPalette()
94
+ .click();
95
+ },
96
+
97
+ clickInColorHuePalette: () => {
98
+ colorPopupComponent.colorHuePalette()
99
+ .click();
100
+ },
101
+
102
+ addInputToHexInputField: (value) => {
103
+ colorPopupComponent.hexInputField()
104
+ .clear()
105
+ .type(value, { delay: 0 })
106
+ },
107
+
108
+ clickOnOpacitySlider: () => {
109
+ colorPopupComponent.opacitySlider()
110
+ .click();
111
+ },
112
+
113
+ /**
114
+ * @param {number} blockIndex index of the color block in the recommended colors section
115
+ * @description this function is used to select a recommended color block
116
+ */
117
+ selectRecommendedColorBlock: (blockIndex) => {
118
+ colorPopupComponent.recommendedColorBlock()
119
+ .eq(blockIndex)
120
+ .click();
121
+ },
122
+
123
+ /**
124
+ * @param {string} value to be entered in the opacity input field
125
+ * @description this function is used to add input to the opacity input field
126
+ */
127
+ addInputToOpacityInputField: (value) => {
128
+ colorPopupComponent.opacityInputField()
129
+ .clear()
130
+ .type(value, { delay: 0 })
131
+ },
132
+
133
+ clickOnCancelButton: () => {
134
+ colorPopupComponent.cancelButton()
135
+ .click();
136
+ },
137
+
138
+ clickOnOkButton: () => {
139
+ colorPopupComponent.okButton()
140
+ .click();
141
+ },
142
+
143
+ /**
144
+ * @param {number} optionAccordionIndex index of the option accordion
145
+ * @param {string} color to be verified present on the color block of an option accordion in rgb format
146
+ * @description this function is used to verify the color of the color block in an option accordion
147
+ */
148
+ verifyColorBlockInOptionAccordion: (optionAccordionIndex, color) => {
149
+ utilities.verifyCSS(colorPopupComponent.colorBlock().eq(optionAccordionIndex), {
150
+ 'background-color': color
151
+ });
152
+ },
153
+
154
+ verifyColorPopupIsDisplayed: () => {
155
+ utilities.verifyElementVisibilityState(colorPopupComponent.dialogBox(), 'visible');
156
+ },
157
+
158
+ verifyColorPopupSelectColorTitle: () => {
159
+ utilities.verifyInnerText(colorPopupComponent.dialogBoxTitle(), 'Select color');
160
+ utilities.verifyElementVisibilityState(colorPopupComponent.dialogBoxTitle(), 'visible');
161
+ },
162
+
163
+ verifyColorSaturationPaletteAndPicker: () => {
164
+ utilities.verifyElementVisibilityState(colorPopupComponent.colorSaturationPalette(), 'visible');
165
+ utilities.verifyElementVisibilityState(colorPopupComponent.colorSaturationPicker(), 'visible');
166
+ },
167
+
168
+ verifyColorHuePaletteAndPicker: () => {
169
+ utilities.verifyElementVisibilityState(colorPopupComponent.colorHuePalette(), 'visible');
170
+ utilities.verifyElementVisibilityState(colorPopupComponent.colorHuePicker(), 'visible');
171
+ },
172
+
173
+ verifySelectedColorLabelAndSelectedColorBlock: () => {
174
+ utilities.verifyInnerText(colorPopupComponent.selectedColorLabel(), 'Selected color');
175
+ utilities.verifyElementVisibilityState(colorPopupComponent.selectedColorLabel(), 'visible');
176
+ utilities.verifyElementVisibilityState(colorPopupComponent.selectedColorBlock(), 'visible');
177
+ },
178
+
179
+ verifyHexLabelAndInputField: () => {
180
+ utilities.verifyInnerText(colorPopupComponent.hexLabel(), 'Hex');
181
+ utilities.verifyElementVisibilityState(colorPopupComponent.hexLabel(), 'visible');
182
+ utilities.verifyElementVisibilityState(colorPopupComponent.hexInputField(), 'visible');
183
+ },
184
+
185
+ verifyOpacityLabelSliderAndInputField: () => {
186
+ utilities.verifyInnerText(colorPopupComponent.opacityLabel(), 'Opacity');
187
+ utilities.verifyElementVisibilityState(colorPopupComponent.opacityLabel(), 'visible');
188
+ utilities.verifyElementVisibilityState(colorPopupComponent.opacitySlider(), 'visible');
189
+ utilities.verifyElementVisibilityState(colorPopupComponent.opacityInputField(), 'visible');
190
+ },
191
+
192
+ verifyRecommendedColorsLabel: () => {
193
+ colorPopupComponent.recommendedColorsLabel()
194
+ .should('contain', 'Recommended colors');
195
+ },
196
+
197
+ verifyRecommendedColorBlocksLabel: () => {
198
+ const recommendedColors = ['Red', 'Yellow', 'Green', 'Black'];
199
+ const colorValues = ['rgb(229, 76, 25)', 'rgb(255, 240, 25)', 'rgb(9, 179, 33)', 'rgb(0, 0, 0)'];
200
+ utilities.verifyElementCount(colorPopupComponent.recommendedColorBlock(), 4);
201
+ recommendedColors.forEach((color, blockIndex) => {
202
+ colorPopupComponent.steps.verifyRecommendedColorBlock(blockIndex, color, colorValues[blockIndex]);
203
+ });
204
+ },
205
+
206
+ verifyColorPopupCancelButton: () => {
207
+ utilities.verifyInnerText(colorPopupComponent.cancelButton(), 'Cancel');
208
+ utilities.verifyElementVisibilityState(colorPopupComponent.cancelButton(), 'visible');
209
+ },
210
+
211
+ verifyColorPopupOkButton: () => {
212
+ utilities.verifyInnerText(colorPopupComponent.okButton(), 'Ok');
213
+ utilities.verifyElementVisibilityState(colorPopupComponent.okButton(), 'visible');
214
+ },
215
+
216
+ /**
217
+ * @param {number} blockIndex index of the color block in the recommended colors section
218
+ * @param {string} colorLabel label of the recommended color block
219
+ * @param {string} color recommended color in rgb format
220
+ * @description this function verifies the label and color of the recommended color block
221
+ */
222
+ verifyRecommendedColorBlock: (blockIndex, colorLabel, color) => {
223
+ utilities.verifyCSS(colorPopupComponent.recommendedColorBlock().eq(blockIndex), {
224
+ 'background-color': color
225
+ });
226
+ utilities.verifyInnerText(colorPopupComponent.recommendedColorBlockLabel().eq(blockIndex), colorLabel);
227
+ },
228
+
229
+ /**
230
+ * @param {number} blockIndex index of the color block in the recommended colors section
231
+ * @description this function verifies the selected state of a recommended color block
232
+ */
233
+ verifyRecommendedColorBlockSelectedState: (blockIndex) => {
234
+ colorPopupComponent.recommendedColorBlock()
235
+ .eq(blockIndex)
236
+ .within(() => {
237
+ utilities.verifyElementVisibilityState(colorPopupComponent.recommendedColorBlockSelectedIcon(), 'visible');
238
+ });
239
+ }
240
+ }
241
+
242
+ const tests = {
243
+ verifyCSSAnda11yOfColourPopupContents: () => {
244
+ it('CSS of color popup contents', { tags: 'css' }, () => {
245
+ const labels = [colorPopupComponent.selectedColorLabel, colorPopupComponent.hexLabel, colorPopupComponent.opacityLabel, colorPopupComponent.recommendedColorsLabel]
246
+ const inputFields = [colorPopupComponent.hexInputField, colorPopupComponent.opacityInputField];
247
+ labels.forEach(label => {
248
+ utilities.verifyCSS(label(), {
249
+ 'color': css.color.labels,
250
+ 'font-size': css.fontSize.normal,
251
+ 'font-weight': css.fontWeight.semibold
252
+
253
+ });
254
+ });
255
+ inputFields.forEach(inputField => {
256
+ utilities.verifyCSS(inputField(), {
257
+ 'color': css.color.text,
258
+ 'font-size': css.fontSize.default,
259
+ 'font-weight': css.fontWeight.regular
260
+
261
+ });
262
+ });
263
+ utilities.verifyCSS(colorPopupComponent.recommendedColorBlockLabel(), {
264
+ 'color': css.color.labelText,
265
+ 'font-size': css.fontSize.normal,
266
+ 'font-weight': css.fontWeight.regular
267
+ });
268
+ utilities.verifyCSS(colorPopupComponent.okButton(), {
269
+ 'color': css.color.text,
270
+ 'font-size': css.fontSize.default,
271
+ 'font-weight': css.fontWeight.regular,
272
+ 'background-color': css.color.successBtnBg
273
+ });
274
+ utilities.verifyCSS(colorPopupComponent.cancelButton(), {
275
+ 'color': css.color.secondaryBtn,
276
+ 'font-size': css.fontSize.default,
277
+ 'font-weight': css.fontWeight.regular,
278
+ 'background-color': css.color.secondaryBtnBg
279
+ });
280
+ });
281
+
282
+ //Failing due to https://redmine.zeuslearning.com/issues/539391
283
+ it('Accessibility of color popup contents', { tags: 'a11y' }, () => {
284
+ cy.checkAccessibility(colorPopupComponent.dialogBox());
285
+ });
286
+ }
287
+ }
288
+
289
+ export const colorPopupComponent = {
290
+ ...selectors,
291
+ steps,
292
+ tests
293
+ }
@@ -0,0 +1,93 @@
1
+ import utilities from "../../support/helpers/utilities";
2
+
3
+ const css = Cypress.env('css');
4
+
5
+ const selectors = {
6
+ previewTabQuestionWrapper: () => cy.get('.edit-question-preview-wrapper'),
7
+ tooltipText: () => cy.get('.MuiTooltip-tooltip'),
8
+ snackbar: () => cy.get('.MuiSnackbarContent-message'),
9
+ snackbarCloseButton: () => cy.get('.MuiSnackbarContent-action'),
10
+ errorMessage: () => cy.get('.error-text-message'),
11
+ nextGenCreateItemWrapper: () => cy.get('#nextgen-assess-create-item'),
12
+ dropdownList: () => cy.get('.dropdown-list'),
13
+ dragHandleButton: () => cy.get('.dragicon-button'),
14
+ deleteButton: () => cy.get('button[aria-label*="Delete option"]'),
15
+ tickIconForOptionButtons: () => cy.get('.ngie-toggle-button-tick-icon')
16
+ }
17
+
18
+ const steps = {
19
+ //Note: The functions below need to be used henceforth
20
+ verifyDeleteButtonDisabled: () => {
21
+ commonComponents.deleteButton()
22
+ .should('be.disabled');
23
+ },
24
+
25
+ verifyDeleteButtonEnabled: () => {
26
+ commonComponents.deleteButton()
27
+ .should('be.enabled');
28
+ },
29
+
30
+ verifyErrorMessageIsNotDisplayed: () => {
31
+ commonComponents.errorMessage()
32
+ .should('not.exist');
33
+ },
34
+
35
+ //V3 - Need to update in all files
36
+ verifyDragHandleButtonTooltip: () => {
37
+ commonComponents.dragHandleButton()
38
+ .eq(0)
39
+ .verifyTooltip('Drag to reorder');
40
+ },
41
+
42
+ //V3 - Need to update in all files
43
+ verifyDeleteButtonTooltip: () => {
44
+ commonComponents.deleteButton()
45
+ .eq(0)
46
+ .verifyTooltip('Delete option');
47
+ },
48
+
49
+ //V3 - Need to update in all files
50
+ verifyDisabledDeleteButtonTooltip: () => {
51
+ commonComponents.deleteButton()
52
+ .eq(0)
53
+ .trigger('mouseover', { force: true })
54
+ commonComponents.tooltipText()
55
+ .should('have.text', 'Minimum two options are required');
56
+ commonComponents.deleteButton()
57
+ .eq(0)
58
+ .trigger('mouseout', { force: true });
59
+ commonComponents.tooltipText()
60
+ .should('not.exist');
61
+ },
62
+
63
+ closeSnackBar: () => {
64
+ commonComponents.snackbarCloseButton()
65
+ .click();
66
+ utilities.verifyElementVisibilityState(commonComponents.snackbar(), 'notExist');
67
+ }
68
+ }
69
+
70
+ const tests = {
71
+ verifya11yOfCreateItemWrapperContents: () => {
72
+ it('Accessibility of create item wrapper contents', { tags: 'a11y' }, () => {
73
+ cy.checkAccessibility(commonComponents.nextGenCreateItemWrapper())
74
+ });
75
+ },
76
+
77
+ verifyCSSAnda11yOfErrorMessage: () => {
78
+ it('CSS of error message', { tags: 'css' }, () => {
79
+ commonComponents.errorMessage()
80
+ .verifyCSS(css.color.errorText, css.fontSize.small, css.fontWeight.regular);
81
+ });
82
+
83
+ it('Accessibility of error message', { tags: 'a11y' }, () => {
84
+ cy.checkAccessibility(commonComponents.errorMessage());
85
+ });
86
+ }
87
+ }
88
+
89
+ export const commonComponents = {
90
+ ...selectors,
91
+ steps,
92
+ tests
93
+ }
@@ -0,0 +1,138 @@
1
+ import { equationEditorCategoriesAndSymbols } from "../../fixtures/equationEditorCategoriesAndSymbols ";
2
+ import { dialogBoxBase } from "../dialogBoxBase";
3
+ import { essayResponsePage } from "../essayResponsePage";
4
+
5
+ const selectors = {
6
+ ...dialogBoxBase,
7
+ createCustomCategoryFlyoutTitle: () => cy.get('.custom-category-popup-header'),
8
+ categoryNameLabel: () => cy.get('.custom-category-flyout-content .input-label').eq(0),
9
+ categoryIconLabel: () => cy.get('.custom-category-flyout-content .input-label').eq(1),
10
+ selectedSymbolsLabel: () => cy.get('.custom-category-flyout-content .input-label').eq(2),
11
+ selectSymbolsToDisplayLabel: () => cy.get('.custom-category-flyout-content .input-label').eq(3),
12
+ categoryNameInputField: () => cy.get('.input-field-custom-category input').eq(0),
13
+ categoryIconInputField: () => cy.get('.input-field-custom-category input').eq(1),
14
+ selectedSymbols: () => cy.get('.EqEditorPopup .drag-item-flex-parent-wrapper'),
15
+ selectedSymbolsWrapper: () => cy.get('.EqEditorPopup.essay-response-grid-wrapper'),
16
+ categoryAccordions: () => cy.get('.accordian-structure-equation-editor .MuiExpansionPanelSummary-root'),
17
+ categoryAccordionIcon: () => cy.get('[class*="expandIcon"]'),
18
+ categoryAccordionCheckbox: () => cy.get('.accordian-checkbox [type="checkbox"]'),
19
+ categoryAccordionLabel: () => cy.get('.accordian-label'),
20
+ buttonSave: () => cy.get('.action-btn-wrapper button').eq(0),
21
+ buttonCancel: () => cy.get('.action-btn-wrapper button').eq(1),
22
+ cateogoryCharacters: (ariaLabel = null) => {
23
+ if (ariaLabel) {
24
+ return cy.get(`.icon-button-custom-format[aria-label="${ariaLabel}"]`)
25
+ } else {
26
+ return cy.get('.icon-button-custom-format')
27
+ }
28
+ },
29
+ selectedCharacterDragIcon: () => cy.get('.drag-icon-button-custom-format')
30
+ }
31
+
32
+ const steps = {
33
+ createCustomCategoryWithMultipleCategoryCharacters: () => {
34
+ cy.log('Creating a custom category by selecting \'Keypad\' category, partially selecting \'Basic\' and \'Greek\' categories')
35
+ essayResponsePage.createCustomCategoryButton()
36
+ .click();
37
+ createCustomCategoryFlyout.categoryAccordions()
38
+ .contains(`${equationEditorCategoriesAndSymbols['keypad'].displayName}`)
39
+ .parents('.accordian-structure-equation-editor')
40
+ .within(() => {
41
+ createCustomCategoryFlyout.categoryAccordionCheckbox()
42
+ .click();
43
+ });
44
+ createCustomCategoryFlyout.categoryAccordions()
45
+ .contains(`${equationEditorCategoriesAndSymbols['basic'].displayName}`)
46
+ .parents('.accordian-structure-equation-editor')
47
+ .within(() => {
48
+ createCustomCategoryFlyout.categoryAccordionCheckbox()
49
+ .should('have.attr', 'data-indeterminate', 'true');
50
+ });
51
+ createCustomCategoryFlyout.categoryAccordions()
52
+ .contains(`${equationEditorCategoriesAndSymbols['greek'].displayName}`)
53
+ .click()
54
+ .parents('.accordian-structure-equation-editor')
55
+ .within(() => {
56
+ createCustomCategoryFlyout.cateogoryCharacters(equationEditorCategoriesAndSymbols.greek.symbols.gamma.ariaLabel)
57
+ .click();
58
+ createCustomCategoryFlyout.cateogoryCharacters(equationEditorCategoriesAndSymbols.greek.symbols.delta.ariaLabel)
59
+ .click();
60
+ });
61
+ createCustomCategoryFlyout.categoryNameInputField()
62
+ .type('Custom category with name.');
63
+ createCustomCategoryFlyout.buttonSave()
64
+ .click();
65
+ createCustomCategoryFlyout.dialogBox()
66
+ .should('not.exist');
67
+ },
68
+
69
+ createCustomCategory: () => {
70
+ cy.log('Creating a category by selecting \'Arrows\' category')
71
+ essayResponsePage.createCustomCategoryButton()
72
+ .click();
73
+ createCustomCategoryFlyout.categoryAccordions()
74
+ .contains(`${equationEditorCategoriesAndSymbols['arrows'].displayName}`)
75
+ .parents('.accordian-structure-equation-editor')
76
+ .within(() => {
77
+ createCustomCategoryFlyout.categoryAccordionCheckbox()
78
+ .click();
79
+ });
80
+ createCustomCategoryFlyout.categoryNameInputField()
81
+ .type('Custom category with name and icon.');
82
+ createCustomCategoryFlyout.categoryIconInputField()
83
+ .type('#');
84
+ createCustomCategoryFlyout.buttonSave()
85
+ .click();
86
+ }
87
+ }
88
+
89
+ const tests = {
90
+ verifyCustomCategoryFlyoutContents: (categoryName) => {
91
+ it(`On clicking the ${equationEditorCategoriesAndSymbols[categoryName].displayName} category accordion the category should be expanded`, () => {
92
+ createCustomCategoryFlyout.categoryAccordionLabel()
93
+ .contains(`${equationEditorCategoriesAndSymbols[categoryName].displayName}`, { matchCase: false })
94
+ .click()
95
+ .parents('.accordian-structure-equation-editor')
96
+ .within(() => {
97
+ createCustomCategoryFlyout.categoryAccordionIcon()
98
+ .should('have.class', 'Mui-expanded');
99
+ });
100
+ });
101
+
102
+ it(`The ${equationEditorCategoriesAndSymbols[categoryName].displayName} category accordian should display all the ${equationEditorCategoriesAndSymbols[categoryName].displayName} category Symbols. By default, all the symbols should be deselected`, () => {
103
+ const symbolsArray = Object.values(equationEditorCategoriesAndSymbols[categoryName].symbols)
104
+ createCustomCategoryFlyout.categoryAccordions()
105
+ .contains(`${equationEditorCategoriesAndSymbols[categoryName].displayName}`, { matchCase: false })
106
+ .parents('.accordian-structure-equation-editor')
107
+ .within(() => {
108
+ createCustomCategoryFlyout.cateogoryCharacters()
109
+ .should('not.have.class', 'Mui-selected')
110
+ .each(($el, index) => {
111
+ cy.wrap($el)
112
+ .invoke('attr', 'aria-label')
113
+ .then((ariaLabel) => {
114
+ const expectedValue = symbolsArray[index].ariaLabel;
115
+ expect(ariaLabel.trim().toLowerCase()).to.equal(expectedValue.toLowerCase());
116
+ if (symbolsArray[index].textElement) {
117
+ cy.wrap($el)
118
+ .verifyInnerText(symbolsArray[index].textElement)
119
+ }
120
+ });
121
+ });
122
+ });
123
+ });
124
+
125
+ it(`On clicking the expanded ${equationEditorCategoriesAndSymbols[categoryName].displayName} category accordion the category should collapse`, () => {
126
+ createCustomCategoryFlyout.categoryAccordions()
127
+ .contains(`${equationEditorCategoriesAndSymbols[categoryName].displayName}`, { matchCase: false })
128
+ .click()
129
+ .should('not.have.class', 'Mui-expanded');
130
+ });
131
+ }
132
+ }
133
+
134
+ export const createCustomCategoryFlyout = {
135
+ ...selectors,
136
+ steps,
137
+ tests
138
+ }