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,924 @@
1
+ import utilities from "../../support/helpers/utilities";
2
+ import { commonComponents } from "./commonComponents";
3
+ import { createQuestionBasePage } from "./createQuestionBasePage";
4
+ import { scoringSectionBase } from "./scoringSectionBase";
5
+ const css = Cypress.env('css');
6
+
7
+ const selectors = {
8
+ addResponseContainerButton: () => cy.get('[class*="ResponseOnImagestyles"] .ngie-icon-with-label-btn').eq(0),
9
+ //Change selectors after https://redmine.zeuslearning.com/issues/518498 is fixed
10
+ responseContainer: () => cy.get('.react-draggable'),
11
+ responseContainerCloseButton: () => cy.get('.remove-button'),
12
+ responseContainerNumeration: () => cy.get('marker'),
13
+ responseContainerPointer: () => cy.get('[class*="PointerDiv"]'),
14
+ responseContainerChevronDownArrow: () => cy.get('.icon-chevron-down'),
15
+ imageHoverTextLabel: () => cy.get('[class*="Imagestyles__RowContainer"] .text-label').eq(0),
16
+ imageHoverTextInputField: () => cy.get('input[aria-label="Image hover text"]'),
17
+ imageAlternativeTextLabel: () => cy.get('[class*="Imagestyles__RowContainer"] .text-label').eq(1),
18
+ imageAlternativeTextInputField: () => cy.get('input[aria-label="Image alternative text"]'),
19
+ heightLabel: () => cy.get('[class*="AddTextResponseOnImagestyles__RowContainer"] [aria-labelledby*="Height (px)"]'),
20
+ heightInputField: () => cy.get('[class*="AddTextResponseOnImagestyles__RowContainer"] input[aria-label="Height (px)"]'),
21
+ widthLabel: () => cy.get('[class*="AddTextResponseOnImagestyles__RowContainer"] [aria-labelledby="Width (px)"]'),
22
+ widthInputField: () => cy.get('[class*="AddTextResponseOnImagestyles__RowContainer"] input[aria-label="Width (px)"]'),
23
+ editAriaLabelForResponseContainersLabel: () => cy.get('[data-ngie-testid*="edit-aria-labels-for-response"] .MuiFormControlLabel-label'),
24
+ editAriaLabelForResponseContainersCheckbox: () => cy.get('[data-ngie-testid*="edit-aria-labels-for-response"] input'),
25
+ ariaLabelsLabel: () => cy.get('[class*="OnImagestyles__LabelWrapper"]'),
26
+ ariaLabelsInputField: () => cy.get('[class*="AriaLabelOptionComponent"] input'),
27
+ ariaLabelsInputFieldNumeration: () => cy.get('.start-adornment'),
28
+ pleaseAddResponseTokenHelpText: () => cy.get('[class*="ClozeWithTextResponsestyles__AddResponseLabel"]'),
29
+ setCorrectAnswerResponseFieldLabel: () => cy.get('.cloze-with-text-form-control-wrapper .input-field-label'),
30
+ imageSectionImageLabel: () => cy.get('[class*="LabelImageWithDropDownstyles__LabelWrapper"]'),
31
+ imageSectionImage: () => cy.get('.image-container img'),
32
+ imagePreviewTab: () => cy.get('.edit-question-preview-wrapper .image-container img'),
33
+ imagePropertiesContainer: () => cy.get('[class*="AddTextResponseOnImagestyles__DimensionsContainer"]'),
34
+ responseNumeration: () => cy.get('.response-input-adornment'),
35
+ // Additional setting accordion
36
+ advanceSettingsforAllResponseAreasLabel: () => cy.get('.additional-settings-heading-label').eq(0),
37
+ placeholderTextLabel: () => cy.get('.additional-settings-container .text-label'),
38
+ placeholderTextInputField: () => cy.get('.additional-option-placeholder-input [aria-label="Placeholder Text"]'),
39
+ responseFieldHeightLabel: () => cy.get('[class*="style__DimensionsContainer"] [aria-labelledby*="Height (px)"]'),
40
+ responseFieldHeightInputField: () => cy.get('[class*="style__DimensionsContainer"] input[aria-label="Height (px)"]'),
41
+ responseFieldWidthLabel: () => cy.get('[class*="style__DimensionsContainer"] [aria-labelledby*="Width (px)"]'),
42
+ responseFieldWidthInputField: () => cy.get('[class*="style__DimensionsContainer"] input[aria-label="Width (px)"]'),
43
+ pointerLabel: () => cy.get('[id*="Pointer"][id*="dropdown-label"]'),
44
+ pointerDropdown: () => cy.get('[id*="Pointer"][id*="select"]'),
45
+ pointerDropdownListOptions: (ariaLabel = null) => {
46
+ if (ariaLabel) {
47
+ return cy.get(`[aria-labelledby*="Pointer-dropdown-label"] li[role="option"][aria-label*="${ariaLabel}"]`)
48
+ } else {
49
+ return cy.get('[aria-labelledby*="Pointer-dropdown-label"] li[role="option"]')
50
+ }
51
+ },
52
+ fixPositionOnImageLabel: () => cy.get('[data-ngie-testid="fix-position-on-image-checkbox"] .MuiFormControlLabel-label'),
53
+ fixPositionOnImageCheckbox: () => cy.get('[data-ngie-testid="fix-position-on-image-checkbox"] input'),
54
+ studentResponseAreaAndLayoutLabel: () => cy.get('[class*="StudentResponseLabel"]'),
55
+ displayAnswerNumerationToStudentsLabel: () => cy.get('[data-ngie-testid="display-answer-numeration-to-students-checkbox"] .MuiFormControlLabel-label'),
56
+ displayAnswerNumerationToStudentsCheckbox: () => cy.get('[data-ngie-testid="display-answer-numeration-to-students-checkbox"] input'),
57
+ //Response accordion
58
+ placeholderTextLabelResponseAccordion: () => cy.get('.dropdown-wrapper .text-label'),
59
+ advanceSettingForIndividualResponsesLabel: () => cy.get('.additional-settings-heading-label').eq(1),
60
+ responseAccordionWrapper: () => cy.get('.response-setting-container'),
61
+ responseAccordion: () => cy.get('.response-setting-container [role="button"]'),
62
+ responseAccordionLabel: () => cy.get('.response-settings-label'),
63
+ responseAccordionCustomLabel: () => cy.get('.custom-label-container'),
64
+ }
65
+
66
+ const steps = {
67
+ /**
68
+ * @param {number} responseContainerIndex
69
+ * @returns coordinatesArray - Array of the coordinates of the response container's position
70
+ * @description Get coordinates of the response container's position
71
+ */
72
+ getResponseContainerPositionCoordinates: (responseContainerIndex) => {
73
+ const coordinatesArray = [];
74
+ figOverImageCommonComponent.responseContainer()
75
+ .eq(responseContainerIndex)
76
+ .invoke('attr', 'style')
77
+ .then(($styleAttribute) => {
78
+ let transformValue = $styleAttribute;
79
+ let position = transformValue.split('(')[1]
80
+ .split(')')[0]
81
+ .split(',');
82
+ let horizontalCoordinate = position[0].trim();
83
+ let verticalCoordinate = position[1].trim();
84
+ coordinatesArray.push(horizontalCoordinate)
85
+ coordinatesArray.push(verticalCoordinate)
86
+ });
87
+ return coordinatesArray;
88
+ },
89
+
90
+ /**
91
+ * @param {number} responseContainerIndex Index of the response container
92
+ * @param {number} responseContainerPositionCoordinates Position coordinates of the response container
93
+ * @description Verify the position coordinates of the response container
94
+ */
95
+ verifyResponseContainerPositionCoordinates: (responseContainerIndex, responseContainerPositionCoordinates) => {
96
+ figOverImageCommonComponent.responseContainer()
97
+ .eq(responseContainerIndex)
98
+ .invoke('attr', 'style')
99
+ .then(($styleAttribute) => {
100
+ let transformValue = $styleAttribute;
101
+ let position = transformValue.split('(')[1]
102
+ .split(')')[0]
103
+ .split(',');
104
+ let horizontalCoordinate = position[0].trim();
105
+ let verticalCoordinate = position[1].trim();
106
+ expect(horizontalCoordinate).to.be.eq(responseContainerPositionCoordinates[0]);
107
+ expect(verticalCoordinate).to.be.eq(responseContainerPositionCoordinates[1]);
108
+ });
109
+ },
110
+
111
+ addResponseContainer: () => {
112
+ figOverImageCommonComponent.addResponseContainerButton()
113
+ .click();
114
+ },
115
+
116
+ /**
117
+ * @param {number} responseContainerIndex Index of response container
118
+ * @description Verify response container is displayed in image section
119
+ */
120
+ verifyResponseContainerIsDisplayedInImageSection: (responseContainerIndex) => {
121
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.responseContainer().eq(responseContainerIndex), 'visible');
122
+ },
123
+
124
+ /**
125
+ * @param {number} responseContainerIndex Index of response container
126
+ * @description Verify pointer of response container is displayed in image section
127
+ */
128
+ verifyResponseContainerPointerInImageSection: (responseContainerIndex) => {
129
+ figOverImageCommonComponent.responseContainer()
130
+ .eq(responseContainerIndex)
131
+ .within(() => {
132
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.responseContainerPointer(), 'visible');
133
+ });
134
+ },
135
+
136
+ /**
137
+ * @param {number} responseContainerIndex Index of response container
138
+ * @description Verify numeration of response container is displayed in image section
139
+ */
140
+ verifyResponseContainerNumerationInImageSection: (responseContainerIndex) => {
141
+ figOverImageCommonComponent.responseContainer()
142
+ .eq(responseContainerIndex)
143
+ .within(() => {
144
+ utilities.verifyInnerText(figOverImageCommonComponent.responseContainerNumeration(), `${responseContainerIndex + 1}`);
145
+ });
146
+ },
147
+
148
+ /**
149
+ * @param {number} responseContainerIndex Index of response container
150
+ * @description Verify chevron down arrow of response container is displayed in image section
151
+ */
152
+ verifyResponseContainerChevronDownArrowInImageSection: (responseContainerIndex) => {
153
+ figOverImageCommonComponent.responseContainer()
154
+ .eq(responseContainerIndex)
155
+ .within(() => {
156
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.responseContainerChevronDownArrow(), 'visible');
157
+ });
158
+ },
159
+
160
+ /**
161
+ * @param {number} responseContainerIndex Index of response container
162
+ * @description Verify close button of response container is displayed in image section
163
+ */
164
+ verifyResponseContainerCloseButtonInImageSection: (responseContainerIndex) => {
165
+ figOverImageCommonComponent.responseContainer()
166
+ .eq(responseContainerIndex)
167
+ .within(() => {
168
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.responseContainerCloseButton(), 'visible');
169
+ });
170
+ },
171
+
172
+ /**
173
+ * @param {number} responseContainerIndex Index of response container
174
+ * @description Click on close button of response container
175
+ */
176
+ clickOnResponseContainerCloseButton: (responseContainerIndex) => {
177
+ figOverImageCommonComponent.responseContainer()
178
+ .eq(responseContainerIndex)
179
+ .within(() => {
180
+ figOverImageCommonComponent.responseContainerCloseButton()
181
+ .click();
182
+ });
183
+ },
184
+
185
+ /**
186
+ * @param {string} imageHoverText Text to be displayed as tooltip when user hovers on image
187
+ * @description Add input to image hover text input field
188
+ */
189
+ enterTextInImageHoverTextInputField: (imageHoverText) => {
190
+ figOverImageCommonComponent.imageHoverTextInputField()
191
+ .clear()
192
+ .type(imageHoverText)
193
+ .should('have.value', imageHoverText);
194
+ },
195
+
196
+ /**
197
+ * @param {string} imageAlternativeText Text to be displayed as alternative text for the image
198
+ * @description Add input to image alternative text input field
199
+ */
200
+ enterTextInImageAlternativeTextInputField: (imageAlternativeText) => {
201
+ figOverImageCommonComponent.imageAlternativeTextInputField()
202
+ .clear()
203
+ .type(imageAlternativeText)
204
+ .should('have.value', imageAlternativeText);
205
+ },
206
+
207
+ clearTextFromImageAlternativeTextInputField: () => {
208
+ figOverImageCommonComponent.imageAlternativeTextInputField()
209
+ .clear();
210
+ },
211
+
212
+ /**
213
+ * @param {number} imageHeight Height of the displayed image
214
+ * @description Add input to height input field
215
+ */
216
+ enterTextInHeightInputField: (imageHeight) => {
217
+ figOverImageCommonComponent.heightInputField()
218
+ .clear()
219
+ .type(`${imageHeight}`)
220
+ .should('have.value', imageHeight);
221
+ },
222
+
223
+ /**
224
+ * @param {number} imageWidth Width of the displayed image
225
+ * @description Add input to width input field
226
+ */
227
+ enterTextInWidthInputField: (imageWidth) => {
228
+ figOverImageCommonComponent.widthInputField()
229
+ .clear()
230
+ .type(`${imageWidth}`)
231
+ .should('have.value', imageWidth);
232
+ },
233
+
234
+ clearTextFromImageHoverTextInputField: () => {
235
+ figOverImageCommonComponent.imageHoverTextInputField()
236
+ .clear();
237
+ },
238
+
239
+ /**
240
+ * @param {number} imageWidth Width of the displayed image
241
+ * @description verify width input field value
242
+ */
243
+ verifyWidthInputFieldValue: (imageWidth) => {
244
+ figOverImageCommonComponent.widthInputField()
245
+ .should('have.value', imageWidth);
246
+ },
247
+
248
+ /**
249
+ * @param {number} imageHeight Height of the displayed image
250
+ * @description verify height input field value
251
+ */
252
+ verifyHeightInputFieldValue: (imageHeight) => {
253
+ figOverImageCommonComponent.heightInputField()
254
+ .should('have.value', imageHeight);
255
+ },
256
+
257
+ /**
258
+ * @param {number} responseFieldIndex Index of response field
259
+ * @description Verify set correct answer response field label
260
+ */
261
+ verifyResponseFieldLabelInSetCorrectAnswerSection: (responseFieldIndex) => {
262
+ utilities.verifyInnerText(figOverImageCommonComponent.setCorrectAnswerResponseFieldLabel().eq(responseFieldIndex), `Response ${responseFieldIndex + 1}`);
263
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.setCorrectAnswerResponseFieldLabel().eq(responseFieldIndex), 'visible');
264
+ },
265
+
266
+ /**
267
+ * Verifies the points input field in an alternate tab when the "Match from All Responses" option is checked.
268
+ * @param {number} count - The index of the points input field to verify.
269
+ * @param {string} points - The expected points value to check for.
270
+ */
271
+ verifyPointsInAlternateTabWhenMatchFromAllResponsesIsChecked: (count, points) => {
272
+ scoringSectionBase.pointsInputField()
273
+ .eq(count)
274
+ .should('have.value', points)
275
+ .and('be.disabled');
276
+ },
277
+
278
+ /**
279
+ * @param {string} altTextValue alternative text of the added image in image section
280
+ * @description this function verifies the alternative text of the added image in image section
281
+ */
282
+ verifyImageAltTextAttributeImageSection: (altTextValue) => {
283
+ figOverImageCommonComponent.imageSectionImage()
284
+ .should('have.attr', 'alt', altTextValue);
285
+ },
286
+
287
+ /**
288
+ * @param {string} altTextValue alternative text of the added image in preview tab
289
+ * @description this function verifies the alternative text of the added image in preview tab
290
+ */
291
+ verifyImageAltTextAttributePreviewTab: (altTextValue) => {
292
+ figOverImageCommonComponent.imagePreviewTab()
293
+ .should('have.attr', 'alt', altTextValue);
294
+ },
295
+
296
+ /**
297
+ * @param {number} imageWidth width of image in image section
298
+ * @description this function verifies the width of image in image section
299
+ */
300
+ verifyImageWidthInImageSection: (imageWidth) => {
301
+ figOverImageCommonComponent.imageSectionImage()
302
+ .should('be.visible')
303
+ .and('have.css', 'width', `${imageWidth}px`)
304
+ },
305
+
306
+ /**
307
+ * @param {number} imageWidth width of image in preview tab
308
+ * @description this function verifies the width of image in preview tab
309
+ */
310
+ verifyImageWidthInPreviewTab: (imageWidth) => {
311
+ figOverImageCommonComponent.imagePreviewTab()
312
+ .should('be.visible')
313
+ .and('have.css', 'width', `${imageWidth}px`)
314
+ },
315
+
316
+ /**
317
+ * @param {number} imageHeight height of image in image section
318
+ * @description this function verifies the height of image in image section
319
+ */
320
+ verifyImageHeightInImageSection: (imageHeight) => {
321
+ figOverImageCommonComponent.imageSectionImage()
322
+ .should('be.visible')
323
+ .and('have.css', 'height', `${imageHeight}px`)
324
+ },
325
+
326
+ /**
327
+ * @param {number} imageHeight height of image in preview tab
328
+ * @description this function verifies the height of image in preview tab
329
+ */
330
+ verifyImageHeightInPreviewTab: (imageHeight) => {
331
+ figOverImageCommonComponent.imagePreviewTab()
332
+ .should('be.visible')
333
+ .and('have.css', 'height', `${imageHeight}px`)
334
+ },
335
+
336
+ /**
337
+ * Verifies the value of a placeholder text input field.
338
+ * @param {string} value - The expected value to match the placeholder text input field.
339
+ */
340
+ verifyPlaceholderTextInputFieldValue: (value) => {
341
+ figOverImageCommonComponent.placeholderTextInputField()
342
+ .should('have.value', value)
343
+ },
344
+
345
+ /**
346
+ * Verifies the value of an input field for additional settings' height.
347
+ * @param {string} value - The expected value to match the input field.
348
+ */
349
+ verifyAdditionalSettingsHeightInputFieldValue: (value) => {
350
+ figOverImageCommonComponent.responseFieldHeightInputField()
351
+ .should('have.attr', 'value', value)
352
+ },
353
+
354
+ /**
355
+ * Verifies the value of an input field for additional settings' width.
356
+ * @param {string} value - The expected value to match the input field.
357
+ */
358
+ verifyAdditionalSettingsWidthInputFieldValue: (value) => {
359
+ figOverImageCommonComponent.responseFieldWidthInputField()
360
+ .should('have.attr', 'value', value)
361
+ },
362
+
363
+ verifyFixPositionOnImageCheckboxUnchecked: () => {
364
+ figOverImageCommonComponent.fixPositionOnImageCheckbox()
365
+ .should('not.be.checked');
366
+ },
367
+
368
+ /**
369
+ * Sets the placeholder text for a response field.
370
+ * @param {string} placeholderText - The placeholder text to set in the response field.
371
+ */
372
+ setResponseFieldPlaceholderTextGlobal: (placeholderText) => {
373
+ figOverImageCommonComponent.placeholderTextInputField()
374
+ .eq(0)
375
+ .type(placeholderText, { delay: 0 })
376
+ .should('have.value', placeholderText)
377
+ },
378
+
379
+ clearPlaceholderTextInputFieldGlobal: () => {
380
+ figOverImageCommonComponent.placeholderTextInputField()
381
+ .eq(0)
382
+ .clear();
383
+ },
384
+
385
+ /**
386
+ * Set the width of a response field in the additional settings for all response areas.
387
+ * @param {string} width - The width value to set for the response field.
388
+ */
389
+ setResponseFieldWidthGlobal: (width) => {
390
+ figOverImageCommonComponent.responseFieldWidthInputField()
391
+ .eq(0)
392
+ .clear()
393
+ .type(width, { delay: 0 })
394
+ .should('have.value', width)
395
+ .blur();
396
+ },
397
+
398
+ /**
399
+ * Set the height of a response field in the additional settings for all response areas.
400
+ * @param {string} height - The height value to set for the response field.
401
+ */
402
+ setResponseFieldHeightGlobal: (height) => {
403
+ figOverImageCommonComponent.responseFieldHeightInputField()
404
+ .eq(0)
405
+ .clear()
406
+ .type(height, { delay: 0 })
407
+ .should('have.value', height)
408
+ .blur();
409
+ },
410
+
411
+ /**
412
+ * Verify the label and input field for a placeholder text in a response accordion.
413
+ * @param {number} responseAccordionIndex - The index of the response accordion to verify.
414
+ */
415
+ verifyPlaceholderTextLabelAndInputFieldResponseAccordion: (responseAccordionIndex) => {
416
+ figOverImageCommonComponent.responseAccordionWrapper()
417
+ .eq(responseAccordionIndex)
418
+ .within(() => {
419
+ utilities.verifyInnerText(figOverImageCommonComponent.placeholderTextLabelResponseAccordion(), 'Placeholder text');
420
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.placeholderTextLabelResponseAccordion(), 'visible');
421
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.placeholderTextInputField(), 'visible');
422
+ figOverImageCommonComponent.steps.verifyPlaceholderTextInputFieldValue('');
423
+ });
424
+ },
425
+
426
+ /**
427
+ * Verify the label and dropdown for a pointer in a response accordion.
428
+ * @param {number} responseAccordionIndex - The index of the response accordion to verify.
429
+ */
430
+ verifyPointerLabelAndDropdownResponseAccordion: (responseAccordionIndex) => {
431
+ figOverImageCommonComponent.responseAccordionWrapper()
432
+ .eq(responseAccordionIndex)
433
+ .within(() => {
434
+ utilities.verifyInnerText(figOverImageCommonComponent.pointerLabel(), 'Pointer');
435
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.pointerLabel(), 'visible');
436
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.pointerDropdown(), 'visible');
437
+ utilities.verifyInnerText(figOverImageCommonComponent.pointerDropdown(), 'Left');
438
+ });
439
+ },
440
+
441
+ /**
442
+ * Verify the label and input fields for height and width in a response accordion.
443
+ * @param {number} responseAccordionIndex - The index of the response accordion to verify.
444
+ */
445
+ verifyHeightAndWidthLabelAndInputFieldResponseAccordion: (responseAccordionIndex) => {
446
+ figOverImageCommonComponent.responseAccordionWrapper()
447
+ .eq(responseAccordionIndex)
448
+ .within(() => {
449
+ utilities.verifyInnerText(figOverImageCommonComponent.responseFieldHeightLabel(), 'Height (px)');
450
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.responseFieldHeightLabel(), 'visible');
451
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.responseFieldHeightInputField(), 'visible');
452
+ figOverImageCommonComponent.steps.verifyAdditionalSettingsHeightInputFieldValue('');
453
+ utilities.verifyInnerText(figOverImageCommonComponent.responseFieldWidthLabel(), 'Width (px)');
454
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.responseFieldWidthLabel(), 'visible');
455
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.responseFieldWidthInputField(), 'visible');
456
+ figOverImageCommonComponent.steps.verifyAdditionalSettingsWidthInputFieldValue('');
457
+ });
458
+ },
459
+
460
+ /**
461
+ * Verify the collapsed state of a response accordion.
462
+ * @param {number} responseAccordionIndex - The index of the response accordion to verify.
463
+ */
464
+ verifyResponseAccordionCollapsedState: (responseAccordionIndex) => {
465
+ figOverImageCommonComponent.responseAccordion()
466
+ .eq(responseAccordionIndex)
467
+ .should('have.attr', 'aria-expanded', 'false')
468
+ },
469
+
470
+ /**
471
+ * Expand a response accordion.
472
+ * @param {number} responseAccordionIndex - The index of the response accordion to expand.
473
+ */
474
+ expandResponseAccordion: (responseAccordionIndex) => {
475
+ figOverImageCommonComponent.responseAccordion()
476
+ .eq(responseAccordionIndex)
477
+ .click()
478
+ .should('have.attr', 'aria-expanded', 'true');
479
+ },
480
+
481
+ /**
482
+ * Collapse a response accordion.
483
+ * @param {number} responseAccordionIndex - The index of the response accordion to collapse.
484
+ */
485
+ collapseResponseAccordion: (responseAccordionIndex) => {
486
+ figOverImageCommonComponent.responseAccordionWrapper()
487
+ .eq(responseAccordionIndex)
488
+ .click()
489
+ .should('have.attr', 'aria-expanded', 'false');
490
+ },
491
+
492
+ /**
493
+ * Set placeholder text in a response accordion.
494
+ * @param {number} responseAccordionIndex - The index of the response accordion to set placeholder text in.
495
+ * @param {string} textContent - The placeholder text to set.
496
+ */
497
+ setPlaceholderTextInResponseAccordion: (responseAccordionIndex, textContent) => {
498
+ figOverImageCommonComponent.responseAccordionWrapper()
499
+ .eq(responseAccordionIndex)
500
+ .within(() => {
501
+ figOverImageCommonComponent.placeholderTextInputField()
502
+ .type(textContent)
503
+ .should('have.value', textContent);
504
+ });
505
+ },
506
+
507
+ /**
508
+ * Clear placeholder text in a response accordion.
509
+ * @param {number} responseAccordionIndex - The index of the response accordion to clear placeholder text in.
510
+ */
511
+ clearPlaceholderTextInResponseAccordion: (responseAccordionIndex) => {
512
+ figOverImageCommonComponent.responseAccordionWrapper()
513
+ .eq(responseAccordionIndex)
514
+ .within(() => {
515
+ figOverImageCommonComponent.placeholderTextInputField()
516
+ .clear();
517
+ });
518
+ },
519
+
520
+ /**
521
+ * Set the width value in a response accordion.
522
+ * @param {number} responseAccordionIndex - The index of the response accordion to set width value in.
523
+ * @param {string} value - The width value to set.
524
+ */
525
+ setWidthInResponseAccordion: (responseAccordionIndex, value) => {
526
+ figOverImageCommonComponent.responseAccordionWrapper()
527
+ .eq(responseAccordionIndex)
528
+ .within(() => {
529
+ figOverImageCommonComponent.responseFieldWidthInputField()
530
+ .clear()
531
+ .type(value)
532
+ .should('have.value', value);
533
+ });
534
+ },
535
+
536
+ /**
537
+ * Set the height value in a response accordion.
538
+ * @param {number} responseAccordionIndex - The index of the response accordion to set height value in.
539
+ * @param {string} value - The height value to set.
540
+ */
541
+ setHeightInResponseAccordion: (responseAccordionIndex, value) => {
542
+ figOverImageCommonComponent.responseAccordionWrapper()
543
+ .eq(responseAccordionIndex)
544
+ .within(() => {
545
+ figOverImageCommonComponent.responseFieldHeightInputField()
546
+ .clear()
547
+ .type(value)
548
+ .should('have.value', value);
549
+ });
550
+ },
551
+
552
+ verifyDisabledStateOfEditAriaLabelsForResponseContainersCheckbox: () => {
553
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.editAriaLabelForResponseContainersLabel(), 'visible');
554
+ figOverImageCommonComponent.editAriaLabelForResponseContainersCheckbox()
555
+ .should('be.disabled');
556
+ },
557
+
558
+ verifyDefaultEnabledStateOfEditAriaLabelsForResponseContainersCheckbox: () => {
559
+ figOverImageCommonComponent.editAriaLabelForResponseContainersCheckbox()
560
+ .should('be.enabled');
561
+ figOverImageCommonComponent.editAriaLabelForResponseContainersCheckbox()
562
+ .should('not.be.checked');
563
+ },
564
+
565
+ checkEditAriaLabelCheckbox: () => {
566
+ figOverImageCommonComponent.editAriaLabelForResponseContainersCheckbox()
567
+ .click()
568
+ .should('be.checked');
569
+ },
570
+
571
+ uncheckEditAriaLabelCheckbox: () => {
572
+ figOverImageCommonComponent.editAriaLabelForResponseContainersCheckbox()
573
+ .click()
574
+ .should('not.be.checked');
575
+ },
576
+
577
+ /**
578
+ * @param {number} numberOfAriaLabelInputFields Total number of edit aria label input fields
579
+ * @description Verify contents of edit aria label input fields
580
+ */
581
+ verifyEditAriaLabelInputFieldContents: (numberOfAriaLabelInputFields) => {
582
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.ariaLabelsInputField(), 'visible');
583
+ figOverImageCommonComponent.ariaLabelsInputField()
584
+ .each(($el) => {
585
+ cy.wrap($el)
586
+ .should('have.attr', 'placeholder', 'Enter label');
587
+ });
588
+ for (let index = 0; index < numberOfAriaLabelInputFields; index++) {
589
+ utilities.verifyTextContent(figOverImageCommonComponent.ariaLabelsInputFieldNumeration().eq(index), `${index + 1}`);
590
+ }
591
+ utilities.verifyElementCount(figOverImageCommonComponent.ariaLabelsInputFieldNumeration(), `${numberOfAriaLabelInputFields}`);
592
+ },
593
+
594
+ /**
595
+ * @param {number} index Index of aria-label input field
596
+ * @param {string} responseContainerAriaLabel Text to be given as aria-label for response container/dropdown
597
+ * @description Enter text in edit aria-label input field
598
+ */
599
+ enterTextInEditAriaLabelInputField: (index, responseContainerAriaLabel) => {
600
+ figOverImageCommonComponent.ariaLabelsInputField()
601
+ .eq(index)
602
+ .clear()
603
+ .type(responseContainerAriaLabel)
604
+ .should('have.value', responseContainerAriaLabel);
605
+ },
606
+
607
+ /**
608
+ * @param {number} index Index of aria-label input field
609
+ * @description Clear aria-label input field
610
+ */
611
+ clearEditAriaLabelInputField: (index) => {
612
+ figOverImageCommonComponent.ariaLabelsInputField()
613
+ .eq(index)
614
+ .clear();
615
+ },
616
+
617
+ /**
618
+ * @param {number} index Index of response container
619
+ * @param {string} ariaLabel Aria-label of response container
620
+ * @description Verify aria-label of response container
621
+ */
622
+ verifyResponseContainerAriaLabelAttribute: (index, ariaLabel) => {
623
+ figOverImageCommonComponent.responseContainer()
624
+ .eq(index)
625
+ .find('.draggable-input')
626
+ .should('have.attr', 'aria-label', ariaLabel);
627
+ },
628
+
629
+ verifyResponseAccordionLabel: (responseAccordionIndex) => {
630
+ utilities.verifyInnerText(figOverImageCommonComponent.responseAccordionLabel().eq(responseAccordionIndex), `Response ${responseAccordionIndex + 1}`);
631
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.responseAccordionLabel().eq(responseFieldIndex), 'visible');
632
+ },
633
+
634
+ /**
635
+ * @param {string} fileFormat format of the uploaded file in the image section
636
+ * @description this function verifies the attribute of the image has the expected file format
637
+ */
638
+ verifyUploadedImageFormatInImageSection: (fileFormat) => {
639
+ figOverImageCommonComponent.imageSectionImage()
640
+ .should(($element) => {
641
+ const srcAttributeValue = $element.attr('src');
642
+ expect(srcAttributeValue).to.include(fileFormat);
643
+ });
644
+ },
645
+
646
+ /**
647
+ * @param {string} fileFormat format of the uploaded file in the image section
648
+ * @description this function verifies the attribute of the image has the expected file format
649
+ */
650
+ verifyUploadedImageFormatInPreviewTab: (fileFormat) => {
651
+ figOverImageCommonComponent.imagePreviewTab()
652
+ .should(($element) => {
653
+ const srcAttributeValue = $element.attr('src');
654
+ expect(srcAttributeValue).to.include(fileFormat);
655
+ });
656
+ },
657
+
658
+
659
+ verifyDisplayAnswerNumerationToStudentsCheckboxNotChecked: () => {
660
+ figOverImageCommonComponent.displayAnswerNumerationToStudentsCheckbox()
661
+ .should('not.be.checked');
662
+ },
663
+
664
+ checkDisplayAnswerNumerationToStudentsCheckbox: () => {
665
+ figOverImageCommonComponent.displayAnswerNumerationToStudentsCheckbox()
666
+ .click()
667
+ .should('be.checked');
668
+ }
669
+ }
670
+
671
+ const tests = {
672
+ verifyMaximumNumberOfTokensSnackbarCSSandA11y: () => {
673
+ it('CSS of maximum number of tokens snackbar', { tags: 'css' }, () => {
674
+ utilities.verifyCSS(commonComponents.snackbar(), {
675
+ 'color': css.color.whiteText,
676
+ 'font-size': css.fontSize.normal,
677
+ 'font-weight': css.fontWeight.regular
678
+ });
679
+ });
680
+ it('Accessibility of maximum number of tokens snackbar', { tags: 'a11y' }, () => {
681
+ cy.checkAccessibility(commonComponents.snackbar());
682
+ });
683
+ },
684
+
685
+ verifyDisabledStateOfAddResponseContainerButton: () => {
686
+ it('When user has added 15 response containers in the image section, then the \'Add response container\' button should be disabled', () => {
687
+ figOverImageCommonComponent.addResponseContainerButton()
688
+ .should('be.disabled');
689
+ });
690
+
691
+ it('CSS of disabled \'Add response container\' button', { tags: 'css' }, () => {
692
+ utilities.verifyCSS(figOverImageCommonComponent.addResponseContainerButton(), {
693
+ 'color': css.color.secondaryBtnDisabled
694
+ })
695
+ });
696
+
697
+ it('Accessibility of disabled \'Add response container\' button', { tags: 'a11y' }, () => {
698
+ cy.checkAccessibility(figOverImageCommonComponent.addResponseContainerButton());
699
+ });
700
+ },
701
+
702
+ verifySetCorrectAnswerSectionDefaultState: () => {
703
+ it('When the user has not added any response containers over an image, A help text \'Please add response tokens\' should be displayed in the set correct answer section', () => {
704
+ utilities.verifyInnerText(figOverImageCommonComponent.pleaseAddResponseTokenHelpText(), 'Please add response tokens');
705
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.pleaseAddResponseTokenHelpText(), 'visible');
706
+ });
707
+
708
+ it(`CSS of \'Please add response tokens\' help text`, { tags: 'css' }, () => {
709
+ utilities.verifyCSS(figOverImageCommonComponent.pleaseAddResponseTokenHelpText(), {
710
+ 'color': css.color.helperText,
711
+ 'font-size': css.fontSize.normal,
712
+ 'font-weight': css.fontWeight.regular,
713
+ 'font-style': 'italic'
714
+ });
715
+ });
716
+ },
717
+
718
+ verifyCustomLabelNotVisibleOnResponseAccordion: (advancedSetting) => {
719
+ it(`When user has not set ${advancedSetting} in the input field then Custom label should not be displayed on the response accordion`, () => {
720
+ figOverImageCommonComponent.responseAccordionCustomLabel()
721
+ .should('not.exist');
722
+ });
723
+ },
724
+
725
+ verifyCustomLabelVisibleOnResponseAccordion: (advancedSetting) => {
726
+ it(`When the user sets ${advancedSetting} for a response then Custom label should be displayed on that response accordion and the other accordion should remain the same`, () => {
727
+ figOverImageCommonComponent.responseAccordionWrapper()
728
+ .eq(0)
729
+ .within(() => {
730
+ figOverImageCommonComponent.responseAccordionCustomLabel()
731
+ .verifyInnerText('Custom')
732
+ .should('be.visible');
733
+ });
734
+ figOverImageCommonComponent.responseAccordionWrapper()
735
+ .eq(1)
736
+ .within(() => {
737
+ figOverImageCommonComponent.responseAccordionCustomLabel()
738
+ .should('not.exist');
739
+ });
740
+ });
741
+ },
742
+
743
+ verifyImagePropertiesSectionContents: () => {
744
+ it('When the user has not added an image, the image properties section and it\'s contents should not be displayed', () => {
745
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.imageSectionImage(), 'notExist');
746
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.imagePropertiesContainer(), 'notExist');
747
+ });
748
+
749
+ it('When the user adds an image, \'Image hover text\' label and empty input field, \'Image alternative text\' label and empty input field should be displayed', () => {
750
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
751
+ figOverImageCommonComponent.steps.clickOnImagePopupOkButton();
752
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.imageSectionImage(), 'visible');
753
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.imageHoverTextLabel(), 'visible');
754
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.imageHoverTextInputField(), 'visible');
755
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.imageAlternativeTextLabel(), 'visible');
756
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.imageAlternativeTextInputField(), 'visible');
757
+ });
758
+
759
+ it('When the user has added an image, \'Height (px)\' label and input field, \'Width (px)\' label and input field with prefilled values of the image height and width should be displayed', () => {
760
+ utilities.verifyInnerText(figOverImageCommonComponent.heightLabel(), 'Height (px)');
761
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.heightLabel(), 'visible');
762
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.heightInputField(), 'visible');
763
+ utilities.verifyInnerText(figOverImageCommonComponent.widthLabel(), 'Width (px)');
764
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.widthLabel(), 'visible');
765
+ utilities.verifyElementVisibilityState(figOverImageCommonComponent.widthInputField(), 'visible');
766
+ figOverImageCommonComponent.steps.verifyHeightInputFieldValue(500);
767
+ figOverImageCommonComponent.steps.verifyWidthInputFieldValue(500);
768
+ });
769
+
770
+ it('CSS of image properties section', { tags: 'css' }, () => {
771
+ const labelCSS = {
772
+ 'color': css.color.labels,
773
+ 'font-size': css.fontSize.normal,
774
+ 'font-weight': css.fontWeight.semibold
775
+ }
776
+ const inputFieldCSS = {
777
+ 'color': css.color.text,
778
+ 'font-size': css.fontSize.default,
779
+ 'font-weight': css.fontWeight.regular
780
+ }
781
+ utilities.verifyCSS(figOverImageCommonComponent.imageHoverTextLabel(), labelCSS);
782
+ utilities.verifyCSS(figOverImageCommonComponent.imageAlternativeTextLabel(), labelCSS);
783
+ utilities.verifyCSS(figOverImageCommonComponent.widthLabel(), labelCSS);
784
+ utilities.verifyCSS(figOverImageCommonComponent.heightLabel(), labelCSS);
785
+ utilities.verifyCSS(figOverImageCommonComponent.imageHoverTextInputField(), inputFieldCSS);
786
+ utilities.verifyCSS(figOverImageCommonComponent.imageAlternativeTextInputField(), inputFieldCSS);
787
+ utilities.verifyCSS(figOverImageCommonComponent.widthInputField(), inputFieldCSS);
788
+ utilities.verifyCSS(figOverImageCommonComponent.heightInputField(), inputFieldCSS);
789
+ });
790
+
791
+ it('Accessibility of image properties section', { tags: 'a11y' }, () => {
792
+ cy.checkAccessibility(figOverImageCommonComponent.imageHoverTextLabel().parents('.common-text-wrapper'));
793
+ });
794
+ },
795
+
796
+ verifyImageHoverAndAlternativeTextFunctionalityInEditTab: () => {
797
+ it('The user should be able to enter text in the \'Image hover text\' input field, on hovering over the image, the entered text should appear on a tooltip and on hovering away from the image, the tooltip should disappear', () => {
798
+ figOverImageCommonComponent.steps.enterTextInImageHoverTextInputField('Flower');
799
+ figOverImageCommonComponent.imageSectionImage()
800
+ .verifyTooltip('Flower');
801
+ });
802
+
803
+ it('CSS of the image tooltip', { tags: 'css' }, () => {
804
+ utilities.hoverOverElement(figOverImageCommonComponent.imageSectionImage());
805
+ utilities.verifyCSS(commonComponents.tooltipText(), {
806
+ 'color': css.color.whiteText,
807
+ 'font-size': css.fontSize.normal,
808
+ 'font-weight': css.fontWeight.regular
809
+ });
810
+ utilities.hoverAwayFromElement(figOverImageCommonComponent.imageSectionImage());
811
+ });
812
+
813
+ it('Accessibility of the image tooltip', { tags: 'a11y' }, () => {
814
+ utilities.hoverOverElement(figOverImageCommonComponent.imageSectionImage());
815
+ cy.checkAccessibility(commonComponents.tooltipText());
816
+ utilities.hoverAwayFromElement(figOverImageCommonComponent.imageSectionImage());
817
+ });
818
+
819
+ it('When the user clears the text from the \'Image hover text\' input field, on hovering over the image, no tooltip should appear', () => {
820
+ figOverImageCommonComponent.steps.clearTextFromImageHoverTextInputField();
821
+ utilities.hoverOverElement(figOverImageCommonComponent.imageSectionImage());
822
+ utilities.verifyElementVisibilityState(commonComponents.tooltipText(), 'notExist');
823
+ });
824
+
825
+ //Update after https://redmine.zeuslearning.com/issues/546992 is resolved
826
+ it('When the user has not added any alternative text in the \'Image alternative text\' input field, the \'alt\' attribute of the added image should be blank', () => {
827
+ figOverImageCommonComponent.steps.verifyImageAltTextAttributeImageSection('');
828
+ });
829
+
830
+ it('When the user enters text in the \'Image alternative text\' input field, the added text should appear as the \'alt\' attribute of the added image', () => {
831
+ figOverImageCommonComponent.steps.enterTextInImageAlternativeTextInputField(constants.flowerImageAltText);
832
+ figOverImageCommonComponent.steps.verifyImageAltTextAttributeImageSection(constants.flowerImageAltText);
833
+ });
834
+
835
+ it('When the user clears the text in the \'Image alternative text\' input field, the \'alt\' attribute of the added image should again appear as blank', () => {
836
+ figOverImageCommonComponent.steps.clearTextFromImageAlternativeTextInputField();
837
+ figOverImageCommonComponent.steps.verifyImageAltTextAttributeImageSection('');
838
+ });
839
+ },
840
+
841
+ verifyImageHoverAndAlternativeTextFunctionalityInPreviewTab: () => {
842
+ it('When the user adds text in the \'Image hover text\' input field and switches to the preview tab, on hovering over the image, the entered text should appear on a tooltip and on hovering away from the image, the tooltip should disappear', () => {
843
+ figOverImageCommonComponent.steps.enterTextInImageHoverTextInputField('Flower');
844
+ createQuestionBasePage.steps.switchToPreviewTab();
845
+ figOverImageCommonComponent.imagePreviewTab()
846
+ .verifyTooltip('Flower');
847
+ });
848
+
849
+ it('CSS of the image tooltip', { tags: 'css' }, () => {
850
+ utilities.hoverOverElement(figOverImageCommonComponent.imagePreviewTab());
851
+ utilities.verifyCSS(commonComponents.tooltipText(), {
852
+ 'color': css.color.whiteText,
853
+ 'font-size': css.fontSize.normal,
854
+ 'font-weight': css.fontWeight.regular
855
+ });
856
+ utilities.hoverAwayFromElement(figOverImageCommonComponent.imagePreviewTab());
857
+ });
858
+
859
+ it('Accessibility of the image tooltip', { tags: 'a11y' }, () => {
860
+ utilities.hoverOverElement(figOverImageCommonComponent.imagePreviewTab());
861
+ cy.checkAccessibility(commonComponents.tooltipText());
862
+ utilities.hoverAwayFromElement(figOverImageCommonComponent.imagePreviewTab());
863
+ });
864
+
865
+ it('When the user clears the text from the \'Image hover text\' input field and switches to the preview tab, on hovering over the image, no tooltip should appear', () => {
866
+ createQuestionBasePage.steps.switchToEditTab();
867
+ figOverImageCommonComponent.steps.clearTextFromImageHoverTextInputField();
868
+ createQuestionBasePage.steps.switchToPreviewTab();
869
+ utilities.hoverOverElement(figOverImageCommonComponent.imagePreviewTab());
870
+ utilities.verifyElementVisibilityState(commonComponents.tooltipText(), 'notExist');
871
+ });
872
+
873
+ it('When the user has not added any alternative text in the \'Image alternative text\' input field, the \'alt\' attribute of the added image in the preview tab should be blank', () => {
874
+ figOverImageCommonComponent.steps.verifyImageAltTextAttributePreviewTab('');
875
+ });
876
+
877
+ it('When the user enters text in the \'Image alternative text\' input field, the added text should appear as the \'alt\' attribute of the added image in the preview tab', () => {
878
+ createQuestionBasePage.steps.switchToEditTab();
879
+ figOverImageCommonComponent.steps.enterTextInImageAlternativeTextInputField(constants.flowerImageAltText);
880
+ createQuestionBasePage.steps.switchToPreviewTab();
881
+ figOverImageCommonComponent.steps.verifyImageAltTextAttributePreviewTab(constants.flowerImageAltText);
882
+ });
883
+
884
+ it('When the user clears the text in the \'Image alternative text\' input field, the \'alt\' attribute of the added image should again appear as blank', () => {
885
+ createQuestionBasePage.steps.switchToEditTab();
886
+ figOverImageCommonComponent.steps.clearTextFromImageAlternativeTextInputField();
887
+ createQuestionBasePage.steps.switchToPreviewTab();
888
+ figOverImageCommonComponent.steps.verifyImageAltTextAttributePreviewTab('');
889
+ });
890
+ },
891
+
892
+ verifyImagePropertiesHeightAndWidthInputFieldInEditTab: () => {
893
+ it('When the user updates the value in the height input field, the height of the added image should update accordingly', () => {
894
+ figOverImageCommonComponent.steps.enterTextInHeightInputField(250);
895
+ figOverImageCommonComponent.steps.verifyImageHeightInImageSection(250);
896
+ });
897
+
898
+ it('When the user updates the value in the width input field, the width of the added image should update accordingly', () => {
899
+ figOverImageCommonComponent.steps.enterTextInWidthInputField(250);
900
+ figOverImageCommonComponent.steps.verifyImageWidthInImageSection(250);
901
+ });
902
+ },
903
+
904
+ verifyImagePropertiesHeightAndWidthInputFieldInPreviewTab: () => {
905
+ it('When the user updates the value in the height input field, the height of the added image should update accordingly', () => {
906
+ figOverImageCommonComponent.steps.enterTextInHeightInputField(250);
907
+ createQuestionBasePage.steps.switchToPreviewTab();
908
+ figOverImageCommonComponent.steps.verifyImageHeightInPreviewTab(250);
909
+ });
910
+
911
+ it('When the user updates the value in the width input field, the width of the added image should update accordingly', () => {
912
+ createQuestionBasePage.steps.switchToEditTab();
913
+ figOverImageCommonComponent.steps.enterTextInWidthInputField(250);
914
+ createQuestionBasePage.steps.switchToPreviewTab();
915
+ figOverImageCommonComponent.steps.verifyImageWidthInPreviewTab(250);
916
+ });
917
+ }
918
+ }
919
+
920
+ export const figOverImageCommonComponent = {
921
+ ...selectors,
922
+ steps,
923
+ tests
924
+ }