itemengine-cypress-automation 1.0.30 → 1.0.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesAdditionalSettings.js +963 -0
  2. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesClickAndDrop.js +669 -0
  3. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesEditTabScoringTypes.js +205 -0
  4. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesGroupedOptionsAllOrNothing.js +143 -0
  5. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesGroupedOptionsPartialScoreForEachCell.js +145 -0
  6. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesGroupedOptionsPartialScoreForEachResponse.js +141 -0
  7. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesGroupedOptionsTotalScoreDividedBetweenCell.js +165 -0
  8. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesGroupedOptionsTotalScoreDividedBetweenResponses.js +420 -0
  9. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesGroupedSetCorrectAnswerCheckboxes.js +266 -0
  10. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesHeaderSection.js +83 -0
  11. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesManuallyAndNonScored.js +184 -0
  12. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesResponseOptionsSection.js +112 -0
  13. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesRowsAndCategoriesSection.js +569 -0
  14. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesSetCorrectAnswerSection.js +130 -0
  15. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesStandardAllOrNothing.js +186 -0
  16. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesStandardPartialScoreForEachCell.js +145 -0
  17. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesStandardPartialScoreForEachResponse.js +140 -0
  18. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesStandardSetCorrectAnswerCheckboxes.js +234 -0
  19. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesStandardTotalScoreDividedBetweenCell.js +165 -0
  20. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesStandardTotalScoreDividedBetweenResponse.js +420 -0
  21. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesSwitchingCases.js +45 -0
  22. package/cypress/e2e/ILC/FillInTheGapsDropdown/fillInTheGapsDropdownAdditionalSettings.js +1 -415
  23. package/cypress/e2e/ILC/FillInTheGapsDropdown/fillInTheGapsDropdownAdditionalSettingsBasic.js +423 -0
  24. package/cypress/e2e/ILC/FillInTheGapsDropdown/fillInTheGapsDropdownAllOrNothingScoring.js +48 -0
  25. package/cypress/e2e/ILC/FillInTheGapsDropdown/{fillInTheGapsDropdownAutoScoredScoring.js → fillInTheGapsDropdownAllOrNothingScoringWithAlternateAnswer.js} +1 -37
  26. package/cypress/e2e/ILC/FillInTheGapsDropdown/fillInTheGapsDropdownPartialDifferentWeights.js +59 -0
  27. package/cypress/e2e/ILC/FillInTheGapsDropdown/{fillInTheGapsDropdownScoringPartialDifferentWeights.js → fillInTheGapsDropdownPartialDifferentWeightsWithAlternateAnswer.js} +1 -47
  28. package/cypress/e2e/ILC/FillInTheGapsDropdown/fillInTheGapsDropdownPartialEqualWeights.js +1 -63
  29. package/cypress/e2e/ILC/FillInTheGapsDropdown/fillInTheGapsDropdownPartialEqualWeightsWithAlternateAnswer.js +73 -0
  30. package/package.json +1 -1
@@ -0,0 +1,669 @@
1
+ import { dragAndDropIntoCategoriesPage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ import utilities from "../../../support/helpers/utilities";
4
+ const optionsArray = ['Bat', 'Eagle', 'Parrot', 'Whale'];
5
+ const groupedOptions = [['Bat', 'Eagle', 'Whale', 'Platypus'], ['Peacock', 'Parrot', 'Ostrich', 'Flying squirrel']];
6
+
7
+ const css = Cypress.env('css');
8
+
9
+ describe('Create Item Page: Drag and drop into categories: Click and drop cases for \'Standard\' and \'Grouped\' response options layouts in \'Set correct answer\' section and \'Preview tab\'', () => {
10
+ before(() => {
11
+ cy.loginAs('admin');
12
+ });
13
+
14
+ describe('Click and drop cases for \'Standard\' response options layout in \'Set correct answer\' section', () => {
15
+ abortEarlySetup();
16
+ before(() => {
17
+ cy.log('Navigate to Drag and drop into categories question type, add input to option input fields');
18
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
19
+ cy.barsPreLoaderWait();
20
+ dragAndDropIntoCategoriesPage.addOptionButton()
21
+ .click();
22
+ dragAndDropIntoCategoriesPage.addOptionButton()
23
+ .click();
24
+ dragAndDropIntoCategoriesPage.steps.addInputToOptionsForDragAndDropFields(optionsArray);
25
+ });
26
+
27
+ it('When the user has not selected any option, the options and category cells should be in inactive state', () => {
28
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllDraggableOptionsInSetCorrectAnswerSection('drag and drop into categories');
29
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInSetCorrectAnswerSection();
30
+ });
31
+
32
+ it('CSS of inactive state of options and category cells', { tags: 'css' }, () => {
33
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption(), {
34
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
35
+ 'background-color': css.color.defaultBackground,
36
+ });
37
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption().find('.question-text-wrapper'), {
38
+ 'color': css.color.text,
39
+ 'font-size': css.fontSize.default,
40
+ 'font-weight': css.fontWeight.regular,
41
+ });
42
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOptionDragIcon(), {
43
+ 'fill': css.color.secondaryBtn
44
+ });
45
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.setCorrectAnswerSectionCategoryGrid(), {
46
+ 'border': `1px dashed ${css.color.figDefaultComponentBorder}`
47
+ });
48
+ });
49
+
50
+ it('Accessibility of inactive state of options and category cells', { tags: 'a11y' }, () => {
51
+ cy.checkAccessibility(dragAndDropIntoCategoriesPage.draggableOption().parents('[class*="DragAndDropMatrixstyles__ContentWrapper"]'));
52
+ });
53
+
54
+ it('When the user selects an option, it should get in selected state and all the category cells should get in active state', () => {
55
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInSetCorrectAnswerSection('drag and drop into categories', 'Bat');
56
+ cy.log('checking active state of selected option')
57
+ dragAndDropIntoCategoriesPage.steps.verifyActiveStateOfDraggableOptionInSetCorrectAnswerSection(0, 'drag and drop into categories');
58
+ cy.log('checking default state of unselected option(s)')
59
+ dragAndDropIntoCategoriesPage.steps.verifyDefaultStateOfUnselectedDraggableOptionsInSetCorrectAnswerSection([1, 2, 3], 'drag and drop into categories');
60
+ cy.log('checking active state of all category cells');
61
+ dragAndDropIntoCategoriesPage.steps.verifyActiveStateOfAllCategoryCellsInSetCorrectAnswerSection();
62
+ });
63
+
64
+ it('CSS of active state of options and category cells', { tags: 'css' }, () => {
65
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption().eq(0), {
66
+ 'border': `1px solid ${css.color.dragOptionActiveBorder}`,
67
+ 'background-color': css.color.figActiveComponentBg
68
+ });
69
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOptionDragIcon(), {
70
+ 'fill': css.color.activeButtons
71
+ });
72
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.setCorrectAnswerSectionCategoryGrid(), {
73
+ 'border': `1px solid ${css.color.activeComponentBorder}`
74
+ });
75
+ });
76
+
77
+ it('Accessibility of active state of options and category cells', { tags: 'a11y' }, () => {
78
+ cy.checkAccessibility(dragAndDropIntoCategoriesPage.draggableOption().parents('[class*="DragAndDropMatrixstyles__ContentWrapper"]'));
79
+ });
80
+
81
+ it('When the user deselects the option, it should get in deselected state and the category cells should return to the inactive state', () => {
82
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInSetCorrectAnswerSection('drag and drop into categories', 'Bat');
83
+ cy.log('Checking default state of deselected option')
84
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllDraggableOptionsInSetCorrectAnswerSection('drag and drop into categories');
85
+ cy.log('Checking default inactive state of category cells')
86
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInSetCorrectAnswerSection();
87
+ });
88
+
89
+ it('When the user drops an option in one of the category cells, the option should get removed from the response container, the category cell should get filled with that option and the other category cells should return to inactive state', () => {
90
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Bat', 0);
91
+ dragAndDropIntoCategoriesPage.steps.verifyDraggableOptionInCategoryCellOfSetCorrectAnswerSection(0, ['Bat']);
92
+ dragAndDropIntoCategoriesPage.steps.verifyDraggableResponsesSetCorrectAnswer('drag and drop into categories', ['Eagle', 'Parrot', 'Whale']);
93
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInSetCorrectAnswerSection();
94
+ });
95
+
96
+ it('When the user has dropped an option inside a category cell, drag handle should not be displayed in the category cell', () => {
97
+ dragAndDropIntoCategoriesPage.steps.verifyDragHandleNotVisibleInFilledCategoryCellOfSetCorrectAnswerSection(0);
98
+ });
99
+
100
+ it('CSS of filled category cell', { tags: 'css' }, () => {
101
+ dragAndDropIntoCategoriesPage.setCorrectAnswerSectionCategoryCell()
102
+ .eq(0)
103
+ .within(() => {
104
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption(), {
105
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
106
+ 'background-color': css.color.defaultBackground
107
+ });
108
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption().find('.question-text-wrapper'), {
109
+ 'color': css.color.text,
110
+ 'font-size': css.fontSize.default,
111
+ 'font-weight': css.fontWeight.regular,
112
+ });
113
+ });
114
+ });
115
+
116
+ it('Accessibility of filled category cell', { tags: 'a11y' }, () => {
117
+ cy.checkAccessibility(dragAndDropIntoCategoriesPage.draggableOption().parents('[class*="DragAndDropMatrixstyles__ContentWrapper"]'));
118
+ });
119
+
120
+ it('When the user drops an option on a filled category cell, the existing option should persist in the category cell', () => {
121
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Eagle', 0);
122
+ dragAndDropIntoCategoriesPage.steps.verifyDraggableOptionInCategoryCellOfSetCorrectAnswerSection(0, ['Bat', 'Eagle']);
123
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInSetCorrectAnswerSection();
124
+ dragAndDropIntoCategoriesPage.steps.verifyDraggableResponsesSetCorrectAnswer('drag and drop into categories', ['Parrot', 'Whale']);
125
+ });
126
+
127
+ it('When the user selects an option from the filled category cell, the response container as well as all category cells should get active for dropping the option', () => {
128
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Bat');
129
+ dragAndDropIntoCategoriesPage.steps.verifyActiveStateOfDraggableOptionsContainerInSetCorrectAnswerSection('drag and drop into categories');
130
+ dragAndDropIntoCategoriesPage.steps.verifyActiveStateOfAllCategoryCellsInSetCorrectAnswerSection(1);
131
+ });
132
+
133
+ it('CSS of option from the filled category cell in selected state', { tags: 'css' }, () => {
134
+ dragAndDropIntoCategoriesPage.setCorrectAnswerSectionCategoryCell()
135
+ .eq(0)
136
+ .within(() => {
137
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption().eq(0), {
138
+ 'border': `1px solid ${css.color.dragOptionActiveBorder}`,
139
+ 'background-color': css.color.figActiveComponentBg
140
+ });
141
+ });
142
+ });
143
+
144
+ it('Accessibility of option from the filled category cell in selected state', { tags: 'a11y' }, () => {
145
+ cy.checkAccessibility(dragAndDropIntoCategoriesPage.draggableOption().parents('[class*="DragAndDropMatrixstyles__ContentWrapper"]'));
146
+ });
147
+
148
+ it('When the user deselects an option from the filled category cell, the option should return to the inactive state', () => {
149
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Bat');
150
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllDraggableOptionsInSetCorrectAnswerSection('drag and drop into categories');
151
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInSetCorrectAnswerSection();
152
+ });
153
+
154
+ it('When the user selects a filled option and clicks in the response container, the selected option should get back in the response container and \'Error: Please set a correct answer\' error message should be displayed', () => {
155
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInResponseContainerOfSetCorrectAnswerSection('Bat');
156
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInResponseContainerOfSetCorrectAnswerSection('Eagle');
157
+ dragAndDropIntoCategoriesPage.steps.verifyDraggableResponsesSetCorrectAnswer('drag and drop into categories', ['Bat', 'Eagle', 'Parrot', 'Whale']);
158
+ utilities.verifyInnerText(dragAndDropIntoCategoriesPage.errorMessage(), 'Error: Please set a correct answer.');
159
+ utilities.verifyElementVisibilityState(dragAndDropIntoCategoriesPage.errorMessage(), 'visible');
160
+ });
161
+
162
+ dragAndDropIntoCategoriesPage.tests.verifyCSSAnda11yOfErrorMessage();
163
+
164
+ it('When the user fills a category cell, the category cell should get filled with the option and the \'Error: Please set a correct answer\' error message should disappear', () => {
165
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Bat', 0);
166
+ dragAndDropIntoCategoriesPage.steps.verifyErrorMessageIsNotDisplayed();
167
+ });
168
+
169
+ it('The user should be able to move an option from one category cell to another category cell', () => {
170
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Bat');
171
+ dragAndDropIntoCategoriesPage.steps.clickOnCategoryCellInCategoryCellOfSetCorrectAnswerSection(1);
172
+ dragAndDropIntoCategoriesPage.steps.verifyEmptyStateOfCategoryCellInSetCorrectAnswerSection(0);
173
+ dragAndDropIntoCategoriesPage.steps.verifyDraggableOptionInCategoryCellOfSetCorrectAnswerSection(1, ['Bat']);
174
+ });
175
+ });
176
+
177
+ describe('Click and drop cases for \'Standard\' response options layout in \'Preview tab\'', () => {
178
+ abortEarlySetup();
179
+ before(() => {
180
+ cy.log('Navigate to Drag and drop into categories question type, add input to option input fields and switch to preview tab');
181
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
182
+ cy.barsPreLoaderWait();
183
+ dragAndDropIntoCategoriesPage.addOptionButton()
184
+ .click();
185
+ dragAndDropIntoCategoriesPage.addOptionButton()
186
+ .click();
187
+ dragAndDropIntoCategoriesPage.steps.addInputToOptionsForDragAndDropFields(optionsArray);
188
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
189
+ });
190
+
191
+ it('When the user has not selected any option, the options and category cells should be in inactive state', () => {
192
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllDraggableOptionsInPreviewTab('drag and drop into categories');
193
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInPreviewTab();
194
+ });
195
+
196
+ it('CSS of inactive state of options and category cells', { tags: 'css' }, () => {
197
+ dragAndDropIntoCategoriesPage.previewTabDraggableOptionsWrapper('drag and drop into categories')
198
+ .within(() => {
199
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption(), {
200
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
201
+ 'background-color': css.color.defaultBackground,
202
+ });
203
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption().find('.question-text-wrapper'), {
204
+ 'color': css.color.text,
205
+ 'font-size': css.fontSize.default,
206
+ 'font-weight': css.fontWeight.regular,
207
+ });
208
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOptionDragIcon(), {
209
+ 'fill': css.color.secondaryBtn
210
+ });
211
+ });
212
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.previewTabCategoryGrid(), {
213
+ 'border': `1px dashed ${css.color.figDefaultComponentBorder}`
214
+ });
215
+ });
216
+
217
+ it('Accessibility of inactive state of options and category cells', { tags: 'a11y' }, () => {
218
+ cy.checkAccessibility(dragAndDropIntoCategoriesPage.draggableOption().parents('.edit-question-preview-wrapper [class*="DragAndDropMatrixstyles__ContentWrapper"]'));
219
+ });
220
+
221
+ it('When the user selects an option, it should get in selected state and all the category cells should get in active state', () => {
222
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInPreviewTab('drag and drop into categories', 'Bat');
223
+ cy.log('checking active state of selected option')
224
+ dragAndDropIntoCategoriesPage.steps.verifyActiveStateOfDraggableOptionInPreviewTab(0, 'drag and drop into categories');
225
+ cy.log('checking default state of unselected option(s)')
226
+ dragAndDropIntoCategoriesPage.steps.verifyDefaultStateOfUnselectedDraggableOptionsInPreviewTab([1, 2, 3], 'drag and drop into categories');
227
+ cy.log('checking active state of all category cells');
228
+ dragAndDropIntoCategoriesPage.steps.verifyActiveStateOfAllCategoryCellsInPreviewTab();
229
+ });
230
+
231
+ it('CSS of active state of options and category cells', { tags: 'css' }, () => {
232
+ dragAndDropIntoCategoriesPage.previewTabDraggableOptionsWrapper('drag and drop into categories')
233
+ .within(() => {
234
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption().eq(0), {
235
+ 'border': `1px solid ${css.color.dragOptionActiveBorder}`,
236
+ 'background-color': css.color.figActiveComponentBg
237
+ });
238
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOptionDragIcon(), {
239
+ 'fill': css.color.activeButtons
240
+ });
241
+ });
242
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.previewTabCategoryGrid(), {
243
+ 'border': `1px solid ${css.color.activeComponentBorder}`
244
+ });
245
+ });
246
+
247
+ it('Accessibility of active state of options and category cells', { tags: 'a11y' }, () => {
248
+ cy.checkAccessibility(dragAndDropIntoCategoriesPage.draggableOption().parents('.edit-question-preview-wrapper [class*="DragAndDropMatrixstyles__ContentWrapper"]'));
249
+ });
250
+
251
+ it('When the user deselects the option, it should get in deselected state and the category cells should return to the inactive state', () => {
252
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInPreviewTab('drag and drop into categories', 'Bat');
253
+ cy.log('Checking default state of deselected option')
254
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllDraggableOptionsInPreviewTab('drag and drop into categories');
255
+ cy.log('Checking default inactive state of category cells')
256
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInPreviewTab();
257
+ });
258
+
259
+ it('When the user drops an option in one of the category cells, the option should get removed from the response container, the category cell should get filled with that option and the other category cells should return to inactive state', () => {
260
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Bat', 0);
261
+ dragAndDropIntoCategoriesPage.steps.verifyDraggableOptionInCategoryCellOfPreviewTab(0, ['Bat']);
262
+ dragAndDropIntoCategoriesPage.steps.verifyDraggableResponsesPreviewTab('drag and drop into categories', ['Eagle', 'Parrot', 'Whale']);
263
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInPreviewTab();
264
+ });
265
+
266
+ it('When the user has dropped an option inside a category cell, drag handle should not be displayed in the category cell', () => {
267
+ dragAndDropIntoCategoriesPage.steps.verifyDragHandleNotVisibleInFilledCategoryCellOfPreviewTab(0);
268
+ });
269
+
270
+ it('CSS of filled category cell', { tags: 'css' }, () => {
271
+ dragAndDropIntoCategoriesPage.previewTabCategoryCell()
272
+ .eq(0)
273
+ .within(() => {
274
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption(), {
275
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
276
+ 'background-color': css.color.defaultBackground
277
+ });
278
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption().find('.question-text-wrapper'), {
279
+ 'color': css.color.text,
280
+ 'font-size': css.fontSize.default,
281
+ 'font-weight': css.fontWeight.regular,
282
+ });
283
+ });
284
+ });
285
+
286
+ it('Accessibility of filled category cell', { tags: 'a11y' }, () => {
287
+ cy.checkAccessibility(dragAndDropIntoCategoriesPage.draggableOption().parents('.edit-question-preview-wrapper [class*="DragAndDropMatrixstyles__ContentWrapper"]'));
288
+ });
289
+
290
+ it('When the user drops an option on a filled category cell, the existing option should persist in the category cell', () => {
291
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Eagle', 0);
292
+ dragAndDropIntoCategoriesPage.steps.verifyDraggableOptionInCategoryCellOfPreviewTab(0, ['Bat', 'Eagle']);
293
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInPreviewTab();
294
+ dragAndDropIntoCategoriesPage.steps.verifyDraggableResponsesPreviewTab('drag and drop into categories', ['Parrot', 'Whale']);
295
+ });
296
+
297
+ it('When the user selects an option from the filled category cell, the response container as well as all category cells should get active for dropping the option', () => {
298
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInCategoryCellOfPreviewTab('Bat');
299
+ dragAndDropIntoCategoriesPage.steps.verifyActiveStateOfDraggableOptionsContainerInPreviewTab('drag and drop into categories');
300
+ dragAndDropIntoCategoriesPage.steps.verifyActiveStateOfAllCategoryCellsInPreviewTab(1);
301
+ });
302
+
303
+ it('CSS of option from the filled category cell in selected state', { tags: 'css' }, () => {
304
+ dragAndDropIntoCategoriesPage.previewTabCategoryCell()
305
+ .eq(0)
306
+ .within(() => {
307
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption().eq(0), {
308
+ 'border': `1px solid ${css.color.dragOptionActiveBorder}`,
309
+ 'background-color': css.color.figActiveComponentBg
310
+ });
311
+ });
312
+ });
313
+
314
+ it('Accessibility of option from the filled category cell in selected state', { tags: 'a11y' }, () => {
315
+ cy.checkAccessibility(dragAndDropIntoCategoriesPage.draggableOption().parents('.edit-question-preview-wrapper [class*="DragAndDropMatrixstyles__ContentWrapper"]'));
316
+ });
317
+
318
+ it('When the user deselects an option from the filled category cell, the option should return to the inactive state', () => {
319
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInCategoryCellOfPreviewTab('Bat');
320
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllDraggableOptionsInPreviewTab('drag and drop into categories');
321
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInPreviewTab();
322
+ });
323
+
324
+ it('The user should be able to move an option from one category cell to another category cell', () => {
325
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInCategoryCellOfPreviewTab('Bat');
326
+ dragAndDropIntoCategoriesPage.steps.clickOnCategoryCellInCategoryCellOfPreviewTab(1);
327
+ dragAndDropIntoCategoriesPage.steps.verifyDraggableOptionInCategoryCellOfPreviewTab(0, ['Eagle']);
328
+ dragAndDropIntoCategoriesPage.steps.verifyDraggableOptionInCategoryCellOfPreviewTab(1, ['Bat']);
329
+ });
330
+ });
331
+
332
+ describe('Click and drop cases for \'Grouped\' response options layout in \'Set correct answer\' section', () => {
333
+ abortEarlySetup();
334
+ before(() => {
335
+ cy.log('Navigate to Drag and drop into categories question type, add input to option input fields');
336
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
337
+ cy.barsPreLoaderWait();
338
+ dragAndDropIntoCategoriesPage.steps.selectResponseOptionsLayout('Grouped');
339
+ dragAndDropIntoCategoriesPage.steps.addGroupTitle(0, 'Group A');
340
+ dragAndDropIntoCategoriesPage.steps.addOption();
341
+ dragAndDropIntoCategoriesPage.steps.addOption();
342
+ dragAndDropIntoCategoriesPage.steps.addInputToOptionsForDragAndDropFields(groupedOptions[0]);
343
+ dragAndDropIntoCategoriesPage.steps.addGroupWithTitleAndOptionsInResponseOptionsSection(1, 'Group B', groupedOptions[1]);
344
+ });
345
+
346
+ it('When the user has not selected any option, the options and category cells should be in inactive state', () => {
347
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllDraggableOptionsInSetCorrectAnswerSection('drag and drop into categories');
348
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInSetCorrectAnswerSection();
349
+ });
350
+
351
+ it('CSS of inactive state of options and category cells', { tags: 'css' }, () => {
352
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption(), {
353
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
354
+ 'background-color': css.color.defaultBackground,
355
+ });
356
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption().find('.question-text-wrapper'), {
357
+ 'color': css.color.text,
358
+ 'font-size': css.fontSize.default,
359
+ 'font-weight': css.fontWeight.regular,
360
+ });
361
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOptionDragIcon(), {
362
+ 'fill': css.color.secondaryBtn
363
+ });
364
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.setCorrectAnswerSectionCategoryGrid(), {
365
+ 'border': `1px dashed ${css.color.figDefaultComponentBorder}`
366
+ });
367
+ });
368
+
369
+ it('Accessibility of inactive state of options and category cells', { tags: 'a11y' }, () => {
370
+ cy.checkAccessibility(dragAndDropIntoCategoriesPage.draggableOption().parents('[class*="DragAndDropMatrixstyles__ContentWrapper"]'));
371
+ });
372
+
373
+ it('When the user selects an option, it should get in selected state and all the category cells should get in active state', () => {
374
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInSetCorrectAnswerSection('drag and drop into categories', 'Bat');
375
+ cy.log('checking active state of selected option')
376
+ dragAndDropIntoCategoriesPage.steps.verifyActiveStateOfDraggableOptionInSetCorrectAnswerSection(0, 'drag and drop into categories');
377
+ cy.log('checking default state of unselected option(s)')
378
+ dragAndDropIntoCategoriesPage.steps.verifyDefaultStateOfUnselectedDraggableOptionsInSetCorrectAnswerSection([1, 2, 3, 4, 5, 6, 7], 'drag and drop into categories');
379
+ cy.log('checking active state of all category cells');
380
+ dragAndDropIntoCategoriesPage.steps.verifyActiveStateOfAllCategoryCellsInSetCorrectAnswerSection();
381
+ });
382
+
383
+ it('CSS of active state of options and category cells', { tags: 'css' }, () => {
384
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption().eq(0), {
385
+ 'border': `1px solid ${css.color.dragOptionActiveBorder}`,
386
+ 'background-color': css.color.figActiveComponentBg
387
+ });
388
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOptionDragIcon(), {
389
+ 'fill': css.color.activeButtons
390
+ });
391
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.setCorrectAnswerSectionCategoryGrid(), {
392
+ 'border': `1px solid ${css.color.activeComponentBorder}`
393
+ });
394
+ });
395
+
396
+ it('Accessibility of active state of options and category cells', { tags: 'a11y' }, () => {
397
+ cy.checkAccessibility(dragAndDropIntoCategoriesPage.draggableOption().parents('[class*="DragAndDropMatrixstyles__ContentWrapper"]'));
398
+ });
399
+
400
+ it('When the user deselects the option, it should get in deselected state and the category cells should return to the inactive state', () => {
401
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInSetCorrectAnswerSection('drag and drop into categories', 'Bat');
402
+ cy.log('Checking default state of deselected option')
403
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllDraggableOptionsInSetCorrectAnswerSection('drag and drop into categories');
404
+ cy.log('Checking default inactive state of category cells')
405
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInSetCorrectAnswerSection();
406
+ });
407
+
408
+ it('When the user drops an option in one of the category cells, the option should get removed from the respective group of the response container, the category cell should get filled with that option and the other category cells should return to inactive state', () => {
409
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Bat', 0);
410
+ dragAndDropIntoCategoriesPage.steps.verifyDraggableOptionInCategoryCellOfSetCorrectAnswerSection(0, ['Bat']);
411
+ dragAndDropIntoCategoriesPage.steps.verifyGroupedResponseContainerContentsInSetCorrectAnswerSection(0, ['Eagle', 'Whale', 'Platypus']);
412
+ dragAndDropIntoCategoriesPage.steps.verifyGroupedResponseContainerContentsInSetCorrectAnswerSection(1, groupedOptions[1]);
413
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInSetCorrectAnswerSection();
414
+ });
415
+
416
+ it('When the user has dropped an option inside a category cell, drag handle should not be displayed in the category cell', () => {
417
+ dragAndDropIntoCategoriesPage.steps.verifyDragHandleNotVisibleInFilledCategoryCellOfSetCorrectAnswerSection(0);
418
+ });
419
+
420
+ it('CSS of filled category cell', { tags: 'css' }, () => {
421
+ dragAndDropIntoCategoriesPage.setCorrectAnswerSectionCategoryCell()
422
+ .eq(0)
423
+ .within(() => {
424
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption(), {
425
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
426
+ 'background-color': css.color.defaultBackground
427
+ });
428
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption().find('.question-text-wrapper'), {
429
+ 'color': css.color.text,
430
+ 'font-size': css.fontSize.default,
431
+ 'font-weight': css.fontWeight.regular,
432
+ });
433
+ });
434
+ });
435
+
436
+ it('Accessibility of filled category cell', { tags: 'a11y' }, () => {
437
+ cy.checkAccessibility(dragAndDropIntoCategoriesPage.draggableOption().parents('[class*="DragAndDropMatrixstyles__ContentWrapper"]'));
438
+ });
439
+
440
+ it('When the user drops an option on a filled category cell, the existing option should persist in the category cell', () => {
441
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Eagle', 0);
442
+ dragAndDropIntoCategoriesPage.steps.verifyDraggableOptionInCategoryCellOfSetCorrectAnswerSection(0, ['Bat', 'Eagle']);
443
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInSetCorrectAnswerSection();
444
+ dragAndDropIntoCategoriesPage.steps.verifyGroupedResponseContainerContentsInSetCorrectAnswerSection(0, ['Whale', 'Platypus']);
445
+ });
446
+
447
+ it('When the user selects an option from the filled category cell, the response container as well as all category cells should get active for dropping the option', () => {
448
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Bat');
449
+ dragAndDropIntoCategoriesPage.steps.verifyActiveStateOfDraggableOptionsContainerInSetCorrectAnswerSection('drag and drop into categories');
450
+ dragAndDropIntoCategoriesPage.steps.verifyActiveStateOfAllCategoryCellsInSetCorrectAnswerSection(1);
451
+ });
452
+
453
+ it('CSS of option from the filled category cell in selected state', { tags: 'css' }, () => {
454
+ dragAndDropIntoCategoriesPage.setCorrectAnswerSectionCategoryCell()
455
+ .eq(0)
456
+ .within(() => {
457
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption().eq(0), {
458
+ 'border': `1px solid ${css.color.dragOptionActiveBorder}`,
459
+ 'background-color': css.color.figActiveComponentBg
460
+ });
461
+ });
462
+ });
463
+
464
+ it('Accessibility of option from the filled category cell in selected state', { tags: 'a11y' }, () => {
465
+ cy.checkAccessibility(dragAndDropIntoCategoriesPage.draggableOption().parents('[class*="DragAndDropMatrixstyles__ContentWrapper"]'));
466
+ });
467
+
468
+ it('When the user deselects an option from the filled category cell, the option should return to the inactive state', () => {
469
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Bat');
470
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllDraggableOptionsInSetCorrectAnswerSection('drag and drop into categories');
471
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInSetCorrectAnswerSection();
472
+ });
473
+
474
+ it('When the user selects a filled option and clicks in the response container, the selected option should get back in the response container and \'Error: Please set a correct answer\' error message should be displayed', () => {
475
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInGroupedResponseContainerOfSetCorrectAnswerSection('Bat');
476
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInGroupedResponseContainerOfSetCorrectAnswerSection('Eagle');
477
+ dragAndDropIntoCategoriesPage.steps.verifyGroupedResponseContainerContentsInSetCorrectAnswerSection(0, groupedOptions[0]);
478
+ dragAndDropIntoCategoriesPage.steps.verifyGroupedResponseContainerContentsInSetCorrectAnswerSection(1, groupedOptions[1]);
479
+ utilities.verifyInnerText(dragAndDropIntoCategoriesPage.errorMessage(), 'Error: Please set a correct answer.');
480
+ utilities.verifyElementVisibilityState(dragAndDropIntoCategoriesPage.errorMessage(), 'visible');
481
+ });
482
+
483
+ dragAndDropIntoCategoriesPage.tests.verifyCSSAnda11yOfErrorMessage();
484
+
485
+ it('When the user fills a category cell, the category cell should get filled with the option and the \'Error: Please set a correct answer\' error message should disappear', () => {
486
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Bat', 0);
487
+ dragAndDropIntoCategoriesPage.steps.verifyErrorMessageIsNotDisplayed();
488
+ });
489
+
490
+ it('The user should be able to move an option from one category cell to another category cell', () => {
491
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Bat');
492
+ dragAndDropIntoCategoriesPage.steps.clickOnCategoryCellInCategoryCellOfSetCorrectAnswerSection(1);
493
+ dragAndDropIntoCategoriesPage.steps.verifyEmptyStateOfCategoryCellInSetCorrectAnswerSection(0);
494
+ dragAndDropIntoCategoriesPage.steps.verifyDraggableOptionInCategoryCellOfSetCorrectAnswerSection(1, ['Bat']);
495
+ });
496
+
497
+ it('When user has dropped all the options from a group in the response areas, then empty group should be displayed in the options container', () => {
498
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Eagle', 0);
499
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Whale', 0);
500
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Platypus', 0);
501
+ dragAndDropIntoCategoriesPage.steps.verifyGroupTitleInSetCorrectAnswerSection(0, 'Group A')
502
+ dragAndDropIntoCategoriesPage.steps.verifyEmptyGroupInSetCorrectAnswerSection(0);
503
+ });
504
+ });
505
+
506
+ describe('Click and drop cases for \'Grouped\' response options layout in \'Preview tab\'', () => {
507
+ abortEarlySetup();
508
+ before(() => {
509
+ cy.log('Navigate to Drag and drop into categories question type, add input to option input fields and switch to preview tab');
510
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
511
+ cy.barsPreLoaderWait();
512
+ dragAndDropIntoCategoriesPage.steps.selectResponseOptionsLayout('Grouped');
513
+ dragAndDropIntoCategoriesPage.steps.addGroupTitle(0, 'Group A');
514
+ dragAndDropIntoCategoriesPage.steps.addOption();
515
+ dragAndDropIntoCategoriesPage.steps.addOption();
516
+ dragAndDropIntoCategoriesPage.steps.addInputToOptionsForDragAndDropFields(groupedOptions[0]);
517
+ dragAndDropIntoCategoriesPage.steps.addGroupWithTitleAndOptionsInResponseOptionsSection(1, 'Group B', groupedOptions[1]);
518
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
519
+ });
520
+
521
+ it('When the user has not selected any option, the options and category cells should be in inactive state', () => {
522
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllDraggableOptionsInPreviewTab('drag and drop into categories');
523
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInPreviewTab();
524
+ });
525
+
526
+ it('CSS of inactive state of options and category cells', { tags: 'css' }, () => {
527
+ dragAndDropIntoCategoriesPage.previewTabDraggableOptionsWrapper('drag and drop into categories')
528
+ .within(() => {
529
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption(), {
530
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
531
+ 'background-color': css.color.defaultBackground,
532
+ });
533
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption().find('.question-text-wrapper'), {
534
+ 'color': css.color.text,
535
+ 'font-size': css.fontSize.default,
536
+ 'font-weight': css.fontWeight.regular,
537
+ });
538
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOptionDragIcon(), {
539
+ 'fill': css.color.secondaryBtn
540
+ });
541
+ });
542
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.previewTabCategoryGrid(), {
543
+ 'border': `1px dashed ${css.color.figDefaultComponentBorder}`
544
+ });
545
+ });
546
+
547
+ it('Accessibility of inactive state of options and category cells', { tags: 'a11y' }, () => {
548
+ cy.checkAccessibility(dragAndDropIntoCategoriesPage.draggableOption().parents('.edit-question-preview-wrapper [class*="DragAndDropMatrixstyles__ContentWrapper"]'));
549
+ });
550
+
551
+ it('When the user selects an option, it should get in selected state and all the category cells should get in active state', () => {
552
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInPreviewTab('drag and drop into categories', 'Bat');
553
+ cy.log('checking active state of selected option')
554
+ dragAndDropIntoCategoriesPage.steps.verifyActiveStateOfDraggableOptionInPreviewTab(0, 'drag and drop into categories');
555
+ cy.log('checking default state of unselected option(s)')
556
+ dragAndDropIntoCategoriesPage.steps.verifyDefaultStateOfUnselectedDraggableOptionsInPreviewTab([1, 2, 3, 4, 5, 6, 7], 'drag and drop into categories');
557
+ cy.log('checking active state of all category cells');
558
+ dragAndDropIntoCategoriesPage.steps.verifyActiveStateOfAllCategoryCellsInPreviewTab();
559
+ });
560
+
561
+ it('CSS of active state of options and category cells', { tags: 'css' }, () => {
562
+ dragAndDropIntoCategoriesPage.previewTabDraggableOptionsWrapper('drag and drop into categories')
563
+ .within(() => {
564
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption().eq(0), {
565
+ 'border': `1px solid ${css.color.dragOptionActiveBorder}`,
566
+ 'background-color': css.color.figActiveComponentBg
567
+ });
568
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOptionDragIcon(), {
569
+ 'fill': css.color.activeButtons
570
+ });
571
+ });
572
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.previewTabCategoryGrid(), {
573
+ 'border': `1px solid ${css.color.activeComponentBorder}`
574
+ });
575
+ });
576
+
577
+ it('Accessibility of active state of options and category cells', { tags: 'a11y' }, () => {
578
+ cy.checkAccessibility(dragAndDropIntoCategoriesPage.draggableOption().parents('.edit-question-preview-wrapper [class*="DragAndDropMatrixstyles__ContentWrapper"]'));
579
+ });
580
+
581
+ it('When the user deselects the option, it should get in deselected state and the category cells should return to the inactive state', () => {
582
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInPreviewTab('drag and drop into categories', 'Bat');
583
+ cy.log('Checking default state of deselected option')
584
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllDraggableOptionsInPreviewTab('drag and drop into categories');
585
+ cy.log('Checking default inactive state of category cells')
586
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInPreviewTab();
587
+ });
588
+
589
+ it('When the user drops an option in one of the category cells, the option should get removed from the respective group of the response container, the category cell should get filled with that option and the other category cells should return to inactive state', () => {
590
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Bat', 0);
591
+ dragAndDropIntoCategoriesPage.steps.verifyDraggableOptionInCategoryCellOfPreviewTab(0, ['Bat']);
592
+ dragAndDropIntoCategoriesPage.steps.verifyGroupedResponseContainerContentsInPreviewTab(0, ['Eagle', 'Whale', 'Platypus']);
593
+ dragAndDropIntoCategoriesPage.steps.verifyGroupedResponseContainerContentsInPreviewTab(1, groupedOptions[1]);
594
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInPreviewTab();
595
+ });
596
+
597
+ it('When the user has dropped an option inside a category cell, drag handle should not be displayed in the category cell', () => {
598
+ dragAndDropIntoCategoriesPage.steps.verifyDragHandleNotVisibleInFilledCategoryCellOfPreviewTab(0);
599
+ });
600
+
601
+ it('CSS of filled category cell', { tags: 'css' }, () => {
602
+ dragAndDropIntoCategoriesPage.previewTabCategoryCell()
603
+ .eq(0)
604
+ .within(() => {
605
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption(), {
606
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
607
+ 'background-color': css.color.defaultBackground
608
+ });
609
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption().find('.question-text-wrapper'), {
610
+ 'color': css.color.text,
611
+ 'font-size': css.fontSize.default,
612
+ 'font-weight': css.fontWeight.regular,
613
+ });
614
+ });
615
+ });
616
+
617
+ it('Accessibility of filled category cell', { tags: 'a11y' }, () => {
618
+ cy.checkAccessibility(dragAndDropIntoCategoriesPage.draggableOption().parents('.edit-question-preview-wrapper [class*="DragAndDropMatrixstyles__ContentWrapper"]'));
619
+ });
620
+
621
+ it('When the user drops an option on a filled category cell, the existing option should persist in the category cell', () => {
622
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Eagle', 0);
623
+ dragAndDropIntoCategoriesPage.steps.verifyDraggableOptionInCategoryCellOfPreviewTab(0, ['Bat', 'Eagle']);
624
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInPreviewTab();
625
+ dragAndDropIntoCategoriesPage.steps.verifyGroupedResponseContainerContentsInPreviewTab(0, ['Whale', 'Platypus']);
626
+ });
627
+
628
+ it('When the user selects an option from the filled category cell, the response container as well as all category cells should get active for dropping the option', () => {
629
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInCategoryCellOfPreviewTab('Bat');
630
+ dragAndDropIntoCategoriesPage.steps.verifyActiveStateOfDraggableOptionsContainerInPreviewTab('drag and drop into categories');
631
+ dragAndDropIntoCategoriesPage.steps.verifyActiveStateOfAllCategoryCellsInPreviewTab(1);
632
+ });
633
+
634
+ it('CSS of option from the filled category cell in selected state', { tags: 'css' }, () => {
635
+ dragAndDropIntoCategoriesPage.previewTabCategoryCell()
636
+ .eq(0)
637
+ .within(() => {
638
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption().eq(0), {
639
+ 'border': `1px solid ${css.color.dragOptionActiveBorder}`,
640
+ 'background-color': css.color.figActiveComponentBg
641
+ });
642
+ });
643
+ });
644
+
645
+ it('Accessibility of option from the filled category cell in selected state', { tags: 'a11y' }, () => {
646
+ cy.checkAccessibility(dragAndDropIntoCategoriesPage.draggableOption().parents('.edit-question-preview-wrapper [class*="DragAndDropMatrixstyles__ContentWrapper"]'));
647
+ });
648
+
649
+ it('When the user deselects an option from the filled category cell, the option should return to the inactive state', () => {
650
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInCategoryCellOfPreviewTab('Bat');
651
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllDraggableOptionsInPreviewTab('drag and drop into categories');
652
+ dragAndDropIntoCategoriesPage.steps.verifyInactiveStateOfAllCategoryCellsInPreviewTab();
653
+ });
654
+
655
+ it('The user should be able to move an option from one category cell to another category cell', () => {
656
+ dragAndDropIntoCategoriesPage.steps.clickOnDraggableOptionInCategoryCellOfPreviewTab('Bat');
657
+ dragAndDropIntoCategoriesPage.steps.clickOnCategoryCellInCategoryCellOfPreviewTab(1);
658
+ dragAndDropIntoCategoriesPage.steps.verifyDraggableOptionInCategoryCellOfPreviewTab(0, ['Eagle']);
659
+ dragAndDropIntoCategoriesPage.steps.verifyDraggableOptionInCategoryCellOfPreviewTab(1, ['Bat']);
660
+ });
661
+
662
+ it('When user has dropped all the options from a group in the response areas, then empty group should be displayed in the options container', () => {
663
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Whale', 0);
664
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Platypus', 0);
665
+ dragAndDropIntoCategoriesPage.steps.verifyGroupTitleInPreviewTab(0, 'Group A')
666
+ dragAndDropIntoCategoriesPage.steps.verifyEmptyGroupInPreviewTab(0);
667
+ });
668
+ });
669
+ });