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,1201 @@
1
+ import constants from "../fixtures/constants";
2
+ import utilities from "../support/helpers/utilities";
3
+ import { additionalSettingsPanel, answerNumerationComponent, autoScoredAdditionalSettings, autoScoredPreviewBase, autoScoredScoringSection, autoScoredScoringSectionMultipleResponsesType, autoScoredSetCorrectAnswerSection, ckEditorToolbar, commonComponents, createQuestionBasePage, equationEditorFlyout, mcqOptionsComponent, optionsWrapperComponent, previewScoringAndShowCorrectAnswerComponent, questionInstructionsComponent, scoringSectionBase, studentResponseAndLayoutComponent } from "./components"
4
+ import { listSortingAndOrderingBase } from "./components/listSortingAndOrderingBase";
5
+ const css = Cypress.env('css');
6
+
7
+ const selectors = {
8
+ ...optionsWrapperComponent,
9
+ ...commonComponents,
10
+ ...scoringSectionBase,
11
+ ...autoScoredScoringSectionMultipleResponsesType,
12
+ ...autoScoredSetCorrectAnswerSection,
13
+ ...listSortingAndOrderingBase,
14
+ ...autoScoredAdditionalSettings,
15
+ ...listSortingAndOrderingBase,
16
+ ...answerNumerationComponent,
17
+ ...additionalSettingsPanel,
18
+ ...autoScoredPreviewBase,
19
+ setCorrectAnswerSectionOption: () => cy.get('.draggable-item-wrapper'),
20
+ //Update once https://redmine.zeuslearning.com/issues/518498 is resolved
21
+ setCorrectAnswerSectionSourceOptionWrapper: () => cy.get('[class*="SourceColumnHeader"]').parents('[class*="ContextWrapper"]').find('[class*="ListSortingResponsestyles__DroppableDiv"]'),
22
+ setCorrectAnswerSectionTargetOptionWrapper: () => cy.get('[class*="TargetColumnHeader"]').parents('[class*="ContextWrapper"]').find('[class*="ListSortingResponsestyles__DroppableDiv"]'),
23
+ previewTabOption: () => cy.get('.edit-question-preview-wrapper .draggable-item-wrapper'),
24
+ previewTabSourceOptionWrapper: () => cy.get('.edit-question-preview-wrapper [class*="SourceColumnHeader"]').parents('[class*="ContextWrapper"]').find('[class*="ListSortingResponsestyles__DroppableDiv"]'),
25
+ previewTabTargetOptionWrapper: () => cy.get('.edit-question-preview-wrapper [class*="TargetColumnHeader"]').parents('[class*="ContextWrapper"]').find('[class*="ListSortingResponsestyles__DroppableDiv"]'),
26
+ dragHandleButton: () => cy.get('[class*="DragIcon"]'),
27
+ pointsPerResponseLabel: () => cy.get('[class*="ListSortingResponsestyles__PointsPerResponseLabel"]'),
28
+ partialEqualWeightsPointsPerResponseScore: () => cy.get('[class*="ListSortingResponsestyles__EqualPoints"]'),
29
+ //Set Correct answer section
30
+ labelsLabel: () => cy.get('.label-header'),
31
+ unsortedColumnLabel: () => cy.get('.text-label').eq(0),
32
+ sortedColumnLabel: () => cy.get('.text-label').eq(1),
33
+ unsortedColumnInputField: () => cy.get('.short-text-response-input-field input').eq(0),
34
+ sortedColumnInputField: () => cy.get('.short-text-response-input-field input').eq(1),
35
+ setCorrectAnswerSectionUnsortedColumnHeader: () => cy.get('[class*="SourceColumnHeader"]'),
36
+ setCorrectAnswerSectionSortedColumnHeader: () => cy.get('[class*="TargetColumnHeader"]'),
37
+ previewTabUnsortedColumnHeader: () => cy.get('.edit-question-preview-wrapper [class*="SourceColumnHeader"]'),
38
+ previewTabSortedColumnHeader: () => cy.get('.edit-question-preview-wrapper [class*="TargetColumnHeader"]'),
39
+ setCorrectAnswerSectionButtonLeftArrow: () => cy.get('.icon-arrow-button-left'),
40
+ setCorrectAnswerSectionButtonRightArrow: () => cy.get('.icon-arrow-button-right'),
41
+ previewTabButtonLeftArrow: () => cy.get('.edit-question-preview-wrapper .icon-arrow-button-left'),
42
+ previewTabButtonRightArrow: () => cy.get('.edit-question-preview-wrapper .icon-arrow-button-right'),
43
+ //Additional Settings
44
+ setCorrectAnswerSectionTopLabel: () => cy.get('[class*="__TopLabel-"]'),
45
+ setCorrectAnswerSectionBottomLabel: () => cy.get('[class*="__BottomLabel-"]'),
46
+ previewTabTopLabel: () => cy.get('.edit-question-preview-wrapper [class*="__TopLabel-"]'),
47
+ previewTabBottomLabel: () => cy.get('.edit-question-preview-wrapper [class*="__BottomLabel-"]'),
48
+ optionStyleNumeration: () => cy.get('[class*="OptionIndexWrapper"]')
49
+ }
50
+
51
+ const steps = {
52
+ ...createQuestionBasePage.steps,
53
+ ...questionInstructionsComponent.steps,
54
+ ...optionsWrapperComponent.steps,
55
+ ...scoringSectionBase.steps,
56
+ ...autoScoredSetCorrectAnswerSection.steps,
57
+ ...mcqOptionsComponent.steps,
58
+ ...commonComponents.steps,
59
+ ...ckEditorToolbar.steps,
60
+ ...equationEditorFlyout.steps,
61
+ ...listSortingAndOrderingBase.steps,
62
+ ...previewScoringAndShowCorrectAnswerComponent.steps,
63
+ ...autoScoredScoringSection.steps,
64
+ ...additionalSettingsPanel.steps,
65
+ ...autoScoredAdditionalSettings.steps,
66
+ ...autoScoredPreviewBase.steps,
67
+ ...autoScoredScoringSectionMultipleResponsesType.steps,
68
+ ...answerNumerationComponent.steps,
69
+ /**
70
+ * @param {number} index set correct answer option index
71
+ * @description this function verfies contents of options
72
+ */
73
+ verifyDragHandleButtonOfOptionInSetCorrectAnswerSection: (index) => {
74
+ listSortingPage.setCorrectAnswerSectionOption()
75
+ .eq(index)
76
+ .within(() => {
77
+ listSortingPage.dragHandleButton()
78
+ .should('exist');
79
+ });
80
+ },
81
+
82
+ /**
83
+ * @param {string[]} optionsTextArray options array for set correct answer option
84
+ * @description this function verifies options text content
85
+ */
86
+ verifySourceOptionsTextContentInSetCorrectAnswerSection: (optionsTextArray) => {
87
+ optionsTextArray.forEach((optionsText, index) => {
88
+ listSortingPage.setCorrectAnswerSectionSourceOptionWrapper()
89
+ .eq(index)
90
+ .verifyInnerText(optionsText);
91
+ });
92
+ },
93
+
94
+ /**
95
+ * @param {string[]} optionsTextArray options array for set correct answer option
96
+ * @description this function verifies options text content
97
+ */
98
+ verifyTargetOptionsTextContentInSetCorrectAnswerSection: (optionsTextArray) => {
99
+ optionsTextArray.forEach((optionsText, index) => {
100
+ listSortingPage.setCorrectAnswerSectionTargetOptionWrapper()
101
+ .eq(index)
102
+ .verifyInnerText(optionsText);
103
+ });
104
+ },
105
+
106
+ /**
107
+ * @param {string} optionsText text content of the option
108
+ * @param {number} targetIndex the position at which the options is being dropped in the target section
109
+ * @description click and drop a option into a position in the set correct answer section
110
+ */
111
+ clickAndDropOptionFromSourceToTargetInSetCorrectAnswerSection: (optionsText, targetIndex) => {
112
+ listSortingPage.setCorrectAnswerSectionSourceOptionWrapper()
113
+ .contains(optionsText)
114
+ .click();
115
+ listSortingPage.setCorrectAnswerSectionTargetOptionWrapper()
116
+ .eq(targetIndex)
117
+ .click();
118
+ },
119
+
120
+ /**
121
+ * @param {string} optionsText text content of the option
122
+ * @param {number} sourceIndex the position at which the options is being dropped in the source section
123
+ * @description click and drop a option into a position in the set correct answer section
124
+ */
125
+ clickAndDropOptionFromTargetToSourceInSetCorrectAnswerSection: (optionsText, sourceIndex) => {
126
+ listSortingPage.setCorrectAnswerSectionTargetOptionWrapper()
127
+ .contains(optionsText)
128
+ .click();
129
+ listSortingPage.setCorrectAnswerSectionSourceOptionWrapper()
130
+ .eq(sourceIndex)
131
+ .click();
132
+ },
133
+
134
+ /**
135
+ * @param {number} sourceIndex index of the source option wrapper
136
+ * @param {number} targetIndex index of the target option wrapper
137
+ * @description click and drop a option into a position in the set correct answer section
138
+ */
139
+ clickAndDropOptionFromSourceIndexToTargetIndexInSetCorrectAnswerSection: (sourceIndex, targetIndex) => {
140
+ listSortingPage.setCorrectAnswerSectionSourceOptionWrapper()
141
+ .eq(sourceIndex)
142
+ .click();
143
+ listSortingPage.setCorrectAnswerSectionTargetOptionWrapper()
144
+ .eq(targetIndex)
145
+ .click();
146
+ },
147
+
148
+ /**
149
+ * @param {number} index of option
150
+ * @description this function verifies image in set correct answer option input field
151
+ */
152
+ verifyImageOptionInSetCorrectAnswerSection: (index) => {
153
+ listSortingPage.setCorrectAnswerSectionOption()
154
+ .eq(index)
155
+ .find('img')
156
+ .should('have.attr', 'src', constants.foxImageLink)
157
+ .and('have.attr', 'alt', constants.foxImageAltText);
158
+ },
159
+
160
+ /**
161
+ * @param {number} index of option
162
+ * @description this function verifies equation in set correct answer option input field
163
+ */
164
+ verifyEquationOptionInSetCorrectAnswerSection: (index) => {
165
+ listSortingPage.setCorrectAnswerSectionOption()
166
+ .eq(index)
167
+ .contains(constants.CKEditorInputFieldEnteredEquationText)
168
+ listSortingPage.setCorrectAnswerSectionOption()
169
+ .find('[role="math"]')
170
+ .should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
171
+ },
172
+
173
+ /**
174
+ * @param {number} index of option
175
+ * @description this function link in set correct answer option input field
176
+ */
177
+ verifyLinkOptionInSetCorrectAnswerSection: (index) => {
178
+ listSortingPage.setCorrectAnswerSectionOption()
179
+ .eq(index)
180
+ .should('have.text', 'lorem')
181
+ .find('a')
182
+ .should('have.attr', 'href', `${Cypress.config().baseUrl}`)
183
+ },
184
+
185
+ /**
186
+ * @param {number} index of option
187
+ * @description this function bold text in set correct answer option input field
188
+ */
189
+ verifyBoldTextOptionInSetCorrectAnswerSection: (index) => {
190
+ listSortingPage.setCorrectAnswerSectionOption()
191
+ .eq(index)
192
+ .find('strong')
193
+ .eq(0)
194
+ .should('have.text', 'This is a bold option');
195
+ },
196
+
197
+ verifyImageEquationLinkBoldTextInSetCorrectAnswerSectionSourceOption: () => {
198
+ listSortingPage.setCorrectAnswerSectionSourceOptionWrapper()
199
+ .eq(0)
200
+ .parents('[class*="ListSortingResponsestyles__ContextWrapper"]')
201
+ .within(() => {
202
+ steps.verifyImageOptionInSetCorrectAnswerSection(0)
203
+ steps.verifyEquationOptionInSetCorrectAnswerSection(1)
204
+ steps.verifyLinkOptionInSetCorrectAnswerSection(2)
205
+ steps.verifyBoldTextOptionInSetCorrectAnswerSection(3)
206
+ });
207
+ },
208
+
209
+ verifyImageEquationLinkBoldTextInSetCorrectAnswerSectionTargetOption: () => {
210
+ listSortingPage.setCorrectAnswerSectionTargetOptionWrapper()
211
+ .eq(0)
212
+ .parents('[class*="ListSortingResponsestyles__ContextWrapper"]')
213
+ .within(() => {
214
+ steps.verifyImageOptionInSetCorrectAnswerSection(0)
215
+ steps.verifyEquationOptionInSetCorrectAnswerSection(1)
216
+ steps.verifyLinkOptionInSetCorrectAnswerSection(2)
217
+ steps.verifyBoldTextOptionInSetCorrectAnswerSection(3)
218
+ });
219
+ },
220
+
221
+ verifyDefaultAndActiveStateOfOptionInSetCorrectAnswerSection: () => {
222
+ listSortingPage.setCorrectAnswerSectionOption()
223
+ .eq(0)
224
+ .realHover()
225
+ .should('have.css', 'border', `2px solid ${css.color.activeButtons}`)
226
+ .find('.question-text-wrapper')
227
+ .and('have.css', 'color', css.color.activeButtons);
228
+ listSortingPage.setCorrectAnswerSectionOption()
229
+ .eq(0)
230
+ .realHover({ position: 'topLeft' })
231
+ .should('have.css', 'border', `1px solid ${css.color.figDefaultComponentBorder}`);
232
+ },
233
+
234
+ //Preview tab
235
+ /**
236
+ * @param {number} index set correct answer option index
237
+ * @description this function verfies contents of options
238
+ */
239
+ verifyDragHandleButtonOfOptionInPreviewTab: (index) => {
240
+ listSortingPage.previewTabOption()
241
+ .eq(index)
242
+ .within(() => {
243
+ listSortingPage.dragHandleButton()
244
+ .should('exist');
245
+ });
246
+ },
247
+
248
+
249
+ /**
250
+ * @param {string[]} optionsTextArray options array for set correct answer option
251
+ * @description this function verifies options text content
252
+ */
253
+ verifySourceOptionsTextContentInPreviewTab: (optionsTextArray) => {
254
+ optionsTextArray.forEach((optionsText, index) => {
255
+ listSortingPage.previewTabSourceOptionWrapper()
256
+ .eq(index)
257
+ .verifyInnerText(optionsText);
258
+ });
259
+ },
260
+
261
+ /**
262
+ * @param {string[]} optionsTextArray options array for set correct answer option
263
+ * @description this function verifies options text content
264
+ */
265
+ verifyTargetOptionsTextContentInPreviewTab: (optionsTextArray) => {
266
+ optionsTextArray.forEach((optionsText, index) => {
267
+ listSortingPage.previewTabTargetOptionWrapper()
268
+ .eq(index)
269
+ .verifyInnerText(optionsText);
270
+ });
271
+ },
272
+
273
+ /**
274
+ * @param {string} optionsText text content of the option
275
+ * @param {number} targetIndex the position at which the options is being dropped in the target section
276
+ * @description click and drop a option into a position in the previewTab
277
+ */
278
+ clickAndDropOptionFromSourceToTargetInPreviewTab: (optionsText, targetIndex) => {
279
+ listSortingPage.previewTabSourceOptionWrapper()
280
+ .contains(optionsText)
281
+ .click();
282
+ listSortingPage.previewTabTargetOptionWrapper()
283
+ .eq(targetIndex)
284
+ .click();
285
+ },
286
+
287
+ /**
288
+ * @param {string} optionsText text content of the option
289
+ * @param {number} sourceIndex the position at which the options is being dropped in the source section
290
+ * @description click and drop a option into a position in the set correct answer section
291
+ */
292
+ clickAndDropOptionFromTargetToSourceInPreviewTab: (optionsText, sourceIndex) => {
293
+ listSortingPage.previewTabTargetOptionWrapper()
294
+ .contains(optionsText)
295
+ .click();
296
+ listSortingPage.previewTabSourceOptionWrapper()
297
+ .eq(sourceIndex)
298
+ .click();
299
+ },
300
+
301
+ /**
302
+ * @param {number} sourceIndex index of the source option wrapper
303
+ * @param {number} targetIndex index of the target option wrapper
304
+ * @description click and drop a option into a position in the previewTab
305
+ */
306
+ clickAndDropOptionFromSourceIndexToTargetIndexInPreviewTab: (sourceIndex, targetIndex) => {
307
+ listSortingPage.previewTabSourceOptionWrapper()
308
+ .eq(sourceIndex)
309
+ .click();
310
+ listSortingPage.previewTabTargetOptionWrapper()
311
+ .eq(targetIndex)
312
+ .click();
313
+ },
314
+
315
+ verifyImageEquationLinkBoldTextInPreviewTabSourceOption: () => {
316
+ listSortingPage.previewTabSourceOptionWrapper()
317
+ .eq(0)
318
+ .parents('[class*="ListSortingResponsestyles__ContextWrapper"]')
319
+ .within(() => {
320
+ steps.verifyImageOptionInSetCorrectAnswerSection(0)
321
+ steps.verifyEquationOptionInSetCorrectAnswerSection(1)
322
+ steps.verifyLinkOptionInSetCorrectAnswerSection(2)
323
+ steps.verifyBoldTextOptionInSetCorrectAnswerSection(3)
324
+ });
325
+ },
326
+
327
+ verifyImageEquationLinkBoldTextInPreviewTabTargetOption: () => {
328
+ listSortingPage.previewTabTargetOptionWrapper()
329
+ .eq(0)
330
+ .parents('[class*="ListSortingResponsestyles__ContextWrapper"]')
331
+ .within(() => {
332
+ steps.verifyImageOptionInSetCorrectAnswerSection(0)
333
+ steps.verifyEquationOptionInSetCorrectAnswerSection(1)
334
+ steps.verifyLinkOptionInSetCorrectAnswerSection(2)
335
+ steps.verifyBoldTextOptionInSetCorrectAnswerSection(3)
336
+ });
337
+ },
338
+
339
+ verifyDefaultAndActiveStateOfOptionInPreviewTab: () => {
340
+ listSortingPage.previewTabOption()
341
+ .eq(0)
342
+ .realHover()
343
+ .should('have.css', 'border', `2px solid ${css.color.activeButtons}`)
344
+ .find('.question-text-wrapper')
345
+ .and('have.css', 'color', css.color.activeButtons);
346
+ listSortingPage.previewTabOption()
347
+ .eq(0)
348
+ .realHover({ position: 'topLeft' })
349
+ .should('have.css', 'border', `1px solid ${css.color.figDefaultComponentBorder}`);
350
+ },
351
+
352
+ /**
353
+ * @param {string} optionsText option to be checked for the correct icon
354
+ * @description This function verifies the correct icon in the preview tab
355
+ */
356
+ verifyCorrectOptionsCheckmarkIcon: (optionsText) => {
357
+ listSortingPage.previewTabTargetOptionWrapper()
358
+ .contains(optionsText)
359
+ .parents('[class*="ListSortingResponsestyles__TargetWrapper"]')
360
+ .within(() => {
361
+ autoScoredPreviewBase.correctIcon()
362
+ .and('be.visible');
363
+ });
364
+ },
365
+
366
+ /**
367
+ * @param {string} optionsText option to be checked for the correct icon
368
+ * @description This function verifies the correct icon in the preview tab
369
+ */
370
+ verifyIncorrectOptionsCrossmarkIcon: (optionsText) => {
371
+ listSortingPage.previewTabTargetOptionWrapper()
372
+ .contains(optionsText)
373
+ .parents('[class*="ListSortingResponsestyles__TargetWrapper"]')
374
+ .within(() => {
375
+ autoScoredPreviewBase.incorrectIcon()
376
+ .and('be.visible');
377
+ });
378
+ },
379
+
380
+ /**
381
+ * @param {number[]} pointsArray the array of points to be alloted to each option
382
+ * @description this function allots points to all the options
383
+ */
384
+ allotPartialDifferentWeightsToAllPointsFields: (pointsArray) => {
385
+ pointsArray.forEach((points, optionIndex) => {
386
+ scoringSectionBase.pointsInputField()
387
+ .eq(optionIndex)
388
+ .clear()
389
+ .type(points, { delay: 0 })
390
+ .should('have.value', points);
391
+ });
392
+ },
393
+
394
+ verifyPartialDifferentWeightsPointsInputFieldIsEmptyAndEnabled: () => {
395
+ scoringSectionBase.pointsInputField()
396
+ .each(($element) => {
397
+ cy.wrap($element)
398
+ .should('have.value', '')
399
+ .and('be.visible')
400
+ .and('be.enabled');
401
+ });
402
+ },
403
+
404
+ /**
405
+ * @param {number} points points displayed in partial equal weights points per response
406
+ * @description Verify points displayed in partial equal weights points per response
407
+ */
408
+ verifyPartialEqualWeightsPointsPerResponseScore: (points) => {
409
+ listSortingPage.partialEqualWeightsPointsPerResponseScore()
410
+ .each(($element) => {
411
+ cy.wrap($element)
412
+ .verifyInnerText(`${points}`);
413
+ });
414
+ },
415
+
416
+ verifyPointsInputFieldErrorMessage: () => {
417
+ commonComponents.errorMessage()
418
+ .eq(0)
419
+ .should('have.text', 'Error: Please enter points.');
420
+ },
421
+
422
+ verifySetCorrectAnswerErrorMessage: () => {
423
+ commonComponents.errorMessage()
424
+ .eq(1)
425
+ .should('have.text', 'Error: Please set a correct answer.');
426
+ },
427
+
428
+ clearUnsortedColumnInputField: () => {
429
+ listSortingPage.unsortedColumnInputField()
430
+ .clear();
431
+ },
432
+
433
+ clearSortedColumnInputField: () => {
434
+ listSortingPage.sortedColumnInputField()
435
+ .clear();
436
+ },
437
+
438
+ verifyUnsortedColumnInputFieldErrorMessage: () => {
439
+ listSortingPage.unsortedColumnInputField()
440
+ .parents('[class*="ListSortingstyle__InputFieldWrapper"]')
441
+ .within(() => {
442
+ commonComponents.errorMessage()
443
+ .verifyInnerText('Error: Please enter label.')
444
+ });
445
+ },
446
+
447
+ verifySortedColumnInputFieldErrorMessage: () => {
448
+ listSortingPage.sortedColumnInputField()
449
+ .parents('[class*="ListSortingstyle__InputFieldWrapper"]')
450
+ .within(() => {
451
+ commonComponents.errorMessage()
452
+ .verifyInnerText('Error: Please enter label.')
453
+ });
454
+ },
455
+
456
+ addInputToUnsortedColumnInputField: (inputText) => {
457
+ listSortingPage.unsortedColumnInputField()
458
+ .type(inputText)
459
+ .should('have.value', inputText);
460
+ },
461
+
462
+ addInputToSortedColumnInputField: (inputText) => {
463
+ listSortingPage.sortedColumnInputField()
464
+ .type(inputText)
465
+ .should('have.value', inputText);
466
+ },
467
+
468
+ verifyUnsortedColumnInputField: (inputText) => {
469
+ listSortingPage.unsortedColumnInputField()
470
+ .should('have.value', inputText);
471
+ },
472
+
473
+ verifySortedColumnInputField: (inputText) => {
474
+ listSortingPage.sortedColumnInputField()
475
+ .should('have.value', inputText);
476
+ },
477
+
478
+ getOptionsArray: () => {
479
+ const optionsArray = []
480
+ listSortingPage.previewTabOption()
481
+ .each(($el) => {
482
+ cy.wrap($el)
483
+ .invoke('text')
484
+ .then((text) => {
485
+ optionsArray.push(text);
486
+ });
487
+ });
488
+ return optionsArray;
489
+ },
490
+
491
+ /**
492
+ * @param {string[]} optionsArray array of options set in the options section
493
+ * @description this function verifies if the options are Randomized in the preview tab
494
+ */
495
+ verifyRandomizeOptionOrder: (optionsArray) => {
496
+ let currentOptionsArray = [...optionsArray]
497
+ for (let index = 0; index < currentOptionsArray.length; index++) {
498
+ listSortingPage.previewTabOption()
499
+ .eq(index)
500
+ .then(($element) => {
501
+ expect($element.text()).to.be.oneOf(currentOptionsArray);
502
+ currentOptionsArray = currentOptionsArray.filter((value) => value !== $element.text())
503
+ });
504
+ };
505
+ listSortingPage.steps.verifyOptionsAreRerandomized(optionsArray)
506
+ },
507
+
508
+ /**
509
+ * @param {string[]} previousOrderOfOptionsArray array of previous order of options
510
+ * @description this function verifies that the order of the options is different from the previous order
511
+ */
512
+ verifyOptionsAreRerandomized: (previousOrderOfOptionsArray) => {
513
+ listSortingPage.previewTabOption()
514
+ .should('not.have.text', '')
515
+ .and('not.have.text', previousOrderOfOptionsArray.join(''));
516
+ },
517
+
518
+ /**
519
+ * @param {number} index set correct answer option index
520
+ * @description this function verfies drag handle of options does not exist
521
+ */
522
+ verifyDragHandleButtonDoesNotExistInSetCorrectAnswerSection: (index) => {
523
+ listSortingPage.setCorrectAnswerSectionOption()
524
+ .eq(index)
525
+ .within(() => {
526
+ commonComponents.dragHandleButton()
527
+ .should('not.exist');
528
+ });
529
+ },
530
+
531
+ /**
532
+ * @param {number} index set correct answer option index
533
+ * @description this function verfies drag handle of options does not exist
534
+ */
535
+ verifyDragHandleButtonDoesNotExistInPreviewTab: (index) => {
536
+ listSortingPage.previewTabOption()
537
+ .eq(index)
538
+ .within(() => {
539
+ commonComponents.dragHandleButton()
540
+ .should('not.exist');
541
+ });
542
+ },
543
+
544
+ //Click and drop
545
+ //Need to update functions once - https://redmine.zeuslearning.com/issues/541167 is resolved
546
+ /**
547
+ * @param {number} index of the source option
548
+ * @description this function verifies if the option is active or inactive
549
+ */
550
+ verifyActiveStateOfSourceOptionWrapperSetCorrectAnswerSection: (index) => {
551
+ listSortingPage.setCorrectAnswerSectionSourceOptionWrapper()
552
+ .eq(index)
553
+ .should('have.class', 'isActive')
554
+ .find('[class*="DroppableWrapper"]')
555
+ .should('have.attr', 'tabindex', '0')
556
+ },
557
+
558
+ /**
559
+ * @param {number} index of the source option
560
+ * @description this function verifies if the option is active or inactive
561
+ */
562
+ verifyActiveStateOfTargetOptionWrapperSetCorrectAnswerSection: (index) => {
563
+ listSortingPage.setCorrectAnswerSectionTargetOptionWrapper()
564
+ .eq(index)
565
+ .should('have.class', 'isActive')
566
+ .find('[class*="DroppableWrapper"]')
567
+ .should('have.attr', 'tabindex', '0')
568
+ },
569
+
570
+ /**
571
+ * @param {number} index of the source option
572
+ * @description this function verifies if the option is active or inactive
573
+ */
574
+ verifyInactiveStateOfSourceOptionWrapperSetCorrectAnswerSection: (index) => {
575
+ listSortingPage.setCorrectAnswerSectionSourceOptionWrapper()
576
+ .eq(index)
577
+ .find('[class*="DroppableWrapper"]')
578
+ .should('have.attr', 'tabindex', '-1')
579
+ },
580
+
581
+ /**
582
+ * @param {number} index of the source option
583
+ * @description this function verifies if the option is active or inactive
584
+ */
585
+ verifyInactiveStateOfTargetOptionWrapperSetCorrectAnswerSection: (index) => {
586
+ listSortingPage.setCorrectAnswerSectionTargetOptionWrapper()
587
+ .eq(index)
588
+ .find('[class*="DroppableWrapper"]')
589
+ .should('have.attr', 'tabindex', '-1')
590
+ },
591
+
592
+ /**
593
+ * @param {number} index of the source option
594
+ * @description verify inactive state of source option
595
+ */
596
+ verifyInactiveStateOfSourceOptionWrapperPreviewTab: (index) => {
597
+ listSortingPage.previewTabSourceOptionWrapper()
598
+ .eq(index)
599
+ .find('[class*="DroppableWrapper"]')
600
+ .should('have.attr', 'tabindex', '-1');
601
+ },
602
+
603
+ /**
604
+ * @param {number} index of the source option
605
+ * @description verify inactive state of target option
606
+ */
607
+ verifyInactiveStateOfTargetOptionWrapperPreviewTab: (index) => {
608
+ listSortingPage.previewTabTargetOptionWrapper()
609
+ .eq(index)
610
+ .find('[class*="DroppableWrapper"]')
611
+ .should('have.attr', 'tabindex', '-1');
612
+ },
613
+
614
+ /**
615
+ * @param {number} index of the source option
616
+ * @description verify active state of source option
617
+ */
618
+ verifyActiveStateOfSourceOptionWrapperPreviewTab: (index) => {
619
+ listSortingPage.previewTabSourceOptionWrapper()
620
+ .eq(index)
621
+ .should('have.class', 'isActive')
622
+ .find('[class*="DroppableWrapper"]')
623
+ .should('have.attr', 'tabindex', '0');
624
+ },
625
+
626
+ /**
627
+ * @param {number} index of the source option
628
+ * @description verify active state of target option
629
+ */
630
+ verifyActiveStateOfTargetOptionWrapperPreviewTab: (index) => {
631
+ listSortingPage.previewTabTargetOptionWrapper()
632
+ .eq(index)
633
+ .should('have.class', 'isActive')
634
+ .find('[class*="DroppableWrapper"]')
635
+ .should('have.attr', 'tabindex', '0');
636
+ },
637
+
638
+ /**
639
+ * @param index of set correct answer section option
640
+ * @description This function selects an option from set correct answer section
641
+ */
642
+ selectSourceOptionSetCorrectAnswerSection: (index) => {
643
+ listSortingPage.setCorrectAnswerSectionSourceOptionWrapper()
644
+ .eq(index)
645
+ .click();
646
+ },
647
+
648
+ /**
649
+ * @param index of set correct answer section option
650
+ * @description This function selects an option from set correct answer section
651
+ */
652
+ selectTargetOptionSetCorrectAnswerSection: (index) => {
653
+ listSortingPage.setCorrectAnswerSectionTargetOptionWrapper()
654
+ .eq(index)
655
+ .click();
656
+ },
657
+
658
+ /**
659
+ * @param {number} index of set correct answer section option
660
+ * @description this function verifies active state of source option wrapper
661
+ */
662
+ verifyActiveStateOfSourceOptionSetCorrectAnswerSection: (index) => {
663
+ listSortingPage.setCorrectAnswerSectionSourceOptionWrapper()
664
+ .eq(index)
665
+ .within(() => {
666
+ listSortingPage.setCorrectAnswerSectionOption()
667
+ .should('have.class', 'isSelected')
668
+ .should('have.css', 'border')
669
+ .and('match', /2px solid/)
670
+ });
671
+ listSortingPage.setCorrectAnswerSectionSourceOptionWrapper()
672
+ .eq(index)
673
+ .within(() => {
674
+ listSortingPage.setCorrectAnswerSectionOption()
675
+ .within(() => {
676
+ listSortingPage.dragHandleButton()
677
+ .find('svg')
678
+ .should('have.css', 'border')
679
+ .and('match', /2px solid/)
680
+ });
681
+ });
682
+ },
683
+
684
+ /**
685
+ * @param {number} index of set correct answer section option
686
+ * @description this function verifies active state of target option wrapper
687
+ */
688
+ verifyActiveStateOfTargetOptionSetCorrectAnswerSection: (index) => {
689
+ listSortingPage.setCorrectAnswerSectionTargetOptionWrapper()
690
+ .eq(index)
691
+ .within(() => {
692
+ listSortingPage.setCorrectAnswerSectionOption()
693
+ .eq(index)
694
+ .should('have.class', 'isSelected')
695
+ .should('have.css', 'border')
696
+ .and('match', /2px solid/)
697
+ });
698
+ listSortingPage.setCorrectAnswerSectionTargetOptionWrapper()
699
+ .eq(index)
700
+ .within(() => {
701
+ listSortingPage.setCorrectAnswerSectionOption()
702
+ .within(() => {
703
+ listSortingPage.dragHandleButton()
704
+ .find('svg')
705
+ .should('have.css', 'border')
706
+ .and('match', /2px solid/)
707
+ });
708
+ });
709
+ },
710
+
711
+ /**
712
+ * @param {number} index of set correct answer section option
713
+ * @description this function verifies inactive state of source option wrapper
714
+ */
715
+ verifyInactiveStateOfSourceOptionSetCorrectAnswerSection: (index) => {
716
+ listSortingPage.setCorrectAnswerSectionSourceOptionWrapper()
717
+ .eq(index)
718
+ .within(() => {
719
+ listSortingPage.setCorrectAnswerSectionOption()
720
+ .should('not.have.class', 'isSelected')
721
+ .should('have.css', 'border', `1px solid ${css.color.figDefaultComponentBorder}`)
722
+ .within(() => {
723
+ listSortingPage.dragHandleButton()
724
+ .find('svg')
725
+ .should('have.css', 'border')
726
+ .and('match', /0px none/);
727
+ });
728
+ });
729
+ },
730
+
731
+ /**
732
+ * @param index of preview tab option
733
+ * @description this function clicks on preview source wrapper
734
+ */
735
+ selectSourceOptionPreviewTab: (index) => {
736
+ listSortingPage.previewTabSourceOptionWrapper()
737
+ .eq(index)
738
+ .click();
739
+ },
740
+
741
+ /**
742
+ * @param index of preview tab option
743
+ * @description this function clicks on preview target wrapper
744
+ */
745
+ selectTargetOptionPreviewTab: (index) => {
746
+ listSortingPage.previewTabTargetOptionWrapper()
747
+ .eq(index)
748
+ .click();
749
+ },
750
+
751
+ /**
752
+ * @param {number} index of preview tab option
753
+ * @description this function verifies active state of source wrapper
754
+ */
755
+ verifyActiveStateOfSourceOptionPreviewTab: (index) => {
756
+ listSortingPage.previewTabSourceOptionWrapper()
757
+ .eq(index)
758
+ .within(() => {
759
+ listSortingPage.setCorrectAnswerSectionOption()
760
+ .should('have.class', 'isSelected')
761
+ .should('have.css', 'border')
762
+ .and('match', /2px solid/)
763
+ });
764
+ listSortingPage.previewTabSourceOptionWrapper()
765
+ .eq(index)
766
+ .within(() => {
767
+ listSortingPage.setCorrectAnswerSectionOption()
768
+ .within(() => {
769
+ listSortingPage.dragHandleButton()
770
+ .find('svg')
771
+ .should('have.css', 'border')
772
+ .and('match', /2px solid/);
773
+ });
774
+ });
775
+ },
776
+
777
+ /**
778
+ * @param {number} index of preview tab option
779
+ * @description this function verifies active state of target wrapper
780
+ */
781
+ verifyActiveStateOfTargetOptionPreviewTab: (index) => {
782
+ listSortingPage.previewTabTargetOptionWrapper()
783
+ .eq(index)
784
+ .within(() => {
785
+ listSortingPage.setCorrectAnswerSectionOption()
786
+ .should('have.class', 'isSelected')
787
+ .should('have.css', 'border')
788
+ .and('match', /2px solid/)
789
+ });
790
+ listSortingPage.previewTabTargetOptionWrapper()
791
+ .eq(index)
792
+ .within(() => {
793
+ listSortingPage.dragHandleButton()
794
+ .find('svg')
795
+ .should('have.css', 'border')
796
+ .and('match', /2px solid/)
797
+ });
798
+ },
799
+
800
+ /**
801
+ * @param {number} index of preview tab option
802
+ * @description this function verifies inactive state of source wrapper
803
+ */
804
+ verifyInactiveStateOfSourceOptionPreviewTab: (index) => {
805
+ listSortingPage.previewTabSourceOptionWrapper()
806
+ .eq(index)
807
+ .within(() => {
808
+ listSortingPage.setCorrectAnswerSectionOption()
809
+ .should('not.have.class', 'isSelected')
810
+ .should('have.css', 'border', `1px solid ${css.color.figDefaultComponentBorder}`)
811
+ .within(() => {
812
+ listSortingPage.dragHandleButton()
813
+ .find('svg')
814
+ .should('have.css', 'border')
815
+ .and('match', /0px none/);
816
+ });
817
+ });
818
+ },
819
+
820
+ clickOnRightArrowKeySetCorrectAnswerSection: () => {
821
+ listSortingPage.setCorrectAnswerSectionButtonRightArrow()
822
+ .click();
823
+ },
824
+
825
+ clickOnLeftArrowKeySetCorrectAnswerSection: () => {
826
+ listSortingPage.setCorrectAnswerSectionButtonLeftArrow()
827
+ .click();
828
+ },
829
+
830
+ clickOnRightArrowKeyPreviewTab: () => {
831
+ listSortingPage.previewTabButtonRightArrow()
832
+ .click();
833
+ },
834
+
835
+ clickOnLeftArrowKeyPreviewTab: () => {
836
+ listSortingPage.previewTabButtonLeftArrow()
837
+ .click();
838
+ },
839
+
840
+ verifyRightArrowEnabledSetCorrectAnswerSection: () => {
841
+ listSortingPage.setCorrectAnswerSectionButtonRightArrow()
842
+ .should('have.class', 'isActive');
843
+ },
844
+
845
+ verifyRightArrowDisabledSetCorrectAnswerSection: () => {
846
+ listSortingPage.setCorrectAnswerSectionButtonRightArrow()
847
+ .should('not.have.class', 'isActive');
848
+ },
849
+
850
+ verifyLeftArrowEnabledSetCorrectAnswerSection: () => {
851
+ listSortingPage.setCorrectAnswerSectionButtonLeftArrow()
852
+ .should('have.class', 'isActive');
853
+ },
854
+
855
+ verifyLeftArrowDisabledSetCorrectAnswerSection: () => {
856
+ listSortingPage.setCorrectAnswerSectionButtonLeftArrow()
857
+ .should('not.have.class', 'isActive');
858
+ },
859
+
860
+ verifyRightArrowEnabledPreviewTab: () => {
861
+ listSortingPage.previewTabButtonRightArrow()
862
+ .should('have.class', 'isActive');
863
+ },
864
+
865
+ verifyRightArrowDisabledPreviewTab: () => {
866
+ listSortingPage.previewTabButtonRightArrow()
867
+ .should('not.have.class', 'isActive');
868
+ },
869
+
870
+ verifyLeftArrowEnabledPreviewTab: () => {
871
+ listSortingPage.previewTabButtonLeftArrow()
872
+ .should('have.class', 'isActive');
873
+ },
874
+
875
+ verifyLeftArrowDisabledPreviewTab: () => {
876
+ listSortingPage.previewTabButtonLeftArrow()
877
+ .should('not.have.class', 'isActive');
878
+ },
879
+
880
+ /**
881
+ * @param {string[]} numerationArray array of numeration numbers, lowercase, uppercase
882
+ * @description this function verifies the numeration of options
883
+ */
884
+ verifyOptionsNumerationSetCorrectAnswerSection: (numerationArray) => {
885
+ numerationArray.forEach((optionNumeration, index) => {
886
+ listSortingPage.setCorrectAnswerSectionTargetOptionWrapper()
887
+ .eq(index)
888
+ .within(() => {
889
+ listSortingPage.optionStyleNumeration()
890
+ .should('have.text', optionNumeration);
891
+ });
892
+ });
893
+ },
894
+
895
+ /**
896
+ * @param {string[]} numerationArray array of numeration numbers, lowercase, uppercase
897
+ * @description this function verifies the numeration of options
898
+ */
899
+ verifyOptionsNumerationPreviewTab: (numerationArray) => {
900
+ numerationArray.forEach((optionNumeration, index) => {
901
+ listSortingPage.previewTabTargetOptionWrapper()
902
+ .eq(index)
903
+ .within(() => {
904
+ listSortingPage.optionStyleNumeration()
905
+ .should('have.text', optionNumeration);
906
+ });
907
+ });
908
+ },
909
+
910
+ //TODO: Need to remove once -https://redmine.zeuslearning.com/issues/518498 is resolved
911
+ /**
912
+ * @param {string} labelText Correct|Incorrect
913
+ * @description this function verifies the border label and icon
914
+ */
915
+ verifyCorrectIncorrectAnswerLabel: (labelText) => {
916
+ autoScoredPreviewBase.correctIncorectAnswerLabel()
917
+ .should('be.visible')
918
+ .verifyInnerText(`${labelText} answer`)
919
+ .parents('[class*="__AnswerStatusWrapper"]')
920
+ .find('[class*="__AnswerStatusIcon"]')
921
+ .should('be.visible')
922
+ .should('have.text', `${labelText}-Icon`)
923
+ }
924
+ }
925
+
926
+ const tests = {
927
+ ...createQuestionBasePage.tests,
928
+ ...commonComponents.tests,
929
+ ...questionInstructionsComponent.tests,
930
+ ...listSortingAndOrderingBase.tests,
931
+ ...autoScoredScoringSection.tests,
932
+ ...previewScoringAndShowCorrectAnswerComponent.tests,
933
+ ...scoringSectionBase.tests,
934
+ ...autoScoredSetCorrectAnswerSection.tests,
935
+ ...additionalSettingsPanel.tests,
936
+ ...studentResponseAndLayoutComponent.tests,
937
+ ...answerNumerationComponent.tests,
938
+ ...autoScoredAdditionalSettings.tests,
939
+ verifyAllContentsOfSetCorrectAnswerSectionForScoringType: (scoringType, optionsArray) => {
940
+ it(`When user has selected ${scoringType} scoring type then added options should be displayed in the set correct answer section`, () => {
941
+ listSortingPage.steps.verifySourceOptionsTextContentInSetCorrectAnswerSection(optionsArray);
942
+ for (let index = 0; index < 4; index++) {
943
+ listSortingPage.steps.verifyDragHandleButtonOfOptionInSetCorrectAnswerSection(index);
944
+ }
945
+ });
946
+ },
947
+
948
+ verifyImageEquationLinkBoldTextInSetCorrectAnswerSection: () => {
949
+ it('When user adds an image, equation, text and link to the options input they should be displayed in the \'Set correct answer\' section along with drag handles', () => {
950
+ for (let index = 0; index < 4; index++) {
951
+ listSortingPage.steps.verifyDragHandleButtonOfOptionInSetCorrectAnswerSection(index)
952
+ }
953
+ listSortingPage.steps.verifyImageEquationLinkBoldTextInSetCorrectAnswerSectionSourceOption();
954
+ });
955
+
956
+ it('When user hovers on the option it should be displayed in active state and on removing the focus the option should return to the default state', () => {
957
+ listSortingPage.steps.verifyDefaultAndActiveStateOfOptionInSetCorrectAnswerSection()
958
+ });
959
+
960
+ //Failing due to https://redmine.zeuslearning.com/issues/537907
961
+ it('CSS of \'Set correct answer\' section when image, equation, text and link are added', { tags: 'css' }, () => {
962
+ utilities.verifyCSS(listSortingPage.setCorrectAnswerSectionOption().eq(0).find('img'), {
963
+ 'color': css.color.text,
964
+ 'font-size': css.fontSize.default,
965
+ 'font-weight': css.fontWeight.regular
966
+ });
967
+ utilities.verifyCSS(listSortingPage.setCorrectAnswerSectionOption().eq(1).find('.question-text-wrapper'), {
968
+ 'color': css.color.text,
969
+ 'font-size': css.fontSize.default,
970
+ 'font-weight': css.fontWeight.regular
971
+ });
972
+ utilities.verifyCSS(listSortingPage.setCorrectAnswerSectionOption().eq(2).find('a'), {
973
+ 'color': css.color.linkText,
974
+ 'font-size': css.fontSize.default,
975
+ 'font-weight': css.fontWeight.regular
976
+ });
977
+ utilities.verifyCSS(listSortingPage.setCorrectAnswerSectionOption().eq(3).find('.question-text-wrapper'), {
978
+ 'color': css.color.text,
979
+ 'font-size': css.fontSize.default,
980
+ 'font-weight': css.fontWeight.regular
981
+ });
982
+ });
983
+
984
+ it('Accessibility of \'Set correct answer\' section when image, equation, text and link are added', { tags: 'a11y' }, () => {
985
+ cy.checkAccessibility(listSortingPage.setCorrectAnswerSectionOption().eq(0).parents('.list-sorting-response-container'))
986
+ });
987
+
988
+ it('When user sets the order in target section then the options should be displayed in the target section of the Set correct answer section', () => {
989
+ listSortingPage.steps.clickAndDropOptionFromSourceIndexToTargetIndexInSetCorrectAnswerSection(0, 0);
990
+ listSortingPage.steps.clickAndDropOptionFromSourceIndexToTargetIndexInSetCorrectAnswerSection(1, 1);
991
+ listSortingPage.steps.clickAndDropOptionFromSourceIndexToTargetIndexInSetCorrectAnswerSection(2, 2);
992
+ listSortingPage.steps.clickAndDropOptionFromSourceIndexToTargetIndexInSetCorrectAnswerSection(3, 3);
993
+ listSortingPage.steps.verifyImageEquationLinkBoldTextInSetCorrectAnswerSectionTargetOption();
994
+ });
995
+ },
996
+
997
+ /**
998
+ * @param {number} totalPoints the maximum points that can be scored by the user
999
+ * @description this function verifies the functionality of minimum points when penalty points are not set and user attempts incorrect answer
1000
+ */
1001
+ verifyMinimumScoreAwardedIfAttemptedFunctionalityForIncorrectAnswer: (totalPoints) => {
1002
+ it('When user has provided minimum score awarded (if attempted) points, then in Preview tab on entering incorrect answer, minimum score should be provided for the question', () => {
1003
+ cy.log('Switch to edit tab and set minimum score if attempted points')
1004
+ createQuestionBasePage.steps.switchToEditTab();
1005
+ scoringSectionBase.steps.allotMinimumScoreAwardedIfAttempted('1')
1006
+ createQuestionBasePage.steps.switchToPreviewTab()
1007
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('sprout', 0);
1008
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('plant', 1);
1009
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('flower', 2);
1010
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('seed', 3);
1011
+ listSortingPage.steps.verifyTargetOptionsTextContentInPreviewTab(['sprout', 'plant', 'flower', 'seed']);
1012
+ listSortingPage.steps.verifyPreviewTabScoreText(1, `${totalPoints}`)
1013
+ });
1014
+
1015
+ it('When user removes minimum score awarded (if attempted) points, then in Preview tab on selecting any options other than correct answers, points should not be provided', () => {
1016
+ cy.log('Switch to edit tab and remove minimum score if attempted points')
1017
+ createQuestionBasePage.steps.switchToEditTab();
1018
+ scoringSectionBase.steps.clearMinimumScoreIfAttemptedPointsField();
1019
+ createQuestionBasePage.steps.switchToPreviewTab()
1020
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('sprout', 0);
1021
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('plant', 1);
1022
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('flower', 2);
1023
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('seed', 3);
1024
+ listSortingPage.steps.verifyTargetOptionsTextContentInPreviewTab(['sprout', 'plant', 'flower', 'seed']);
1025
+ listSortingPage.steps.verifyPreviewTabScoreText(0, `${totalPoints}`)
1026
+ });
1027
+ },
1028
+
1029
+ /**
1030
+ *
1031
+ * @param {number} scoredPoints the points scored by the user when penalty points are reduced
1032
+ * @param {number} totalPoints the maximum points that can be scored by the user
1033
+ * @description this function verifies the functionality of Penalty points when minimum points are not set and user attempts incorrect answer
1034
+ */
1035
+ verifyPenaltyPointsFunctionalityForIncorrectAnswer: (scoredPoints, totalPoints) => {
1036
+ it('When user has defined penalty points', () => {
1037
+ cy.log('Pre-step: Switch to edit tab and set penalty points');
1038
+ createQuestionBasePage.steps.switchToEditTab();
1039
+ autoScoredScoringSectionMultipleResponsesType.steps.allotPenaltyPoints(3)
1040
+
1041
+ cy.log('After switching to preview tab, when user adds an incorrect answer input, then 0 points should be awarded(no negative points)');
1042
+ createQuestionBasePage.steps.switchToPreviewTab();
1043
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('sprout', 0);
1044
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('plant', 1);
1045
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('flower', 2);
1046
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('seed', 3);
1047
+ listSortingPage.steps.verifyTargetOptionsTextContentInPreviewTab(['sprout', 'plant', 'flower', 'seed']);
1048
+ listSortingPage.steps.verifyPreviewTabScoreText(0, `${totalPoints}`)
1049
+
1050
+ cy.log('When user adds a partially correct answer input, the points should be updated accordingly with deducted penalty points');
1051
+ listSortingPage.steps.resetQuestionPreview()
1052
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('seed', 0);
1053
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('plant', 1);
1054
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('sprout', 2);
1055
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('flower', 3);
1056
+ listSortingPage.steps.verifyTargetOptionsTextContentInPreviewTab(['seed', 'plant', 'sprout', 'flower']);
1057
+ listSortingPage.steps.verifyPreviewTabScoreText(`${scoredPoints}`, `${totalPoints}`);
1058
+
1059
+ cy.log('Post step: Clearing the Penalty points field')
1060
+ createQuestionBasePage.steps.switchToEditTab();
1061
+ autoScoredScoringSectionMultipleResponsesType.penaltyPointsInputField()
1062
+ .clear();
1063
+ });
1064
+ },
1065
+
1066
+ /**
1067
+ * @param {*} totalPointsScored the maximum points that can be achieved by the user
1068
+ * @description this function verifies the functionality of penalty points when penalty points are set and user attempts alternate tab answers
1069
+ */
1070
+ verifyPenaltyPointsFunctionalityForAlternateTabAnswers: (totalPointsScored) => {
1071
+ it('When the user has alloted penalty points and attempts the question according to the alternate tab then user should be awarded with full points of the alternate tab and penalty points should not be deducted', () => {
1072
+ listSortingPage.steps.switchToEditTab()
1073
+ listSortingPage.steps.allotPenaltyPoints(3);
1074
+ listSortingPage.steps.switchToPreviewTab();
1075
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('seed', 0);
1076
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('flower', 1);
1077
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('sprout', 2);
1078
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('plant', 3);
1079
+ listSortingPage.steps.verifyTargetOptionsTextContentInPreviewTab(['seed', 'flower', 'sprout', 'plant']);
1080
+ listSortingPage.steps.verifyPreviewTabScoreText(`${totalPointsScored}`, `${totalPointsScored}`);
1081
+ cy.log('Post step: Clearing the Penalty points field')
1082
+ createQuestionBasePage.steps.switchToEditTab();
1083
+ autoScoredScoringSectionMultipleResponsesType.penaltyPointsInputField()
1084
+ .clear();
1085
+ });
1086
+ },
1087
+
1088
+ /**
1089
+ * @param {number[]} scoredPointsArray An array of numbers representing points scored in different cases.
1090
+ * - The first element represents points scored for incorrect answers.
1091
+ * - The second element represents points scored for partially correct answers.
1092
+ * - The third element represents points scored when minimum score awarded (if attempted) points is greater than the points achieved by attempting the question partially correct
1093
+ * @param {number} minimumPointsForPartialCorrectAnswers minimum score awarded (if attempted) points on attempting the question partially correct
1094
+ * @param {number} totalPoints the maximum points that can be achieved by the user
1095
+ * @description this function verifies the functionality of Minimum score if attempted points when penalty points are set and user attempts incorrect answer
1096
+ * - For all incorrect responses
1097
+ * - For partially correct responses, when points scored > minimum score awarded(if attempted) points
1098
+ * - For partially correct responses, when minimum score awarded(if attempted) points > points scored
1099
+ */
1100
+ verifyMinimumScoreIfAttemptedAndPenaltyPointsFunctionalityForIncorrectAnswer: (scoredPointsArray, minimumPointsForPartialCorrectAnswers, totalPoints) => {
1101
+ it('When user has defined both penalty points and minimum score awarded (if attempted) points', () => {
1102
+ cy.log('Pre-step: Switch to edit tab and set minimum score awarded (if attempted) points and Penalty points');
1103
+ createQuestionBasePage.steps.switchToEditTab();
1104
+ scoringSectionBase.steps.allotMinimumScoreAwardedIfAttempted(1);
1105
+ autoScoredScoringSectionMultipleResponsesType.steps.allotPenaltyPoints(3);
1106
+
1107
+ cy.log('Switch to preview tab and give incorrect answer input to check that minimum points are displayed');
1108
+ createQuestionBasePage.steps.switchToPreviewTab();
1109
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('sprout', 0);
1110
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('plant', 1);
1111
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('flower', 2);
1112
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('seed', 3);
1113
+ listSortingPage.steps.verifyTargetOptionsTextContentInPreviewTab(['sprout', 'plant', 'flower', 'seed']);
1114
+ listSortingPage.steps.verifyPreviewTabScoreText(`${scoredPointsArray[0]}`, `${totalPoints}`);
1115
+
1116
+ cy.log('When user adds a partially correct answer such that the points of the attempt(with penalty points deducted) is more than the minimum score awarded(if attempted) points');
1117
+ listSortingPage.steps.resetQuestionPreview();
1118
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('seed', 0);
1119
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('plant', 1);
1120
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('sprout', 2);
1121
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('flower', 3);
1122
+ listSortingPage.steps.verifyTargetOptionsTextContentInPreviewTab(['seed', 'plant', 'sprout', 'flower']);
1123
+ listSortingPage.steps.verifyPreviewTabScoreText(`${scoredPointsArray[1]}`, `${totalPoints}`);
1124
+
1125
+ cy.log('When user switches to edit tab and increases the minimum score awarded (if attempted) points to check the case for an attempt in which points of the attempt is less than minimum score awarded (if attempted) points, then the minimum score awarded (if attempted) points should be displayed to the user');
1126
+ createQuestionBasePage.steps.switchToEditTab();
1127
+ scoringSectionBase.steps.clearMinimumScoreIfAttemptedPointsField()
1128
+ scoringSectionBase.steps.allotMinimumScoreAwardedIfAttempted(minimumPointsForPartialCorrectAnswers)
1129
+ cy.log('Switching to preview tab');
1130
+ createQuestionBasePage.steps.switchToPreviewTab();
1131
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('plant', 0);
1132
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('seed', 1);
1133
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('sprout', 2);
1134
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('flower', 3);
1135
+ listSortingPage.steps.verifyTargetOptionsTextContentInPreviewTab(['plant', 'seed', 'sprout', 'flower']);
1136
+ listSortingPage.steps.verifyPreviewTabScoreText(`${scoredPointsArray[2]}`, `${totalPoints}`);
1137
+ });
1138
+ },
1139
+
1140
+ //Additional settings
1141
+ /**
1142
+ * @param {string[]} numerationArray array of the numeration displayed with options numbers| lowercase| uppercase
1143
+ * @description this function checks the numeration displayed for the options and correct answer container options when check answer is selected
1144
+ */
1145
+ verifyOptionStyleNumerationWhenCheckAnswerIsSelected: (optionNumerationArray) => {
1146
+ it('When user clicks on \'Check answer\' button then the default \'Answer numeration\' should be displayed in the \'Correct answers:\' section', () => {
1147
+ listSortingPage.steps.checkAnswer()
1148
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('plant', 0)
1149
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('flower', 1)
1150
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('seed', 2)
1151
+ listSortingPage.steps.clickAndDropOptionFromSourceToTargetInPreviewTab('sprout', 3)
1152
+ steps.verifyOptionsNumerationPreviewTab(optionNumerationArray)
1153
+ });
1154
+ },
1155
+
1156
+ verifyCSSAndA11yOfIncorrectAnswerLabel: () => {
1157
+ it('CSS of incorrect answer state', { tags: 'css' }, () => {
1158
+ cy.log('Pre requisite: The user has attempted the question incorrectly')
1159
+ cy.log('Pre step: Select show answer checkbox')
1160
+ previewScoringAndShowCorrectAnswerComponent.showCorrectAnswerCheckbox()
1161
+ .click()
1162
+ .should('be.checked');
1163
+ cy.log('Verifying CSS of incorrect crossmark icon')
1164
+ autoScoredPreviewBase.incorrectIcon()
1165
+ .eq(0)
1166
+ .verifyPseudoClassBeforeProperty('color', css.color.incorrectAnswer);
1167
+ autoScoredPreviewBase.correctIncorectAnswerLabel()
1168
+ .verifyCSS(css.color.incorrectAnswer, css.fontSize.normal, css.fontWeight.bold)
1169
+ autoScoredPreviewBase.steps.verifyIncorrectAttemptBorder();
1170
+ });
1171
+
1172
+ it('Accessibility of incorrect answer state', { tags: 'a11y' }, () => {
1173
+ cy.checkAccessibility(commonComponents.previewTabQuestionWrapper());
1174
+ cy.log('Post step: Deselect show answer checkbox')
1175
+ previewScoringAndShowCorrectAnswerComponent.showCorrectAnswerCheckbox()
1176
+ .click()
1177
+ .should('not.be.checked');
1178
+ });
1179
+ },
1180
+
1181
+ verifyCSSAndA11yOfFullScoreTextAndCorrectAnswerLabel: () => {
1182
+ it('CSS of check score text full score state and Correct Answer label', { tags: 'css' }, () => {
1183
+ previewScoringAndShowCorrectAnswerComponent.previewScoreText()
1184
+ .should('have.css', 'color', css.color.primaryBtn)
1185
+ .and('have.css', 'background-color', css.color.correctAnswer)
1186
+ autoScoredPreviewBase.correctIncorectAnswerLabel()
1187
+ .verifyCSS(css.color.correctAnswer, css.fontSize.normal, css.fontWeight.bold);
1188
+ autoScoredPreviewBase.steps.verifyCorrectAttemptBorder();
1189
+ });
1190
+
1191
+ it('Accessibility of check score text full score state and Correct Answer label', { tags: 'a11y' }, () => {
1192
+ cy.checkAccessibility(commonComponents.previewTabQuestionWrapper());
1193
+ });
1194
+ },
1195
+ }
1196
+
1197
+ export const listSortingPage = {
1198
+ ...selectors,
1199
+ steps,
1200
+ tests
1201
+ }