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,857 @@
1
+ import { createQuestionBasePage } from "./createQuestionBasePage"
2
+ import { dragAndDropResponseOptions } from "./dragAndDropResponseOptions"
3
+ import { optionsWrapperComponent } from "./optionsWrapperComponent"
4
+ const css = Cypress.env('css');
5
+ let optionsForResponses = ['Response 1', 'Response 2'];
6
+ let optionsForThreeResponses = ['Response 1', 'Response 2', 'Response 3'];
7
+ let responseForGroup2 = ['Response 3', 'Response 4'];
8
+
9
+ const selectors = {
10
+ draggableOption: () => cy.get('[class*="DraggableItems"][class*="style__ItemWrapper"]'),
11
+ draggableOptionDragIcon: () => cy.get('.drag-indicator-icon'),
12
+ setCorrectAnswerSectionGroupedResponseTitle: () => cy.get('[class*="GroupTitleWrapper"]'),
13
+ setCorrectAnswerSectionGroupedResponseContainer: () => cy.get('[class*="GroupDiv"]'),
14
+ //TODO: will need to update all these conditional selectors once, common selectors are implemented across all drag and drop question types
15
+ setCorrectAnswerDraggableOptionsWrapper: (questionType) => {
16
+ if (questionType === 'drag and drop into categories') {
17
+ return cy.get('.option-drag-and-drop')
18
+ } else {
19
+ return cy.get('.draggable-wrapper')
20
+ }
21
+ },
22
+ previewTabDraggableOptionsWrapper: (questionType) => {
23
+ if (questionType === 'drag and drop into categories') {
24
+ return cy.get('.edit-question-preview-wrapper .option-drag-and-drop')
25
+ } else {
26
+ return cy.get('.edit-question-preview-wrapper .draggable-wrapper')
27
+ }
28
+ },
29
+ previewTabGroupedResponseContainer: () => cy.get('.edit-question-preview-wrapper [class*="GroupDiv"]'),
30
+ previewTabGroupedResponseTitle: () => cy.get('.edit-question-preview-wrapper [class*="GroupTitleWrapper"]'),
31
+ previewTabGroupedResponseOptionsGrid: () => cy.get('.edit-question-preview-wrapper [class*="DraggableGroupsGrid"]')
32
+ }
33
+
34
+ const steps = {
35
+ verifyDraggableOptionContentsInPreviewTab: (questionType) => {
36
+ draggableOptionsContainer.previewTabDraggableOptionsWrapper(questionType)
37
+ .each(($element) => {
38
+ cy.wrap($element)
39
+ .within(() => {
40
+ draggableOptionsContainer.draggableOption()
41
+ .should('have.text', '');
42
+ draggableOptionsContainer.draggableOptionDragIcon()
43
+ .should('be.visible');
44
+ });
45
+ });
46
+ },
47
+
48
+ verifyDefaultStateOfDraggableOptionsInSetCorrectAnswerSection: (questionType, optionIndex) => {
49
+ draggableOptionsContainer.setCorrectAnswerDraggableOptionsWrapper(questionType)
50
+ .within(() => {
51
+ draggableOptionsContainer.draggableOption()
52
+ .eq(optionIndex)
53
+ .should('have.text', '');
54
+ draggableOptionsContainer.draggableOptionDragIcon()
55
+ .should('be.visible');
56
+ });
57
+ },
58
+
59
+ verifyDefaultStateOfDraggableOptionsInPreviewTab: (questionType, optionIndex) => {
60
+ draggableOptionsContainer.previewTabDraggableOptionsWrapper(questionType)
61
+ .within(() => {
62
+ draggableOptionsContainer.draggableOption()
63
+ .eq(optionIndex)
64
+ .should('have.text', '');
65
+ draggableOptionsContainer.draggableOptionDragIcon()
66
+ .should('be.visible');
67
+ });
68
+ },
69
+
70
+ verifyCountOfDraggableOptionsInSetCorrectAnswerSection: (questionType, count) => {
71
+ draggableOptionsContainer.setCorrectAnswerDraggableOptionsWrapper(questionType)
72
+ .within(() => {
73
+ draggableOptionsContainer.draggableOption()
74
+ .should('have.length', count);
75
+ });
76
+ },
77
+
78
+ verifyCountOfDraggableOptionsInPreviewTab: (questionType, count) => {
79
+ draggableOptionsContainer.previewTabDraggableOptionsWrapper(questionType)
80
+ .within(() => {
81
+ draggableOptionsContainer.draggableOption()
82
+ .should('have.length', count);
83
+ });
84
+ },
85
+
86
+ verifyDraggableResponsesSetCorrectAnswer: (questionType, draggableOptionsArray) => {
87
+ draggableOptionsContainer.setCorrectAnswerDraggableOptionsWrapper(questionType)
88
+ .within(() => {
89
+ draggableOptionsArray.forEach((draggableOption, optionIndex) => {
90
+ draggableOptionsContainer.draggableOption()
91
+ .eq(optionIndex)
92
+ .should('have.text', draggableOption);
93
+ });
94
+ draggableOptionsContainer.draggableOption()
95
+ .should('have.length', draggableOptionsArray.length);
96
+ });
97
+ },
98
+
99
+ verifyDraggableResponsesPreviewTab: (questionType, draggableOptionsArray) => {
100
+ draggableOptionsContainer.previewTabDraggableOptionsWrapper(questionType)
101
+ .within(() => {
102
+ draggableOptionsArray.forEach((draggableOption, optionIndex) => {
103
+ draggableOptionsContainer.draggableOption()
104
+ .eq(optionIndex)
105
+ .should('have.text', draggableOption);
106
+ });
107
+ draggableOptionsContainer.draggableOption()
108
+ .should('have.length', draggableOptionsArray.length);
109
+ });
110
+ },
111
+
112
+ verifyGroupedResponseContainerContentsInPreviewTab: (groupIndex, draggableOptionsArray) => {
113
+ draggableOptionsContainer.previewTabGroupedResponseContainer()
114
+ .eq(groupIndex)
115
+ .should('be.visible')
116
+ .within(() => {
117
+ draggableOptionsArray.forEach((draggableOption, optionIndex) => {
118
+ draggableOptionsContainer.draggableOption()
119
+ .eq(optionIndex)
120
+ .should('have.text', draggableOption)
121
+ .and('be.visible');
122
+ });
123
+ draggableOptionsContainer.draggableOption()
124
+ .should('have.length', draggableOptionsArray.length);
125
+ });
126
+ },
127
+
128
+ verifyGroupedResponseContainerContentsInSetCorrectAnswerSection: (groupIndex, draggableOptionsArray) => {
129
+ draggableOptionsContainer.setCorrectAnswerSectionGroupedResponseContainer()
130
+ .eq(groupIndex)
131
+ .should('be.visible')
132
+ .within(() => {
133
+ draggableOptionsContainer.draggableOption()
134
+ .should('have.length', draggableOptionsArray.length);
135
+ draggableOptionsArray.forEach((draggableOption, optionIndex) => {
136
+ draggableOptionsContainer.draggableOption()
137
+ .eq(optionIndex)
138
+ .should('have.text', draggableOption)
139
+ .and('be.visible');
140
+ });
141
+ });
142
+ },
143
+
144
+ verifyCountOfGroupsInSetCorrectAnswerSection: (count) => {
145
+ draggableOptionsContainer.setCorrectAnswerSectionGroupedResponseContainer()
146
+ .should('have.length', count);
147
+ },
148
+
149
+ /**
150
+ * @param {number} count
151
+ * @description Verify the count of option groups displayed in preview tab
152
+ */
153
+ verifyCountOfGroupsInPreviewTab: (count) => {
154
+ draggableOptionsContainer.previewTabGroupedResponseContainer()
155
+ .should('have.length', count);
156
+ },
157
+
158
+ //V3 this functions needs to be updated in all files
159
+ /**
160
+ * @param {number[]} optionArray Array of options set in set correct answer section
161
+ * @param {string} questionType Name of the question type
162
+ * @description Verify that options are randomized in preview tab
163
+ */
164
+ verifyRandomizeOptionOrder: (optionArray, questionType) => {
165
+ let currentOptions = [...optionArray]
166
+ draggableOptionsContainer.previewTabDraggableOptionsWrapper(questionType)
167
+ .within(() => {
168
+ for (let index = 0; index < currentOptions.length; index++) {
169
+ draggableOptionsContainer.draggableOption()
170
+ .eq(index)
171
+ .then(($element) => {
172
+ expect($element.text()).to.be.oneOf(currentOptions);
173
+ currentOptions = currentOptions.filter((value) => value !== $element.text())
174
+ });
175
+ };
176
+ });
177
+ draggableOptionsContainer.steps.verifyRerandomizedOptionsOrder(optionArray, questionType);
178
+ },
179
+
180
+ /**
181
+ * @param {string[]} previousOrderOfOptions Array of options displayed in preview tab
182
+ * @param {string} questionType Name of the question type
183
+ * @description Verify that options are re-randomized in preview tab for standard options layout
184
+ */
185
+ verifyRerandomizedOptionsOrder: (previousOrderOfOptions, questionType) => {
186
+ draggableOptionsContainer.previewTabDraggableOptionsWrapper(questionType)
187
+ .within(() => {
188
+ draggableOptionsContainer.draggableOption()
189
+ .should('not.have.text', '')
190
+ .and('not.have.text', previousOrderOfOptions.join(''));
191
+ });
192
+ },
193
+
194
+ verifyRerandomizedGroupOrder: (previousOrderOfGroups) => {
195
+ draggableOptionsContainer.previewTabGroupedResponseTitle()
196
+ .should('not.have.text', '')
197
+ .and('not.have.text', previousOrderOfGroups.join(''));
198
+ },
199
+
200
+ /**
201
+ * @param {string} questionType Name of the question type
202
+ * @description Get options array of the options displayed in preview tab
203
+ */
204
+ getOptionsArray: (questionType) => {
205
+ const optionsArray = [];
206
+ draggableOptionsContainer.previewTabDraggableOptionsWrapper(questionType)
207
+ .within(() => {
208
+ draggableOptionsContainer.draggableOption()
209
+ .each(($el) => {
210
+ cy.wrap($el)
211
+ .invoke('text')
212
+ .then((text) => {
213
+ optionsArray.push(text);
214
+ });
215
+ });
216
+ });
217
+ return optionsArray;
218
+ },
219
+
220
+ getGroupTitleArray: () => {
221
+ const groupTitleArray = [];
222
+ draggableOptionsContainer.previewTabGroupedResponseTitle()
223
+ .each(($el) => {
224
+ cy.wrap($el)
225
+ .invoke('text')
226
+ .then((text) => {
227
+ groupTitleArray.push(text);
228
+ });
229
+ });
230
+ return groupTitleArray;
231
+ },
232
+
233
+ /**
234
+ * @param {string} questionType question type
235
+ * @param {string[]} groupTitlesArray array of group titles
236
+ * @description verify randomization of grouped options in preview tab
237
+ */
238
+ verifyRandomizationOfGroupsInPreviewTab: (groupTitlesArray) => {
239
+ let groupTitles = [...groupTitlesArray];
240
+ for (let index = 0; index < groupTitles.length; index++) {
241
+ draggableOptionsContainer.previewTabGroupedResponseTitle()
242
+ .eq(index)
243
+ .then(($element) => {
244
+ expect($element.text()).to.be.oneOf(groupTitles);
245
+ groupTitles = groupTitles.filter((value) => value !== $element.text())
246
+ });
247
+ };
248
+ draggableOptionsContainer.previewTabGroupedResponseTitle()
249
+ .then((newElements) => {
250
+ const newOrder = Array.from(newElements).map((element) => element.textContent);
251
+ expect(newOrder).to.not.deep.equal(groupTitlesArray);
252
+ });
253
+ },
254
+
255
+ verifyRandomizeOptionOrderInGroup: (groupTitle, optionArray) => {
256
+ let currentOptions = [...optionArray];
257
+ draggableOptionsContainer.previewTabGroupedResponseContainer()
258
+ .contains(groupTitle)
259
+ .parents('.edit-question-preview-wrapper [class*="GroupDiv"]')
260
+ .within(() => {
261
+ for (let index = 0; index < currentOptions.length; index++) {
262
+ draggableOptionsContainer.draggableOption()
263
+ .eq(index)
264
+ .then(($element) => {
265
+ expect($element.text()).to.be.oneOf(currentOptions);
266
+ currentOptions = currentOptions.filter((value) => value !== $element.text())
267
+ });
268
+ };
269
+ draggableOptionsContainer.draggableOption()
270
+ .then((newElements) => {
271
+ const newOrder = Array.from(newElements).map((element) => element.textContent);
272
+ expect(newOrder).to.not.deep.equal(optionArray);
273
+ });
274
+ });
275
+ },
276
+
277
+ verifyDragIconVisibleInOptionsInSetCorrectAnswerSection: (questionType) => {
278
+ draggableOptionsContainer.setCorrectAnswerDraggableOptionsWrapper(questionType)
279
+ .within(() => {
280
+ draggableOptionsContainer.draggableOption()
281
+ .each($element => {
282
+ cy.wrap($element)
283
+ .within(() => {
284
+ draggableOptionsContainer.draggableOptionDragIcon()
285
+ .should('be.visible');
286
+ });
287
+ });
288
+ })
289
+ },
290
+
291
+ verifyDragIconNotVisibleInOptionsInSetCorrectAnswerSection: (questionType) => {
292
+ draggableOptionsContainer.setCorrectAnswerDraggableOptionsWrapper(questionType)
293
+ .within(() => {
294
+ draggableOptionsContainer.draggableOption()
295
+ .each($element => {
296
+ cy.wrap($element)
297
+ .within(() => {
298
+ draggableOptionsContainer.draggableOptionDragIcon()
299
+ .should('not.exist');
300
+ });
301
+ });
302
+ });
303
+ },
304
+
305
+ verifyDragIconVisibleInOptionsInPreviewTab: (questionType) => {
306
+ draggableOptionsContainer.previewTabDraggableOptionsWrapper(questionType)
307
+ .within(() => {
308
+ draggableOptionsContainer.draggableOption()
309
+ .each($element => {
310
+ cy.wrap($element)
311
+ .within(() => {
312
+ draggableOptionsContainer.draggableOptionDragIcon()
313
+ .should('be.visible');
314
+ });
315
+ });
316
+ });
317
+ },
318
+
319
+ verifyDragIconNotVisibleInOptionsInPreviewTab: (questionType) => {
320
+ draggableOptionsContainer.previewTabDraggableOptionsWrapper(questionType)
321
+ .within(() => {
322
+ draggableOptionsContainer.draggableOption()
323
+ .each($element => {
324
+ cy.wrap($element)
325
+ .within(() => {
326
+ draggableOptionsContainer.draggableOptionDragIcon()
327
+ .should('not.exist');
328
+ });
329
+ });
330
+ });
331
+ },
332
+
333
+ verifyGroupTitleInSetCorrectAnswerSection: (groupIndex, groupTitle) => {
334
+ draggableOptionsContainer.setCorrectAnswerSectionGroupedResponseTitle()
335
+ .eq(groupIndex)
336
+ .verifyInnerText(groupTitle);
337
+ },
338
+
339
+ verifyGroupTitleInPreviewTab: (groupIndex, groupTitle) => {
340
+ draggableOptionsContainer.previewTabGroupedResponseTitle()
341
+ .eq(groupIndex)
342
+ .verifyInnerText(groupTitle);
343
+ },
344
+
345
+ //V3 - This function should be updated in all files
346
+ /**
347
+ * @param {string} questionType Text displayed inside the draggable option
348
+ * @description Verify inactive state of all options in set correct answer section
349
+ */
350
+ verifyInactiveStateOfAllDraggableOptionsInSetCorrectAnswerSection: (questionType) => {
351
+ const expectedClass = questionType === 'drag and drop into categories' ? 'isSelected' : 'item-selected';
352
+
353
+ draggableOptionsContainer.setCorrectAnswerDraggableOptionsWrapper(questionType)
354
+ .within(() => {
355
+ draggableOptionsContainer.draggableOption()
356
+ .each($element => {
357
+ cy.wrap($element)
358
+ .should('not.have.class', expectedClass);
359
+ });
360
+ });
361
+ },
362
+
363
+ //V3 - This function should be updated in all files
364
+ /**
365
+ * @param {string} questionType Text displayed inside the draggable option
366
+ * @description Verify inactive state of all options in set correct answer section
367
+ */
368
+ verifyInactiveStateOfAllDraggableOptionsInPreviewTab: (questionType) => {
369
+ const expectedClass = questionType === 'drag and drop into categories' ? 'isSelected' : 'item-selected';
370
+
371
+ draggableOptionsContainer.previewTabDraggableOptionsWrapper(questionType)
372
+ .within(() => {
373
+ draggableOptionsContainer.draggableOption()
374
+ .each($element => {
375
+ cy.wrap($element)
376
+ .should('not.have.class', expectedClass);
377
+ });
378
+ });
379
+ },
380
+
381
+ //V3 - This function should be updated in all files
382
+ /**
383
+ * @param {string} optionText Text displayed inside the draggable option
384
+ * @description Click on the draggable option to select or deselect it
385
+ */
386
+ clickOnDraggableOptionInSetCorrectAnswerSection: (questionType, optionText) => {
387
+ draggableOptionsContainer.setCorrectAnswerDraggableOptionsWrapper(questionType)
388
+ .within(() => {
389
+ draggableOptionsContainer.draggableOption()
390
+ .contains(`${optionText}`)
391
+ .click();
392
+ });
393
+ },
394
+
395
+ //V3 - This function should be updated in all files
396
+ /**
397
+ * @param {string} optionText Text displayed inside the draggable option
398
+ * @description Click on the draggable option to select or deselect it
399
+ */
400
+ clickOnDraggableOptionInPreviewTab: (questionType, optionText) => {
401
+ draggableOptionsContainer.previewTabDraggableOptionsWrapper(questionType)
402
+ .within(() => {
403
+ draggableOptionsContainer.draggableOption()
404
+ .contains(`${optionText}`)
405
+ .click();
406
+ });
407
+ },
408
+
409
+ //V3 - This function should be updated in all files
410
+ /**
411
+ * @param {number} optionIndex Index of the option
412
+ * @param {string} questionType
413
+ * @description Verify active state of option in set correct answer section
414
+ */
415
+ verifyActiveStateOfDraggableOptionInSetCorrectAnswerSection: (optionIndex, questionType) => {
416
+ const expectedClass = questionType === 'drag and drop into categories' ? 'isSelected' : 'item-selected';
417
+
418
+ draggableOptionsContainer.draggableOption()
419
+ .eq(optionIndex)
420
+ .should('have.class', expectedClass);
421
+ if (questionType !== 'drag and drop into categories') {
422
+ draggableOptionsContainer.setCorrectAnswerDraggableOptionsWrapper(questionType)
423
+ .should('have.class', 'itemSelected');
424
+ }
425
+ },
426
+
427
+ //V3 - This function should be updated in all files
428
+ /**
429
+ * @param {number} optionIndex Index of the option
430
+ * @param {string} questionType
431
+ * @description Verify active state of option in preview tab
432
+ */
433
+ verifyActiveStateOfDraggableOptionInPreviewTab: (optionIndex, questionType) => {
434
+ const expectedClass = questionType === 'drag and drop into categories' ? 'isSelected' : 'item-selected';
435
+ draggableOptionsContainer.previewTabDraggableOptionsWrapper(questionType)
436
+ .within(() => {
437
+ draggableOptionsContainer.draggableOption()
438
+ .eq(optionIndex)
439
+ .should('have.class', expectedClass);
440
+ });
441
+ if (questionType !== 'drag and drop into categories') {
442
+ draggableOptionsContainer.previewTabDraggableOptionsWrapper(questionType)
443
+ .should('have.class', 'itemSelected');
444
+ };
445
+ },
446
+
447
+ //V3 - This function should be updated in all files
448
+ /**
449
+ * @param {number[]} unselectedOptionIndexArray Array of index of options which are in unselected state
450
+ * @param {string} questionType
451
+ * @description Verify default inactive state of options in set correct answer section
452
+ */
453
+ verifyDefaultStateOfUnselectedDraggableOptionsInSetCorrectAnswerSection: (unselectedOptionIndexArray, questionType) => {
454
+ const expectedClass = questionType === 'drag and drop into categories' ? 'isSelected' : 'item-selected';
455
+
456
+ draggableOptionsContainer.setCorrectAnswerDraggableOptionsWrapper(questionType)
457
+ .within(() => {
458
+ unselectedOptionIndexArray.forEach((optionIndex) => {
459
+ draggableOptionsContainer.draggableOption()
460
+ .eq(optionIndex)
461
+ .should('not.have.class', expectedClass);
462
+ });
463
+ });
464
+ },
465
+
466
+ //V3 - This function should be updated in all files
467
+ /**
468
+ * @param {number[]} unselectedOptionIndexArray Array of index of options which are in unselected state
469
+ * @param {string} questionType
470
+ * @description Verify default inactive state of options in preview tab
471
+ */
472
+ verifyDefaultStateOfUnselectedDraggableOptionsInPreviewTab: (unselectedOptionIndexArray, questionType) => {
473
+ const expectedClass = questionType === 'drag and drop into categories' ? 'isSelected' : 'item-selected';
474
+ draggableOptionsContainer.previewTabDraggableOptionsWrapper(questionType)
475
+ .within(() => {
476
+ unselectedOptionIndexArray.forEach((optionIndex) => {
477
+ draggableOptionsContainer.draggableOption()
478
+ .eq(optionIndex)
479
+ .should('not.have.class', expectedClass);
480
+ });
481
+ });
482
+ },
483
+
484
+ //V3 - This function should be updated in all files
485
+ /**
486
+ * @param {string} questionType
487
+ * @description Verify active state of options container in set correct answer section
488
+ */
489
+ verifyActiveStateOfDraggableOptionsContainerInSetCorrectAnswerSection: (questionType) => {
490
+ const expectedClass = questionType === 'drag and drop into categories' ? 'active-area-on-tap' : 'isActiveForDropping';
491
+
492
+ draggableOptionsContainer.setCorrectAnswerDraggableOptionsWrapper(questionType)
493
+ .should('have.class', expectedClass);
494
+ },
495
+
496
+ //V3 - This function should be updated in all files
497
+ /**
498
+ * @param {string} questionType
499
+ * @description Verify active state of options container in preview tab
500
+ */
501
+ verifyActiveStateOfDraggableOptionsContainerInPreviewTab: (questionType) => {
502
+ const expectedClass = questionType === 'drag and drop into categories' ? 'active-area-on-tap' : 'isActiveForDropping';
503
+
504
+ draggableOptionsContainer.previewTabDraggableOptionsWrapper(questionType)
505
+ .should('have.class', expectedClass);
506
+ },
507
+
508
+ /**
509
+ * @param {number} groupIndex Index of group
510
+ * @description Verify the empty group displayed in set correct answer section
511
+ */
512
+ verifyEmptyGroupInSetCorrectAnswerSection: (groupIndex) => {
513
+ draggableOptionsContainer.setCorrectAnswerSectionGroupedResponseContainer()
514
+ .eq(groupIndex)
515
+ .should('be.visible')
516
+ .within(() => {
517
+ draggableOptionsContainer.draggableOption()
518
+ .should('not.exist');
519
+ });
520
+ },
521
+
522
+ /**
523
+ * @param {number} groupIndex Index of group
524
+ * @description Verify the empty group displayed in set correct answer section
525
+ */
526
+ verifyEmptyGroupInPreviewTab: (groupIndex) => {
527
+ draggableOptionsContainer.previewTabGroupedResponseContainer()
528
+ .eq(groupIndex)
529
+ .should('be.visible')
530
+ .within(() => {
531
+ draggableOptionsContainer.draggableOption()
532
+ .should('not.exist');
533
+ })
534
+ },
535
+ }
536
+
537
+ const tests = {
538
+ verifyStandardResponseDraggableOptionsInSetCorrectAnswerSection: (questionType) => {
539
+ it('When the user has not entered text in the options input field then two empty draggable options along with drag handles should be displayed in the response options container of the \'Set correct answer\' section', () => {
540
+ draggableOptionsContainer.steps.verifyCountOfDraggableOptionsInSetCorrectAnswerSection(questionType, 2);
541
+ for (let index = 0; index < 2; index++) {
542
+ draggableOptionsContainer.steps.verifyDefaultStateOfDraggableOptionsInSetCorrectAnswerSection(questionType, index);
543
+ };
544
+ });
545
+
546
+ it('When the user enters text in options input fields then the entered text should be displayed in the respective draggable options in the response options container of the \'Set correct answer\' section', () => {
547
+ dragAndDropResponseOptions.steps.addInputToOptionsForDragAndDropFields(optionsForResponses);
548
+ draggableOptionsContainer.steps.verifyDraggableResponsesSetCorrectAnswer(questionType, optionsForResponses);
549
+ });
550
+
551
+ it('When the user adds an option using \'Add Option\' button then the added option should be displayed along with drag handle in the response options container of the \'Set Correct Answer\' section', () => {
552
+ optionsWrapperComponent.addOptionButton()
553
+ .click();
554
+ cy.log('Checking the added input field should be displayed along with its drag handle and be blank')
555
+ draggableOptionsContainer.steps.verifyCountOfDraggableOptionsInSetCorrectAnswerSection(questionType, 3);
556
+ draggableOptionsContainer.steps.verifyDefaultStateOfDraggableOptionsInSetCorrectAnswerSection(questionType, 2);
557
+ cy.log('Checking that input text to the newly added option is displayed in the response options container of the \'Set Correct Answer\' section')
558
+ optionsWrapperComponent.steps.editOptionInputField(2, `${optionsForThreeResponses[2]}`);
559
+ draggableOptionsContainer.steps.verifyDraggableResponsesSetCorrectAnswer(questionType, optionsForThreeResponses);
560
+ });
561
+
562
+ it('When the user adds an identical option in the options field, then both options should be displayed in the response options container of the \'Set Correct Answer\' section', () => {
563
+ cy.log('Pre step: Editing the Response 3 to Response 2 to make two responses identical')
564
+ optionsWrapperComponent.steps.editOptionInputField(2, `${optionsForThreeResponses[1]}`);
565
+ draggableOptionsContainer.steps.verifyCountOfDraggableOptionsInSetCorrectAnswerSection(questionType, 3);
566
+ draggableOptionsContainer.setCorrectAnswerDraggableOptionsWrapper(questionType)
567
+ .within(() => {
568
+ for (let index = 1; index <= 2; index++) {
569
+ draggableOptionsContainer.draggableOption()
570
+ .eq(index)
571
+ .should('be.visible')
572
+ .should('have.text', 'Response 2');
573
+ };
574
+ });
575
+ cy.log('Post step: Editing the the identical option back to Response 3')
576
+ optionsWrapperComponent.steps.editOptionInputField(2, `${optionsForThreeResponses[2]}`);
577
+ });
578
+ },
579
+
580
+ verifyStandardResponseDraggableOptionsInPreviewTab: (questionType) => {
581
+ it('When the user has not entered text in the options input field then two empty draggable options along with drag handles should be displayed in the response options container of the \'Preview tab\'', () => {
582
+ draggableOptionsContainer.steps.verifyCountOfDraggableOptionsInPreviewTab(questionType, 2);
583
+ for (let index = 0; index < 2; index++) {
584
+ draggableOptionsContainer.steps.verifyDefaultStateOfDraggableOptionsInPreviewTab(questionType, index);
585
+ }
586
+ });
587
+
588
+ it('When the user enters text in options input fields then the entered text should be displayed in the respective draggable options in the response options container of the \'Preview tab\'', () => {
589
+ cy.log('Pre-step : Switching to \'Edit\' tab')
590
+ createQuestionBasePage.steps.switchToEditTab();
591
+ dragAndDropResponseOptions.steps.addInputToOptionsForDragAndDropFields(optionsForResponses);
592
+ cy.log('Switching to preview tab to check Preview tab draggable options')
593
+ createQuestionBasePage.steps.switchToPreviewTab();
594
+ draggableOptionsContainer.steps.verifyDraggableResponsesPreviewTab(questionType, optionsForResponses);
595
+ });
596
+
597
+ it('When the user adds an option using \'Add Option\' button then the added option should be displayed in the response options container of the \'Preview tab\'', () => {
598
+ cy.log('Pre-step : Switching to \'Edit\' tab')
599
+ createQuestionBasePage.steps.switchToEditTab();
600
+ optionsWrapperComponent.steps.addOption();
601
+ cy.log('Checking the added input field should be displayed in the Preview tab along with its drag handle and be blank')
602
+ createQuestionBasePage.steps.switchToPreviewTab();
603
+ draggableOptionsContainer.steps.verifyCountOfDraggableOptionsInPreviewTab(questionType, 3);
604
+ draggableOptionsContainer.steps.verifyDefaultStateOfDraggableOptionsInPreviewTab(questionType, 2);
605
+ cy.log('Checking that input text to the newly added option is displayed in the option in Preview tab section')
606
+ createQuestionBasePage.steps.switchToEditTab();
607
+ optionsWrapperComponent.steps.editOptionInputField(2, `${optionsForThreeResponses[2]}`);
608
+ createQuestionBasePage.steps.switchToPreviewTab();
609
+ draggableOptionsContainer.steps.verifyDraggableResponsesPreviewTab(questionType, optionsForThreeResponses);
610
+ });
611
+
612
+ it('When the user adds an identical option in the options field, then both options should be displayed in the response options container of the \'Preview tab\'', () => {
613
+ cy.log('Pre-step : Switching to \'Edit\' tab and editing the Response 3 to Response 2 to make two responses identical')
614
+ createQuestionBasePage.steps.switchToEditTab();
615
+ optionsWrapperComponent.steps.editOptionInputField(2, `${optionsForThreeResponses[1]}`);
616
+ createQuestionBasePage.steps.switchToPreviewTab();
617
+ draggableOptionsContainer.steps.verifyCountOfDraggableOptionsInPreviewTab(questionType, 3);
618
+ draggableOptionsContainer.previewTabDraggableOptionsWrapper(questionType)
619
+ .within(() => {
620
+ for (let index = 1; index <= 2; index++) {
621
+ draggableOptionsContainer.draggableOption()
622
+ .eq(index)
623
+ .should('be.visible')
624
+ .should('have.text', 'Response 2');
625
+ };
626
+ });
627
+ cy.log('Post step: Editing the the identical option back to Response 3')
628
+ createQuestionBasePage.steps.switchToEditTab();
629
+ optionsWrapperComponent.steps.editOptionInputField(2, `${optionsForThreeResponses[2]}`);
630
+ });
631
+
632
+ it('When the user deletes an option then the deleted option should get removed from the response options container of the \'Preview tab\'', () => {
633
+ const optionsAfterDeleting = optionsForThreeResponses.filter((el) => el !== 'Response 3')
634
+ cy.log('Pre-step : Switching to \'Edit\' tab')
635
+ createQuestionBasePage.steps.switchToEditTab();
636
+ optionsWrapperComponent.steps.deleteOption(2);
637
+ cy.log('Checking the deleted option should not exist in the Preview tab')
638
+ createQuestionBasePage.steps.switchToPreviewTab();
639
+ draggableOptionsContainer.steps.verifyCountOfDraggableOptionsInPreviewTab(questionType, 2);
640
+ draggableOptionsContainer.steps.verifyDraggableResponsesPreviewTab(questionType, optionsAfterDeleting);
641
+ });
642
+ },
643
+
644
+ verifyGroupedResponseDraggableOptionsInSetCorrectAnswerSection: () => {
645
+ it('When the user has not entered text in the \'Group title\' input field then no group title should be displayed for the group in the response options container of the \'Set Correct Answer\' section', () => {
646
+ draggableOptionsContainer.setCorrectAnswerSectionGroupedResponseTitle()
647
+ .should('not.exist');
648
+ });
649
+
650
+ it('When the user enters text in the \'Group title\' input field, a group title should be displayed for the group in the response options container of the \'Set Correct Answer\' section', () => {
651
+ dragAndDropResponseOptions.steps.addGroupTitle(0, 'Group title A');
652
+ draggableOptionsContainer.setCorrectAnswerSectionGroupedResponseTitle()
653
+ .should('have.text', 'Group title A');
654
+ });
655
+
656
+ it('When the user has not entered text in the options input field then two empty draggable options along with drag handles should be displayed as a group in the response options container of the \'Set Correct Answer\' section', () => {
657
+ draggableOptionsContainer.steps.verifyGroupedResponseContainerContentsInSetCorrectAnswerSection(0, ['', '']);
658
+ });
659
+
660
+ it('When the user enters text in options input fields then the entered text should be displayed in the respective draggable options in a group in the response options container of the \'Set Correct Answer\' section', () => {
661
+ dragAndDropResponseOptions.steps.addInputToOptionsForDragAndDropFields(optionsForResponses);
662
+ cy.wait(500);
663
+ draggableOptionsContainer.steps.verifyGroupedResponseContainerContentsInSetCorrectAnswerSection(0, optionsForResponses);
664
+ });
665
+
666
+ it('CSS of \'Grouped\' container in the \'Set Correct Answer\' section', { tags: 'css' }, () => {
667
+ draggableOptionsContainer.setCorrectAnswerSectionGroupedResponseContainer()
668
+ .should('have.css', 'border', `1px solid ${css.color.defaultDropdownBorder}`);
669
+ draggableOptionsContainer.draggableOption()
670
+ .should('have.css', 'border', `1px solid ${css.color.figDefaultComponentBorder}`)
671
+ .find('.question-text-wrapper')
672
+ .verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
673
+ draggableOptionsContainer.draggableOption()
674
+ .find('.drag-indicator-icon')
675
+ .should('have.css', 'fill', `${css.color.activeButtons}`);
676
+ });
677
+
678
+ it('Accessibility of \'Grouped\' container in the \'Set Correct Answer\' section', { tags: 'a11y' }, () => {
679
+ cy.checkAccessibility(draggableOptionsContainer.setCorrectAnswerSectionGroupedResponseContainer());
680
+ });
681
+
682
+ it('When the user adds an option using \'Add Option\' button then the added option should be displayed along with drag handle inside the group in the response options container of the \'Set Correct Answer\' section', () => {
683
+ optionsWrapperComponent.steps.addOption();
684
+ draggableOptionsContainer.steps.verifyGroupedResponseContainerContentsInSetCorrectAnswerSection(0, ['Response 1', 'Response 2', '']);
685
+ cy.log('Checking that input text to the newly added option is displayed in the response options container of the \'Set Correct Answer\' section')
686
+ optionsWrapperComponent.steps.editOptionInputField(2, `${optionsForThreeResponses[2]}`);
687
+ cy.wait(500);
688
+ draggableOptionsContainer.steps.verifyGroupedResponseContainerContentsInSetCorrectAnswerSection(0, optionsForThreeResponses);
689
+ });
690
+
691
+ it('When the user adds an identical option in the options field, then both options should be displayed inside the group in the response options container of the \'Set Correct Answer\' section', () => {
692
+ cy.log('Pre step: Editing the Response 3 to Response 2 to make two responses identical')
693
+ optionsWrapperComponent.steps.editOptionInputField(2, `${optionsForThreeResponses[1]}`);
694
+ cy.wait(500);
695
+ draggableOptionsContainer.steps.verifyGroupedResponseContainerContentsInSetCorrectAnswerSection(0, ['Response 1', 'Response 2', 'Response 2']);
696
+ cy.log('Post step: Editing the the identical option back to Response 3')
697
+ optionsWrapperComponent.steps.editOptionInputField(2, `${optionsForThreeResponses[2]}`);
698
+ });
699
+
700
+ it('When the user deletes an option then the deleted option should get removed from the group in the response options container of the \'Set Correct Answer\' section', () => {
701
+ dragAndDropResponseOptions.groupResponseContainer()
702
+ .eq(0)
703
+ .within(() => {
704
+ optionsWrapperComponent.steps.deleteOption(2);
705
+ });
706
+ cy.log('verifying the text of draggable options after deleting an option')
707
+ draggableOptionsContainer.steps.verifyGroupedResponseContainerContentsInSetCorrectAnswerSection(0, ['Response 1', 'Response 2']);
708
+ });
709
+
710
+ it('When the user adds a new group, the new group should be displayed in the response options container of the \'Set Correct Answer\' section', () => {
711
+ dragAndDropResponseOptions.steps.addGroup();
712
+ draggableOptionsContainer.setCorrectAnswerSectionGroupedResponseContainer()
713
+ .should('have.length', 2);
714
+ draggableOptionsContainer.setCorrectAnswerSectionGroupedResponseContainer()
715
+ .eq(1)
716
+ .should('be.visible');
717
+ });
718
+
719
+ it('By default, the newly added group should have two empty draggable options along with drag handles', () => {
720
+ draggableOptionsContainer.setCorrectAnswerSectionGroupedResponseContainer()
721
+ .eq(1)
722
+ .within(() => {
723
+ draggableOptionsContainer.setCorrectAnswerSectionGroupedResponseTitle()
724
+ .should('not.exist');
725
+ });
726
+ draggableOptionsContainer.steps.verifyGroupedResponseContainerContentsInSetCorrectAnswerSection(1, ['', '']);
727
+ });
728
+ },
729
+
730
+ verifyGroupedResponseDraggableOptionsInPreviewTab: () => {
731
+ it('When the user has not entered text in the \'Group title\' input field then no group title should be displayed for the group in the response options container of the \'Preview tab\'', () => {
732
+ draggableOptionsContainer.previewTabGroupedResponseTitle()
733
+ .should('not.exist');
734
+ });
735
+
736
+ it('When the user enters text in the \'Group title\' input field, a group title should be displayed for the group in the response options container of the \'Preview tab\'', () => {
737
+ cy.log('Pre step: Switching to edit tab')
738
+ createQuestionBasePage.steps.switchToEditTab();
739
+ dragAndDropResponseOptions.steps.addGroupTitle(0, 'Group title A');
740
+ createQuestionBasePage.steps.switchToPreviewTab();
741
+ draggableOptionsContainer.previewTabGroupedResponseTitle()
742
+ .should('have.text', 'Group title A');
743
+ });
744
+
745
+ it('When the user has not entered text in the options input field then two empty draggable options along with drag handles should be displayed as a group in the response options container of the \'Preview tab\'', () => {
746
+ draggableOptionsContainer.steps.verifyGroupedResponseContainerContentsInPreviewTab(0, ['', '']);
747
+ });
748
+
749
+ it('When the user enters text in options input fields then the entered text should be displayed in the respective draggable options in the response options container of the \'Preview tab\'', () => {
750
+ cy.log('Pre step: Switching to edit tab')
751
+ createQuestionBasePage.steps.switchToEditTab();
752
+ dragAndDropResponseOptions.steps.addInputToOptionsForDragAndDropFields(optionsForResponses);
753
+ createQuestionBasePage.steps.switchToPreviewTab();
754
+ draggableOptionsContainer.steps.verifyGroupedResponseContainerContentsInPreviewTab(0, optionsForResponses);
755
+ });
756
+
757
+ it('CSS of \'Grouped\' container in the response options container of the \'Preview tab\'', { tags: 'css' }, () => {
758
+ draggableOptionsContainer.previewTabGroupedResponseContainer()
759
+ .should('have.css', 'border', `1px solid ${css.color.defaultDropdownBorder}`)
760
+ .within(() => {
761
+ draggableOptionsContainer.draggableOption()
762
+ .should('have.css', 'border', `1px solid ${css.color.figDefaultComponentBorder}`)
763
+ .find('.drag-indicator-icon')
764
+ .should('have.css', 'fill', `${css.color.activeButtons}`);
765
+ });
766
+ });
767
+
768
+ it('Accessibility of \'Grouped\' container in the response options container of the \'Preview tab\'', { tags: 'a11y' }, () => {
769
+ cy.checkAccessibility(draggableOptionsContainer.previewTabGroupedResponseContainer());
770
+ });
771
+
772
+ it('When the user adds an option using \'Add Option\' button then the added option should be displayed inside the group in the response options container of the \'Preview tab\'', () => {
773
+ cy.log('Pre step: Switching to edit tab')
774
+ createQuestionBasePage.steps.switchToEditTab();
775
+ optionsWrapperComponent.steps.addOption();
776
+ createQuestionBasePage.steps.switchToPreviewTab();
777
+ draggableOptionsContainer.steps.verifyGroupedResponseContainerContentsInPreviewTab(0, ['Response 1', 'Response 2', '']);
778
+ cy.log('Checking that input text to the newly added option is displayed in the option in Preview tab section')
779
+ createQuestionBasePage.steps.switchToEditTab();
780
+ optionsWrapperComponent.steps.editOptionInputField(2, `${optionsForThreeResponses[2]}`);
781
+ createQuestionBasePage.steps.switchToPreviewTab();
782
+ draggableOptionsContainer.steps.verifyGroupedResponseContainerContentsInPreviewTab(0, optionsForThreeResponses);
783
+ });
784
+
785
+ it('When the user adds an identical option in the options field, then both options should be displayed inside the group in the response options container of the \'Preview tab\'', () => {
786
+ cy.log('Pre step: Switching to edit tab')
787
+ createQuestionBasePage.steps.switchToEditTab();
788
+ cy.log('Editing the Response 3 to Response 2 to make two responses identical')
789
+ optionsWrapperComponent.steps.editOptionInputField(2, `${optionsForThreeResponses[1]}`);
790
+ createQuestionBasePage.steps.switchToPreviewTab();
791
+ draggableOptionsContainer.steps.verifyGroupedResponseContainerContentsInPreviewTab(0, ['Response 1', 'Response 2', 'Response 2']);
792
+ cy.log('Post step: Editing the identical option back to Response 3')
793
+ createQuestionBasePage.steps.switchToEditTab();
794
+ optionsWrapperComponent.steps.editOptionInputField(2, `${optionsForThreeResponses[2]}`);
795
+ });
796
+
797
+ it('When the user deletes an option then the deleted option should get removed from the group in the response options container of the \'Preview tab\'', () => {
798
+ cy.log('Pre step: Switching to edit tab')
799
+ createQuestionBasePage.steps.switchToEditTab();
800
+ dragAndDropResponseOptions.groupResponseContainer()
801
+ .eq(0)
802
+ .within(() => {
803
+ optionsWrapperComponent.steps.deleteOption(2);
804
+ });
805
+ cy.log('Checking the deleted option should not exist in the Preview tab')
806
+ createQuestionBasePage.steps.switchToPreviewTab();
807
+ cy.log('verifying the text of draggable options after deleting an option')
808
+ draggableOptionsContainer.steps.verifyGroupedResponseContainerContentsInPreviewTab(0, ['Response 1', 'Response 2']);
809
+ });
810
+
811
+ it('When the user adds a new group, the new group should be displayed in the response options container of the \'Preview tab\'', () => {
812
+ cy.log('Pre step: Switching to edit tab')
813
+ createQuestionBasePage.steps.switchToEditTab();
814
+ dragAndDropResponseOptions.addGroupButton()
815
+ .click();
816
+ createQuestionBasePage.steps.switchToPreviewTab();
817
+ draggableOptionsContainer.previewTabGroupedResponseContainer()
818
+ .should('have.length', 2);
819
+ draggableOptionsContainer.previewTabGroupedResponseContainer()
820
+ .eq(1)
821
+ .should('be.visible');
822
+ });
823
+
824
+ it('By default, the newly added group should have two empty draggable options along with drag handles', () => {
825
+ draggableOptionsContainer.steps.verifyGroupedResponseContainerContentsInPreviewTab(1, ['', '']);
826
+ });
827
+
828
+ it('When the user deletes a group, it should get removed from response options container of the \'Preview tab\'', () => {
829
+ cy.log('Pre step: Switching to edit tab')
830
+ createQuestionBasePage.steps.switchToEditTab();
831
+ cy.log('Pre step: Entering text into the text fields of group 2 response container')
832
+ dragAndDropResponseOptions.groupResponseContainer()
833
+ .eq(1)
834
+ .within(() => {
835
+ dragAndDropResponseOptions.steps.addInputToOptionsForDragAndDropFields(responseForGroup2);
836
+ });
837
+ dragAndDropResponseOptions.steps.addGroupTitle(1, 'Group title B');
838
+ dragAndDropResponseOptions.steps.deleteGroup(0);
839
+ createQuestionBasePage.steps.switchToPreviewTab();
840
+ draggableOptionsContainer.previewTabGroupedResponseContainer()
841
+ .should('have.length', 1);
842
+ draggableOptionsContainer.previewTabGroupedResponseContainer()
843
+ .eq(1)
844
+ .should('not.exist');
845
+ cy.log('verifying the contents of group 2 after deleting group 1')
846
+ draggableOptionsContainer.steps.verifyGroupedResponseContainerContentsInPreviewTab(0, responseForGroup2);
847
+ draggableOptionsContainer.previewTabGroupedResponseTitle()
848
+ .should('have.text', 'Group title B');
849
+ });
850
+ },
851
+ }
852
+
853
+ export const draggableOptionsContainer = {
854
+ ...selectors,
855
+ steps,
856
+ tests
857
+ }