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,442 @@
1
+ import utilities from "../../support/helpers/utilities"
2
+ import { commonComponents } from "./commonComponents"
3
+ import { optionsWrapperComponent } from "./optionsWrapperComponent"
4
+ import { scoringSectionBase } from "./scoringSectionBase"
5
+ import { autoScoredSetCorrectAnswerSection } from "./autoScoredSetCorrectAnswerSection"
6
+ import { autoScoredScoringSectionMultipleResponsesType } from "./autoScoredScoringSectionMultipleResponsesType"
7
+ import { additionalSettingsPanel } from "./additionalSettingsPanel"
8
+ import { autoScoredAdditionalSettings } from "./autoScoredAdditionalSettings"
9
+ const css = Cypress.env('css');
10
+
11
+ let optionsForResponse = ['changing', 'progressively', 'healthy', 'new'];
12
+
13
+ const selectors = {
14
+ ...commonComponents,
15
+ ...optionsWrapperComponent,
16
+ ...scoringSectionBase,
17
+ optionsForResponseContainer: () => cy.get('.edit-mcq-options-wrapper'),
18
+ optionsForResponseLabel: () => cy.get('.options-label'),
19
+ responseDropdownOptions: (ariaLabel = null) => {
20
+ if (ariaLabel) {
21
+ return cy.get(`[role="listbox"] .dropdown-menu-item[aria-label*="${ariaLabel}"]`)
22
+ } else {
23
+ return cy.get('[role="listbox"] .dropdown-menu-item')
24
+ }
25
+ },
26
+ responseDropdownSetCorrectAnswerSection: () => cy.get('.response-dropdown [role="combobox"]'),
27
+ responseFieldLabelSetCorrectAnswerSection: () => cy.get('.cloze-with-text-form-control-wrapper .input-field-label'),
28
+ responseDropdownWrapperSetCorrectAnswerSection: () => cy.get('.response-dropdown-wrapper .dropdown-form-control'),
29
+ optionsForResponseInputField: () => cy.get('.input-editable input[type*="text"]'),
30
+ //TODO: Update class name once https://redmine.zeuslearning.com/issues/518498 is resolved
31
+ optionIsRequiredErrorMessage: () => cy.get('.Mui-error.Mui-required'),
32
+ optionNumeration: () => cy.get('.MuiInputAdornment-positionStart'),
33
+ responseDropdownPlaceholderText: () => cy.get('.cloze-with-dropdown-placeholder'),
34
+ randomizeOptionsCheckbox: () => cy.get('[data-ngie-testid="randomize-options-checkbox"] input'),
35
+ matchFromAllResponsesCheckbox: () => cy.get('[data-ngie-testid="match-from-all-responses-checkbox"] input'),
36
+ randomizeOptionsLabel: () => cy.get('[data-ngie-testid="randomize-options-checkbox"] .MuiFormControlLabel-label'),
37
+ matchFromAllResponsesLabel: () => cy.get('[data-ngie-testid="match-from-all-responses-checkbox"] .MuiFormControlLabel-label'),
38
+ }
39
+
40
+ const steps = {
41
+ ...scoringSectionBase.steps,
42
+ /**
43
+ * @param {number} responseIndex index of the response token/container
44
+ * @description Verify that options for response label and its section is displayed for the response token
45
+ */
46
+ verifyOptionsForResponseLabelAndSectionIsDisplayed: (responseIndex) => {
47
+ utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.optionsForResponseContainer().eq(responseIndex), 'visible');
48
+ utilities.verifyInnerText(fillInTheGapsDropdownCommonComponent.optionsForResponseLabel().eq(responseIndex), `Options for response ${responseIndex + 1}`);
49
+ },
50
+
51
+ /**
52
+ * @param {number} optionsForResponseIndex Index of the options for response section
53
+ * @param {string[]} responseTextArray Array of text to be given as input in options input field
54
+ * @description Add input to options input fields
55
+ */
56
+ addInputToResponseOptionFields: (optionsForResponseIndex, responseTextArray) => {
57
+ fillInTheGapsDropdownCommonComponent.optionsSectionWrapper()
58
+ .eq(optionsForResponseIndex)
59
+ .within(() => {
60
+ responseTextArray.forEach((responseFieldText, optionIndex) => {
61
+ fillInTheGapsDropdownCommonComponent.steps.addInputToResponseOptionInputField(optionIndex, responseFieldText);
62
+ });
63
+ });
64
+ },
65
+
66
+ /**
67
+ * @param {number} optionIndex index of the option input field
68
+ * @param {string} responseText text to be given as input in option input field
69
+ * @description Add input to options input fields
70
+ */
71
+ addInputToResponseOptionInputField: (optionIndex, responseFieldText) => {
72
+ fillInTheGapsDropdownCommonComponent.optionsForResponseInputField()
73
+ .eq(optionIndex)
74
+ .clear()
75
+ .type(responseFieldText, { delay: 0 })
76
+ .should('have.value', responseFieldText);
77
+ },
78
+
79
+ /**
80
+ * @param {string} dropdownOption Option to be selected from dropdown
81
+ * @description Select option from dropdown
82
+ */
83
+ selectOptionFromResponseDropdown: (dropdownOption) => {
84
+ fillInTheGapsDropdownCommonComponent.responseDropdownOptions(dropdownOption)
85
+ .click();
86
+ fillInTheGapsDropdownCommonComponent.dropdownList()
87
+ .should('not.exist');
88
+ },
89
+
90
+ /**
91
+ * @param {number} dropdownIndex Index of the dropdown
92
+ * @param {string} dropdownOption Option to be selected in the dropdown
93
+ * @description Select option from dropdown in set correct answer section
94
+ */
95
+ selectResponseFromSetCorrectAnswerSectionResponseDropdown: (dropdownIndex, dropdownOption) => {
96
+ fillInTheGapsDropdownCommonComponent.steps.expandResponseDropdownInSetCorrectAnswerSection(dropdownIndex)
97
+ fillInTheGapsDropdownCommonComponent.steps.selectOptionFromResponseDropdown(dropdownOption);
98
+ fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection()
99
+ .eq(dropdownIndex)
100
+ .verifyInnerText(dropdownOption);
101
+ },
102
+
103
+ /**
104
+ * @param {string[]} dropdownOptionsArray Array of dropdown options
105
+ * @description Verify the options displayed in dropdown
106
+ */
107
+ verifyResponseDropdownOptions: (dropdownOptionsArray) => {
108
+ dropdownOptionsArray.forEach((dropdownOption, optionIndex) => {
109
+ fillInTheGapsDropdownCommonComponent.responseDropdownOptions()
110
+ .eq(optionIndex)
111
+ .should('have.attr', 'data-value', dropdownOption)
112
+ fillInTheGapsDropdownCommonComponent.responseDropdownOptions()
113
+ .eq(dropdownOptionsArray.length)
114
+ .should('not.exist');
115
+ });
116
+ },
117
+
118
+ /**
119
+ * @param {number} responseTokenIndex Index of the response token
120
+ * @description Verify the contents of options for response section displayed for a response token
121
+ */
122
+ verifyOptionsForResponseContents: (responseTokenIndex) => {
123
+ fillInTheGapsDropdownCommonComponent.optionsSectionWrapper()
124
+ .eq(responseTokenIndex)
125
+ .should('exist')
126
+ .within(() => {
127
+ fillInTheGapsDropdownCommonComponent.optionWrapper()
128
+ .each(($el, index) => {
129
+ cy.wrap($el)
130
+ .within(() => {
131
+ fillInTheGapsDropdownCommonComponent.optionsForResponseInputField()
132
+ .should('have.attr', 'placeholder', 'Enter option');
133
+ commonComponents.dragHandleButton()
134
+ .should('exist');
135
+ commonComponents.deleteButton()
136
+ .should('be.visible');
137
+ fillInTheGapsDropdownCommonComponent.optionNumeration()
138
+ .should('have.text', index + 1)
139
+ });
140
+ });
141
+ });
142
+ },
143
+
144
+ /**
145
+ * @param {string[]} optionArray Array of options displayed in dropdown
146
+ * @description Verify randomized order of options in dropdown
147
+ */
148
+ verifyRandomizeOptionOrder: (optionArray) => {
149
+ let currentOptions = [...optionArray]
150
+ commonComponents.dropdownList()
151
+ .within(() => {
152
+ for (let index = 0; index < currentOptions.length; index++) {
153
+ fillInTheGapsDropdownCommonComponent.responseDropdownOptions()
154
+ .eq(index)
155
+ .then(($element) => {
156
+ expect($element.text()).to.be.oneOf(currentOptions);
157
+ currentOptions = currentOptions.filter((value) => value !== $element.text())
158
+ });
159
+ };
160
+ });
161
+ fillInTheGapsDropdownCommonComponent.steps.verifyRerandomizedOptionsOrder(optionArray);
162
+ },
163
+
164
+ /**
165
+ * @param {string[]} previousOrderOfOptions Array of options displayed in preview tab
166
+ * @description Verify that dropdown options are re-randomized in preview tab
167
+ */
168
+ verifyRerandomizedOptionsOrder: (previousOrderOfOptions) => {
169
+ commonComponents.dropdownList()
170
+ .should('not.have.text', '')
171
+ .and('not.have.text', previousOrderOfOptions.join(''));
172
+ },
173
+
174
+ getDropdownOptionsArray: () => {
175
+ const dropdownOptionsArray = []
176
+ fillInTheGapsDropdownCommonComponent.responseDropdownOptions()
177
+ .each(($el) => {
178
+ cy.wrap($el)
179
+ .invoke('text')
180
+ .then((text) => {
181
+ dropdownOptionsArray.push(text);
182
+ });
183
+ });
184
+ return dropdownOptionsArray;
185
+ },
186
+
187
+ /**
188
+ * @param {number} responseDropdownIndex Index of response dropdown
189
+ * @description Verify response dropdown is displayed in set correct answer section
190
+ */
191
+ verifyResponseDropdownIsDisplayedInSetCorrectAnswerSection: (responseDropdownIndex) => {
192
+ utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection().eq(responseDropdownIndex), 'visible');
193
+ },
194
+
195
+ verifyDisabledResponseDropdownInSetCorrectAnswerSection: () => {
196
+ fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection()
197
+ .should('have.class', 'Mui-disabled');
198
+ fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection()
199
+ .click();
200
+ fillInTheGapsDropdownCommonComponent.dropdownList()
201
+ .should('not.exist');
202
+ },
203
+
204
+ /**
205
+ * @param {number} responseDropdownIndex Index of response dropdown in set correct answer section
206
+ * @description Expand response dropdown in set correct answer section
207
+ */
208
+ expandResponseDropdownInSetCorrectAnswerSection: (responseDropdownIndex) => {
209
+ fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection()
210
+ .eq(responseDropdownIndex)
211
+ .click({ position: "right" });
212
+ fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection()
213
+ .eq(responseDropdownIndex)
214
+ .should('have.attr', 'aria-expanded', 'true');
215
+ },
216
+
217
+ verifyOptionsForResponseInputFieldDeleteButtonTooltip: () => {
218
+ fillInTheGapsDropdownCommonComponent.deleteButton()
219
+ .eq(1)
220
+ .verifyTooltip('Delete option');
221
+ },
222
+
223
+ verifyOptionsForResponseInputFieldDisabledDeleteButtonTooltip: () => {
224
+ fillInTheGapsDropdownCommonComponent.deleteButton()
225
+ .eq(1)
226
+ .trigger('mouseover', { force: true })
227
+ fillInTheGapsDropdownCommonComponent.tooltipText()
228
+ .should('have.text', 'Minimum two options are required');
229
+ fillInTheGapsDropdownCommonComponent.deleteButton()
230
+ .eq(1)
231
+ .trigger('mouseout', { force: true });
232
+ fillInTheGapsDropdownCommonComponent.tooltipText()
233
+ .should('not.exist');
234
+ },
235
+
236
+ /**
237
+ * @param {number} index of the option input field
238
+ * @description this function focuses in and out of options input fields
239
+ */
240
+ focusInAndFocusOutOfOptionsForResponseInputField: (index) => {
241
+ fillInTheGapsDropdownCommonComponent.optionsForResponseInputField()
242
+ .eq(index)
243
+ .focus();
244
+ fillInTheGapsDropdownCommonComponent.optionsForResponseInputField()
245
+ .eq(index)
246
+ .blur();
247
+ },
248
+
249
+ /**
250
+ * @param {number} index of option input field
251
+ * @description this function verifies error message of option input field
252
+ */
253
+ verifyOptionsForResponseInputFieldErrorMessage: (index) => {
254
+ fillInTheGapsDropdownCommonComponent.optionWrapper()
255
+ .eq(index)
256
+ .within(() => {
257
+ fillInTheGapsDropdownCommonComponent.optionIsRequiredErrorMessage()
258
+ .should('have.text', 'Error: Option is required.');
259
+ });
260
+ },
261
+
262
+ /**
263
+ * @param {number} index of option input field
264
+ * @description this function verifies error message does not exist for option input field
265
+ */
266
+ verifyOptionsForResponseInputFieldErrorMessageDoesNotExist: (index) => {
267
+ fillInTheGapsDropdownCommonComponent.optionWrapper()
268
+ .eq(index)
269
+ .within(() => {
270
+ fillInTheGapsDropdownCommonComponent.optionIsRequiredErrorMessage()
271
+ .should('not.exist');
272
+ });
273
+ },
274
+ verifyMatchFromAllResponsesLabelAndCheckboxEnabledState: () => {
275
+ fillInTheGapsDropdownCommonComponent.matchFromAllResponsesLabel()
276
+ .should('not.have.class', 'Mui-disabled');
277
+ fillInTheGapsDropdownCommonComponent.matchFromAllResponsesCheckbox()
278
+ .and('not.be.disabled');
279
+ },
280
+
281
+ checkRandomizeOptionsCheckbox: () => {
282
+ fillInTheGapsDropdownCommonComponent.randomizeOptionsCheckbox()
283
+ .click()
284
+ .should('be.checked');
285
+ },
286
+
287
+ uncheckRandomizeOptionsCheckbox: () => {
288
+ fillInTheGapsDropdownCommonComponent.randomizeOptionsCheckbox()
289
+ .click()
290
+ .should('not.be.checked');
291
+ },
292
+
293
+ checkMatchFromAllResponsesCheckbox: () => {
294
+ fillInTheGapsDropdownCommonComponent.matchFromAllResponsesCheckbox()
295
+ .click()
296
+ .should('be.checked');
297
+ },
298
+
299
+ uncheckMatchFromAllResponsesCheckbox: () => {
300
+ fillInTheGapsDropdownCommonComponent.matchFromAllResponsesCheckbox()
301
+ .click()
302
+ .should('not.be.checked');
303
+ },
304
+
305
+ verifyRandomizeOptionsCheckboxNotChecked: () => {
306
+ fillInTheGapsDropdownCommonComponent.randomizeOptionsCheckbox()
307
+ .should('not.be.checked');
308
+ },
309
+
310
+ verifyMatchFromAllResponsesLabelAndCheckboxDisabledState: () => {
311
+ fillInTheGapsDropdownCommonComponent.matchFromAllResponsesLabel()
312
+ .should('have.class', 'Mui-disabled');
313
+ fillInTheGapsDropdownCommonComponent.matchFromAllResponsesCheckbox()
314
+ .and('be.disabled');
315
+ },
316
+
317
+ /**
318
+ * @param {index} responseDropdownIndex Index of response dropdown
319
+ * @param {string} ariaLabel Aria-label of response dropdown
320
+ * @description Verify aria-label of response dropdown in set correct answer section
321
+ */
322
+ verifyDropdownAriaLabelAttributeInSetCorrectAnswerSection: (responseDropdownIndex, ariaLabel) => {
323
+ fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection()
324
+ .eq(responseDropdownIndex)
325
+ .should('have.attr', 'aria-label', ariaLabel);
326
+ }
327
+ }
328
+
329
+ const tests = {
330
+ verifyCorrectResponseConditionSectionDefaultState: () => {
331
+ it('\'Randomize options\' functionality label and checkbox should be displayed and by default it should be unchecked', () => {
332
+ utilities.verifyInnerText(fillInTheGapsDropdownCommonComponent.randomizeOptionsLabel(), 'Randomize options');
333
+ utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.randomizeOptionsLabel(), 'visible');
334
+ fillInTheGapsDropdownCommonComponent.steps.verifyRandomizeOptionsCheckboxNotChecked();
335
+ });
336
+
337
+ it('\'Match from all responses\' functionality label and checkbox should be displayed and by default it should be unchecked and disabled', () => {
338
+ utilities.verifyInnerText(fillInTheGapsDropdownCommonComponent.matchFromAllResponsesLabel(), 'Match from all responses');
339
+ utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.matchFromAllResponsesLabel(), 'visible');
340
+ fillInTheGapsDropdownCommonComponent.steps.verifyMatchFromAllResponsesLabelAndCheckboxDisabledState();
341
+ });
342
+
343
+ it('CSS of correct response conditions section', { tags: 'css' }, () => {
344
+ const labels = [fillInTheGapsDropdownCommonComponent.randomizeOptionsLabel, fillInTheGapsDropdownCommonComponent.matchFromAllResponsesLabel]
345
+ const uncheckedCheckboxes = [fillInTheGapsDropdownCommonComponent.randomizeOptionsCheckbox, fillInTheGapsDropdownCommonComponent.matchFromAllResponsesCheckbox]
346
+ labels.forEach((checkingLabel) => {
347
+ utilities.verifyCSS(checkingLabel(), {
348
+ 'color': css.color.labelText,
349
+ 'font-size': css.fontSize.normal,
350
+ 'font-weight': css.fontWeight.regular
351
+ });
352
+ });
353
+ uncheckedCheckboxes.forEach((uncheckedCheckbox) => {
354
+ utilities.verifyCSS(uncheckedCheckbox().parent().find('svg'), {
355
+ 'fill': css.color.uncheckedCheckbox
356
+ });
357
+ });
358
+ });
359
+
360
+ it(`Accessibility of correct response conditions section`, { tags: 'a11y' }, () => {
361
+ cy.checkAccessibility(fillInTheGapsDropdownCommonComponent.randomizeOptionsLabel().parents('.ngie-checkbox-form-group'));
362
+ });
363
+ },
364
+
365
+ /**
366
+ * @param {string} tabName Correct or Alternate tab
367
+ * @description This function verifies the input field and error states of set correct answer section
368
+ */
369
+ verifySetCorrectAnswerTabContentsAndFunctionality: (tabName) => {
370
+ it('An empty points input field and two dropdowns with labels \'Response 1\' and \'Response 2\' should be present', () => {
371
+ fillInTheGapsDropdownCommonComponent.steps.verifyPointsFieldValue('');
372
+ for (let index = 0; index < 2; index++) {
373
+ utilities.verifyInnerText(fillInTheGapsDropdownCommonComponent.responseFieldLabelSetCorrectAnswerSection().eq(index), `Response ${index + 1}`)
374
+ utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection().eq(index), 'visible');
375
+ };
376
+ });
377
+
378
+ it('When the user selects any option from the dropdown, that option should get set as correct answer option and it should get displayed on the dropdown', () => {
379
+ fillInTheGapsDropdownCommonComponent.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, optionsForResponse[0]);
380
+ fillInTheGapsDropdownCommonComponent.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, optionsForResponse[1]);
381
+ });
382
+
383
+ autoScoredSetCorrectAnswerSection.tests.verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty(tabName);
384
+
385
+ it(`CSS of ${tabName} contents`, { tags: 'css' }, () => {
386
+ utilities.verifyCSS(fillInTheGapsDropdownCommonComponent.responseFieldLabelSetCorrectAnswerSection(), {
387
+ 'color': css.color.labels,
388
+ 'font-size': css.fontSize.default,
389
+ 'font-weight': css.fontWeight.regular
390
+ });
391
+ utilities.verifyCSS(fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection(), {
392
+ 'opacity': '1',
393
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
394
+ });
395
+ //CSS of selected dropdown option which appears on dropdown
396
+ utilities.verifyCSS(fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection(), {
397
+ 'color': css.color.liText,
398
+ 'font-size': css.fontSize.default,
399
+ 'font-weight': css.fontWeight.regular
400
+ });
401
+ });
402
+
403
+ it(`Accessibility of ${tabName} contents`, { tags: 'a11y' }, () => {
404
+ cy.checkAccessibility(fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection().parents('.cloze-with-text-authoring-mode-response-wrapper'));
405
+ });
406
+ },
407
+
408
+ verifyResponseContentsOfSetCorrectAnswerSection: () => {
409
+ it('Response dropdown contents should be displayed in the set correct answer section', () => {
410
+ for (let index = 0; index < 2; index++) {
411
+ utilities.verifyInnerText(fillInTheGapsDropdownCommonComponent.responseFieldLabelSetCorrectAnswerSection().eq(index), `Response ${index + 1}`)
412
+ utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection().eq(index), 'visible');
413
+ };
414
+ });
415
+ },
416
+
417
+ verifyManualScoringEditTabFunctionality: () => {
418
+ 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', () => {
419
+ utilities.verifyElementVisibilityState(autoScoredSetCorrectAnswerSection.setCorrectAnswerLabel(), 'notExist');
420
+ utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.allOrNothingCheckbox(), 'notExist');
421
+ utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.partialEqualWeightsCheckbox(), 'notExist');
422
+ utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.partialDifferentWeightsCheckbox(), 'notExist');
423
+ utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.penaltyPointsInputField(), 'notExist');
424
+ utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.penaltyPointsLabel(), 'notExist');
425
+ utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.rounddownScoreCheckbox(), 'notExist');
426
+ utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.rounddownScoreCheckboxLabel(), 'notExist');
427
+ utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.randomizeOptionsCheckbox(), 'notExist');
428
+ utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.matchFromAllResponsesCheckbox(), 'notExist');
429
+ scoringSectionBase.steps.verifyDefaultMinimumScoreIfAttemptedLabelAndPointsField();
430
+ additionalSettingsPanel.steps.expandAdditonalSettings();
431
+ utilities.verifyElementVisibilityState(autoScoredAdditionalSettings.checkAnswerLabel(), 'notExist');
432
+ utilities.verifyElementVisibilityState(autoScoredAdditionalSettings.allowStudentsToCheckAnswerLabel(), 'notExist');
433
+ utilities.verifyElementVisibilityState(autoScoredAdditionalSettings.allowStudentsToCheckAnswerCheckbox(), 'notExist');
434
+ });
435
+ }
436
+ }
437
+
438
+ export const fillInTheGapsDropdownCommonComponent = {
439
+ ...selectors,
440
+ steps,
441
+ tests
442
+ }