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,1316 @@
1
+ import utilities from "../support/helpers/utilities";
2
+ import { dialogBoxBase } from "./dialogBoxBase";
3
+ import { createQuestionBasePage, questionInstructionsComponent, commonComponents, autoScoredScoringSection, scoringSectionBase, previewScoringAndShowCorrectAnswerComponent, additionalSettingsPanel, autoScoredAdditionalSettings, autoScoredPreviewBase, autoScoredSetCorrectAnswerSection, autoScoredScoringSectionMultipleResponsesType, answerNumerationComponent } from "./components"
4
+ import { customizeHighlightPropertiesComponent } from './components/customizeHighlightPropertiesComponent'
5
+
6
+ const css = Cypress.env('css');
7
+ let imageWidth = 500;
8
+ let imageHeight = 500;
9
+
10
+ const selectors = {
11
+ ...commonComponents,
12
+ ...autoScoredPreviewBase,
13
+ ...previewScoringAndShowCorrectAnswerComponent,
14
+ ...autoScoredScoringSectionMultipleResponsesType,
15
+ ...scoringSectionBase,
16
+ ...autoScoredSetCorrectAnswerSection,
17
+ ...autoScoredAdditionalSettings,
18
+ ...dialogBoxBase,
19
+ ...answerNumerationComponent,
20
+ ...additionalSettingsPanel,
21
+ ...questionInstructionsComponent,
22
+ ...customizeHighlightPropertiesComponent,
23
+ highlightImageLabel: () => cy.get('[class*="HighlightImageLabel"]'),
24
+ selectTool: () => cy.get('.drawing-tool__button-select'),
25
+ penTool: () => cy.get('.drawing-tool__button-polygon'),
26
+ undoTool: () => cy.get('.drawing-tool__button-undo'),
27
+ redoTool: () => cy.get('.drawing-tool__button-redo'),
28
+ itemEraserTool: () => cy.get('.drawing-tool__button-itemEraser'),
29
+ clearAllTool: () => cy.get('.drawing-tool__button-clearAll'),
30
+ highlightCount: () => cy.get('[class*="HighlightImagestyles__HighlightCountWrapper"]'),
31
+ tooltipText: () => cy.get('[class*="Tooltipstyles__TooltipContent"]:visible'),
32
+ highlightImageSectionWrapper: () => cy.get('.highlight-image-drawing-tool .drawing-tool__wrapper'),
33
+ widthLabel: () => cy.get('.width-alternative-text-wrapper .highlight-image-property-label'),
34
+ widthInputField: () => cy.get('.highlight-image-input-field input'),
35
+ imageAlternativeTextLabel: () => cy.get('.image-alternative-text-wrapper .inline-text-property-label'),
36
+ imageAlternativeTextInputField: () => cy.get('.inline-text-question-prefix-wrapper input'),
37
+ highlighImageCanvasWrapper: () => cy.get('.drawing-tool__wrapper .drawing-tool__canvas'),
38
+ highlighImageCanvas: () => cy.get('.drawing-tool__wrapper .upper-canvas'),
39
+ setCorrectAnswerSectionHighlight: () => cy.get('[class*="HighlightImageControlstyles__ShapeWrapper"] a'),
40
+ setCorrectAnswerSectionHighlightActivePattern: () => cy.get('[class*="HighlightImageControlstyles__ShapeWrapper"] a [class*="HighlightImageControlstyles__DiamondPattern-"]'),
41
+ setCorrectAnswerSectionHighlightFillColor: () => cy.get('[class*="HighlightImageControlstyles__ShapeWrapper"] a [class*="HighlightImageControlstyles__DiamondPatternWrapper"]'),
42
+ setCorrectAnswerSectionHighlightPolygon: () => cy.get('[class*="HighlightImageControlstyles__PolygonWrapper"]'),
43
+ highlightNumeration: () => cy.get('[class*="styles__TextWrapper"]'),
44
+ setCorrectAnswerSectionImage: () => cy.get('.highlight-svg-responseive image'),
45
+ previewTabHighlight: () => cy.get('.edit-question-preview-wrapper [class*="HighlightImageControlstyles__ShapeWrapper"] a'),
46
+ previewTabHighlightActivePattern: () => cy.get('.edit-question-preview-wrapper [class*="HighlightImageControlstyles__ShapeWrapper"] a [class*="HighlightImageControlstyles__DiamondPattern-"]'),
47
+ previewTabHighlightFillColor: () => cy.get('.edit-question-preview-wrapper [class*="HighlightImageControlstyles__ShapeWrapper"] a [class*="HighlightImageControlstyles__DiamondPatternWrapper"]'),
48
+ previewTabHighlightPolygon: () => cy.get('.edit-question-preview-wrapper [class*="HighlightImageControlstyles__PolygonWrapper"]'),
49
+ multipleSelectionCheckboxLabel: () => cy.get('[data-ngie-testid="multiple-selection-checkbox"] .MuiFormControlLabel-label'),
50
+ multipleSelectionCheckbox: () => cy.get('[data-ngie-testid="multiple-selection-checkbox"] input'),
51
+ hideHighlightsCheckboxLabel: () => cy.get('[data-ngie-testid="hide-highlights-checkbox"] .MuiFormControlLabel-label'),
52
+ hideHighlightsCheckbox: () => cy.get('[data-ngie-testid="hide-highlights-checkbox"] input'),
53
+ //Customize highlight property panel
54
+ customizeHighlightPropertiesPanel: () => cy.get('.customize-highlight-properties-wrapper .ngie-accordion-summary'),
55
+ customizeHighlightPropertiesLabel: () => cy.get('.customize-highlight-properties-label'),
56
+ customizeHighlightPropertiesTab: () => cy.get('.customize-highlight-properties-wrapper .ngie-tablist-box-wrapper button'),
57
+ highlightColorLabel: () => cy.get('[class*=CustomizeHighlightPropertiesstyles__HighlightColorWrapper]'),
58
+ labelTitle: () => cy.get('[class*="CustomizeHighlightPropertiesstyles__LabelWrapper"]'),
59
+ ariaLabelInputFieldLabel: () => cy.get('.aria-label-wrapper .text-label'),
60
+ ariaLabelInputField: () => cy.get('.aria-label-wrapper input'),
61
+ optionLabelInputFieldLabel: () => cy.get('[class*=CustomizeHighlightPropertiesstyles__OptionLabelWrapper] .text-label'),
62
+ optionLabelInputField: () => cy.get('[class*=CustomizeHighlightPropertiesstyles__OptionLabelWrapper] input'),
63
+ resetToGlobalColorButton: () => cy.get('.reset-color-wrapper button'),
64
+ //Correct answer container
65
+ correctAnswerContainerLabel: () => cy.get('.edit-question-preview-wrapper [class*="CorrectAnswerLabel"]'),
66
+ correctAnswerContainerAnswerWrapper: () => cy.get('[class*="ItemWrapperDiv"]'),
67
+ correctAnswerNumeration: () => cy.get('[class*="NumerationWrapper"]'),
68
+ correctIncorrectAnswerBorder: () => cy.get('.edit-question-preview-wrapper .highlight-svg-responseive'),
69
+ checkmarkCrossmarkIcon: () => cy.get('g[id*="Rectangle"]'),
70
+ //Scoring
71
+ pointsPerResponseLabel: () => cy.get('.alternate-points-points-per-text-span'),
72
+ partialEqualWeightsPointsPerResponseScore: () => cy.get('.alternate-points-points-per-value-span'),
73
+ partialDifferentWeightsPointsOptionsLabel: () => cy.get('.highlight-image-partial-points-per-response-form-control-wrapper .points-label'),
74
+ studentResponseAreaAndLayoutLabel: () => cy.get('.highlight-image-wrapper [role="heading"]').eq(0),
75
+ canvasMaximumWidthLabel: () => cy.get('.canvas-max-width-wrapper .additional-settings-label'),
76
+ canvasMaximumWidthInputField: () => cy.get('.canvas-max-width-wrapper input'),
77
+ //Preview tab
78
+ previewTabImage: () => cy.get('.edit-question-preview-wrapper .highlight-svg-responseive image')
79
+ }
80
+
81
+ const steps = {
82
+ ...createQuestionBasePage.steps,
83
+ ...questionInstructionsComponent.steps,
84
+ ...scoringSectionBase.steps,
85
+ ...previewScoringAndShowCorrectAnswerComponent.steps,
86
+ ...additionalSettingsPanel.steps,
87
+ ...autoScoredAdditionalSettings.steps,
88
+ ...autoScoredPreviewBase.steps,
89
+ ...autoScoredSetCorrectAnswerSection.steps,
90
+ ...autoScoredScoringSectionMultipleResponsesType.steps,
91
+ ...autoScoredScoringSection.steps,
92
+ ...dialogBoxBase.steps,
93
+ ...commonComponents.steps,
94
+ ...answerNumerationComponent.steps,
95
+ ...customizeHighlightPropertiesComponent.steps,
96
+ verifyImageUploadedInHighlightRegion: () => {
97
+ highlightImagePage.highlighImageCanvasWrapper()
98
+ .should('be.visible')
99
+ .and('have.css', 'background-image');
100
+ highlightImagePage.highlighImageCanvasWrapper()
101
+ .should('have.css', 'background-size')
102
+ .and('eq', '100% 100%');
103
+ highlightImagePage.highlighImageCanvas()
104
+ .should('be.visible')
105
+ .should('have.css', 'cursor');
106
+ },
107
+
108
+ /**
109
+ * @param {number} imageWidth width of highlight image wrapper
110
+ * @description this function verifies the width of highlight image wrapper
111
+ */
112
+ verifyImageWidthInHighlightImageSection: (imageWidth) => {
113
+ highlightImagePage.highlighImageCanvasWrapper()
114
+ .should('be.visible')
115
+ .and('have.css', 'width', `${imageWidth}px`)
116
+ },
117
+
118
+ verifyImageUploadedInSetCorrectAnswerSection: () => {
119
+ utilities.verifyElementVisibilityState(highlightImagePage.setCorrectAnswerSectionImage(), 'visible')
120
+ },
121
+
122
+ /**
123
+ * @param {number} index of highlighted region
124
+ * @param {number[]} hotspotCoordsInPercentage co-ordinates of the highlighted image in set correct answer section
125
+ * @description this function verifies the co-ordinates of region highlighted in set correct answer section
126
+ */
127
+ verifyHighlightRegionsInSetCorrectAnswerSection: (index, hotspotCoordsInPercentage) => {
128
+ let flattenedArr = hotspotCoordsInPercentage.flat();
129
+ highlightImagePage.setCorrectAnswerSectionHighlightPolygon()
130
+ .eq(index)
131
+ .then(($element) => {
132
+ const pointsValue = $element.attr('points');
133
+ const pointsArray = pointsValue.split(',');
134
+ let wholeNumbersArray = pointsArray.map((point) => {
135
+ return Math.floor(Number(point))
136
+ });
137
+ wholeNumbersArray.forEach((actualPointsValue, index) => {
138
+ const expectedPointsValue = flattenedArr[index] * imageWidth / 100;
139
+ cy.wrap(actualPointsValue).should('be.closeTo', expectedPointsValue, 2);
140
+ });
141
+ });
142
+ highlightImagePage.setCorrectAnswerSectionHighlight()
143
+ .eq(index)
144
+ .within(() => {
145
+ highlightImagePage.highlightNumeration()
146
+ .should('have.text', index + 1);
147
+ });
148
+ },
149
+
150
+ /**
151
+ * @param {number[]} arrayOfPoints co-ordinates of the region to be highlighted
152
+ * @description this function draws the region to be highlighted
153
+ */
154
+ highlightRegionInImage: (arrayOfPoints) => {
155
+ highlightImagePage.steps.clickOnPenTool();
156
+ highlightImagePage.highlighImageCanvas()
157
+ .then(($element) => {
158
+ const clientWidth = $element[0].clientWidth;
159
+ arrayOfPoints.forEach((coordinates) => {
160
+ highlightImagePage.highlighImageCanvas()
161
+ .click(coordinates[0] * clientWidth / 100, coordinates[1] * clientWidth / 100);
162
+ });
163
+ highlightImagePage.highlighImageCanvas()
164
+ .click(arrayOfPoints[0][0] * clientWidth / 100, arrayOfPoints[0][1] * clientWidth / 100);
165
+ highlightImagePage.highlighImageCanvas()
166
+ .click(arrayOfPoints[0][0] * clientWidth / 100, arrayOfPoints[0][1] * clientWidth / 100);
167
+ });
168
+ },
169
+
170
+ /**
171
+ * @param {number} index of highlighted region
172
+ * @param {number[]} hotspotCoordsInPercentage co-ordinates of the highlighted image in preview tab
173
+ * @description this function verifies the co-ordinates of region highlighted in preview tab
174
+ */
175
+ verifyHighlightRegionsInPreviewTab: (index, hotspotCoordsInPercentage) => {
176
+ let flattenedArr = hotspotCoordsInPercentage.flat();
177
+ highlightImagePage.previewTabHighlightPolygon()
178
+ .eq(index)
179
+ .then(($element) => {
180
+ const pointsValue = $element.attr('points');
181
+ const pointsArray = pointsValue.split(',');
182
+ let wholeNumbersArray = pointsArray.map((point) => {
183
+ return Math.floor(Number(point))
184
+ });
185
+ wholeNumbersArray.forEach((actualValue, index) => {
186
+ const targetValue = flattenedArr[index] * imageWidth / 100;
187
+ cy.wrap(actualValue).should('be.closeTo', targetValue, 2);
188
+ });
189
+ });
190
+ },
191
+
192
+ /**
193
+ * @param {number} index of region to be highlighted in set correct answer section
194
+ * @description this function verifies if the region is highlighted
195
+ */
196
+ verifySelectedHighlightRegionInSetCorrectAnswerSection: (index) => {
197
+ highlightImagePage.setCorrectAnswerSectionHighlight()
198
+ .eq(index)
199
+ .should('have.attr', 'aria-checked', 'true');
200
+ },
201
+
202
+ verifySelectedStateOfPenTool: () => {
203
+ highlightImagePage.penTool()
204
+ .should('have.class', 'drawing-tool__button--active');
205
+ },
206
+
207
+ verifyUnselectedStateOfSelectTool: () => {
208
+ highlightImagePage.selectTool()
209
+ .should('not.have.class', 'drawing-tool__button--active');
210
+ },
211
+
212
+ verifyUnselectedStateOfUndoTool: () => {
213
+ highlightImagePage.undoTool()
214
+ .should('not.have.class', 'drawing-tool__button--active');
215
+ },
216
+
217
+ verifyUnselectedStateOfRedoTool: () => {
218
+ highlightImagePage.redoTool()
219
+ .should('not.have.class', 'drawing-tool__button--active');
220
+ },
221
+
222
+ verifyUnselectedStateOfItemEraserTool: () => {
223
+ highlightImagePage.itemEraserTool()
224
+ .should('not.have.class', 'drawing-tool__button--active');
225
+ },
226
+
227
+ verifySelectedStateOfItemEraserTool: () => {
228
+ highlightImagePage.itemEraserTool()
229
+ .should('have.class', 'drawing-tool__button--active');
230
+ },
231
+
232
+ verifyUnselectedStateOfClearAllTool: () => {
233
+ highlightImagePage.clearAllTool()
234
+ .should('not.have.class', 'drawing-tool__button--active');
235
+ },
236
+
237
+ /**
238
+ * @description verify the highlight count
239
+ * @param {number} count shows the count of highlight
240
+ */
241
+ verifyHighlightCountInHighlightImageSection: (count) => {
242
+ highlightImagePage.highlightCount()
243
+ .verifyInnerText(`Highlight count: ${count}`)
244
+ },
245
+
246
+ //TODO: Need to update script after https://redmine.zeuslearning.com/issues/518498 is resolved
247
+ /**
248
+ * @description verify the tooltip text
249
+ * @param {tool selector} button cy.get selector
250
+ * @param {string} tooltipText shows the tooltip text
251
+ */
252
+ verifyTooltip: (tool, tooltipText) => {
253
+ tool
254
+ .trigger('mouseover')
255
+ highlightImagePage.tooltipText()
256
+ .and('be.visible')
257
+ .should('have.text', tooltipText)
258
+ tool
259
+ .trigger('mouseout')
260
+ highlightImagePage.tooltipText()
261
+ .should('not.exist')
262
+ },
263
+
264
+ /**
265
+ * @param {number} imageWidth width of the image
266
+ * @description this function enters and verifies width input field value
267
+ */
268
+ addInputToEditTabWidthInputField: (imageWidth) => {
269
+ highlightImagePage.widthInputField()
270
+ .clear()
271
+ .type(imageWidth);
272
+ steps.verifyEditTabWidthInputFieldValue(imageWidth);
273
+ },
274
+
275
+ /**
276
+ * @param {number} imageWidth width of the image
277
+ * @description this function verifies width input field value
278
+ */
279
+ verifyEditTabWidthInputFieldValue: (imageWidth) => {
280
+ highlightImagePage.widthInputField()
281
+ .should('have.value', imageWidth);
282
+ },
283
+
284
+ /**
285
+ * @param {number} index of highlight region
286
+ * @description this function verifies the numeration displayed for highlight regions
287
+ */
288
+ verifyHighlightNumerationSetCorrectAnswer: (index) => {
289
+ highlightImagePage.setCorrectAnswerSectionHighlight()
290
+ .eq(index)
291
+ .within(() => {
292
+ utilities.verifyTextContent(highlightImagePage.highlightNumeration(), index + 1);
293
+ });
294
+ },
295
+
296
+ /**
297
+ * @param {string} imageAlternativeText alternate input field
298
+ * @description this function enters and verifies text present in image alternative text input
299
+ */
300
+ addInputToImageAlternativeTextInputField: (imageAlternativeText) => {
301
+ highlightImagePage.imageAlternativeTextInputField()
302
+ .clear()
303
+ .type(imageAlternativeText);
304
+ steps.verifyImageAlternativeTextInputField(imageAlternativeText);
305
+ },
306
+
307
+ clearImageAlternativeTextInputField: () => {
308
+ highlightImagePage.imageAlternativeTextInputField()
309
+ .clear();
310
+ steps.verifyImageAlternativeTextInputField('');
311
+ },
312
+
313
+ /**
314
+ * @param {string} imageAlternativeText alternate input field
315
+ * @description this function verifies text present in image alternative text input
316
+ */
317
+ verifyImageAlternativeTextInputField: (imageAlternativeText) => {
318
+ highlightImagePage.imageAlternativeTextInputField()
319
+ .should('have.value', imageAlternativeText);
320
+ },
321
+
322
+ /**
323
+ * @param {number} index of region to be highlighted in set correct answer section
324
+ * @description this function verifies if the region is highlighted
325
+ */
326
+ verifySelectedHighlightRegionInPreviewTab: (index) => {
327
+ highlightImagePage.previewTabHighlight()
328
+ .eq(index)
329
+ .should('have.attr', 'aria-checked', 'true');
330
+ },
331
+
332
+ /**
333
+ * @param {number} index of highlight region
334
+ * @description this functions highlights a region in set correct answer section
335
+ */
336
+ highlightARegionInSetCorrectAnswerSection: (index) => {
337
+ highlightImagePage.setCorrectAnswerSectionHighlightPolygon()
338
+ .eq(index)
339
+ .click();
340
+ steps.verifySelectedHighlightRegionInSetCorrectAnswerSection(index);
341
+ },
342
+
343
+ /**
344
+ * @param {number} index of highlight region
345
+ * @description this functions highlights a region in set correct answer section
346
+ */
347
+ removeHighlightOfARegionInSetCorrectAnswerSection: (index) => {
348
+ highlightImagePage.setCorrectAnswerSectionHighlightPolygon()
349
+ .eq(index)
350
+ .click();
351
+ steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(index);
352
+ },
353
+
354
+ /**
355
+ * @param {number} index of highlight region
356
+ * @description this functions highlights a region in preview tab
357
+ */
358
+ highlightARegionInPreviewTab: (index) => {
359
+ highlightImagePage.previewTabHighlightPolygon()
360
+ .eq(index)
361
+ .click();
362
+ steps.verifySelectedHighlightRegionInPreviewTab(index);
363
+ },
364
+
365
+ /**
366
+ * @param {number} index of highlight region
367
+ * @description this functions highlights a region in set correct answer section
368
+ */
369
+ removeHighlightOfARegionInPreviewTab: (index) => {
370
+ highlightImagePage.previewTabHighlightPolygon()
371
+ .eq(index)
372
+ .click();
373
+ steps.verifyRegionIsNotHighlighted(index)
374
+ },
375
+
376
+ /**
377
+ * @param {number} index of highlight region
378
+ * @description this function verifies if aa highlight region is not selected
379
+ */
380
+ verifyRegionIsNotHighlighted: (index) => {
381
+ highlightImagePage.previewTabHighlight()
382
+ .eq(index)
383
+ .should('have.attr', 'aria-checked', 'false');
384
+ },
385
+
386
+ /**
387
+ * @param {number} index of highlight region
388
+ * @description this function verifies if a highlight region is not selected
389
+ */
390
+ verifyRegionIsNotHighlightedInSetCorrectAnswerSection: (index) => {
391
+ highlightImagePage.setCorrectAnswerSectionHighlight()
392
+ .eq(index)
393
+ .should('have.attr', 'aria-checked', 'false');
394
+ },
395
+
396
+ checkMultipleSelectionCheckbox: () => {
397
+ highlightImagePage.multipleSelectionCheckbox()
398
+ .click()
399
+ .should('be.checked');
400
+ },
401
+
402
+ uncheckMultipleSelectionCheckbox: () => {
403
+ highlightImagePage.multipleSelectionCheckbox()
404
+ .click()
405
+ .should('not.be.checked');
406
+ },
407
+
408
+ //Scoring
409
+ /**
410
+ * @param {*} index of highlight region
411
+ * @description this function verifies the highlight region is correct
412
+ */
413
+ verifyCorrectHighlightRegion: (index) => {
414
+ utilities.verifyCSS(highlightImagePage.previewTabHighlightPolygon().eq(index), {
415
+ 'fill': css.color.correctAnswerHighlightRegion,
416
+ 'stroke': css.color.correctAnswer
417
+ });
418
+ highlightImagePage.previewTabHighlight()
419
+ .eq(index)
420
+ .within(() => {
421
+ utilities.verifyCSS(highlightImagePage.checkmarkCrossmarkIcon(), {
422
+ 'fill': css.color.correctAnswer
423
+ });
424
+ });
425
+ },
426
+
427
+ /**
428
+ * @param {*} index of highlight region
429
+ * @description this function verifies the highlight region is incorrect
430
+ */
431
+ verifyIncorrectHighlightRegion: (index) => {
432
+ utilities.verifyCSS(highlightImagePage.previewTabHighlightPolygon().eq(index), {
433
+ 'fill': css.color.incorrectAnswerHighlightRegion,
434
+ 'stroke': css.color.incorrectAnswer
435
+ });
436
+ highlightImagePage.previewTabHighlight()
437
+ .eq(index)
438
+ .within(() => {
439
+ utilities.verifyCSS(highlightImagePage.checkmarkCrossmarkIcon(), {
440
+ 'fill': css.color.incorrectAnswer
441
+ });
442
+ });
443
+ },
444
+
445
+ /**
446
+ * @param {*} index of highlight region
447
+ * @description this function verifies the highlight region is neither correct nor incorrect
448
+ */
449
+ verifyDefaultHighlightRegion: (index) => {
450
+ utilities.verifyCSS(highlightImagePage.previewTabHighlightPolygon().eq(index), {
451
+ 'stroke': css.color.activeButtons
452
+ });
453
+ },
454
+
455
+ /**
456
+ * @param {number} index of highlight region
457
+ * @param {number} numeration numeration displayed beside the highlight region
458
+ * @description this function verifies the numeration displayed for highlight regions
459
+ */
460
+ verifyHighlightNumerationPreviewTab: (index, numeration) => {
461
+ highlightImagePage.previewTabHighlight()
462
+ .eq(index)
463
+ .within(() => {
464
+ utilities.verifyTextContent(highlightImagePage.highlightNumeration(), numeration);
465
+ });
466
+ },
467
+
468
+ eraseAHighlightRegion: (arrayOfCoordinates) => {
469
+ highlightImagePage.itemEraserTool()
470
+ .click();
471
+ highlightImagePage.highlighImageCanvas()
472
+ .then(($element) => {
473
+ const clientWidth = $element[0].clientWidth;
474
+ arrayOfCoordinates.forEach((coordinates) => {
475
+ highlightImagePage.highlighImageCanvas()
476
+ .click(coordinates[0] * clientWidth / 100, coordinates[1] * clientWidth / 100);
477
+ });
478
+ });
479
+ },
480
+
481
+ clickOnPenTool: () => {
482
+ highlightImagePage.penTool()
483
+ .click()
484
+ .blur();
485
+ },
486
+
487
+ clickOnUndoTool: () => {
488
+ highlightImagePage.undoTool()
489
+ .click()
490
+ .blur();
491
+ },
492
+
493
+ clickOnRedoTool: () => {
494
+ highlightImagePage.redoTool()
495
+ .click()
496
+ .blur();
497
+ },
498
+
499
+ clickOnClearAllTool: () => {
500
+ highlightImagePage.clearAllTool()
501
+ .click()
502
+ .blur();
503
+ },
504
+
505
+ /**
506
+ * @description verify count of highlight in set correct anser section
507
+ * @param {number} count count of the element
508
+ */
509
+ verifyHighlightRegionCountInSetCorrectAnswerSection: (count) => {
510
+ highlightImagePage.setCorrectAnswerSectionHighlight()
511
+ .should('have.length', count);
512
+ },
513
+
514
+ verifyCorrectAnswerContainerDoesNotExist: () => {
515
+ highlightImagePage.correctAnswerContainerLabel()
516
+ .should('not.exist');
517
+ highlightImagePage.correctAnswerContainerAnswerWrapper()
518
+ .should('not.exist');
519
+ },
520
+
521
+ /**
522
+ * @param {string[]} numerationArray array of numeration numbers, lowercase, uppercase
523
+ * @description this function verifies the numeration of Correct Answer Container
524
+ */
525
+ verifyCorrectAnswerContainerNumeration: (numerationArray) => {
526
+ numerationArray.forEach((optionNumeration, index) => {
527
+ highlightImagePage.correctAnswerNumeration()
528
+ .eq(index)
529
+ .should('have.text', optionNumeration);
530
+ });
531
+ },
532
+
533
+ /**
534
+ * @param {string[]} optionsTextArray array of options in the correct answer container
535
+ * @param {string[]} numerationArray array of numeration numbers, lowercase, uppercase
536
+ * @description this function verifies the contents of Correct Answer Container
537
+ */
538
+ verifyCorrectAnswerContainerContents: (optionsTextArray, numerationArray) => {
539
+ optionsTextArray.forEach((optionsText, index) => {
540
+ highlightImagePage.correctAnswerContainerAnswerWrapper()
541
+ .eq(index)
542
+ .should('have.text', optionsText);
543
+ });
544
+ steps.verifyCorrectAnswerContainerNumeration(numerationArray);
545
+ },
546
+
547
+ verifyCorrectIncorrectBorderNotVisible: () => {
548
+ highlightImagePage.correctIncorrectAnswerBorder()
549
+ .should('have.css', 'border')
550
+ .and('match', /0px none/);
551
+ },
552
+
553
+ verifyCorrectAttemptBorder: () => {
554
+ highlightImagePage.correctIncorrectAnswerBorder()
555
+ .should('have.css', 'border', `1px solid ${css.color.correctAnswer}`);
556
+ },
557
+
558
+ verifyIncorrectAttemptBorder: () => {
559
+ highlightImagePage.correctIncorrectAnswerBorder()
560
+ .should('have.css', 'border', `1px solid ${css.color.incorrectAnswer}`);
561
+ },
562
+
563
+ verifyQuestionPreviewStateWhenShowCorrectAnswerIsUnchecked: () => {
564
+ cy.log('After deselecting Show correct answer checkbox, the question preview should return to the previous state');
565
+ previewScoringAndShowCorrectAnswerComponent.showCorrectAnswerCheckbox()
566
+ .click()
567
+ .should('not.be.checked');
568
+ autoScoredPreviewBase.correctIncorectAnswerLabel()
569
+ .should('not.exist');
570
+ highlightImagePage.steps.verifyCorrectIncorrectBorderNotVisible();
571
+ },
572
+
573
+ /**
574
+ * @description verify count of highlight in set correct answer section
575
+ * @param {number} count count of the element
576
+ */
577
+ verifyHighlightRegionCountInPreviewTab: (count) => {
578
+ highlightImagePage.previewTabHighlight()
579
+ .should('have.length', count);
580
+ },
581
+
582
+ verifyCustomizeHighlightPropertiesCollapsedState: () => {
583
+ highlightImagePage.customizeHighlightPropertiesPanel()
584
+ .should('have.attr', 'aria-expanded', 'false');
585
+ },
586
+
587
+ expandCustomizeHighlightProperties: () => {
588
+ highlightImagePage.customizeHighlightPropertiesPanel()
589
+ .click()
590
+ .should('have.attr', 'aria-expanded', 'true');
591
+ },
592
+
593
+ /**
594
+ * @param {number} tabIndex index of the tab in customize highlight properties accordion
595
+ * @description this function verifies active state of the tab
596
+ */
597
+ verifyActiveStateOfCustomizeHighlightPropertiesTab: (tabIndex) => {
598
+ highlightImagePage.customizeHighlightPropertiesTab()
599
+ .eq(tabIndex)
600
+ .should('have.attr', 'aria-selected', 'true');
601
+ },
602
+
603
+ /**
604
+ * @param {number} tabIndex index of the tab in customize highlight properties accordion
605
+ * @description this function verifies Inactive state of the tab
606
+ */
607
+ verifyInactiveStateOfCustomizeHighlightPropertiesTab: (tabIndex) => {
608
+ highlightImagePage.customizeHighlightPropertiesTab()
609
+ .eq(tabIndex)
610
+ .should('have.attr', 'aria-selected', 'false');
611
+ },
612
+ /**
613
+ * @param {number} points points displayed in partial equal weights points per response
614
+ * @description Verify points displayed in partial equal weights points per response
615
+ */
616
+ verifyPartialEqualWeightsPointsPerResponseScore: (points) => {
617
+ highlightImagePage.partialEqualWeightsPointsPerResponseScore()
618
+ .verifyInnerText(`${points}`);
619
+ },
620
+
621
+ /**
622
+ * @param {number} index of points input field
623
+ * @param {number} points alloted in the points input field
624
+ * @description this function verifies the Options label and points input field
625
+ */
626
+ verifyPartialDifferentWeightsOptionLabelAndPoints: (index, points) => {
627
+ utilities.verifyInnerText(highlightImagePage.partialDifferentWeightsPointsOptionsLabel().eq(index), `Option ${index + 1}`);
628
+ highlightImagePage.pointsInputField()
629
+ .eq(index)
630
+ .should('have.value', points);
631
+ utilities.verifyElementVisibilityState(highlightImagePage.pointsInputField().eq(index), 'visible');
632
+ },
633
+
634
+ //TODO: Need to check if common function verifyPartialDifferentWeightsPointsInputFieldIsDisabled can be used once https://redmine.zeuslearning.com/issues/545223 is resolved
635
+ /**
636
+ * @param {number} index of points input field
637
+ * @description this function verifies if points field is disabled
638
+ */
639
+ verifyPartialDifferentWeightsPointsInputFieldDisabled: (index) => {
640
+ scoringSectionBase.pointsInputField()
641
+ .eq(index)
642
+ .should('be.disabled');
643
+ },
644
+
645
+ /**
646
+ * @param {number} index of points input field
647
+ * @description this function verifies if points field is enabled
648
+ */
649
+ verifyPartialDifferentWeightsPointsInputFieldEnabled: (index) => {
650
+ scoringSectionBase.pointsInputField()
651
+ .eq(index)
652
+ .should('be.enabled');
653
+ },
654
+
655
+ /**
656
+ * @param {number} imageWidth canvas maximum width input field
657
+ * @description this verifies input of canvas maximum width input field
658
+ */
659
+ verifyCanvasMaximumWidthInputField: (imageWidth) => {
660
+ highlightImagePage.canvasMaximumWidthInputField()
661
+ .should('have.value', imageWidth)
662
+ },
663
+
664
+ clearCanvasMaximumWidthInputField: () => {
665
+ highlightImagePage.canvasMaximumWidthInputField()
666
+ .clear()
667
+ .blur();
668
+ },
669
+
670
+ /**
671
+ * @param {number} imageWidth canvas maximum width input field
672
+ * @description this function adds input to canvas maximum width input field
673
+ */
674
+ addInputToCanvasMaximumWidthInputField: (imageWidth) => {
675
+ highlightImagePage.canvasMaximumWidthInputField()
676
+ .type(imageWidth)
677
+ .blur();
678
+ steps.verifyCanvasMaximumWidthInputField(imageWidth)
679
+ },
680
+
681
+ /**
682
+ * @param {number} imageHeight expected height of image
683
+ * @param {number} imageWidth expected width of image
684
+ * @description this function verifies height and width of image in set correct answer section
685
+ */
686
+ verifyHeightAndWidthOfImageInSetCorrectAnswerSection: (imageHeight, imageWidth) => {
687
+ highlightImagePage.setCorrectAnswerSectionImage()
688
+ .should('have.attr', 'height', imageHeight)
689
+ .and('have.attr', 'width', imageWidth);
690
+ },
691
+
692
+ /**
693
+ * @param {string} imageAlternativeText alternate text of image
694
+ * @description this function verifies the alt attribute of the image
695
+ */
696
+ verifyImageAlternativeTextOfImageInSetCorrectAnswerSection: (imageAlternativeText) => {
697
+ highlightImagePage.setCorrectAnswerSectionImage()
698
+ .should('have.attr', 'alt', imageAlternativeText);
699
+ },
700
+
701
+ /**
702
+ * @param {number} imageHeight expected height of image
703
+ * @param {number} imageWidth expected width of image
704
+ * @description this function verifies height and width of image in preview tab
705
+ */
706
+ verifyHeightAndWidthOfImageInPreviewTab: (imageHeight, imageWidth) => {
707
+ highlightImagePage.previewTabImage()
708
+ .should('have.attr', 'height', imageHeight)
709
+ .and('have.attr', 'width', imageWidth);
710
+ },
711
+
712
+ /**
713
+ * @param {string} imageAlternativeText alternate text of image
714
+ * @description this function verifies the alt attribute of the image
715
+ */
716
+ verifyImageAlternativeTextOfImageInPreviewTab: (imageAlternativeText) => {
717
+ highlightImagePage.previewTabImage()
718
+ .should('have.attr', 'alt', imageAlternativeText);
719
+ },
720
+
721
+ //Conditional checkboxes
722
+ verifyMultipleSelectionCheckboxIsUnchecked: () => {
723
+ highlightImagePage.multipleSelectionCheckbox()
724
+ .should('not.be.checked');
725
+ },
726
+
727
+ verifyHideHighlightsCheckboxIsUnchecked: () => {
728
+ highlightImagePage.hideHighlightsCheckbox()
729
+ .should('not.be.checked');
730
+ },
731
+
732
+ checkHideHighlightsCheckbox: () => {
733
+ highlightImagePage.hideHighlightsCheckbox()
734
+ .click()
735
+ .should('be.checked');
736
+ },
737
+
738
+ /**
739
+ * @param {number} index of highlight region
740
+ * @description this function hovers over highlight region
741
+ */
742
+ hoverOverHighlightRegionInSetCorrectSection: (index) => {
743
+ utilities.hoverOverElement(highlightImagePage.setCorrectAnswerSectionHighlightPolygon().eq(index));
744
+ },
745
+
746
+ /**
747
+ * @param {number} index of highlight region
748
+ * @description this function hovers over highlight region
749
+ */
750
+ hoverOverHighlightRegionInPreviewTab: (index) => {
751
+ utilities.hoverOverElement(highlightImagePage.previewTabHighlightPolygon().eq(index));
752
+ },
753
+
754
+ /**
755
+ * @param {number} index of highlight region
756
+ * @description this function verifies that the highlight region is visible
757
+ */
758
+ verifyHighlightRegionVisibleInSetCorrectAnswerSection: (index) => {
759
+ highlightImagePage.setCorrectAnswerSectionHighlightPolygon()
760
+ .eq(index)
761
+ .should('have.attr', 'fill-opacity', '40')
762
+ .and('have.attr', 'stroke-opacity', '100');
763
+ },
764
+
765
+ /**
766
+ * @param {number} index of highlight region
767
+ * @description this function verifies that the highlight region is visible
768
+ */
769
+ verifySelectedHighlightRegionVisibleInSetCorrectAnswerSection: (index) => {
770
+ highlightImagePage.setCorrectAnswerSectionHighlightPolygon()
771
+ .eq(index)
772
+ .should('have.attr', 'fill-opacity', '70')
773
+ .and('have.attr', 'stroke-opacity', '100');
774
+ },
775
+
776
+ /**
777
+ * @param {number} index of highlight region
778
+ * @description this function verifies that the highlight region is not visible
779
+ */
780
+ verifyHighlightRegionHiddenInSetCorrectAnswerSection: (index) => {
781
+ highlightImagePage.setCorrectAnswerSectionHighlightPolygon()
782
+ .eq(index)
783
+ .should('have.attr', 'fill-opacity', 'transparent')
784
+ .and('have.attr', 'stroke-opacity', 'transparent');
785
+ },
786
+
787
+ /**
788
+ * @param {number} index of highlight region
789
+ * @description this function verifies that the highlight region is visible
790
+ */
791
+ verifyHighlightRegionVisibleInPreviewTab: (index) => {
792
+ highlightImagePage.previewTabHighlightPolygon()
793
+ .eq(index)
794
+ .should('have.attr', 'fill-opacity', '40')
795
+ .and('have.attr', 'stroke-opacity', '100');
796
+ },
797
+
798
+ /**
799
+ * @param {number} index of highlight region
800
+ * @description this function verifies that the highlight region is visible
801
+ */
802
+ verifySelectedHighlightRegionVisibleInPreviewTab: (index) => {
803
+ highlightImagePage.previewTabHighlightPolygon()
804
+ .eq(index)
805
+ .should('have.attr', 'fill-opacity', '70')
806
+ .and('have.attr', 'stroke-opacity', '100');
807
+ },
808
+
809
+ /**
810
+ * @param {number} index of highlight region
811
+ * @description this function verifies that the highlight region is not visible
812
+ */
813
+ verifyHighlightRegionHiddenInPreviewTab: (index) => {
814
+ highlightImagePage.previewTabHighlightPolygon()
815
+ .eq(index)
816
+ .should('have.attr', 'fill-opacity', 'transparent')
817
+ .and('have.attr', 'stroke-opacity', 'transparent');
818
+ },
819
+
820
+ /**
821
+ * @param {string} fileFormat format of the uploaded file in the highlight region
822
+ * @description this function verifies the attribute of the image has the expected file format
823
+ */
824
+ verifyUploadedImageFormatInSetCorrectAnswerSection: (fileFormat) => {
825
+ highlightImagePage.setCorrectAnswerSectionImage()
826
+ .should(($element) => {
827
+ const hrefAttributeValue = $element.attr('href');
828
+ expect(hrefAttributeValue).to.include(fileFormat);
829
+ });
830
+ },
831
+
832
+ /**
833
+ * @param {string} fileFormat format of the uploaded file in the highlight region
834
+ * @description this function verifies the attribute of the image has the expected file format
835
+ */
836
+ verifyUploadedImageFormatInPreviewTab: (fileFormat) => {
837
+ highlightImagePage.previewTabImage()
838
+ .should(($element) => {
839
+ const hrefAttributeValue = $element.attr('href');
840
+ expect(hrefAttributeValue).to.include(fileFormat);
841
+ });
842
+ },
843
+
844
+ /**
845
+ * @param {number} count of tabs in customize highlight properties accordion
846
+ * @description this function verifies the count of tabs in customize highlight properties accordion
847
+ */
848
+ verifyCountOfCustomizePropertiesTab: (count) => {
849
+ utilities.verifyElementCount(highlightImagePage.customizeHighlightPropertiesTab(), count)
850
+ },
851
+
852
+ verifyResetToGlobalColorButtonEnabled: () => {
853
+ highlightImagePage.resetToGlobalColorButton()
854
+ .should('be.enabled');
855
+ },
856
+
857
+ verifyResetToGlobalColorButtonDisabled: () => {
858
+ highlightImagePage.resetToGlobalColorButton()
859
+ .should('be.disabled');
860
+ },
861
+
862
+ /**
863
+ * @param {string} text to enter in option label input field
864
+ * @description this function adds and verifies the text in option label input field
865
+ */
866
+ addAndVerifyTextInOptionLabelInputField: (text) => {
867
+ highlightImagePage.optionLabelInputField()
868
+ .type(text, { delay: 0 })
869
+ .blur()
870
+ .should('have.attr', 'value', text);
871
+ },
872
+
873
+ /**
874
+ * @param {string} text to enter in aria label input field
875
+ * @description this function adds and verifies the text in aria label input field
876
+ */
877
+ addAndVerifyTextInAriaLabelInputField: (text) => {
878
+ highlightImagePage.ariaLabelInputField()
879
+ .type(text, { delay: 0 })
880
+ .blur()
881
+ .should('have.attr', 'value', text);
882
+ },
883
+
884
+ /**
885
+ * @param {number} index of the option tab
886
+ * @description this function verifies that option tab is displayed
887
+ */
888
+ verifyOptionTabIsDisplayed: (index) => {
889
+ utilities.verifyInnerText(highlightImagePage.customizeHighlightPropertiesTab().eq(index), `Option ${index}`);
890
+ utilities.verifyElementVisibilityState(highlightImagePage.customizeHighlightPropertiesTab().eq(index), 'visible');
891
+ },
892
+
893
+ /**
894
+ * @param {number} tabIndex of the option tab to navigate
895
+ * @description this function navigates to option tab
896
+ */
897
+ navigateToOptionTab: (tabIndex) => {
898
+ highlightImagePage.customizeHighlightPropertiesTab().eq(tabIndex)
899
+ .click();
900
+ },
901
+
902
+ navigateToGlobalTab: () => {
903
+ highlightImagePage.customizeHighlightPropertiesTab().eq(0)
904
+ .click();
905
+ },
906
+
907
+ verifyHighlightColorLabelIsDisplayed: () => {
908
+ highlightImagePage.highlightColorLabel()
909
+ .invoke('text')
910
+ .then(text => {
911
+ const highlightColorLabel = text.split('R')[0];
912
+ expect(highlightColorLabel).to.deep.eq('Highlight color');
913
+ });
914
+ utilities.verifyElementVisibilityState(highlightImagePage.highlightColorLabel(), 'visible');
915
+ },
916
+
917
+ /**
918
+ * @param {string} highlightColorBlock 'defaultFillColor' | 'defaultBorderColor' | 'hoverFillColor' | 'hoverBorderColor' | 'activeFillColor' | 'activeBorderColor'
919
+ * @description this function clicks on the highlight color block
920
+ */
921
+ clickOnHighlightColorBlock: (highlightColorBlock) => {
922
+ switch (highlightColorBlock) {
923
+ case 'defaultFillColor':
924
+ highlightImagePage.defaultFillColorBlock()
925
+ .click();
926
+ break;
927
+ case 'defaultBorderColor':
928
+ highlightImagePage.defaultBorderColorBlock()
929
+ .click();
930
+ break;
931
+ case 'hoverFillColor':
932
+ highlightImagePage.hoverFillColorBlock()
933
+ .click();
934
+ break;
935
+ case 'hoverBorderColor':
936
+ highlightImagePage.hoverBorderColorBlock()
937
+ .click();
938
+ break;
939
+ case 'activeFillColor':
940
+ highlightImagePage.activeFillColorBlock()
941
+ .click();
942
+ break;
943
+ case 'activeBorderColor':
944
+ highlightImagePage.activeBorderColorBlock()
945
+ .click();
946
+ break;
947
+ default:
948
+ throw new Error('Invalid highlight color block');
949
+ }
950
+ },
951
+
952
+ /**
953
+ * @param {number} index of highlight region
954
+ * @param {string} fillColor of highlight region
955
+ * @param {string} fillOpacity of highlight region
956
+ * @description this function verifies default state fill color and opacity of a highlight region in set correct answer section
957
+ */
958
+ verifyDefaultFillColorOfHighlightRegionInSetCorrectAnswerSection: (index, fillColor, fillOpacity) => {
959
+ highlightImagePage.setCorrectAnswerSectionHighlightFillColor()
960
+ .eq(index)
961
+ .should('have.css', 'fill', fillColor)
962
+ .and('have.css', 'fill-opacity', fillOpacity);
963
+ },
964
+
965
+ /**
966
+ * @param {number} index of highlight region
967
+ * @param {string} fillColor of highlight region
968
+ * @param {string} fillOpacity of highlight region
969
+ * @description this function verifies default state fill color and opacity of a highlight region in preview tab
970
+ */
971
+ verifyDefaultFillColorOfHighlightRegionInPreviewTab: (index, fillColor, fillOpacity) => {
972
+ highlightImagePage.previewTabHighlightFillColor()
973
+ .eq(index)
974
+ .should('have.css', 'fill', fillColor)
975
+ .and('have.css', 'fill-opacity', fillOpacity);
976
+ },
977
+
978
+ /**
979
+ * @param {number} index of highlight region
980
+ * @param {string} borderColor of highlight region
981
+ * @param {string} borderOpacity of highlight region
982
+ * @description this function verifies default state border color and opacity of a highlight region in set correct answer section
983
+ */
984
+ verifyDefaultBorderColorOfHighlightRegionInSetCorrectAnswerSection: (index, borderColor, borderOpacity) => {
985
+ highlightImagePage.setCorrectAnswerSectionHighlightPolygon()
986
+ .eq(index)
987
+ .should('have.css', 'stroke', borderColor)
988
+ .and('have.css', 'stroke-opacity', borderOpacity);
989
+ },
990
+
991
+ /**
992
+ * @param {number} index of highlight region
993
+ * @param {string} borderColor of highlight region
994
+ * @param {string} borderOpacity of highlight region
995
+ * @description this function verifies default state border color and opacity of a highlight region in preview tab
996
+ */
997
+ verifyDefaultBorderColorOfHighlightRegionInPreviewTab: (index, borderColor, borderOpacity) => {
998
+ highlightImagePage.previewTabHighlightPolygon()
999
+ .eq(index)
1000
+ .should('have.css', 'stroke', borderColor)
1001
+ .and('have.css', 'stroke-opacity', borderOpacity);
1002
+ },
1003
+
1004
+ /**
1005
+ * @param {number} index of highlight region
1006
+ * @param {string} fillColor of highlight region
1007
+ * @param {string} fillOpacity of highlight region
1008
+ * @description this function verifies hover state fill color and opacity of a highlight region in set correct answer section
1009
+ */
1010
+ verifyHoverFillColorOfHighlightRegionInSetCorrectAnswerSection: (index, fillColor, fillOpacity) => {
1011
+ utilities.hoverOverElement(highlightImagePage.setCorrectAnswerSectionHighlightPolygon().eq(index));
1012
+ highlightImagePage.setCorrectAnswerSectionHighlightFillColor()
1013
+ .eq(index)
1014
+ .should('have.css', 'fill', fillColor)
1015
+ .and('have.css', 'fill-opacity', fillOpacity);
1016
+ utilities.hoverAwayFromElement(highlightImagePage.setCorrectAnswerSectionHighlightPolygon().eq(index));
1017
+ },
1018
+
1019
+ /**
1020
+ * @param {number} index of highlight region
1021
+ * @param {string} fillColor of highlight region
1022
+ * @param {string} fillOpacity of highlight region
1023
+ * @description this function verifies hover state fill color and opacity of a highlight region in preview tab
1024
+ */
1025
+ verifyHoverFillColorOfHighlightRegionInPreviewTab: (index, fillColor, fillOpacity) => {
1026
+ utilities.hoverOverElement(highlightImagePage.previewTabHighlightPolygon().eq(index));
1027
+ highlightImagePage.previewTabHighlightFillColor()
1028
+ .eq(index)
1029
+ .should('have.css', 'fill', fillColor)
1030
+ .and('have.css', 'fill-opacity', fillOpacity);
1031
+ utilities.hoverAwayFromElement(highlightImagePage.previewTabHighlightPolygon().eq(index));
1032
+ },
1033
+
1034
+ /**
1035
+ * @param {number} index of highlight region
1036
+ * @param {string} borderColor of highlight region
1037
+ * @param {string} borderOpacity of highlight region
1038
+ * @description this function verifies hover state border color and opacity of a highlight region in set correct answer section
1039
+ */
1040
+ verifyHoverBorderColorOfHighlightRegionInSetCorrectAnswerSection: (index, borderColor, borderOpacity) => {
1041
+ utilities.hoverOverElement(highlightImagePage.setCorrectAnswerSectionHighlightPolygon().eq(index));
1042
+ highlightImagePage.setCorrectAnswerSectionHighlightPolygon()
1043
+ .eq(index)
1044
+ .should('have.css', 'stroke', borderColor)
1045
+ .and('have.css', 'stroke-opacity', borderOpacity);
1046
+ utilities.hoverAwayFromElement(highlightImagePage.setCorrectAnswerSectionHighlightPolygon().eq(index));
1047
+ },
1048
+
1049
+ /**
1050
+ * @param {number} index of highlight region
1051
+ * @param {string} borderColor of highlight region
1052
+ * @param {string} borderOpacity of highlight region
1053
+ * @description this function verifies hover state border color and opacity of a highlight region in preview tab
1054
+ */
1055
+
1056
+ verifyHoverBorderColorOfHighlightRegionInPreviewTab: (index, borderColor, borderOpacity) => {
1057
+ utilities.hoverOverElement(highlightImagePage.previewTabHighlightPolygon().eq(index));
1058
+ highlightImagePage.previewTabHighlightPolygon()
1059
+ .eq(index)
1060
+ .should('have.css', 'stroke', borderColor)
1061
+ .and('have.css', 'stroke-opacity', borderOpacity);
1062
+ utilities.hoverAwayFromElement(highlightImagePage.previewTabHighlightPolygon().eq(index));
1063
+ },
1064
+
1065
+ /**
1066
+ * @param {number} index of highlight region
1067
+ * @param {string} fillColor of highlight region
1068
+ * @param {string} fillOpacity of highlight region
1069
+ * @description this function verifies active state fill color and opacity of a highlight region in set correct answer section
1070
+ */
1071
+ verifyActiveFillColorOfHighlightRegionInSetCorrectAnswerSection: (index, fillColor, fillOpacity) => {
1072
+ highlightImagePage.steps.highlightARegionInSetCorrectAnswerSection(index);
1073
+ highlightImagePage.setCorrectAnswerSectionHighlightFillColor()
1074
+ .eq(index)
1075
+ .should('have.css', 'fill', fillColor)
1076
+ .and('have.css', 'fill-opacity', fillOpacity);
1077
+ highlightImagePage.steps.removeHighlightOfARegionInSetCorrectAnswerSection(index);
1078
+ },
1079
+
1080
+ /**
1081
+ * @param {number} index of highlight region
1082
+ * @param {string} fillColor of highlight region
1083
+ * @param {string} fillOpacity of highlight region
1084
+ * @description this function verifies active state fill color and opacity of a highlight region in preview tab
1085
+ */
1086
+ verifyActiveFillColorOfHighlightRegionInPreviewTab: (index, fillColor, fillOpacity) => {
1087
+ highlightImagePage.steps.highlightARegionInPreviewTab(index);
1088
+ highlightImagePage.previewTabHighlightFillColor()
1089
+ .eq(index)
1090
+ .should('have.css', 'fill', fillColor)
1091
+ .and('have.css', 'fill-opacity', fillOpacity);
1092
+ highlightImagePage.steps.removeHighlightOfARegionInPreviewTab(index);
1093
+ },
1094
+
1095
+ /**
1096
+ * @param {number} index of highlight region
1097
+ * @param {string} borderColor of highlight region
1098
+ * @param {string} borderOpacity of highlight region
1099
+ * @description this function verifies active state border color and opacity of a highlight region in set correct answer section
1100
+ */
1101
+ verifyActiveBorderColorOfHighlightRegionInSetCorrectAnswerSection: (index, borderColor, borderOpacity) => {
1102
+ highlightImagePage.steps.highlightARegionInSetCorrectAnswerSection(index);
1103
+ highlightImagePage.setCorrectAnswerSectionHighlightPolygon()
1104
+ .eq(index)
1105
+ .should('have.css', 'stroke', borderColor)
1106
+ .and('have.css', 'stroke-opacity', borderOpacity);
1107
+ highlightImagePage.steps.removeHighlightOfARegionInSetCorrectAnswerSection(index);
1108
+ },
1109
+
1110
+ /**
1111
+ * @param {number} index of highlight region
1112
+ * @param {string} borderColor of highlight region
1113
+ * @param {string} borderOpacity of highlight region
1114
+ * @description this function verifies active state border color and opacity of a highlight region in preview tab
1115
+ */
1116
+ verifyActiveBorderColorOfHighlightRegionInPreviewTab: (index, borderColor, borderOpacity) => {
1117
+ highlightImagePage.steps.highlightARegionInPreviewTab(index);
1118
+ highlightImagePage.previewTabHighlightPolygon()
1119
+ .eq(index)
1120
+ .should('have.css', 'stroke', borderColor)
1121
+ .and('have.css', 'stroke-opacity', borderOpacity);
1122
+ highlightImagePage.steps.removeHighlightOfARegionInPreviewTab(index);
1123
+ },
1124
+
1125
+ clickOnResetToGlobalColorButton: () => {
1126
+ highlightImagePage.resetToGlobalColorButton()
1127
+ .click();
1128
+ },
1129
+
1130
+ verifyHideHighlightsCheckboxIsChecked: () => {
1131
+ highlightImagePage.hideHighlightsCheckbox()
1132
+ .should('be.checked');
1133
+ },
1134
+
1135
+ checkApplyPatternOnActiveStateCheckbox: () => {
1136
+ highlightImagePage.applyPatternOnActiveStateCheckbox()
1137
+ .click()
1138
+ .should('be.checked');
1139
+ },
1140
+
1141
+ uncheckApplyPatternOnActiveStateCheckbox: () => {
1142
+ highlightImagePage.applyPatternOnActiveStateCheckbox()
1143
+ .click()
1144
+ .should('not.be.checked');
1145
+ },
1146
+
1147
+ //TODO: Need to update script after https://redmine.zeuslearning.com/issues/518498 is resolved
1148
+ /**
1149
+ * @param {number} index of highlight region
1150
+ * @description this function verifies that active pattern is displayed on the highlight region in Set correct answer section
1151
+ */
1152
+ verifyActivePatternIsDisplayedOnHighlightRegionInSetCorrectAnswerSection: (index) => {
1153
+ highlightImagePage.setCorrectAnswerSectionHighlightActivePattern()
1154
+ .eq(index)
1155
+ .should('exist');
1156
+ },
1157
+
1158
+ /**
1159
+ * @param {number} index of highlight region
1160
+ * @description this function verifies that active pattern is displayed on the highlight region in Preview tab
1161
+ */
1162
+ verifyActivePatternIsDisplayedOnHighlightRegionInPreviewTab: (index) => {
1163
+ highlightImagePage.previewTabHighlightActivePattern()
1164
+ .eq(index)
1165
+ .should('exist');
1166
+ },
1167
+
1168
+ /**
1169
+ * @param {number} index of highlight region
1170
+ * @description this function verifies that active pattern is not displayed on the highlight region in Set correct answer section
1171
+ */
1172
+ verifyActivePatternIsNotDisplayedOnHighlightRegionInSetCorrectAnswerSection: (index) => {
1173
+ highlightImagePage.setCorrectAnswerSectionHighlightActivePattern()
1174
+ .eq(index)
1175
+ .should('not.exist');
1176
+ },
1177
+
1178
+ /**
1179
+ * @param {number} index of highlight region
1180
+ * @description this function verifies that active pattern is not displayed on the highlight region in Preview Tab
1181
+ */
1182
+ verifyActivePatternIsNotDisplayedOnHighlightRegionInPreviewTab: (index) => {
1183
+ highlightImagePage.previewTabHighlightActivePattern()
1184
+ .eq(index)
1185
+ .should('not.exist');
1186
+ }
1187
+ }
1188
+
1189
+ const tests = {
1190
+ ...questionInstructionsComponent.tests,
1191
+ ...autoScoredScoringSection.tests,
1192
+ ...previewScoringAndShowCorrectAnswerComponent.tests,
1193
+ ...commonComponents.tests,
1194
+ ...scoringSectionBase.tests,
1195
+ ...autoScoredScoringSectionMultipleResponsesType.tests,
1196
+ ...autoScoredSetCorrectAnswerSection.tests,
1197
+ ...additionalSettingsPanel.tests,
1198
+ ...answerNumerationComponent.tests,
1199
+ ...autoScoredAdditionalSettings.tests,
1200
+ ...createQuestionBasePage.tests,
1201
+ /**
1202
+ *
1203
+ * @param {number} totalPoints total points scored by user
1204
+ * @description this verifies the minimum score functionality when user attempts the question incorrectly
1205
+ */
1206
+ verifyMinimumScoreAwardedIfAttemptedFunctionalityForIncorrectAnswer: (totalPoints) => {
1207
+ it('When user has provided minimum score awarded (if attempted) points, then in Preview tab on entering incorrect answer, minimum score should be provided for the question', () => {
1208
+ cy.log('Switch to edit tab and set minimum score if attempted points')
1209
+ createQuestionBasePage.steps.switchToEditTab();
1210
+ scoringSectionBase.steps.allotMinimumScoreAwardedIfAttempted('1')
1211
+ createQuestionBasePage.steps.switchToPreviewTab()
1212
+ highlightImagePage.steps.highlightARegionInPreviewTab(2);
1213
+ previewScoringAndShowCorrectAnswerComponent.steps.verifyPreviewTabScoreText(1, `${totalPoints}`)
1214
+ });
1215
+
1216
+ it('When user removes minimum score awarded (if attempted) points, then in Preview tab on selecting any options other than correct answers, points should not be provided', () => {
1217
+ cy.log('Switch to edit tab and remove minimum score if attempted points')
1218
+ createQuestionBasePage.steps.switchToEditTab();
1219
+ scoringSectionBase.steps.clearMinimumScoreIfAttemptedPointsField();
1220
+ createQuestionBasePage.steps.switchToPreviewTab();
1221
+ highlightImagePage.steps.highlightARegionInPreviewTab(2);
1222
+ previewScoringAndShowCorrectAnswerComponent.steps.verifyPreviewTabScoreText(0, `${totalPoints}`)
1223
+ });
1224
+ },
1225
+
1226
+ /**
1227
+ *
1228
+ * @param {number} scoredPoints the points scored by the user when penalty points are reduced
1229
+ * @param {number} totalPoints the maximum points that can be scored by the user
1230
+ * @description this function verifies the functionality of Penalty points when minimum points are not set and user attempts incorrect answer
1231
+ */
1232
+ verifyPenaltyPointsFunctionalityForIncorrectAnswer: (scoredPoints, totalPoints) => {
1233
+ it('When user has defined penalty points', () => {
1234
+ cy.log('Pre-step: Switch to edit tab and set penalty points');
1235
+ createQuestionBasePage.steps.switchToEditTab();
1236
+ autoScoredScoringSectionMultipleResponsesType.steps.allotPenaltyPoints(3)
1237
+
1238
+ cy.log('After switching to preview tab, when user adds an incorrect answer input, then 0 points should be awarded(no negative points)');
1239
+ createQuestionBasePage.steps.switchToPreviewTab();
1240
+ highlightImagePage.steps.highlightARegionInPreviewTab(2);
1241
+ highlightImagePage.steps.verifyPreviewTabScoreText(0, `${totalPoints}`)
1242
+
1243
+ cy.log('When user adds a partially correct answer input, the points should be updated accordingly with deducted penalty points');
1244
+ createQuestionBasePage.steps.resetQuestionPreview()
1245
+ highlightImagePage.steps.highlightARegionInPreviewTab(0);
1246
+ highlightImagePage.steps.highlightARegionInPreviewTab(2);
1247
+ highlightImagePage.steps.verifyPreviewTabScoreText(`${scoredPoints}`, `${totalPoints}`);
1248
+
1249
+ cy.log('Post step: Clearing the Penalty points field')
1250
+ createQuestionBasePage.steps.switchToEditTab();
1251
+ autoScoredScoringSectionMultipleResponsesType.penaltyPointsInputField()
1252
+ .clear();
1253
+ });
1254
+ },
1255
+
1256
+ /**
1257
+ * @param {number[]} scoredPointsArray An array of numbers representing points scored in different cases.
1258
+ * - The first element represents points scored for incorrect answers.
1259
+ * - The second element represents points scored for partially correct answers.
1260
+ * - The third element represents points scored when minimum score awarded (if attempted) points is greater than the points achieved by attempting the question partially correct
1261
+ * @param {number} minimumPointsForPartialCorrectAnswers minimum score awarded (if attempted) points on attempting the question partially correct
1262
+ * @param {number} totalPoints the maximum points that can be achieved by the user
1263
+ * @description this function verifies the functionality of Minimum score if attempted points when penalty points are set and user attempts incorrect answer
1264
+ * - For all incorrect responses
1265
+ * - For partially correct responses, when points scored > minimum score awarded(if attempted) points
1266
+ * - For partially correct responses, when minimum score awarded(if attempted) points > points scored
1267
+ */
1268
+ verifyMinimumScoreIfAttemptedAndPenaltyPointsFunctionalityForIncorrectAnswer: (scoredPointsArray, minimumPointsForPartialCorrectAnswers, totalPoints) => {
1269
+ it('When user has defined both penalty points and minimum score awarded (if attempted) points', () => {
1270
+ cy.log('Pre-step: Switch to edit tab and set minimum score awarded (if attempted) points and Penalty points');
1271
+ createQuestionBasePage.steps.switchToEditTab();
1272
+ scoringSectionBase.steps.allotMinimumScoreAwardedIfAttempted(1);
1273
+ autoScoredScoringSectionMultipleResponsesType.steps.allotPenaltyPoints(3);
1274
+
1275
+ cy.log('Switch to preview tab and give incorrect answer input to check that minimum points are displayed');
1276
+ createQuestionBasePage.steps.switchToPreviewTab();
1277
+ highlightImagePage.steps.highlightARegionInPreviewTab(2);
1278
+ highlightImagePage.steps.verifyPreviewTabScoreText(`${scoredPointsArray[0]}`, `${totalPoints}`);
1279
+
1280
+ cy.log('When user adds a partially correct answer such that the points of the attempt(with penalty points deducted) is more than the minimum score awarded(if attempted) points');
1281
+ createQuestionBasePage.steps.resetQuestionPreview();
1282
+ highlightImagePage.steps.highlightARegionInPreviewTab(0);
1283
+ highlightImagePage.steps.highlightARegionInPreviewTab(2);
1284
+ highlightImagePage.steps.verifyPreviewTabScoreText(`${scoredPointsArray[1]}`, `${totalPoints}`);
1285
+
1286
+ cy.log('When user switches to edit tab and increases the minimum score awarded (if attempted) points to check the case for an attempt in which points of the attempt is less than minimum score awarded (if attempted) points, then the minimum score awarded (if attempted) points should be displayed to the user');
1287
+ createQuestionBasePage.steps.switchToEditTab();
1288
+ scoringSectionBase.steps.clearMinimumScoreIfAttemptedPointsField()
1289
+ scoringSectionBase.steps.allotMinimumScoreAwardedIfAttempted(minimumPointsForPartialCorrectAnswers)
1290
+ cy.log('Switching to preview tab');
1291
+ createQuestionBasePage.steps.switchToPreviewTab();
1292
+ highlightImagePage.steps.highlightARegionInPreviewTab(0);
1293
+ highlightImagePage.steps.verifyPreviewTabScoreText(`${scoredPointsArray[2]}`, `${totalPoints}`);
1294
+ });
1295
+ },
1296
+
1297
+ /**
1298
+ * @param {string} scoringType scoring type 'All or nothing| Partial equal weights| Partial different weights'
1299
+ * @description this function verifies the contents of Set correct answer section for different scoring types
1300
+ */
1301
+ verifyResponseContentsOfSetCorrectAnswerSection: () => {
1302
+ it(`When user has selected a scoring type then the uploaded image with highlight regions should be displayed in the set correct answer section`, () => {
1303
+ highlightImagePage.steps.verifyImageUploadedInSetCorrectAnswerSection();
1304
+ utilities.verifyElementCount(highlightImagePage.setCorrectAnswerSectionHighlightPolygon(), 3);
1305
+ highlightImagePage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(0);
1306
+ highlightImagePage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(1);
1307
+ highlightImagePage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(2);
1308
+ });
1309
+ }
1310
+ }
1311
+
1312
+ export const highlightImagePage = {
1313
+ ...selectors,
1314
+ steps,
1315
+ tests
1316
+ }