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,884 @@
1
+ import utilities from "../../support/helpers/utilities";
2
+ import { additionalSettingsPanel } from "./additionalSettingsPanel";
3
+ import { autoScoredAdditionalSettings } from "./autoScoredAdditionalSettings";
4
+ import { autoScoredScoringSectionMultipleResponsesType } from "./autoScoredScoringSectionMultipleResponsesType";
5
+ import { autoScoredSetCorrectAnswerSection } from "./autoScoredSetCorrectAnswerSection";
6
+ import { commonComponents } from "./commonComponents";
7
+ import { figOverImageCommonComponent } from "./figOverImageCommonComponent";
8
+ import { scoringSectionBase } from "./scoringSectionBase";
9
+ import { specialAndCustomSpecialCharactersComponent } from "./specialAndCustomSpecialCharactersComponent";
10
+ const css = Cypress.env('css');
11
+
12
+ const selectors = {
13
+ responseFieldSetCorrectAnswerSection: () => cy.get('.response-input-field input[type="text"]'),
14
+ responseFieldWrapperSetCorrectAnswerSection: () => cy.get('.response-input-field'),
15
+ responseFieldLabelSetCorrectAnswerSection: () => cy.get('.response-label'),
16
+ caseSensitiveLabel: () => cy.get('.ngie-checkbox-control-label').eq(0),
17
+ caseSensitiveCheckbox: () => cy.get('.ngie-checkbox input').eq(0),
18
+ ignoreSpacesBeforeAndAfterLabel: () => cy.get('.ngie-checkbox-control-label').eq(1),
19
+ ignoreSpacesBeforeAndAfterCheckbox: () => cy.get('.ngie-checkbox input').eq(1),
20
+ matchFromAllResponsesLabel: () => cy.get('.ngie-checkbox-control-label').eq(2),
21
+ matchFromAllResponsesCheckbox: () => cy.get('.ngie-checkbox input').eq(2),
22
+ responseFieldPreviewTab: () => cy.get('.edit-question-preview-wrapper .response-input-field input[type="text"]'),
23
+ responseFieldWrapperPreviewTab: () => cy.get('.edit-question-preview-wrapper .response-input-field'),
24
+ previewTabCorrectAnswerContainer: () => cy.get('[class*="ClozeWithTextResponsestyles__CorrectAnswerWrapper"]'),
25
+ previewTabCorrectAnswerResponseWrapper: () => cy.get('[class*="ClozeWithTextResponsestyles__CorrectResponseWrapper"] [aria-label*="Response"]'),
26
+ previewTabResponseWrapper: () => cy.get('.draggable-input .cloze-with-text-answer-status-response-preview-wrapper'),
27
+ previewTabCorrectAnswerLabel: () => cy.get('[class*="ClozeWithTextResponsestyles__CorrectAnswerLabel"]'),
28
+ responseNumeration: () => cy.get('.response-input-adornment'),
29
+ setCharacterLimitLabel: () => cy.get('[aria-labelledby="Set character limit"]'),
30
+ setCharacterLimitInputField: () => cy.get('input[aria-label="Set character limit"]'),
31
+ typeOfAnswerInputLabel: () => cy.get('[id*="Type-of-Answer-input"][id*="dropdown-label"]'),
32
+ typeOfAnswerInputDropdown: () => cy.get('[id*="Type-of-Answer-input"][id*="select"]'),
33
+ typeOfAnswerInputDropdownListOptions: (ariaLabel = null) => {
34
+ if (ariaLabel) {
35
+ return cy.get(`[aria-labelledby*="Type-of-Answer-input"][aria-labelledby*="dropdown-label"] li[role="option"][aria-label*="${ariaLabel}"]`)
36
+ } else {
37
+ return cy.get('[aria-labelledby*="Type-of-Answer-input"][aria-labelledby*="dropdown-label"] li[role="option"]')
38
+ }
39
+ },
40
+ multilineResponseLabel: () => cy.get('[data-ngie-testid="multiline-response-checkbox"] .MuiFormControlLabel-label'),
41
+ multilineResponseCheckbox: () => cy.get('[data-ngie-testid="multiline-response-checkbox"] input'),
42
+ multilineResponseAreaSetCorrectAnswerSection: () => cy.get('.response-multiline-input-field textarea'),
43
+ multilineResponseAreaPreviewTab: () => cy.get('.cloze-with-text-response-preview-wrapper .response-multiline-input-field textarea'),
44
+ spellCheckLabel: () => cy.get('[data-ngie-testid="spell-check-checkbox"] .MuiFormControlLabel-label'),
45
+ spellCheckCheckbox: () => cy.get('[data-ngie-testid="spell-check-checkbox"] input[type="checkbox"]'),
46
+ previewTabResponseFieldSpecialCharactersButton: () => cy.get('.cloze-with-text-response-preview-wrapper .custon-special-character-button'),
47
+ }
48
+
49
+ const steps = {
50
+ /**
51
+ * Enters text into a response field in the 'Set correct answer' section.
52
+ * @param {number} index - The index of the response field to target.
53
+ * @param {string} text - The text to be entered into the response field.
54
+ * @returns {void}
55
+ */
56
+ enterTextInResponseFieldSetCorrectAnswerSection: (index, text) => {
57
+ fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
58
+ .eq(index)
59
+ .clear()
60
+ .type(text)
61
+ .blur();
62
+ },
63
+
64
+ /**
65
+ * Clears the response field in the correct answer section at the specified index.
66
+ * @param {number} index - The index of the response field to clear.
67
+ */
68
+ clearResponseFieldSetCorrectAnswerSection: (index) => {
69
+ fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
70
+ .eq(index)
71
+ .clear();
72
+ },
73
+
74
+ /**
75
+ * Clears the response field in the preview tab at the specified index.
76
+ * @param {number} index - The index of the response field to clear.
77
+ */
78
+ clearResponseFieldPreviewTab: (index) => {
79
+ fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
80
+ .eq(index)
81
+ .clear();
82
+ },
83
+
84
+ /**
85
+ * Verifies the text value in a response field in the 'Set Correct Answer' section.
86
+ * @param {number} index - The index of the response field to target.
87
+ * @param {string} value - The expected text value to compare against.
88
+ * @returns {void}
89
+ */
90
+ verifyTextInResponseFieldSetCorrectAnswerSection: (index, value) => {
91
+ fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
92
+ .eq(index)
93
+ .should('have.attr', 'value', value);
94
+ },
95
+
96
+ /**
97
+ * Enters text into a response field in the preview tab
98
+ * @param {number} index - The index of the response field to target.
99
+ * @param {string} text - The text to be entered into the response field.
100
+ * @returns {void}
101
+ */
102
+ enterTextInResponseFieldPreviewTab: (index, text) => {
103
+ fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
104
+ .eq(index)
105
+ .clear()
106
+ .type(text)
107
+ .blur();
108
+ },
109
+
110
+ /**
111
+ * Verifies the text value in a response field in the 'Set Correct Answer' section.
112
+ * @param {number} index - The index of the response field to target.
113
+ * @param {string} value - The expected text value to compare against.
114
+ * @returns {void}
115
+ */
116
+ verifyTextInResponseFieldPreviewTab: (index, value) => {
117
+ fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
118
+ .eq(index)
119
+ .should('have.attr', 'value', value);
120
+ },
121
+
122
+ verifyMatchFromAllResponsesLabelAndCheckboxEnabledState: () => {
123
+ fillInTheGapsTextCommonComponent.matchFromAllResponsesLabel()
124
+ .should('not.have.class', 'Mui-disabled');
125
+ fillInTheGapsTextCommonComponent.matchFromAllResponsesCheckbox()
126
+ .and('not.be.disabled');
127
+ },
128
+
129
+ verifyCaseSensitiveCheckboxNotChecked: () => {
130
+ fillInTheGapsTextCommonComponent.caseSensitiveCheckbox()
131
+ .should('not.be.checked');
132
+ },
133
+
134
+ verifyCaseSensitiveCheckBoxChecked: () => {
135
+ fillInTheGapsTextCommonComponent.caseSensitiveCheckbox()
136
+ .should('be.checked')
137
+ },
138
+
139
+ verifyIgnoreSpacesBeforeAndAfterCheckboxChecked: () => {
140
+ fillInTheGapsTextCommonComponent.ignoreSpacesBeforeAndAfterCheckbox()
141
+ .should('be.checked');
142
+ },
143
+
144
+ verifyIgnoreSpacesBeforeAndAfterCheckboxNotChecked: () => {
145
+ fillInTheGapsTextCommonComponent.ignoreSpacesBeforeAndAfterCheckbox()
146
+ .should('not.be.checked');
147
+ },
148
+
149
+ verifyMatchFromAllResponsesLabelAndCheckboxDisabledState: () => {
150
+ fillInTheGapsTextCommonComponent.matchFromAllResponsesLabel()
151
+ .should('have.class', 'Mui-disabled');
152
+ fillInTheGapsTextCommonComponent.matchFromAllResponsesCheckbox()
153
+ .and('be.disabled');
154
+ },
155
+
156
+ //Note: Need to move this in figOverImageCommonComponent file along with the selectors once the checkbox enhancement build is uploaded
157
+ checkMatchFromAllResponsesCheckbox: () => {
158
+ fillInTheGapsTextCommonComponent.matchFromAllResponsesCheckbox()
159
+ .click()
160
+ .should('be.checked');
161
+ },
162
+
163
+ /**
164
+ * @param {string[]} correctAnswerArray array of correct answer response
165
+ * @param {number[]} optionNumerationArray numeration of the correct answer response
166
+ * @description verify the correct answer responses in the correct answer container
167
+ */
168
+ verifyCorrectAnswerResponsesInCorrectAnswerContainerAndCount: (correctAnswerArray, optionNumerationArray) => {
169
+ fillInTheGapsTextCommonComponent.previewTabCorrectAnswerContainer()
170
+ .should('be.visible')
171
+ .within(() => {
172
+ correctAnswerArray.forEach((responseFieldText, count) => {
173
+ fillInTheGapsTextCommonComponent.previewTabCorrectAnswerResponseWrapper()
174
+ .eq(count)
175
+ .should('have.value', responseFieldText);
176
+ });
177
+ optionNumerationArray.forEach((optionNumeration, count) => {
178
+ fillInTheGapsTextCommonComponent.responseNumeration()
179
+ .eq(count)
180
+ .should('have.text', `${optionNumeration}`);
181
+ });
182
+ });
183
+ fillInTheGapsTextCommonComponent.previewTabCorrectAnswerResponseWrapper()
184
+ .should('have.length', optionNumerationArray.length);
185
+ },
186
+
187
+ /**
188
+ * Verify that the incorrect option at the specified index has a cross-mark icon and is visible.
189
+ * @param {number} index - The index of the incorrect option to verify.
190
+ */
191
+ verifyIncorrectOptionCrossmarkIcon: (index) => {
192
+ fillInTheGapsTextCommonComponent.previewTabResponseWrapper()
193
+ .eq(index)
194
+ .find('.tick-icon-wrapper')
195
+ .should('have.class', 'icon-incorrect')
196
+ .and('be.visible');
197
+ },
198
+
199
+ /**
200
+ * Verify that the correct option at the specified index has a check-mark icon and is visible.
201
+ * @param {number} index - The index of the correct option to verify.
202
+ */
203
+ verifyCorrectOptionCheckmarkIcon: (index) => {
204
+ fillInTheGapsTextCommonComponent.previewTabResponseWrapper()
205
+ .eq(index)
206
+ .find('.tick-icon-wrapper')
207
+ .should('have.class', 'icon-correct')
208
+ .and('be.visible');
209
+ },
210
+
211
+ verifyPreviewTabCorrectAnswerContainerNotExist: () => {
212
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.previewTabCorrectAnswerContainer(), 'notExist');
213
+ },
214
+
215
+ checkCaseSensitiveCheckbox: () => {
216
+ fillInTheGapsTextCommonComponent.caseSensitiveCheckbox()
217
+ .click()
218
+ .should('be.checked');
219
+ },
220
+
221
+ uncheckIgnoreSpacesBeforeAndAfterCheckbox: () => {
222
+ fillInTheGapsTextCommonComponent.ignoreSpacesBeforeAndAfterCheckbox()
223
+ .click()
224
+ .should('not.be.checked');
225
+ },
226
+
227
+ uncheckMatchFromAllResponsesCheckbox: () => {
228
+ fillInTheGapsTextCommonComponent.matchFromAllResponsesCheckbox()
229
+ .click()
230
+ .should('not.be.checked')
231
+ },
232
+
233
+ /**
234
+ * @param {number} index - The index of the option to verify.
235
+ * @description Verify that the option at the specified index does not have a check-mark or cross-mark.
236
+ */
237
+ verifyCheckmarkOrCrossmarkNotVisible: (index) => {
238
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.previewTabResponseWrapper().eq(index).find('.tick-icon-wrapper'), 'notExist');
239
+ },
240
+
241
+ /**
242
+ * Verify the character limit input field value.
243
+ * @param {string} value - The expected character limit value to match the input field value.
244
+ */
245
+ verifySetCharacterLimitInputFieldValue: (value) => {
246
+ fillInTheGapsTextCommonComponent.setCharacterLimitInputField()
247
+ .should('have.value', value)
248
+ },
249
+
250
+ /**
251
+ * Verify that the placeholder attribute does not exist in a response field in the Correct Answer section.
252
+ * @param {number} responseFieldIndex - The index of the response field to verify.
253
+ */
254
+ verifyPlaceholderAttributeInSetCorrectAnswerSectionResponseFieldNotExists: (responseFieldIndex) => {
255
+ fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
256
+ .eq(responseFieldIndex)
257
+ .should('not.have.attr', 'placeholder');
258
+ },
259
+
260
+ /**
261
+ * Verify that the placeholder attribute does not exist in a response field in the Preview Tab.
262
+ * @param {number} responseFieldIndex - The index of the response field to verify.
263
+ */
264
+ verifyPlaceholderAttributeInPreviewTabResponseFieldNotExists: (responseFieldIndex) => {
265
+ fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
266
+ .eq(responseFieldIndex)
267
+ .should('not.have.attr', 'placeholder');
268
+ },
269
+
270
+ /**
271
+ * Verify the placeholder attribute in a response field in the Correct Answer section.
272
+ * @param {number} responseFieldIndex - The index of the response field to verify.
273
+ * @param {string} placeholderText - The expected placeholder text to match the attribute.
274
+ */
275
+ verifyPlaceholderAttributeInSetCorrectAnswerSectionResponseField: (responseFieldIndex, placeholderText) => {
276
+ fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
277
+ .eq(responseFieldIndex)
278
+ .should('have.attr', 'placeholder', placeholderText);
279
+ },
280
+
281
+ /**
282
+ * Verify the placeholder attribute in a response field in the Preview Tab.
283
+ * @param {number} responseFieldIndex - The index of the response field to verify.
284
+ * @param {string} placeholderText - The expected placeholder text to match the attribute.
285
+ */
286
+ verifyPlaceholderAttributeInPreviewTabResponseField: (responseFieldIndex, placeholderText) => {
287
+ fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
288
+ .eq(responseFieldIndex)
289
+ .should('have.attr', 'placeholder', placeholderText);
290
+ },
291
+
292
+ /**
293
+ * @param {index} responseIndex Index of response field
294
+ * @param {string} ariaLabel Aria-label of response field
295
+ * @description Verify Aria-label of response field in set correct answer section
296
+ * @param {number} index of response field in preview tab
297
+ * @description this function focuses in the preview atb response field
298
+ */
299
+ focusInResponseFieldPreviewTab: (index) => {
300
+ fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
301
+ .eq(index)
302
+ .click();
303
+ },
304
+
305
+ /**
306
+ * @param {index} responseIndex Index of response
307
+ * @param {string} ariaLabel Aria-label of response
308
+ * @description Verify aria-label of response in set correct answer section
309
+ */
310
+ verifyResponseFieldAriaLabelAttributeInSetCorrectAnswerSection: (responseIndex, ariaLabel) => {
311
+ fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
312
+ .eq(responseIndex)
313
+ .should('have.attr', 'aria-label', ariaLabel);
314
+ },
315
+
316
+ /**
317
+ * @param {index} responseIndex Index of response field
318
+ * @param {string} ariaLabel Aria-label of response field
319
+ * @description Verify Aria-label of response field in preview tab
320
+ */
321
+ verifyResponseFieldAriaLabelAttributeInPreviewTab: (responseIndex, ariaLabel) => {
322
+ fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
323
+ .eq(responseIndex)
324
+ .should('have.attr', 'aria-label', ariaLabel);
325
+ },
326
+
327
+ /**
328
+ * @param {number} responseIndex Index of response field
329
+ * @description Verify response is displayed in set correct answer section
330
+ */
331
+ verifyResponseFieldIsDisplayedInSetCorrectAnswerSection: (responseIndex) => {
332
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection().eq(responseIndex), 'visible');
333
+ },
334
+
335
+ /**
336
+ * @param {array} dropdownOptionsArray array of type of answer dropdown options
337
+ * @description This function is used to verify the type of answer dropdown options
338
+ */
339
+ verifyTypeOfAnswerDropdownOptions: (dropdownOptionsArray) => {
340
+ dropdownOptionsArray.forEach((option, count) => {
341
+ fillInTheGapsTextCommonComponent.typeOfAnswerInputDropdownListOptions()
342
+ .eq(count)
343
+ .should('have.text', option);
344
+ });
345
+ },
346
+
347
+ clickOnTypeOfAnswerDropdown: () => {
348
+ fillInTheGapsTextCommonComponent.typeOfAnswerInputDropdown()
349
+ .eq(0)
350
+ .click();
351
+ },
352
+
353
+ /**
354
+ * Select a specific option from the "Type of Answer" dropdown.
355
+ * @param {("Text" | "Number")} option - The option to select from the dropdown.
356
+ */
357
+ selectTypeOfAnswerDropdownOption: (option) => {
358
+ fillInTheGapsTextCommonComponent.typeOfAnswerInputDropdownListOptions(option)
359
+ .click();
360
+ },
361
+
362
+ setCharacterLimit: (value) => {
363
+ fillInTheGapsTextCommonComponent.setCharacterLimitInputField()
364
+ .clear()
365
+ .type(value)
366
+ .blur();
367
+ },
368
+
369
+ verifySetCharacterLimitInputFieldMinimumValue: () => {
370
+ fillInTheGapsTextCommonComponent.setCharacterLimitInputField()
371
+ .should('not.have.value', '0')
372
+ .and('have.value', '1');
373
+ },
374
+
375
+ clearSetCharacterLimitInputField: () => {
376
+ fillInTheGapsTextCommonComponent.setCharacterLimitInputField()
377
+ .clear()
378
+ .blur();
379
+ },
380
+
381
+ /**
382
+ * Verify the height attribute of a response field in the Correct Answer section.
383
+ * @param {number} responseFieldIndex - The index of the response field to verify.
384
+ * @param {string} height - The expected height value to match the attribute.
385
+ */
386
+ verifyHeightResponseFieldSetCorrectAnswerSection: (responseFieldIndex, height) => {
387
+ fillInTheGapsTextCommonComponent.responseFieldWrapperSetCorrectAnswerSection()
388
+ .eq(responseFieldIndex)
389
+ .should('have.attr', 'height', height);
390
+ },
391
+
392
+ /**
393
+ * Verify the width attribute of a response field in the Correct Answer section.
394
+ * @param {number} responseFieldIndex - The index of the response field to verify.
395
+ * @param {string} width - The expected width value to match the attribute.
396
+ */
397
+ verifyWidthResponseFieldSetCorrectAnswerSection: (responseFieldIndex, width) => {
398
+ fillInTheGapsTextCommonComponent.responseFieldWrapperSetCorrectAnswerSection()
399
+ .eq(responseFieldIndex)
400
+ .should('have.attr', 'width', width);
401
+ },
402
+
403
+ /**
404
+ * Verify the height attribute of a response field in the Preview Tab.
405
+ * @param {number} responseFieldIndex - The index of the response field to verify.
406
+ * @param {string} height - The expected height value to match the attribute.
407
+ */
408
+ verifyHeightResponseFieldPreviewTab: (responseFieldIndex, height) => {
409
+ fillInTheGapsTextCommonComponent.responseFieldWrapperPreviewTab()
410
+ .eq(responseFieldIndex)
411
+ .should('have.attr', 'height', height);
412
+ },
413
+
414
+ /**
415
+ * Verify the width attribute of a response field in the Preview Tab.
416
+ * @param {number} responseFieldIndex - The index of the response field to verify.
417
+ * @param {string} width - The expected width value to match the attribute.
418
+ */
419
+ verifyWidthResponseFieldPreviewTab: (responseFieldIndex, width) => {
420
+ fillInTheGapsTextCommonComponent.responseFieldWrapperPreviewTab()
421
+ .eq(responseFieldIndex)
422
+ .should('have.attr', 'width', width);
423
+ },
424
+
425
+ verifyTypeOfAnswerLabelAndDropdownResponseAccordion: () => {
426
+ figOverImageCommonComponent.responseAccordionWrapper()
427
+ .within(() => {
428
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.typeOfAnswerInputLabel(), 'Type of answer input');
429
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.typeOfAnswerInputLabel(), 'visible');
430
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.typeOfAnswerInputDropdown(), 'visible');
431
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.typeOfAnswerInputDropdown(), 'Text');
432
+ });
433
+ },
434
+
435
+ /**
436
+ * Click on the "Type of Answer" dropdown in a response accordion.
437
+ * @param {number} responseIndex - The index of the response accordion to click the dropdown in.
438
+ */
439
+ clickOnTypeOfAnswerDropdownInResponseAccordion: (responseIndex) => {
440
+ figOverImageCommonComponent.responseAccordionWrapper()
441
+ .eq(responseIndex)
442
+ .within(() => {
443
+ fillInTheGapsTextCommonComponent.typeOfAnswerInputDropdown()
444
+ .click();
445
+ });
446
+ },
447
+
448
+ /**
449
+ * Verify the selected option in the "Type of Answer" dropdown in a response accordion.
450
+ * @param {number} responseIndex - The index of the response accordion to verify.
451
+ * @param {string} option - The expected option to be selected in the dropdown.
452
+ */
453
+ verifySelectedOptionInTypeOfAnswerDropdownInResponseAccordion: (responseIndex, option) => {
454
+ figOverImageCommonComponent.responseAccordionWrapper()
455
+ .eq(responseIndex)
456
+ .within(() => {
457
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.typeOfAnswerInputDropdown(), option);
458
+ });
459
+ },
460
+
461
+ verifyMultilineResponseCheckboxNotChecked: () => {
462
+ fillInTheGapsTextCommonComponent.multilineResponseCheckbox()
463
+ .should('not.be.checked');
464
+ },
465
+
466
+ verifyMultilineResponseForResponseFieldSetCorrectAnswerSectionDisabled: () => {
467
+ fillInTheGapsTextCommonComponent.responseFieldWrapperSetCorrectAnswerSection()
468
+ .each(($el) => {
469
+ cy.wrap($el)
470
+ .should('not.have.class', 'response-multiline-input-field');
471
+ // Assert that textarea does not exist
472
+ cy.wrap($el)
473
+ .find('textarea')
474
+ .should('not.exist');
475
+ });
476
+ },
477
+
478
+ verifyMultilineResponseForResponseFieldPreviewTabDisabled: () => {
479
+ fillInTheGapsTextCommonComponent.responseFieldWrapperPreviewTab()
480
+ .each(($el) => {
481
+ cy.wrap($el)
482
+ .should('not.have.class', 'response-multiline-input-field')
483
+ // Assert that textarea does not exist
484
+ cy.wrap($el)
485
+ .find('textarea')
486
+ .should('not.exist');
487
+ });
488
+ },
489
+
490
+ checkMultilineResponseCheckbox: () => {
491
+ fillInTheGapsTextCommonComponent.multilineResponseCheckbox()
492
+ .click()
493
+ .should('be.checked');
494
+ },
495
+
496
+ uncheckMultilineResponseCheckbox: () => {
497
+ fillInTheGapsTextCommonComponent.multilineResponseCheckbox()
498
+ .click()
499
+ .should('not.be.checked');
500
+ },
501
+
502
+ /**
503
+ * Enter text in a multiline response area in the set correct answer section.
504
+ * @param {number} responseFieldIndex - The index of the response field to enter text in.
505
+ * @param {string} text - The text to enter in the multiline response area.
506
+ */
507
+ enterTextInMultilineResponseAreaSetCorrectAnswerSection: (responseFieldIndex, text) => {
508
+ fillInTheGapsTextCommonComponent.multilineResponseAreaSetCorrectAnswerSection()
509
+ .eq(responseFieldIndex)
510
+ .clear()
511
+ .type(text);
512
+ },
513
+
514
+ /**
515
+ * Verify the text in a multiline response area in the set correct answer section.
516
+ * @param {number} responseFieldIndex - The index of the response field to verify.
517
+ * @param {string} text - The expected text to be present in the multiline response area.
518
+ */
519
+ verifyTextInMultilineResponseAreaSetCorrectAnswerSection: (responseFieldIndex, text) => {
520
+ fillInTheGapsTextCommonComponent.multilineResponseAreaSetCorrectAnswerSection()
521
+ .eq(responseFieldIndex)
522
+ .should('have.text', text);
523
+ },
524
+
525
+ /**
526
+ * Enter text in a multiline response area in the Preview Tab.
527
+ * @param {number} responseFieldIndex - The index of the response field to enter text in.
528
+ * @param {string} text - The text to enter in the multiline response area.
529
+ */
530
+ enterTextInMultilineResponseAreaPreviewTab: (responseFieldIndex, text) => {
531
+ fillInTheGapsTextCommonComponent.multilineResponseAreaPreviewTab()
532
+ .eq(responseFieldIndex)
533
+ .clear()
534
+ .type(text);
535
+ },
536
+
537
+ /**
538
+ * Verify the text in a multiline response area in the Preview Tab.
539
+ * @param {number} responseFieldIndex - The index of the response field to verify.
540
+ * @param {string} text - The expected text to be present in the multiline response area.
541
+ */
542
+ verifyTextInMultilineResponseAreaPreviewTab: (responseFieldIndex, text) => {
543
+ fillInTheGapsTextCommonComponent.multilineResponseAreaPreviewTab()
544
+ .eq(responseFieldIndex)
545
+ .should('have.text', text);
546
+ },
547
+
548
+ verifySpellCheckCheckboxNotChecked: () => {
549
+ fillInTheGapsTextCommonComponent.spellCheckCheckbox()
550
+ .should('not.be.checked');
551
+ },
552
+
553
+ /**
554
+ * Verify that the spell check for a response field in the Correct Answer section is disabled.
555
+ * @param {number} responseFieldIndex - The index of the response field to verify.
556
+ */
557
+ verifySpellCheckOfResponseFieldSetCorrectAnswerSectionDisabled: (responseFieldIndex) => {
558
+ fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
559
+ .eq(responseFieldIndex)
560
+ .should('have.attr', 'spellcheck', 'false');
561
+ },
562
+
563
+ /**
564
+ * Verify that the spell check for a response field in the Correct Answer section is enabled.
565
+ * @param {number} responseFieldIndex - The index of the response field to verify.
566
+ */
567
+ verifySpellCheckOfResponseFieldSetCorrectAnswerSectionEnabled: (responseFieldIndex) => {
568
+ fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
569
+ .eq(responseFieldIndex)
570
+ .should('have.attr', 'spellcheck', 'true');
571
+ },
572
+
573
+ /**
574
+ * Verify that the spell check for a response field in the Preview Tab is disabled.
575
+ * @param {number} responseFieldIndex - The index of the response field to verify.
576
+ */
577
+ verifySpellCheckOfResponseFieldPreviewTabDisabled: (responseFieldIndex) => {
578
+ fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
579
+ .eq(responseFieldIndex)
580
+ .should('have.attr', 'spellcheck', 'false');
581
+ },
582
+
583
+ /**
584
+ * Verify that the spell check for a response field in the Preview Tab is enabled.
585
+ * @param {number} responseFieldIndex - The index of the response field to verify.
586
+ */
587
+ verifySpellCheckOfResponseFieldPreviewTabEnabled: (responseFieldIndex) => {
588
+ fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
589
+ .eq(responseFieldIndex)
590
+ .should('have.attr', 'spellcheck', 'true');
591
+ },
592
+
593
+ checkSpellCheckCheckbox: () => {
594
+ fillInTheGapsTextCommonComponent.spellCheckCheckbox()
595
+ .click()
596
+ .should('be.checked');
597
+ },
598
+
599
+ /**
600
+ * Verify the numeration of response fields in the Preview Tab and Correct Answer section.
601
+ * @param {string[]} numerationArray - An array of expected numeration strings to verify.
602
+ */
603
+ verifyPreviewTabResponseFieldAndCorrectAnswerNumeration: (numerationArray) => {
604
+ numerationArray.forEach((optionNumeration, index) => {
605
+ fillInTheGapsTextCommonComponent.previewTabResponseWrapper()
606
+ .eq(index)
607
+ .within(() => {
608
+ fillInTheGapsTextCommonComponent.responseNumeration()
609
+ .should('have.text', optionNumeration);
610
+ });
611
+ fillInTheGapsTextCommonComponent.previewTabCorrectAnswerResponseWrapper()
612
+ .eq(index)
613
+ .parent()
614
+ .within(() => {
615
+ fillInTheGapsTextCommonComponent.responseNumeration()
616
+ .should('have.text', optionNumeration);
617
+ });
618
+ });
619
+ },
620
+
621
+ /**
622
+ * @param {number} responseIndex Index of response field in preview tab
623
+ * @description Verify response field is displayed in preview tab
624
+ */
625
+ verifyResponseFieldIsDisplayedInPreviewTab: (responseIndex) => {
626
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.responseFieldPreviewTab().eq(responseIndex), 'visible');
627
+ },
628
+
629
+ /**
630
+ * Verify that the special character button is not visible in a response field in the Correct Answer section.
631
+ * @param {number} responseFieldIndex - The index of the response field to verify.
632
+ */
633
+ verifySpecialCharacterButtonNotVisibleInResponseFieldSetCorrectAnswerSection: (responseFieldIndex) => {
634
+ specialAndCustomSpecialCharactersComponent.setCorrectAnsResponseFieldSpecialCharactersButton()
635
+ .eq(responseFieldIndex)
636
+ .should('not.have.class', 'active-response-input-field')
637
+ .should('not.be.visible');
638
+ },
639
+
640
+ /**
641
+ * Focus and verify the special characters button in a response field in the Correct Answer section.
642
+ * @param {number} responseFieldIndex - The index of the response field to focus and verify.
643
+ */
644
+ focusAndVerifySpecialCharactersButtonInResponseFieldSetCorrectAnswerSection: (responseFieldIndex) => {
645
+ fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
646
+ .eq(responseFieldIndex)
647
+ .click();
648
+ specialAndCustomSpecialCharactersComponent.setCorrectAnsResponseFieldSpecialCharactersButton()
649
+ .eq(responseFieldIndex)
650
+ .should('have.class', 'active-response-input-field')
651
+ .should('be.visible');
652
+ },
653
+
654
+ /**
655
+ * Verify that the special character button is not visible in a response field in the Preview Tab.
656
+ * @param {number} responseFieldIndex - The index of the response field to verify.
657
+ */
658
+ verifySpecialCharacterButtonNotVisibleInResponseFieldPreviewTab: (responseFieldIndex) => {
659
+ fillInTheGapsTextCommonComponent.previewTabResponseFieldSpecialCharactersButton()
660
+ .eq(responseFieldIndex)
661
+ .should('not.have.class', 'active-response-input-field')
662
+ .should('not.be.visible');
663
+ },
664
+
665
+ /**
666
+ * Focus and verify the special characters button in a response field in the Preview Tab.
667
+ * @param {number} responseFieldIndex - The index of the response field to focus and verify.
668
+ */
669
+ focusAndVerifySpecialCharactersButtonInResponseFieldPreviewTab: (responseFieldIndex) => {
670
+ fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
671
+ .eq(responseFieldIndex)
672
+ .click();
673
+ fillInTheGapsTextCommonComponent.previewTabResponseFieldSpecialCharactersButton()
674
+ .eq(responseFieldIndex)
675
+ .should('have.class', 'active-response-input-field')
676
+ .should('be.visible');
677
+ },
678
+
679
+ /**
680
+ * Click on the special characters button in a response field in the Preview Tab.
681
+ * @param {number} responseFieldIndex - The index of the response field to click the button.
682
+ */
683
+ clickOnSpecialCharactersButtonPreviewTab: (responseFieldIndex) => {
684
+ fillInTheGapsTextCommonComponent.previewTabResponseFieldSpecialCharactersButton()
685
+ .eq(responseFieldIndex)
686
+ .click();
687
+ },
688
+
689
+ /**
690
+ * Verify the numeration of response fields in the Preview Tab.
691
+ * @param {string[]} optionNumerationArray - An array of expected numeration strings to verify.
692
+ */
693
+ verifyResponseFieldNumeration: (optionNumerationArray) => {
694
+ fillInTheGapsTextCommonComponent.previewTabResponseWrapper()
695
+ .should('be.visible')
696
+ .within(() => {
697
+ optionNumerationArray.forEach((optionNumeration, count) => {
698
+ fillInTheGapsTextCommonComponent.responseNumeration()
699
+ .eq(count)
700
+ .should('have.text', `${optionNumeration}`);
701
+ });
702
+ });
703
+ }
704
+ }
705
+
706
+ const tests = {
707
+ ...autoScoredSetCorrectAnswerSection.tests,
708
+ /**
709
+ * @param {string} tabName Correct or Alternate tab
710
+ * @description This function verifies the input field and error states of set correct answer section
711
+ */
712
+ verifySetCorrectAnswerTabContentsAndFunctionality: (tabName) => {
713
+ it('An empty points input field and two empty response fields with labels \'Response 1\' and \'Response 2\' should be present', () => {
714
+ scoringSectionBase.steps.verifyPointsFieldValue('');
715
+ for (let index = 0; index < 2; index++) {
716
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.responseFieldLabelSetCorrectAnswerSection().eq(index), `Response ${index + 1}`)
717
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection().eq(index), 'visible');
718
+ };
719
+ });
720
+
721
+ it('User should be able to enter text in the empty response field', () => {
722
+ fillInTheGapsTextCommonComponent.steps.enterTextInResponseFieldSetCorrectAnswerSection(0, 'Flower');
723
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseFieldSetCorrectAnswerSection(0, 'Flower');
724
+ });
725
+
726
+ it(`When the user has only partially filled response fields out of the available response fields, \'Error: Please set a correct answer.\' validation error message should be thrown along with an error icon on the \'${tabName}\'`, () => {
727
+ fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
728
+ .eq(1)
729
+ .focus()
730
+ .blur();
731
+ utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: Please set a correct answer.');
732
+ if (tabName == 'Correct tab') {
733
+ autoScoredSetCorrectAnswerSection.correctTab()
734
+ .within(() => {
735
+ utilities.verifyElementVisibilityState(autoScoredSetCorrectAnswerSection.setCorrectAnswerErrorIcon(), 'visible');
736
+ });
737
+ } else {
738
+ autoScoredSetCorrectAnswerSection.alternateAnswerTab(1)
739
+ .within(() => {
740
+ utilities.verifyElementVisibilityState(autoScoredSetCorrectAnswerSection.setCorrectAnswerErrorIcon(), 'visible');
741
+ });
742
+ };
743
+ });
744
+
745
+ autoScoredSetCorrectAnswerSection.tests.verifyCSSAndA11yOfAutoScoredSetCorrectAnswerErrorMessage();
746
+
747
+ it('CSS of response field error state', { tags: 'css' }, () => {
748
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.responseFieldWrapperSetCorrectAnswerSection().eq(1), {
749
+ 'background-color': css.color.errorFieldBg
750
+ });
751
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.responseFieldWrapperSetCorrectAnswerSection().eq(1).find('fieldset'), {
752
+ 'border': `1px solid ${css.color.errorFieldBorder}`
753
+ });
754
+ });
755
+
756
+ it('Accessibility of response field error state', { tags: 'a11y' }, () => {
757
+ cy.checkAccessibility(fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection().parents('.cloze-with-text-response-form-controls-wrapper'));
758
+ });
759
+
760
+ it('When the user has added text in all the available response fields, the error message should disappear', () => {
761
+ fillInTheGapsTextCommonComponent.steps.enterTextInResponseFieldSetCorrectAnswerSection(1, 'Leaf');
762
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseFieldSetCorrectAnswerSection(1, 'Leaf');
763
+ utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'notExist');
764
+ });
765
+
766
+ autoScoredSetCorrectAnswerSection.tests.verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty(tabName);
767
+
768
+ it(`CSS of ${tabName} contents`, { tags: 'css' }, () => {
769
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.responseFieldLabelSetCorrectAnswerSection(), {
770
+ 'color': css.color.labels,
771
+ 'font-size': css.fontSize.default,
772
+ 'font-weight': css.fontWeight.regular
773
+ });
774
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection(), {
775
+ 'color': css.color.text,
776
+ 'font-size': css.fontSize.default,
777
+ 'font-weight': css.fontWeight.regular
778
+ });
779
+ });
780
+
781
+ it(`Accessibility of ${tabName} contents`, { tags: 'a11y' }, () => {
782
+ cy.checkAccessibility(fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection().parents('.cloze-with-text-authoring-mode-response-wrapper'));
783
+ });
784
+ },
785
+
786
+ verifyCorrectResponseConditionSectionDefaultState: () => {
787
+ it('\'Case sensitive\' functionality label and checkbox should be displayed and by default it should be unchecked', () => {
788
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.caseSensitiveLabel(), 'Case sensitive');
789
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.caseSensitiveLabel(), 'visible');
790
+ fillInTheGapsTextCommonComponent.steps.verifyCaseSensitiveCheckboxNotChecked();
791
+ });
792
+
793
+ it('\'Ignore spaces before and after\' functionality label and checkbox should be displayed and by default it should be checked', () => {
794
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.ignoreSpacesBeforeAndAfterLabel(), 'Ignore spaces before and after');
795
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.ignoreSpacesBeforeAndAfterLabel(), 'visible');
796
+ fillInTheGapsTextCommonComponent.steps.verifyIgnoreSpacesBeforeAndAfterCheckboxChecked();
797
+ });
798
+
799
+ it('\'Match from all responses\' functionality label and checkbox should be displayed and by default it should be unchecked and disabled', () => {
800
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.matchFromAllResponsesLabel(), 'Match from all responses');
801
+ fillInTheGapsTextCommonComponent.steps.verifyMatchFromAllResponsesLabelAndCheckboxDisabledState();
802
+ });
803
+
804
+ it('When the user hovers over the \'Match from all responses\' label, \'Feature available for only alternate correct answers\' text should appear on a tooltip, on hovering away from the label, the tooltip should disappear', () => {
805
+ fillInTheGapsTextCommonComponent.matchFromAllResponsesLabel()
806
+ .verifyTooltip('Feature available for only alternate correct answers');
807
+ });
808
+
809
+ it('CSS of correct response conditions section', { tags: 'css' }, () => {
810
+ const labels = [fillInTheGapsTextCommonComponent.caseSensitiveLabel, fillInTheGapsTextCommonComponent.ignoreSpacesBeforeAndAfterLabel, fillInTheGapsTextCommonComponent.matchFromAllResponsesLabel]
811
+ const uncheckedCheckboxes = [fillInTheGapsTextCommonComponent.caseSensitiveCheckbox, fillInTheGapsTextCommonComponent.matchFromAllResponsesCheckbox]
812
+ labels.forEach((checkingLabel) => {
813
+ utilities.verifyCSS(checkingLabel(), {
814
+ 'color': css.color.labelText,
815
+ 'font-size': css.fontSize.normal,
816
+ 'font-weight': css.fontWeight.regular
817
+ });
818
+ });
819
+ uncheckedCheckboxes.forEach((uncheckedCheckbox) => {
820
+ utilities.verifyCSS(uncheckedCheckbox().parent().find('svg'), {
821
+ 'fill': css.color.uncheckedCheckbox
822
+ });
823
+ });
824
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.ignoreSpacesBeforeAndAfterCheckbox().parent().find('svg'), {
825
+ 'fill': css.color.activeButtons
826
+ });
827
+ cy.log('Checking CSS of match from all responses tooltip')
828
+ utilities.hoverOverElement(fillInTheGapsTextCommonComponent.matchFromAllResponsesLabel());
829
+ utilities.verifyElementVisibilityState(commonComponents.tooltipText(), 'visible');
830
+ utilities.verifyCSS(commonComponents.tooltipText(), {
831
+ 'color': css.color.whiteText,
832
+ 'font-size': css.fontSize.normal,
833
+ 'font-weight': css.fontWeight.regular,
834
+ 'background-color': css.color.tooltipBg
835
+ });
836
+ utilities.verifyElementVisibilityState(commonComponents.tooltipText(), 'notExist');
837
+ });
838
+
839
+ it(`Accessibility of correct response conditions section`, { tags: 'a11y' }, () => {
840
+ cy.checkAccessibility(fillInTheGapsTextCommonComponent.ignoreSpacesBeforeAndAfterCheckbox().parents('.ngie-checkbox-form-group'));
841
+ cy.log('Checking a11y of match from all responses tooltip')
842
+ utilities.hoverOverElement(fillInTheGapsTextCommonComponent.matchFromAllResponsesLabel());
843
+ utilities.verifyElementVisibilityState(commonComponents.tooltipText(), 'visible');
844
+ cy.checkAccessibility(commonComponents.tooltipText());
845
+ utilities.verifyElementVisibilityState(commonComponents.tooltipText(), 'notExist');
846
+ });
847
+ },
848
+
849
+ verifyResponseContentsOfSetCorrectAnswerSection: () => {
850
+ it('Response option contents should be displayed in the set correct answer section', () => {
851
+ for (let index = 0; index < 2; index++) {
852
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.responseFieldLabelSetCorrectAnswerSection().eq(index), `Response ${index + 1}`)
853
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection().eq(index), 'visible');
854
+ };
855
+ });
856
+ },
857
+
858
+ verifyManualScoringEditTabFunctionality: () => {
859
+ it('When the user has selected \'Manually scored\' option from the \'Scoring type\' dropdown then the \'Set correct answer\' section should not be displayed; \'All or nothing\', \'Partial - equal weights\' and \'Partial - different weights\' radio buttons should not be displayed; \'Points\' and \'Minimum score awarded (if attempted)\' labels and input fields should be displayed and inside additional settings accordion, Check answer section i.e. \'Allow students to check answer\' checkbox should not be displayed', () => {
860
+ utilities.verifyElementVisibilityState(autoScoredSetCorrectAnswerSection.setCorrectAnswerLabel(), 'notExist');
861
+ utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.allOrNothingCheckbox(), 'notExist');
862
+ utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.partialEqualWeightsCheckbox(), 'notExist');
863
+ utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.partialDifferentWeightsCheckbox(), 'notExist');
864
+ utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.penaltyPointsInputField(), 'notExist');
865
+ utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.penaltyPointsLabel(), 'notExist');
866
+ utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.rounddownScoreCheckbox(), 'notExist');
867
+ utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.rounddownScoreCheckboxLabel(), 'notExist');
868
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.caseSensitiveCheckbox(), 'notExist');
869
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.ignoreSpacesBeforeAndAfterCheckbox(), 'notExist');
870
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.matchFromAllResponsesCheckbox(), 'notExist');
871
+ scoringSectionBase.steps.verifyDefaultMinimumScoreIfAttemptedLabelAndPointsField();
872
+ additionalSettingsPanel.steps.expandAdditonalSettings();
873
+ utilities.verifyElementVisibilityState(autoScoredAdditionalSettings.checkAnswerLabel(), 'notExist');
874
+ utilities.verifyElementVisibilityState(autoScoredAdditionalSettings.allowStudentsToCheckAnswerLabel(), 'notExist');
875
+ utilities.verifyElementVisibilityState(autoScoredAdditionalSettings.allowStudentsToCheckAnswerCheckbox(), 'notExist');
876
+ });
877
+ }
878
+ }
879
+
880
+ export const fillInTheGapsTextCommonComponent = {
881
+ ...selectors,
882
+ steps,
883
+ tests
884
+ }