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,742 @@
1
+ import { additionalSettingsPanel, autoScoredAdditionalSettings, autoScoredPreviewBase, autoScoredScoringSection, autoScoredScoringSectionMultipleResponsesType, autoScoredSetCorrectAnswerSection, commonComponents, createQuestionBasePage, dragAndDropSetCorrectAnswerCheckboxComponents, draggableOptionsContainer, fillInTheGapsCommonComponents, optionsWrapperComponent, previewScoringAndShowCorrectAnswerComponent, questionInstructionsComponent, scoringSectionBase } from "./components"
2
+ import { dragAndDropResponseOptions } from "./components/dragAndDropResponseOptions";
3
+ const css = Cypress.env('css');
4
+ let optionsForResponses = ['Response 1', 'Response 2'];
5
+
6
+ const selectors = {
7
+ ...scoringSectionBase,
8
+ ...createQuestionBasePage,
9
+ ...additionalSettingsPanel,
10
+ ...questionInstructionsComponent,
11
+ ...commonComponents,
12
+ ...fillInTheGapsCommonComponents,
13
+ ...autoScoredSetCorrectAnswerSection,
14
+ ...autoScoredAdditionalSettings,
15
+ ...autoScoredPreviewBase,
16
+ ...autoScoredScoringSectionMultipleResponsesType,
17
+ ...optionsWrapperComponent,
18
+ ...previewScoringAndShowCorrectAnswerComponent,
19
+ ...dragAndDropResponseOptions,
20
+ ...draggableOptionsContainer,
21
+ //TODO: Can be shifted to optionsWrapperComponent once https://redmine.zeuslearning.com/issues/518498 is resolved
22
+ setCorrectAnswerResponseArea: () => cy.get('[class="droppable-area"] [role="button"]'),
23
+ setCorrectAnswerDraggableOption: () => cy.get('.draggable-selected-item'),
24
+ randomizeOptionsLabel: () => cy.get('[data-ngie-testid="randomize-options-checkbox"] .MuiFormControlLabel-label'),
25
+ reuseOptionsLabel: () => cy.get('[data-ngie-testid="reuse-options-checkbox"] .MuiFormControlLabel-label'),
26
+ hideDragHandleLabel: () => cy.get('[data-ngie-testid="hide-drag-handle-checkbox"] .MuiFormControlLabel-label'),
27
+ matchFromAllResponsesLabel: () => cy.get('[data-ngie-testid="match-from-all-responses-checkbox"] .MuiFormControlLabel-label'),
28
+ randomizeOptionsCheckbox: () => cy.get('[data-ngie-testid="randomize-options-checkbox"] input'),
29
+ reuseOptionsCheckbox: () => cy.get('[data-ngie-testid="reuse-options-checkbox"] input'),
30
+ hideDragHandleCheckbox: () => cy.get('[data-ngie-testid="hide-drag-handle-checkbox"] input'),
31
+ matchFromAllResponsesCheckbox: () => cy.get('[data-ngie-testid="match-from-all-responses-checkbox"] input'),
32
+ setCorrectAnswerResponseAreaWrapper: () => cy.get('[class*="DroppableHotspotstyle__DroppableHotspotWrapper"]'),
33
+ setCorrectAnswerDraggableOptionContainer: () => cy.get('[class*="ClozeWithDragAndDropstyles__DraggableWrapper"]'),
34
+ //Preview tab
35
+ previewTabResponseArea: () => cy.get('.no-split-pane-wrapper [class="droppable-area"] [role="button"]'),
36
+ previewTabQuestionField: () => cy.get('.no-split-pane-wrapper div[class*="ClozeWithDragAndDropstyles__QuestionItemContainer"]'),
37
+ previewTabDraggableOption: () => cy.get('.no-split-pane-wrapper .draggable-selected-item'),
38
+ previewDraggableOptionsWrapper: () => cy.get('.no-split-pane-wrapper .draggable-wrapper'),
39
+ previewTabCorrectAnswerContainer: () => cy.get('[class*="ClozeWithDragAndDropstyles__CorrectAnswerTextWrapper"]'),
40
+ previewTabCorrectAnswerLabel: () => fillInTheGapsDragAndDropPage.previewTabCorrectAnswerContainer().find('[class*="ClozeWithDragAndDropstyles__CorrectAnswerLabel"]'),
41
+ previewTabCorrectAnswerResponseNumerationWrapper: () => cy.get('[class*="ClozeWithDragAndDropstyles__NumerationWrapper"]'),
42
+ previewTabCorrectAnswerResponseWrapper: () => fillInTheGapsDragAndDropPage.previewTabCorrectAnswerResponseNumerationWrapper().parents('[class*="ClozeWithDragAndDropstyles__ItemWrapper"]'),
43
+ previewTabCorrectAnswerResponseText: () => cy.get('[class*="ClozeWithDragAndDropstyles__ItemWrapper"] .question-text-wrapper'),
44
+ previewTabResponseAreaWrapper: () => cy.get('.no-split-pane-wrapper [class*="DroppableHotspotstyle__DroppableHotspotWrapper"]'),
45
+ draggableOption: () => cy.get('.draggable-selected-item'),
46
+ }
47
+
48
+ const steps = {
49
+ ...createQuestionBasePage.steps,
50
+ ...questionInstructionsComponent.steps,
51
+ ...additionalSettingsPanel.steps,
52
+ ...scoringSectionBase.steps,
53
+ ...fillInTheGapsCommonComponents.steps,
54
+ ...autoScoredSetCorrectAnswerSection.steps,
55
+ ...autoScoredPreviewBase.steps,
56
+ ...autoScoredScoringSection.steps,
57
+ ...autoScoredAdditionalSettings.steps,
58
+ ...optionsWrapperComponent.steps,
59
+ ...dragAndDropResponseOptions.steps,
60
+ ...autoScoredScoringSectionMultipleResponsesType.steps,
61
+ ...dragAndDropResponseOptions.steps,
62
+ ...draggableOptionsContainer.steps,
63
+ ...dragAndDropSetCorrectAnswerCheckboxComponents.steps,
64
+ ...previewScoringAndShowCorrectAnswerComponent.steps,
65
+ setCorrectAnswerSectionClickAndDropDraggableOptionInResponseArea: (optionName, responseAreaIndex) => {
66
+ fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
67
+ .contains(optionName)
68
+ .click();
69
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
70
+ .eq(responseAreaIndex)
71
+ .click();
72
+ },
73
+
74
+ previewTabClickAndDropDraggableOptionInResponseArea: (optionName, responseAreaIndex) => {
75
+ fillInTheGapsDragAndDropPage.previewTabDraggableOption()
76
+ .contains(optionName)
77
+ .click();
78
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
79
+ .eq(responseAreaIndex)
80
+ .click();
81
+ },
82
+
83
+ verifyIncorrectOptionCrossmarkIcon: (index) => {
84
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
85
+ .eq(index)
86
+ .parents('[class="droppable-area"]')
87
+ .prev('.tick-icon-wrapper')
88
+ .should('have.class', 'icon-incorrect')
89
+ .and('be.visible');
90
+ },
91
+
92
+ verifyCorrectOptionCheckmarkIcon: (index) => {
93
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
94
+ .eq(index)
95
+ .parents('[class="droppable-area"]')
96
+ .prev('.tick-icon-wrapper')
97
+ .should('have.class', 'icon-correct')
98
+ .and('be.visible');
99
+ },
100
+
101
+ verifyCorrectIncorrectIconNotVisible: (index) => {
102
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
103
+ .eq(index)
104
+ .parents('[class="droppable-area"]')
105
+ .prev('.tick-icon-wrapper')
106
+ .should('not.exist');
107
+ },
108
+
109
+ verifyCorrectAnswerResponsesInCorrectAnswerContainerAndCount: (correctAnswerArray, optionNumerationArray) => {
110
+ fillInTheGapsDragAndDropPage.previewTabCorrectAnswerContainer()
111
+ .should('be.visible');
112
+ fillInTheGapsDragAndDropPage.previewTabCorrectAnswerLabel()
113
+ .verifyInnerText('Correct answers:');
114
+ correctAnswerArray.forEach((responseFieldText, count) => {
115
+ fillInTheGapsDragAndDropPage.previewTabCorrectAnswerResponseNumerationWrapper()
116
+ .eq(count)
117
+ .should('have.text', optionNumerationArray[count]);
118
+ fillInTheGapsDragAndDropPage.previewTabCorrectAnswerResponseText()
119
+ .eq(count)
120
+ .verifyInnerText(responseFieldText);
121
+ });
122
+ fillInTheGapsDragAndDropPage.previewTabCorrectAnswerResponseWrapper()
123
+ .should('have.length', correctAnswerArray.length);
124
+ },
125
+
126
+ verifyInactiveStateOfResponseAreaInSetCorrectAnswerSection: (responseAreaIndex) => {
127
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
128
+ .eq(responseAreaIndex)
129
+ .should('have.class', 'isEmpty');
130
+ },
131
+
132
+ verifyActiveStateOfResponseAreaInSetCorrectAnswerSection: (responseAreaIndex) => {
133
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
134
+ .eq(responseAreaIndex)
135
+ .should('have.class', 'isActiveForDrop');
136
+ },
137
+
138
+ verifyInactiveStateOfDraggableOptionInSetCorrectAnswerSection: (optionIndex) => {
139
+ fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
140
+ .eq(optionIndex)
141
+ .should('not.have.class', 'item-selected');
142
+ },
143
+
144
+ verifyActiveStateOfDraggableOptionInSetCorrectAnswerSection: (optionIndex) => {
145
+ fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
146
+ .eq(optionIndex)
147
+ .should('have.class', 'item-selected');
148
+ fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOptionsWrapper()
149
+ .should('have.class', 'itemSelected');
150
+ },
151
+
152
+ verifyErroredStateOfResponseAreaInSetCorrectAnswerSection: (responseAreaIndex) => {
153
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
154
+ .eq(responseAreaIndex)
155
+ .should('have.class', 'isEmpty')
156
+ .and('have.class', 'error');
157
+ },
158
+
159
+ verifyInactiveStateOfResponseAreaInPreviewTab: (responseAreaIndex) => {
160
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
161
+ .eq(responseAreaIndex)
162
+ .should('have.class', 'isEmpty');
163
+ },
164
+
165
+ verifyActiveStateOfResponseAreaInPreviewTab: (responseAreaIndex) => {
166
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
167
+ .eq(responseAreaIndex)
168
+ .should('have.class', 'isActiveForDrop');
169
+ },
170
+
171
+ verifyInactiveStateOfDraggableOptionInPreviewTab: (optionIndex) => {
172
+ fillInTheGapsDragAndDropPage.previewTabDraggableOption()
173
+ .eq(optionIndex)
174
+ .should('not.have.class', 'item-selected');
175
+ },
176
+
177
+ verifyActiveStateOfDraggableOptionInPreviewTab: (optionIndex) => {
178
+ fillInTheGapsDragAndDropPage.previewTabDraggableOption()
179
+ .eq(optionIndex)
180
+ .should('have.class', 'item-selected');
181
+ },
182
+
183
+ verifyFilledResponseAreaInSetCorrectAnswerSection: (responseAreaIndex, optionText) => {
184
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseAreaWrapper()
185
+ .eq(responseAreaIndex)
186
+ .should('have.class', 'isNotEmpty');
187
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
188
+ .eq(responseAreaIndex)
189
+ .should('have.text', optionText)
190
+ .and('be.visible');
191
+ },
192
+
193
+ verifyInactiveStateOfFilledResponseAreaInSetCorrectAnswerSection: (optionIndex) => {
194
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
195
+ .eq(optionIndex)
196
+ .should('not.have.class', 'isActiveForDrop');
197
+ },
198
+
199
+ verifyInactiveStateOfFilledResponseAreaInPreviewTab: (optionIndex) => {
200
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
201
+ .eq(optionIndex)
202
+ .should('not.have.class', 'isActiveForDrop');
203
+ },
204
+
205
+ verifyFilledResponseAreaInPreviewTab: (responseAreaIndex, optionText) => {
206
+ fillInTheGapsDragAndDropPage.previewTabResponseAreaWrapper()
207
+ .eq(responseAreaIndex)
208
+ .should('have.class', 'isNotEmpty');
209
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
210
+ .eq(responseAreaIndex)
211
+ .should('have.text', optionText)
212
+ .and('be.visible');
213
+ },
214
+
215
+ clickAndDropDraggableOptionInResponseContainerOfSetCorrectAnswerSection: (optionName) => {
216
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
217
+ .contains(optionName)
218
+ .click();
219
+ fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOptionsWrapper('fill in the gaps - drag and drop')
220
+ .click();
221
+ },
222
+
223
+ clickAndDropDraggableOptionInResponseContainerOfPreviewTab: (optionName) => {
224
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
225
+ .contains(optionName)
226
+ .click();
227
+ fillInTheGapsDragAndDropPage.previewDraggableOptionsWrapper('fill in the gaps - drag and drop')
228
+ .click();
229
+ }
230
+ }
231
+
232
+ const tests = {
233
+ ...createQuestionBasePage.tests,
234
+ ...questionInstructionsComponent.tests,
235
+ ...fillInTheGapsCommonComponents.tests,
236
+ ...scoringSectionBase.tests,
237
+ ...autoScoredScoringSection.tests,
238
+ ...commonComponents.tests,
239
+ ...additionalSettingsPanel.tests,
240
+ ...autoScoredSetCorrectAnswerSection.tests,
241
+ ...autoScoredAdditionalSettings.tests,
242
+ ...previewScoringAndShowCorrectAnswerComponent.tests,
243
+ ...dragAndDropResponseOptions.tests,
244
+ ...autoScoredScoringSectionMultipleResponsesType.tests,
245
+ ...dragAndDropSetCorrectAnswerCheckboxComponents.tests,
246
+ ...draggableOptionsContainer.tests,
247
+ verifyDefaultResponseLabelAndResponseAreasInSetCorrectAnswerSection: () => {
248
+ it('Two empty response areas with labels \'Response 1\' and \'Response 2\' should be displayed', () => {
249
+ for (let index = 0; index < 2; index++) {
250
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseFieldLabel()
251
+ .eq(index)
252
+ .verifyInnerText(`Response ${index + 1}`);
253
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
254
+ .eq(index)
255
+ .should('be.visible')
256
+ .verifyInnerText('');
257
+ };
258
+ });
259
+ },
260
+
261
+ verifyDefaultDraggableOptionsInSetCorrectAnswerSection: () => {
262
+ it('The two empty draggable options should be displayed along with their drag handles', () => {
263
+ fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
264
+ .should('have.length', 2)
265
+ .each(($element) => {
266
+ cy.wrap($element)
267
+ .should('be.visible')
268
+ .verifyInnerText('')
269
+ .find('.drag-indicator-icon')
270
+ .should('be.visible');
271
+ });
272
+ });
273
+ },
274
+
275
+ verifyDraggableOptionContentsInAlternateTab: () => {
276
+ it('The draggable options set by the user should also be displayed in the response container of the alternate tab in the \'Set correct answer\' section', () => {
277
+ draggableOptionsContainer.steps.verifyDraggableResponsesSetCorrectAnswer('fill in the gaps - drag and drop', optionsForResponses);
278
+ });
279
+ },
280
+
281
+ verifyScoreForPartialEqualWeightsWhenResponseTokenIsAdded: () => {
282
+ it('When user adds a response token to the question, one more response area should be displayed in the response container of the set correct answer section and points per response score should be updated accordingly', () => {
283
+ cy.log('Pre-step: Adding a response token to question field')
284
+ fillInTheGapsDragAndDropPage.questionInputField()
285
+ .click();
286
+ fillInTheGapsDragAndDropPage.ckEditorAddResponseButton()
287
+ .click();
288
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
289
+ .should('have.length', '3');
290
+ fillInTheGapsDragAndDropPage.partialEqualWeightsPointsPerResponseScore()
291
+ .each(($element) => {
292
+ cy.wrap($element)
293
+ .verifyInnerText('1.33');
294
+ });
295
+ });
296
+ },
297
+
298
+ verifyReuseOptionScoring: () => {
299
+ it('When the user has set same answer options in the \'Set correct answer\' section, then the user should be awarded full points on attempting the question with reused options', () => {
300
+ fillInTheGapsDragAndDropPage.steps.previewTabClickAndDropDraggableOptionInResponseArea('Response 1', 0);
301
+ fillInTheGapsDragAndDropPage.steps.previewTabClickAndDropDraggableOptionInResponseArea('Response 1', 1);
302
+ fillInTheGapsDragAndDropPage.previewScoreText()
303
+ .verifyInnerText('5/5');
304
+ fillInTheGapsDragAndDropPage.steps.verifyPreviewTabPointsBackgroundForCorrectAnswer();
305
+ });
306
+ },
307
+
308
+ verifyHideDragHandleFunctionalityInSetCorrectAnswerSection: () => {
309
+ it('When the \'Hide drag handle\' functionality is disabled, then the draggable options displayed in response container of the \'Set correct answer\' section should have a drag handle', () => {
310
+ fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
311
+ .each($element => {
312
+ cy.wrap($element)
313
+ .within(() => {
314
+ fillInTheGapsDragAndDropPage.draggableOptionDragIcon()
315
+ .should('be.visible');
316
+ });
317
+ });
318
+ });
319
+
320
+ it('When the user enables the \'Hide drag handle\' functionality, then the draggable options displayed in response container of the \'Set correct answer\' section should not have a drag handle', () => {
321
+ fillInTheGapsDragAndDropPage.steps.switchToEditTab();
322
+ fillInTheGapsDragAndDropPage.hideDragHandleCheckbox()
323
+ .click()
324
+ .should('be.checked');
325
+ fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
326
+ .each($element => {
327
+ cy.wrap($element)
328
+ .within(() => {
329
+ fillInTheGapsDragAndDropPage.draggableOptionDragIcon()
330
+ .should('not.exist');
331
+ });
332
+ });
333
+ });
334
+ },
335
+
336
+ verifyInactiveStateOfResponseAreasAndDraggableOptionsWithCSSAndA11yInSetCorrectAnswerSection: () => {
337
+ it('When the user has not selected any draggable option, the draggable options and response areas should be in inactive state', () => {
338
+ fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOptionsWrapper()
339
+ .within(() => {
340
+ fillInTheGapsDragAndDropPage.draggableOption()
341
+ .each($element => {
342
+ cy.wrap($element)
343
+ .should('not.have.class', 'item-selected');
344
+ });
345
+ });
346
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
347
+ .each($element => {
348
+ cy.wrap($element)
349
+ .should('have.class', 'isEmpty');
350
+ });
351
+ });
352
+
353
+ it('CSS of inactive state of draggable options and response areas', { tags: 'css' }, () => {
354
+ fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
355
+ .should('have.css', 'border', `1px solid ${css.color.figDefaultComponentBorder}`)
356
+ .and('have.css', 'background-color', `${css.color.defaultBackground}`)
357
+ .find('.drag-indicator-icon')
358
+ .should('have.css', 'fill', `${css.color.activeButtons}`);
359
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
360
+ .should('have.css', 'border', `2px dashed ${css.color.figDefaultComponentBorder}`);
361
+ });
362
+
363
+ it('Accessibility of inactive state of draggable options and response areas', { tags: 'a11y' }, () => {
364
+ cy.checkAccessibility(fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOptionsWrapper().parents('.cloze-width-drag-and-drop-set-correct-response'));
365
+ });
366
+ },
367
+
368
+ verifyActiveStateOfResponseAreaAndDraggableOptionsWithCSSAndA11yInSetCorrectAnswerSection: () => {
369
+ it('When the user selects a draggable option, it should get in selected state and all the response areas should get in active state', () => {
370
+ fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
371
+ .contains('Response 1')
372
+ .click();
373
+ cy.log('checking active state of selected draggable option')
374
+ fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfDraggableOptionInSetCorrectAnswerSection(0);
375
+ cy.log('checking default state of unselected draggable option(s)')
376
+ fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOptionsWrapper()
377
+ .within(() => {
378
+ fillInTheGapsDragAndDropPage.draggableOption()
379
+ .each(($element, index) => {
380
+ if (index !== 0) {
381
+ cy.wrap($element)
382
+ .should('not.have.class', 'item-selected');
383
+ };
384
+ });
385
+ });
386
+ cy.log('checking active state of all response areas')
387
+ fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfResponseAreaInSetCorrectAnswerSection(0);
388
+ fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfResponseAreaInSetCorrectAnswerSection(1);
389
+ });
390
+
391
+ it('CSS of active state of draggable options and response areas', { tags: 'css' }, () => {
392
+ fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
393
+ .eq(0)
394
+ .should('have.css', 'border', `1px solid ${css.color.activeComponentBorder}`)
395
+ .and('have.css', 'background-color', `${css.color.figActiveComponentBg}`)
396
+ .find('.drag-indicator-icon')
397
+ .should('have.css', 'fill', `${css.color.activeButtons}`);
398
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
399
+ .should('have.css', 'border', `1px solid ${css.color.activeComponentBorder}`);
400
+ });
401
+
402
+ it('Accessibility of active state of draggable options and response areas', { tags: 'a11y' }, () => {
403
+ cy.checkAccessibility(fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOptionsWrapper().parents('.cloze-width-drag-and-drop-set-correct-response'));
404
+ });
405
+ },
406
+
407
+ verifyInactiveStateOfResponseAreaWhenDraggableOptionIsDeselectedInSetCorrectAnswerSection: () => {
408
+ it('When the user deselects the draggable option, it should get in deselected state and the response areas should return to the inactive state', () => {
409
+ fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
410
+ .contains('Response 1')
411
+ .click();
412
+ cy.log('Checking default state of deselected draggable option')
413
+ fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfDraggableOptionInSetCorrectAnswerSection(0);
414
+ cy.log('Checking default inactive state of response areas')
415
+ fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfResponseAreaInSetCorrectAnswerSection(0);
416
+ fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfResponseAreaInSetCorrectAnswerSection(1);
417
+ });
418
+ },
419
+
420
+ verifyFilledResponseAreaWithCSSAndA11yInSetCorrectAnswerSection: () => {
421
+ it('When the user has dropped a draggable option inside a response area, drag handle should not be displayed in the response area', () => {
422
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseAreaWrapper()
423
+ .eq(0)
424
+ .within(() => {
425
+ fillInTheGapsDragAndDropPage.draggableOptionDragIcon()
426
+ .should('not.exist');
427
+ });
428
+ });
429
+
430
+ it('CSS of filled response area', { tags: 'css' }, () => {
431
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
432
+ .eq(0)
433
+ .should('have.css', 'border', `1px solid ${css.color.figDefaultComponentBorder}`)
434
+ .should('have.css', 'background-color', css.color.transparent)
435
+ .find('.question-text-wrapper')
436
+ .verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
437
+ });
438
+
439
+ it('Accessibility of filled response area', { tags: 'a11y' }, () => {
440
+ cy.checkAccessibility(fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOptionsWrapper().parents('.cloze-width-drag-and-drop-set-correct-response'));
441
+ });
442
+ },
443
+
444
+ verifyStateOfPartiallyFilledResponseAreasWhenDraggableOptionsIsSelectedInSetCorrectAnswerSection: () => {
445
+ it('When the response areas are partially filled and the user selects a draggable option, then only the empty response area should get in active state', () => {
446
+ fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
447
+ .contains('Response 2')
448
+ .click();
449
+ fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfFilledResponseAreaInSetCorrectAnswerSection(0);
450
+ fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfResponseAreaInSetCorrectAnswerSection(1);
451
+ cy.log('Post step: deselecting the draggable option')
452
+ fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
453
+ .contains('Response 2')
454
+ .click();
455
+ });
456
+ },
457
+
458
+ verifySelectedStateOfDraggableOptionInFilledResponseAreaWithCSSandA11yInSetCorrectAnswerSection: () => {
459
+ it('When the user selects a draggable option from the filled response area, the response container should get active for dropping the option, the filled response area should not get in active state and only the empty response area should get active', () => {
460
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
461
+ .eq(0)
462
+ .click();
463
+ fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOptionsWrapper()
464
+ .should('have.class', 'isActiveForDropping');
465
+ fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfFilledResponseAreaInSetCorrectAnswerSection(0);
466
+ fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfResponseAreaInSetCorrectAnswerSection(1);
467
+ });
468
+
469
+ it('CSS of draggable option from the filled response area in selected state', { tags: 'css' }, () => {
470
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
471
+ .eq(0)
472
+ .should('have.css', 'border', `1px solid ${css.color.activeComponentBorder}`)
473
+ .and('have.css', 'background-color', `${css.color.figActiveComponentBg}`);
474
+ });
475
+
476
+ it('Accessibility of draggable option from the filled response area in selected state', { tags: 'a11y' }, () => {
477
+ cy.checkAccessibility(fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea().parents('.cloze-width-drag-and-drop-set-correct-response'));
478
+ });
479
+ },
480
+
481
+ verifyDeselectedStateOfDraggableOptionInFilledResponseAreaWithCSSandA11yInSetCorrectAnswerSection: () => {
482
+ it('When the user deselects a draggable option from the filled response area, the draggable option should return to the inactive state', () => {
483
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
484
+ .eq(0)
485
+ .click();
486
+ fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfFilledResponseAreaInSetCorrectAnswerSection(0);
487
+ fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfResponseAreaInSetCorrectAnswerSection(1);
488
+ });
489
+ },
490
+
491
+ verifyErroredStateOfResponseAreaWithCSSAndA11yInSetCorrectAnswerSection: () => {
492
+ it('CSS of error state of response area', { tags: 'css' }, () => {
493
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
494
+ .eq(0)
495
+ .should('have.css', 'border', `2px dashed ${css.color.errorFieldBorder}`)
496
+ .and('have.css', 'background-color', `${css.color.textAreaErrorBg}`);
497
+ });
498
+
499
+ it('Accessibility of error state of response area', { tags: 'a11y' }, () => {
500
+ cy.checkAccessibility(fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea().parents('.cloze-width-drag-and-drop-set-correct-response'));
501
+ });
502
+
503
+ it('When the user selects a draggable option when a response area is in errored state, the error state of the response area should persist and the user should be able to drop an option into the errored response area', () => {
504
+ fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
505
+ .contains('Response 1')
506
+ .click();
507
+ fillInTheGapsDragAndDropPage.steps.verifyErroredStateOfResponseAreaInSetCorrectAnswerSection(0);
508
+ fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfResponseAreaInSetCorrectAnswerSection(0);
509
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
510
+ .eq(0)
511
+ .click();
512
+ fillInTheGapsDragAndDropPage.steps.verifyFilledResponseAreaInSetCorrectAnswerSection(0, 'Response 1');
513
+ });
514
+
515
+ it('When the user has filled the errored response area, the response area should get filled with the dropped option and the \'Error: Please set a correct answer\' error message should disappear', () => {
516
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
517
+ .eq(0)
518
+ .should('not.have.class', 'isEmpty error');
519
+ fillInTheGapsDragAndDropPage.errorMessage()
520
+ .should('not.exist');
521
+ });
522
+
523
+ it('The user should be able to move a draggable option from one response area to another response area and the empty response area should get errored and \'Error: Please set a correct answer\' error message should be displayed', () => {
524
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
525
+ .eq(0)
526
+ .click();
527
+ fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
528
+ .eq(1)
529
+ .click();
530
+ fillInTheGapsDragAndDropPage.steps.verifyFilledResponseAreaInSetCorrectAnswerSection(1, 'Response 1');
531
+ fillInTheGapsDragAndDropPage.steps.verifyErroredStateOfResponseAreaInSetCorrectAnswerSection(0);
532
+ fillInTheGapsDragAndDropPage.errorMessage()
533
+ .verifyInnerText('Error: Please set a correct answer.')
534
+ .and('be.visible');
535
+ });
536
+ },
537
+
538
+ verifyInactiveStateOfResponseAreasAndDraggableOptionsWithCSSAndA11yInPreviewTab: () => {
539
+ it('When the user has not selected any draggable option, the draggable options and response areas should be in inactive state', () => {
540
+ fillInTheGapsDragAndDropPage.previewTabDraggableOptionsWrapper('fill in the gaps - drag and drop')
541
+ .within(() => {
542
+ fillInTheGapsDragAndDropPage.draggableOption()
543
+ .each($element => {
544
+ cy.wrap($element)
545
+ .should('not.have.class', 'item-selected');
546
+ });
547
+ });
548
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
549
+ .each($element => {
550
+ cy.wrap($element)
551
+ .should('have.class', 'isEmpty');
552
+ });
553
+ });
554
+
555
+ it('CSS of inactive state of draggable options and response areas', { tags: 'css' }, () => {
556
+ fillInTheGapsDragAndDropPage.previewTabDraggableOption()
557
+ .should('have.css', 'border', `1px solid ${css.color.figDefaultComponentBorder}`)
558
+ .and('have.css', 'background-color', `${css.color.defaultBackground}`)
559
+ .find('.drag-indicator-icon')
560
+ .should('have.css', 'fill', `${css.color.activeButtons}`);
561
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
562
+ .should('have.css', 'border', `2px dashed ${css.color.figDefaultComponentBorder}`);
563
+ });
564
+
565
+ it('Accessibility of inactive state of draggable options and response areas', { tags: 'a11y' }, () => {
566
+ cy.checkAccessibility(fillInTheGapsDragAndDropPage.previewDraggableOptionsWrapper().parents('.cloze-with-drag-and-drop-preview'));
567
+ });
568
+ },
569
+
570
+ verifyActiveStateOfResponseAreaAndDraggableOptionsWithCSSAndA11yInPreviewTab: () => {
571
+ it('When the user selects a draggable option, it should get in selected state and all the response areas should get in active state', () => {
572
+ fillInTheGapsDragAndDropPage.previewTabDraggableOption()
573
+ .contains('Response 1')
574
+ .click();
575
+ cy.log('checking active state of selected draggable option')
576
+ fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfDraggableOptionInPreviewTab(0);
577
+ cy.log('checking default state of unselected draggable option')
578
+ fillInTheGapsDragAndDropPage.previewTabDraggableOptionsWrapper('fill in the gaps - drag and drop')
579
+ .within(() => {
580
+ fillInTheGapsDragAndDropPage.draggableOption()
581
+ .each(($element, index) => {
582
+ if (index !== 0) {
583
+ cy.wrap($element)
584
+ .should('not.have.class', 'item-selected');
585
+ };
586
+ });
587
+ });
588
+ cy.log('checking active state of all response areas')
589
+ fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfResponseAreaInPreviewTab(0);
590
+ fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfResponseAreaInPreviewTab(1);
591
+ });
592
+
593
+ it('CSS of active state of draggable options and response areas', { tags: 'css' }, () => {
594
+ fillInTheGapsDragAndDropPage.previewTabDraggableOptionsWrapper('fill in the gaps - drag and drop')
595
+ .within(() => {
596
+ fillInTheGapsDragAndDropPage.draggableOption()
597
+ .eq(0)
598
+ .should('have.css', 'border', `1px solid ${css.color.activeComponentBorder}`)
599
+ .and('have.css', 'background-color', `${css.color.figActiveComponentBg}`)
600
+ .find('.drag-indicator-icon')
601
+ .should('have.css', 'fill', `${css.color.activeButtons}`);
602
+ });
603
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
604
+ .should('have.css', 'border', `1px solid ${css.color.activeComponentBorder}`);
605
+ });
606
+
607
+ it('Accessibility of active state of draggable options and response areas', { tags: 'a11y' }, () => {
608
+ cy.checkAccessibility(fillInTheGapsDragAndDropPage.previewDraggableOptionsWrapper().parents('.cloze-with-drag-and-drop-preview'));
609
+ });
610
+ },
611
+
612
+ verifyStateOfResponseAreaWhenDraggableOptionIsDeselectedInPreviewTab: () => {
613
+ it('When the user deselects the draggable option, it should get in deselected state and the response areas should return to the inactive state', () => {
614
+ fillInTheGapsDragAndDropPage.previewTabDraggableOption()
615
+ .contains('Response 1')
616
+ .click();
617
+ cy.log('Checking default state of deselected draggable option')
618
+ fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfDraggableOptionInPreviewTab(0);
619
+ cy.log('Checking default inactive state of response areas')
620
+ fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfResponseAreaInPreviewTab(0);
621
+ fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfResponseAreaInPreviewTab(1);
622
+ });
623
+ },
624
+
625
+ verifyFilledResponseAreaWithCSSAndA11yInPreviewTab: () => {
626
+ it('When the user has dropped a draggable option inside a response area, drag handle should not be displayed in the response area', () => {
627
+ fillInTheGapsDragAndDropPage.previewTabResponseAreaWrapper()
628
+ .eq(0)
629
+ .within(() => {
630
+ fillInTheGapsDragAndDropPage.draggableOptionDragIcon()
631
+ .should('not.exist');
632
+ });
633
+ });
634
+
635
+ it('CSS of filled response area', { tags: 'css' }, () => {
636
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
637
+ .eq(0)
638
+ .should('have.css', 'border', `1px solid ${css.color.figDefaultComponentBorder}`)
639
+ .find('.question-text-wrapper')
640
+ .verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
641
+ });
642
+
643
+ it('Accessibility of filled response area', { tags: 'a11y' }, () => {
644
+ cy.checkAccessibility(fillInTheGapsDragAndDropPage.previewDraggableOptionsWrapper().parents('.cloze-with-drag-and-drop-preview'));
645
+ });
646
+ },
647
+
648
+ verifyStateOfPartiallyFilledResponseAreasInPreviewTab: () => {
649
+ it('When the response areas are partially filled and the user selects a draggable option, then only the empty response area should get in active state', () => {
650
+ fillInTheGapsDragAndDropPage.previewTabDraggableOption()
651
+ .contains('Response 2')
652
+ .click();
653
+ fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfFilledResponseAreaInPreviewTab(0);
654
+ fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfResponseAreaInPreviewTab(1);
655
+ cy.log('Post step: deselecting the draggable option')
656
+ fillInTheGapsDragAndDropPage.previewTabDraggableOption()
657
+ .contains('Response 2')
658
+ .click();
659
+ });
660
+ },
661
+
662
+ verifyStateOfDraggableOptionInFilledResponseAreaWithCSSandA11yInPreviewTab: () => {
663
+ it('When the user selects a draggable option from the filled response area, the response container should get active for dropping the option, the filled response area should not get in active state and only the empty response area should get active', () => {
664
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
665
+ .eq(0)
666
+ .click();
667
+ fillInTheGapsDragAndDropPage.previewTabDraggableOptionsWrapper('fill in the gaps - drag and drop')
668
+ .should('have.class', 'isActiveForDropping');
669
+ fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfFilledResponseAreaInPreviewTab(0);
670
+ fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfResponseAreaInPreviewTab(1);
671
+ });
672
+
673
+ it('CSS of draggable option from the filled response area in selected state', { tags: 'css' }, () => {
674
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
675
+ .eq(0)
676
+ .should('have.css', 'border', `1px solid ${css.color.activeComponentBorder}`)
677
+ .and('have.css', 'background-color', `${css.color.figActiveComponentBg}`);
678
+ });
679
+
680
+ it('Accessibility of draggable option from the filled response area in selected state', { tags: 'a11y' }, () => {
681
+ cy.checkAccessibility(fillInTheGapsDragAndDropPage.previewDraggableOptionsWrapper().parents('.cloze-with-drag-and-drop-preview'));
682
+ });
683
+
684
+ it('When the user deselects a draggable option from the filled response area, the draggable option should return to the inactive state', () => {
685
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
686
+ .eq(0)
687
+ .click();
688
+ fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfFilledResponseAreaInPreviewTab(0);
689
+ fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfResponseAreaInPreviewTab(1);
690
+ });
691
+ },
692
+
693
+ verifyMovingDraggableOptionFromOneResponseAreaToAnotherInPreviewTab: () => {
694
+ it('The user should be able to move a draggable option from one response area to another response area', () => {
695
+ cy.log('Pre step: Setting up an option in the response area')
696
+ fillInTheGapsDragAndDropPage.steps.previewTabClickAndDropDraggableOptionInResponseArea('Response 1', 0);
697
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
698
+ .eq(0)
699
+ .click();
700
+ fillInTheGapsDragAndDropPage.previewTabResponseArea()
701
+ .eq(1)
702
+ .click();
703
+ fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfResponseAreaInPreviewTab(0);
704
+ fillInTheGapsDragAndDropPage.steps.verifyFilledResponseAreaInPreviewTab(1, 'Response 1');
705
+ });
706
+ },
707
+
708
+ verifyHideDragHandleFunctionalityInPreviewTab: () => {
709
+ it('When the \'Hide drag handle\' functionality is disabled, then the draggable options displayed in response container of the preview tab should have a drag handle', () => {
710
+ fillInTheGapsDragAndDropPage.previewTabDraggableOption()
711
+ .each($element => {
712
+ cy.wrap($element)
713
+ .within(() => {
714
+ fillInTheGapsDragAndDropPage.draggableOptionDragIcon()
715
+ .should('be.visible');
716
+ });
717
+ });
718
+ });
719
+
720
+ it('When the \'Hide drag handle\' functionality is enabled, then the draggable options displayed in response container of the preview tab should not have a drag handle', () => {
721
+ fillInTheGapsDragAndDropPage.steps.switchToEditTab();
722
+ fillInTheGapsDragAndDropPage.hideDragHandleCheckbox()
723
+ .click()
724
+ .should('be.checked');
725
+ fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
726
+ fillInTheGapsDragAndDropPage.previewTabDraggableOption()
727
+ .each($element => {
728
+ cy.wrap($element)
729
+ .within(() => {
730
+ fillInTheGapsDragAndDropPage.draggableOptionDragIcon()
731
+ .should('not.exist');
732
+ });
733
+ });
734
+ });
735
+ }
736
+ }
737
+
738
+ export const fillInTheGapsDragAndDropPage = {
739
+ ...selectors,
740
+ steps,
741
+ tests
742
+ }