itemengine-cypress-automation 1.0.162-questionInsructionSelectorFix-15973d5.0 → 1.0.162

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/cypress/e2e/ILC/DrawingResponse/drawingResponsePreviewTabContents.smoke.js +2 -2
  2. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/FillInTheGapsOverImageDragAndDropScoring/allOrNothingForAllViews.smoke.js +0 -24
  3. package/cypress/e2e/ILC/Matching/additionalSettings.js +339 -0
  4. package/cypress/e2e/ILC/Matching/allOrNothingScoringForAllViews.smoke.js +0 -25
  5. package/cypress/e2e/ILC/Matching/clickAndDrop.js +634 -0
  6. package/cypress/e2e/ILC/Matching/studentViewSettings.js +453 -0
  7. package/cypress/e2e/ILC/Matching/studentViewSettingsForGroupedLayout.js +260 -0
  8. package/cypress/pages/components/gridQuestionCommonComponent.js +1 -1
  9. package/cypress/pages/matchingPage.js +444 -17
  10. package/package.json +2 -2
  11. /package/cypress/e2e/ILC/{Desmos → ThirdPartyDesmos}/desmosFourFunctionCalculatorEditTabBasicSection.js +0 -0
  12. /package/cypress/e2e/ILC/{Desmos → ThirdPartyDesmos}/desmosFourFunctionCalculatorPreviewContents.smoke.js +0 -0
  13. /package/cypress/e2e/ILC/{Desmos → ThirdPartyDesmos}/desmosGeometryToolEditTabBasicSection.js +0 -0
  14. /package/cypress/e2e/ILC/{Desmos → ThirdPartyDesmos}/desmosGeometryToolPreviewContents.smoke.js +0 -0
  15. /package/cypress/e2e/ILC/{Desmos → ThirdPartyDesmos}/desmosGraphingCalculatorEditTabBasicSection.js +0 -0
  16. /package/cypress/e2e/ILC/{Desmos → ThirdPartyDesmos}/desmosGraphingCalculatorPreviewContents.smoke.js +0 -0
  17. /package/cypress/e2e/ILC/{Desmos → ThirdPartyDesmos}/desmosMatrixCalculatorEditTabBasicSection.js +0 -0
  18. /package/cypress/e2e/ILC/{Desmos → ThirdPartyDesmos}/desmosMatrixCalculatorPreviewContents.smoke.js +0 -0
  19. /package/cypress/e2e/ILC/{Desmos → ThirdPartyDesmos}/desmosScientificCalculatorEditTabBasicSection.js +0 -0
  20. /package/cypress/e2e/ILC/{Desmos → ThirdPartyDesmos}/desmosScientificCalculatorPreviewContents.smoke.js +0 -0
  21. /package/cypress/e2e/ILC/{DesmosGraphing → ThirdPartyDesmosGraphing}/additionalSettings.js +0 -0
  22. /package/cypress/e2e/ILC/{DesmosGraphing → ThirdPartyDesmosGraphing}/editTabBasic.js +0 -0
  23. /package/cypress/e2e/ILC/{DesmosGraphing → ThirdPartyDesmosGraphing}/editTabScoring.js +0 -0
  24. /package/cypress/e2e/ILC/{DesmosGraphing → ThirdPartyDesmosGraphing}/gradingViewAndCorrectAnswerViewContents.smoke.js +0 -0
  25. /package/cypress/e2e/ILC/{DesmosGraphing → ThirdPartyDesmosGraphing}/previewTabContent.smoke.js +0 -0
  26. /package/cypress/e2e/ILC/{DesmosGraphing → ThirdPartyDesmosGraphing}/studentViewSettings.js +0 -0
  27. /package/cypress/e2e/ILC/{GeoGebraTools → ThirdPartyGeoGebra}/3DGraphingCalculatorEditTabBasicSection.js +0 -0
  28. /package/cypress/e2e/ILC/{GeoGebraTools → ThirdPartyGeoGebra}/3DGraphingCalculatorPreviewTabContents.smoke.js +0 -0
  29. /package/cypress/e2e/ILC/{GeoGebraTools → ThirdPartyGeoGebra}/casCalculatorEditTabBasicSection.js +0 -0
  30. /package/cypress/e2e/ILC/{GeoGebraTools → ThirdPartyGeoGebra}/casCalculatorPreviewTabContents.smoke.js +0 -0
  31. /package/cypress/e2e/ILC/{GeoGebraTools → ThirdPartyGeoGebra}/geometryCalculatorEditTabBasicSection.js +0 -0
  32. /package/cypress/e2e/ILC/{GeoGebraTools → ThirdPartyGeoGebra}/geometryCalculatorPreviewTabContents.smoke.js +0 -0
  33. /package/cypress/e2e/ILC/{GeoGebraTools → ThirdPartyGeoGebra}/graphingCalculatorEditTabBasicSection.js +0 -0
  34. /package/cypress/e2e/ILC/{GeoGebraTools → ThirdPartyGeoGebra}/graphingCalculatorPreviewTabContents.smoke.js +0 -0
  35. /package/cypress/e2e/ILC/{GeoGebraTools → ThirdPartyGeoGebra}/probablityCalculatorEditTabBasicSection.js +0 -0
  36. /package/cypress/e2e/ILC/{GeoGebraTools → ThirdPartyGeoGebra}/probablityCalculatorPreviewTabContents.smoke.js +0 -0
  37. /package/cypress/e2e/ILC/{GeoGebraTools → ThirdPartyGeoGebra}/scientificCalculatorEditTabBasicSection.js +0 -0
  38. /package/cypress/e2e/ILC/{GeoGebraTools → ThirdPartyGeoGebra}/scientificCalculatorPreviewTabContents.smoke.js +0 -0
  39. /package/cypress/e2e/ILC/{GeogebraActivity → ThirdPartyGeogebraActivity}/additionalSettings.js +0 -0
  40. /package/cypress/e2e/ILC/{GeogebraActivity → ThirdPartyGeogebraActivity}/editTabScoringSection.js +0 -0
  41. /package/cypress/e2e/ILC/{GeogebraActivity → ThirdPartyGeogebraActivity}/gradingViewAndCorrectAnswerViewContents.smoke.js +0 -0
  42. /package/cypress/e2e/ILC/{GeogebraActivity → ThirdPartyGeogebraActivity}/headerSection.js +0 -0
  43. /package/cypress/e2e/ILC/{GeogebraActivity → ThirdPartyGeogebraActivity}/insertResourceLink.js +0 -0
  44. /package/cypress/e2e/ILC/{GeogebraActivity → ThirdPartyGeogebraActivity}/previewTabContent.smoke.js +0 -0
  45. /package/cypress/e2e/ILC/{GeogebraActivity → ThirdPartyGeogebraActivity}/questionInstructions.js +0 -0
@@ -0,0 +1,634 @@
1
+ import { matchingPage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ import utilities from "../../../support/helpers/utilities";
4
+ const css = Cypress.env('css');
5
+
6
+ const groupedOptions = ['Petals', 'Flower', 'Stem'];
7
+ const groupedOptionsTwo = ['option 1', 'option 2', 'option 3'];
8
+
9
+ describe('Create Item Page: Matching: Click and drop cases for \'Standard\' and \'Grouped\' response options layouts in \'Specify 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 \'Specify correct answer\' section', () => {
15
+ abortEarlySetup();
16
+ before(() => {
17
+ matchingPage.steps.navigateToCreateQuestion('matching');
18
+ cy.barsPreLoaderWait();
19
+ matchingPage.steps.enterTextInOptionInputField(groupedOptions);
20
+ });
21
+
22
+ it('When the user has not selected any option, the options and dropzone should be in inactive state', () => {
23
+ matchingPage.steps.verifyInactiveStateOfAllDraggableOptionsInSpecifyCorrectAnswerSection();
24
+ matchingPage.steps.verifyInactiveStateOfAllDropzoneInSpecifyCorrectAnswerSection();
25
+ });
26
+
27
+ it('CSS of inactive state of options and dropzone', { tags: 'css' }, () => {
28
+ utilities.verifyCSS(matchingPage.draggableOption(), {
29
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
30
+ 'background-color': css.color.defaultBackground,
31
+ });
32
+ utilities.verifyCSS(matchingPage.draggableOption().find('.question-text-wrapper'), {
33
+ 'color': css.color.text,
34
+ 'font-size': css.fontSize.default,
35
+ 'font-weight': css.fontWeight.regular,
36
+ });
37
+ utilities.verifyCSS(matchingPage.draggableOptionDragIcon().find('g path').eq(1), {
38
+ 'fill': css.color.secondaryBtn
39
+ });
40
+ utilities.verifyCSS(matchingPage.dropzoneSpecifyCorrectAnswerSection().eq(0), {
41
+ 'border-left': `2px dashed ${css.color.activeComponentBorder}`
42
+ });
43
+ });
44
+
45
+ it('Accessibility of inactive state of options and dropzone', { tags: 'a11y' }, () => {
46
+ cy.checkAccessibility(matchingPage.pointsWrapper().parents('.ngie-accordion-detail'));
47
+ });
48
+
49
+ it('When the user selects an option, it should get in selected state and all the other options should be displayed in inactive state and dropzones should be in active state', () => {
50
+ matchingPage.steps.clickOnDraggableOptionInSpecifyCorrectAnswerSection('Petals');
51
+ cy.log('checking active state of selected option')
52
+ matchingPage.steps.verifyActiveStateOfDraggableOptionInSpecifyCorrectAnswerSection(0);
53
+ cy.log('checking default state of unselected option(s)')
54
+ matchingPage.steps.verifyInactiveStateOfUnselectedDraggableOptionsInSpecifyCorrectAnswerSection([1, 2]);
55
+ matchingPage.steps.verifyActiveStateOfAllDropzoneInSpecifyCorrectAnswerSection();
56
+ });
57
+
58
+ it('CSS of active state of options and inactive state of dropzone', { tags: 'css' }, () => {
59
+ utilities.verifyCSS(matchingPage.draggableOption().eq(0), {
60
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
61
+ 'background-color': css.color.defaultBackground
62
+ });
63
+ utilities.verifyCSS(matchingPage.draggableOptionDragIcon().find('g path').eq(1), {
64
+ 'fill': css.color.secondaryBtn
65
+ });
66
+ utilities.verifyCSS(utilities.getNthElement(matchingPage.dropzoneSpecifyCorrectAnswerSection(), 0), {
67
+ 'border-left': `2px dashed ${css.color.activeComponentBorder}`
68
+ });
69
+ });
70
+
71
+ it('Accessibility of active state of options and dropzone', { tags: 'a11y' }, () => {
72
+ cy.checkAccessibility(matchingPage.pointsWrapper().parents('.ngie-accordion-detail'));
73
+ });
74
+
75
+ it('When the user deselects the option, it should get in deselected state and the dropzone should remain in the inactive state', () => {
76
+ matchingPage.steps.clickOnDraggableOptionInSpecifyCorrectAnswerSection('Petals');
77
+ cy.log('Checking default state of deselected option')
78
+ matchingPage.steps.verifyInactiveStateOfAllDraggableOptionsInSpecifyCorrectAnswerSection();
79
+ cy.log('checking inactive state of all dropzones');
80
+ matchingPage.steps.verifyInactiveStateOfAllDropzoneInSpecifyCorrectAnswerSection();
81
+ });
82
+
83
+ it('When the user drops an option in one of the dropzone, the option should get removed from the options container, the dropzone should get filled with that option and the other dropzone should remain in inactive state', () => {
84
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ optionText: 'Petals', dropzoneIndex: 0 }]);
85
+ matchingPage.steps.verifyDraggableOptionInDropzoneSpecifyCorrectAnswerSection(0, ['Petals']);
86
+ matchingPage.steps.verifyDraggableOptionInOptionsContainerSpecifyCorrectAnswerSection(['Flower', 'Stem']);
87
+ matchingPage.steps.verifyInactiveStateOfAllDropzoneInSpecifyCorrectAnswerSection();
88
+ });
89
+
90
+ it('When the user has dropped an option inside a dropzone, drag handle should not be displayed in the dropzone', () => {
91
+ matchingPage.steps.verifyDragHandleNotVisibleInFilledDropzoneOfSpecifyCorrectAnswerSection(0);
92
+ });
93
+
94
+ it('CSS of filled dropzone', { tags: 'css' }, () => {
95
+ matchingPage.dropzoneSpecifyCorrectAnswerSection()
96
+ .eq(0)
97
+ .within(() => {
98
+ utilities.verifyCSS(matchingPage.droppedDraggableOptionInDropzoneSpecifyCorrectAnswerSection().find('.item-content-wrapper'), {
99
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
100
+ 'background-color': css.color.defaultBackground
101
+ });
102
+ utilities.verifyCSS(matchingPage.droppedDraggableOptionInDropzoneSpecifyCorrectAnswerSection().find('.question-text-wrapper'), {
103
+ 'color': css.color.text,
104
+ 'font-size': css.fontSize.default,
105
+ 'font-weight': css.fontWeight.regular,
106
+ });
107
+ });
108
+ });
109
+
110
+ it('Accessibility of filled dropzone', { tags: 'a11y' }, () => {
111
+ cy.checkAccessibility(matchingPage.pointsWrapper().parents('.ngie-accordion-detail'));
112
+ });
113
+
114
+ it('When the user drops an option on a filled dropzone, the dropzone should have newly dropped option', () => {
115
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ optionText: 'Flower', dropzoneIndex: 0 }]);
116
+ matchingPage.steps.verifyDraggableOptionInDropzoneSpecifyCorrectAnswerSection(0, ['Flower']);
117
+ matchingPage.steps.verifyInactiveStateOfAllDropzoneInSpecifyCorrectAnswerSection();
118
+ matchingPage.steps.verifyDraggableOptionInOptionsContainerSpecifyCorrectAnswerSection(['Petals', 'Stem']);
119
+ });
120
+
121
+ it('When the user selects an option from the filled dropzone, dropzone should be in active', () => {
122
+ matchingPage.steps.clickOnDraggableOptionInDropzoneOfSpecifyCorrectAnswerSection('Flower', 0);
123
+ matchingPage.steps.verifyActiveStateOfAllDropzoneInSpecifyCorrectAnswerSection();
124
+ });
125
+
126
+ it('When the user deselects an option from the filled dropzone, the option should return to the inactive state', () => {
127
+ matchingPage.steps.clickOnDraggableOptionInDropzoneOfSpecifyCorrectAnswerSection('Flower', 0);
128
+ matchingPage.steps.verifyInactiveStateOfAllDraggableOptionsInSpecifyCorrectAnswerSection();
129
+ matchingPage.steps.verifyInactiveStateOfAllDropzoneInSpecifyCorrectAnswerSection();
130
+ });
131
+
132
+ it('When the user selects a filled option and clicks in the options container, the selected option should get back in the options container and \'Error: Please set a correct answer\' error message should be displayed', () => {
133
+ matchingPage.steps.clickAndDropOptionInOptionsContainerInSpecifyCorrectAnswerSection('Flower');
134
+ matchingPage.steps.verifyDraggableOptionInOptionsContainerSpecifyCorrectAnswerSection(['Petals', 'Flower', 'Stem']);
135
+ utilities.verifyInnerText(matchingPage.errorMessage(), 'Error: Please set a correct answer.');
136
+ utilities.verifyElementVisibilityState(matchingPage.errorMessage(), 'visible');
137
+ });
138
+
139
+ matchingPage.tests.verifyErrorMessageCSSAndA11y();
140
+
141
+ it('When the user fills a dropzone, the dropzone should get filled with the option and the \'Error: Please set a correct answer\' error message should disappear', () => {
142
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ optionText: 'Petals', dropzoneIndex: 0 }]);
143
+ matchingPage.steps.verifyErrorMessageIsNotDisplayed();
144
+ });
145
+
146
+ it('The user should be able to move an option from one dropzone to another dropzone', () => {
147
+ matchingPage.steps.clickOnDraggableOptionInDropzoneOfSpecifyCorrectAnswerSection('Petals', 0);
148
+ matchingPage.steps.clickOnDropzoneOfSpecifyCorrectAnswerSection(1);
149
+ matchingPage.steps.verifyDropzoneTextSpecifyCorrectAnswerSection(0, '');
150
+ matchingPage.steps.verifyDraggableOptionInDropzoneSpecifyCorrectAnswerSection(1, ['Petals']);
151
+ });
152
+ });
153
+
154
+ describe('Click and drop cases for \'Standard\' response options layout in \'Preview tab\'', () => {
155
+ abortEarlySetup();
156
+ before(() => {
157
+ matchingPage.steps.navigateToCreateQuestion('matching');
158
+ cy.barsPreLoaderWait();
159
+ matchingPage.steps.enterTextInOptionInputField(groupedOptions);
160
+ matchingPage.steps.switchToPreviewTab();
161
+ });
162
+
163
+ it('When the user has not selected any option, the options and dropzone should be in inactive state', () => {
164
+ matchingPage.steps.verifyInactiveStateOfAllDraggableOptionsInPreviewTab();
165
+ matchingPage.steps.verifyInactiveStateOfAllDropzoneInPreviewTab();
166
+ });
167
+
168
+ it('CSS of inactive state of options and dropzone', { tags: 'css' }, () => {
169
+ matchingPage.optionsContainerPreviewTab()
170
+ .within(() => {
171
+ utilities.verifyCSS(matchingPage.draggableOption(), {
172
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
173
+ 'background-color': css.color.defaultBackground,
174
+ });
175
+ utilities.verifyCSS(matchingPage.draggableOption().find('.question-text-wrapper'), {
176
+ 'color': css.color.text,
177
+ 'font-size': css.fontSize.default,
178
+ 'font-weight': css.fontWeight.regular,
179
+ });
180
+ utilities.verifyCSS(matchingPage.draggableOptionDragIcon().find('g path').eq(1), {
181
+ 'fill': css.color.secondaryBtn
182
+ });
183
+ });
184
+ utilities.verifyCSS(matchingPage.dropzonePreviewTab().eq(0), {
185
+ 'border-left': `2px dashed ${css.color.activeComponentBorder}`
186
+ });
187
+ });
188
+
189
+ it('Accessibility of inactive state of options and dropzone', { tags: 'a11y' }, () => {
190
+ cy.checkAccessibility(matchingPage.dropzonePreviewTab().parents('.preview-container'));
191
+ });
192
+
193
+ it('When the user selects an option, it should get in selected state and all other options should remain in inactive state and dropzones should be in active state', () => {
194
+ matchingPage.steps.clickOnDraggableOptionInPreviewTab('Petals');
195
+ cy.log('checking active state of selected option')
196
+ matchingPage.steps.verifyActiveStateOfDraggableOptionInPreviewTab(0);
197
+ cy.log('checking default state of unselected option(s)')
198
+ matchingPage.steps.verifyInactiveStateOfUnselectedDraggableOptionsInPreviewTab([1, 2]);
199
+ matchingPage.steps.verifyActiveStateOfAllDropzoneInPreviewTab();
200
+ });
201
+
202
+ it('CSS of active state of options and dropzone', { tags: 'css' }, () => {
203
+ matchingPage.optionsContainerPreviewTab()
204
+ .within(() => {
205
+ utilities.verifyCSS(matchingPage.draggableOption().eq(0), {
206
+ 'border': `1px solid ${css.color.activeComponentBorder}`,
207
+ 'background-color': css.color.defaultBackground
208
+ });
209
+ utilities.verifyCSS(matchingPage.draggableOptionDragIcon().find('g path').eq(1), {
210
+ 'fill': css.color.activeButtons
211
+ });
212
+ });
213
+ utilities.verifyCSS(matchingPage.dropzonePreviewTab().eq(0), {
214
+ 'border-left': `2px dashed ${css.color.activeComponentBorder}`
215
+ });
216
+ });
217
+
218
+ it('Accessibility of active state of options and dropzone', { tags: 'a11y' }, () => {
219
+ cy.checkAccessibility(matchingPage.dropzonePreviewTab().parents('.no-split-pane-wrapper'));
220
+ });
221
+
222
+ it('When the user deselects the option, it should get in deselected state and the dropzone should remain in the inactive state', () => {
223
+ matchingPage.steps.clickOnDraggableOptionInPreviewTab('Petals');
224
+ cy.log('Checking default state of deselected option')
225
+ matchingPage.steps.verifyInactiveStateOfAllDraggableOptionsInPreviewTab();
226
+ cy.log('checking inactive state of all dropzones');
227
+ matchingPage.steps.verifyInactiveStateOfAllDropzoneInPreviewTab();
228
+ });
229
+
230
+ it('When the user drops an option in one of the dropzone, the option should get removed from the options container, the dropzone should get filled with that option and the other dropzone should return to inactive state', () => {
231
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Petals', dropzoneIndex: 0 }]);
232
+ matchingPage.steps.verifyDraggableOptionInDropzoneOfPreviewTab(0, ['Petals']);
233
+ matchingPage.steps.verifyDraggableOptionsInOptionsContainerPreviewTab(['Flower', 'Stem']);
234
+ matchingPage.steps.verifyInactiveStateOfAllDropzoneInPreviewTab();
235
+ });
236
+
237
+ it('When the user has dropped an option inside a dropzone, drag handle should not be displayed in the dropzone', () => {
238
+ matchingPage.steps.verifyDragHandleNotVisibleInFilledDropzoneOfPreviewTab(0);
239
+ });
240
+
241
+ it('CSS of filled dropzone', { tags: 'css' }, () => {
242
+ matchingPage.dropzonePreviewTab()
243
+ .eq(0)
244
+ .within(() => {
245
+ utilities.verifyCSS(matchingPage.droppedDraggableOptionInDropzonePreviewTab().find('.item-content-wrapper'), {
246
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
247
+ 'background-color': css.color.defaultBackground
248
+ });
249
+ utilities.verifyCSS(matchingPage.droppedDraggableOptionInDropzonePreviewTab().find('.question-text-wrapper'), {
250
+ 'color': css.color.text,
251
+ 'font-size': css.fontSize.default,
252
+ 'font-weight': css.fontWeight.regular,
253
+ });
254
+ });
255
+ });
256
+
257
+ it('Accessibility of filled dropzone', { tags: 'a11y' }, () => {
258
+ cy.checkAccessibility(matchingPage.dropzonePreviewTab().parents('.preview-container'));
259
+ });
260
+
261
+ it('When the user drops an option on a filled dropzone, the dropzone should have newly dropped option and previously added option should be dropped in options container', () => {
262
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Flower', dropzoneIndex: 0 }]);
263
+ matchingPage.steps.verifyDraggableOptionInDropzoneOfPreviewTab(0, ['Flower']);
264
+ matchingPage.steps.verifyInactiveStateOfAllDropzoneInPreviewTab();
265
+ matchingPage.steps.verifyDraggableOptionsInOptionsContainerPreviewTab(['Petals', 'Stem']);
266
+ });
267
+
268
+ it('When the user selects an option from the filled dropzone, the dropzone should be in active state', () => {
269
+ matchingPage.steps.clickOnDraggableOptionInDropzoneOfPreviewTab('Flower', 0);
270
+ matchingPage.steps.verifyActiveStateOfAllDropzoneInPreviewTab();
271
+ });
272
+
273
+ it('CSS of option from the filled dropzone in selected state', { tags: 'css' }, () => {
274
+ matchingPage.dropzonePreviewTab()
275
+ .eq(0)
276
+ .within(() => {
277
+ utilities.verifyCSS(matchingPage.droppedDraggableOptionInDropzonePreviewTab(), {
278
+ 'border': `1px solid ${css.color.activeComponentBorder}`,
279
+ 'background-color': css.color.defaultBackground
280
+ });
281
+ });
282
+ });
283
+
284
+ it('Accessibility of option from the filled dropzone in selected state', { tags: 'a11y' }, () => {
285
+ cy.checkAccessibility(matchingPage.dropzonePreviewTab().parents('.preview-container'));
286
+ });
287
+
288
+ it('When the user deselects an option from the filled dropzone, the option should return to the inactive state', () => {
289
+ matchingPage.steps.clickOnDraggableOptionInDropzoneOfPreviewTab('Flower', 0);
290
+ matchingPage.steps.verifyInactiveStateOfAllDraggableOptionsInPreviewTab();
291
+ matchingPage.steps.verifyInactiveStateOfAllDropzoneInPreviewTab();
292
+ });
293
+
294
+ it('The user should be able to move an option from one dropzone to another dropzone', () => {
295
+ matchingPage.steps.clickOnDraggableOptionInDropzoneOfPreviewTab('Flower', 0);
296
+ matchingPage.steps.clickOnDropzoneOfPreviewTab(1);
297
+ matchingPage.steps.verifyDropzoneTextContentPreviewTab(0, '');
298
+ matchingPage.steps.verifyDraggableOptionInDropzoneOfPreviewTab(1, ['Flower']);
299
+ });
300
+
301
+ it('When the user selects a filled option and clicks in the options container, the selected option should get back in the options container', () => {
302
+ matchingPage.steps.clickAndDropDraggableOptionFromDropzoneToOptionsContainerPreviewTab('Flower', 1);
303
+ matchingPage.steps.verifyDraggableOptionsInOptionsContainerPreviewTab(groupedOptions);
304
+ });
305
+ });
306
+
307
+ describe('Click and drop cases for \'Grouped\' response options layout in \'Specify correct answer\' section', () => {
308
+ abortEarlySetup();
309
+ before(() => {
310
+ matchingPage.steps.navigateToCreateQuestion('matching');
311
+ cy.barsPreLoaderWait();
312
+ matchingPage.steps.expandDraggableOptionsLayoutDropdown();
313
+ matchingPage.steps.selectOptionFromDraggableOptionsLayoutDropdown('Grouped');
314
+ matchingPage.steps.addGroupTitle('Group A');
315
+ matchingPage.steps.enterTextInOptionInputField(groupedOptions);
316
+ matchingPage.steps.addGroupWithTitleAndOptionsInDraggableOptionsSection('Group A', groupedOptionsTwo);
317
+ });
318
+
319
+ it('When the user has not selected any option, the options and dropzone should be in inactive state', () => {
320
+ matchingPage.steps.verifyInactiveStateOfAllDraggableOptionsInSpecifyCorrectAnswerSection();
321
+ matchingPage.steps.verifyInactiveStateOfAllDropzoneInSpecifyCorrectAnswerSection();
322
+ });
323
+
324
+ it('CSS of inactive state of options and dropzone', { tags: 'css' }, () => {
325
+ utilities.verifyCSS(matchingPage.draggableOption(), {
326
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
327
+ 'background-color': css.color.defaultBackground,
328
+ });
329
+ utilities.verifyCSS(matchingPage.draggableOption().find('.question-text-wrapper'), {
330
+ 'color': css.color.text,
331
+ 'font-size': css.fontSize.default,
332
+ 'font-weight': css.fontWeight.regular
333
+ });
334
+ utilities.verifyCSS(matchingPage.draggableOptionDragIcon().find('g path').eq(1), {
335
+ 'fill': css.color.secondaryBtn
336
+ });
337
+ utilities.verifyCSS(matchingPage.dropzoneSpecifyCorrectAnswerSection().eq(0), {
338
+ 'border-left': `2px dashed ${css.color.activeComponentBorder}`
339
+ });
340
+ });
341
+
342
+ it('Accessibility of inactive state of options and dropzone', { tags: 'a11y' }, () => {
343
+ cy.checkAccessibility(matchingPage.dropzoneSpecifyCorrectAnswerSection().parents('.ngie-accordion-detail'));
344
+ });
345
+
346
+ it('When the user selects an option, it should get in selected state and all other remain in inactive state and dropzones should be in active state', () => {
347
+ matchingPage.steps.clickOnDraggableOptionInSpecifyCorrectAnswerSection('Petals');
348
+ cy.log('checking active state of selected option')
349
+ matchingPage.steps.verifyActiveStateOfDraggableOptionInSpecifyCorrectAnswerSection(0);
350
+ cy.log('checking default state of unselected option(s)')
351
+ matchingPage.steps.verifyInactiveStateOfUnselectedDraggableOptionsInSpecifyCorrectAnswerSection([1, 2]);
352
+ matchingPage.steps.verifyActiveStateOfAllDropzoneInSpecifyCorrectAnswerSection();
353
+ });
354
+
355
+ it('CSS of active state of options and dropzone', { tags: 'css' }, () => {
356
+ utilities.verifyCSS(matchingPage.draggableOption().eq(0), {
357
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
358
+ 'background-color': css.color.defaultBackground
359
+ });
360
+ utilities.verifyCSS(matchingPage.draggableOptionDragIcon().find('g path').eq(1), {
361
+ 'fill': css.color.secondaryBtn
362
+ });
363
+ });
364
+
365
+ it('Accessibility of active state of options and dropzone', { tags: 'a11y' }, () => {
366
+ cy.checkAccessibility(matchingPage.dropzoneSpecifyCorrectAnswerSection().parents('.ngie-accordion-detail'));
367
+ });
368
+
369
+ it('When the user deselects the option, it should get in deselected state and the dropzone should return to the inactive state', () => {
370
+ matchingPage.steps.clickOnDraggableOptionInSpecifyCorrectAnswerSection('Petals');
371
+ cy.log('Checking default state of deselected option')
372
+ matchingPage.steps.verifyInactiveStateOfAllDraggableOptionsInSpecifyCorrectAnswerSection();
373
+ cy.log('checking inactive state of all dropzones');
374
+ matchingPage.steps.verifyInactiveStateOfAllDropzoneInSpecifyCorrectAnswerSection();
375
+ });
376
+
377
+ it('When the user drops an option in one of the dropzone, the option should get removed from the respective group of the options container, the dropzone should get filled with that option and the other dropzone should return to inactive state', () => {
378
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ optionText: 'Petals', dropzoneIndex: 0 }]);
379
+ matchingPage.steps.verifyDraggableOptionInDropzoneSpecifyCorrectAnswerSection(0, ['Petals']);
380
+ matchingPage.steps.verifyGroupedContainerContentsInSpecifyCorrectAnswerSection(0, ['Flower', 'Stem']);
381
+ matchingPage.steps.verifyGroupedContainerContentsInSpecifyCorrectAnswerSection(1, groupedOptionsTwo);
382
+ });
383
+
384
+ it('When the user has dropped an option inside a dropzone, drag handle should not be displayed in the dropzone', () => {
385
+ matchingPage.steps.verifyDragHandleNotVisibleInFilledDropzoneOfSpecifyCorrectAnswerSection(0);
386
+ });
387
+
388
+ it('CSS of filled dropzone', { tags: 'css' }, () => {
389
+ matchingPage.dropzoneSpecifyCorrectAnswerSection()
390
+ .eq(0)
391
+ .within(() => {
392
+ utilities.verifyCSS(matchingPage.droppedDraggableOptionInDropzoneSpecifyCorrectAnswerSection().find('.item-content-wrapper'), {
393
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
394
+ 'background-color': css.color.defaultBackground
395
+ });
396
+ utilities.verifyCSS(matchingPage.droppedDraggableOptionInDropzoneSpecifyCorrectAnswerSection().find('.question-text-wrapper'), {
397
+ 'color': css.color.text,
398
+ 'font-size': css.fontSize.default,
399
+ 'font-weight': css.fontWeight.regular,
400
+ });
401
+ });
402
+ });
403
+
404
+ it('Accessibility of filled dropzone', { tags: 'a11y' }, () => {
405
+ cy.checkAccessibility(matchingPage.dropzoneSpecifyCorrectAnswerSection().parents('.ngie-accordion-detail'));
406
+ });
407
+
408
+ it('When the user drops an option on a filled dropzone, then the dropzone should have newly dropped option and previously added option should be dropped in options container', () => {
409
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ optionText: 'Flower', dropzoneIndex: 0 }]);
410
+ matchingPage.steps.verifyDraggableOptionInDropzoneSpecifyCorrectAnswerSection(0, ['Flower']);
411
+ matchingPage.steps.verifyInactiveStateOfAllDropzoneInSpecifyCorrectAnswerSection();
412
+ matchingPage.steps.verifyGroupedContainerContentsInSpecifyCorrectAnswerSection(0, ['Petals', 'Stem']);
413
+ });
414
+
415
+ it('When the user selects an option from the filled dropzone, the dropzone should be in active state', () => {
416
+ matchingPage.steps.clickOnDraggableOptionInDropzoneOfSpecifyCorrectAnswerSection('Flower', 0);
417
+ matchingPage.steps.verifyActiveStateOfAllDropzoneInSpecifyCorrectAnswerSection();
418
+ });
419
+
420
+ it('CSS of option from the filled dropzone in selected state', { tags: 'css' }, () => {
421
+ matchingPage.dropzoneSpecifyCorrectAnswerSection()
422
+ .eq(0)
423
+ .within(() => {
424
+ utilities.verifyCSS(matchingPage.droppedDraggableOptionInDropzoneSpecifyCorrectAnswerSection().find('.item-content-wrapper'), {
425
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
426
+ 'background-color': css.color.defaultBackground
427
+ });
428
+ });
429
+ });
430
+
431
+ it('Accessibility of option from the filled dropzone in selected state', { tags: 'a11y' }, () => {
432
+ cy.checkAccessibility(matchingPage.dropzoneSpecifyCorrectAnswerSection().parents('.ngie-accordion-detail'));
433
+ });
434
+
435
+ it('When the user deselects an option from the filled dropzone, the option should return to the inactive state', () => {
436
+ matchingPage.steps.clickOnDraggableOptionInDropzoneOfSpecifyCorrectAnswerSection('Flower', 0);
437
+ matchingPage.steps.verifyInactiveStateOfAllDraggableOptionsInSpecifyCorrectAnswerSection();
438
+ matchingPage.steps.verifyInactiveStateOfAllDropzoneInSpecifyCorrectAnswerSection();
439
+ });
440
+
441
+ it('When the user selects a filled option and clicks in the options container, the selected option should get back in the options container and \'Error: Please set a correct answer\' error message should be displayed', () => {
442
+ matchingPage.steps.clickAndDropOptionInOptionsContainerInSpecifyCorrectAnswerSection('Flower');
443
+ matchingPage.steps.verifyGroupedContainerContentsInSpecifyCorrectAnswerSection(0, groupedOptions);
444
+ matchingPage.steps.verifyGroupedContainerContentsInSpecifyCorrectAnswerSection(1, groupedOptionsTwo);
445
+ utilities.verifyInnerText(matchingPage.errorMessage(), 'Error: Please set a correct answer.');
446
+ utilities.verifyElementVisibilityState(matchingPage.errorMessage(), 'visible');
447
+ });
448
+
449
+ matchingPage.tests.verifyErrorMessageCSSAndA11y();
450
+
451
+ it('When the user fills a dropzone, the dropzone should get filled with the option and the \'Error: Please set a correct answer\' error message should disappear', () => {
452
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ optionText: 'Petals', dropzoneIndex: 0 }]);
453
+ matchingPage.steps.verifyErrorMessageIsNotDisplayed();
454
+ });
455
+
456
+ it('The user should be able to move an option from one dropzone to another dropzone', () => {
457
+ matchingPage.steps.clickOnDraggableOptionInDropzoneOfSpecifyCorrectAnswerSection('Petals', 0);
458
+ matchingPage.steps.clickOnDropzoneOfSpecifyCorrectAnswerSection(1);
459
+ matchingPage.steps.verifyDropzoneTextSpecifyCorrectAnswerSection(0, '');
460
+ matchingPage.steps.verifyDraggableOptionInDropzoneSpecifyCorrectAnswerSection(1, ['Petals']);
461
+ });
462
+
463
+ 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', () => {
464
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ optionText: 'Flower', dropzoneIndex: 0 }, { optionText: 'Stem', dropzoneIndex: 2 }]);
465
+ matchingPage.steps.verifyGroupedOptionsTitleSpecifyCorrectAnswerSection(0, 'Group A')
466
+ matchingPage.steps.verifyEmptyGroupInSpecifyCorrectAnswerSection(0);
467
+ });
468
+ });
469
+
470
+ describe('Click and drop cases for \'Grouped\' response options layout in \'Preview tab\'', () => {
471
+ abortEarlySetup();
472
+ before(() => {
473
+ matchingPage.steps.navigateToCreateQuestion('matching');
474
+ cy.barsPreLoaderWait();
475
+ matchingPage.steps.expandDraggableOptionsLayoutDropdown();
476
+ matchingPage.steps.selectOptionFromDraggableOptionsLayoutDropdown('Grouped');
477
+ matchingPage.steps.addGroupTitle('Group A');
478
+ matchingPage.steps.enterTextInOptionInputField(groupedOptions);
479
+ matchingPage.steps.addGroupWithTitleAndOptionsInDraggableOptionsSection('Group A', groupedOptionsTwo);
480
+ matchingPage.steps.switchToPreviewTab();
481
+ });
482
+
483
+ it('When the user has not selected any option, the options and dropzone should be in inactive state', () => {
484
+ matchingPage.steps.verifyInactiveStateOfAllDraggableOptionsInPreviewTab();
485
+ matchingPage.steps.verifyInactiveStateOfAllDropzoneInPreviewTab();
486
+ });
487
+
488
+ it('CSS of inactive state of options and dropzone', { tags: 'css' }, () => {
489
+ matchingPage.optionsContainerPreviewTab()
490
+ .within(() => {
491
+ utilities.verifyCSS(matchingPage.draggableOption(), {
492
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
493
+ 'background-color': css.color.defaultBackground,
494
+ });
495
+ utilities.verifyCSS(matchingPage.draggableOption().find('.question-text-wrapper'), {
496
+ 'color': css.color.text,
497
+ 'font-size': css.fontSize.default,
498
+ 'font-weight': css.fontWeight.regular,
499
+ });
500
+ utilities.verifyCSS(matchingPage.draggableOptionDragIcon().find('g path').eq(1), {
501
+ 'fill': css.color.secondaryBtn
502
+ });
503
+ });
504
+ utilities.verifyCSS(matchingPage.dropzonePreviewTab().eq(0), {
505
+ 'border-left': `2px dashed ${css.color.activeComponentBorder}`
506
+ });
507
+ });
508
+
509
+ it('Accessibility of inactive state of options and dropzone', { tags: 'a11y' }, () => {
510
+ cy.checkAccessibility(matchingPage.dropzonePreviewTab().parents('.preview-container'));
511
+ });
512
+
513
+ it('When the user selects an option, it should get in selected state and all other options should get in inactive state and dropzones should be in active state', () => {
514
+ matchingPage.steps.clickOnDraggableOptionInPreviewTab('Petals');
515
+ cy.log('checking active state of selected option')
516
+ matchingPage.steps.verifyActiveStateOfDraggableOptionInPreviewTab(0);
517
+ cy.log('checking default state of unselected option(s)')
518
+ matchingPage.steps.verifyInactiveStateOfUnselectedDraggableOptionsInPreviewTab([1, 2]);
519
+ cy.log('checking inactive state of all dropzones');
520
+ matchingPage.steps.verifyActiveStateOfAllDropzoneInPreviewTab();
521
+ });
522
+
523
+ it('CSS of active state of options and dropzone', { tags: 'css' }, () => {
524
+ matchingPage.optionsContainerPreviewTab()
525
+ .within(() => {
526
+ utilities.verifyCSS(matchingPage.draggableOption().eq(0), {
527
+ 'border': `1px solid ${css.color.activeComponentBorder}`,
528
+ 'background-color': css.color.defaultBackground
529
+ });
530
+ utilities.verifyCSS(matchingPage.draggableOptionDragIcon().find('g path').eq(1), {
531
+ 'fill': css.color.activeButtons
532
+ });
533
+ });
534
+ utilities.verifyCSS(matchingPage.dropzonePreviewTab().eq(0), {
535
+ 'border-left': `2px dashed ${css.color.activeComponentBorder}`
536
+ });
537
+ });
538
+
539
+ it('Accessibility of active state of options and dropzone', { tags: 'a11y' }, () => {
540
+ cy.checkAccessibility(matchingPage.dropzonePreviewTab().parents('.preview-container'));
541
+ });
542
+
543
+ it('When the user deselects the option, it should get in deselected state and the dropzone should return to the inactive state', () => {
544
+ matchingPage.steps.clickOnDraggableOptionInPreviewTab('Petals');
545
+ cy.log('Checking default state of deselected option')
546
+ matchingPage.steps.verifyInactiveStateOfAllDraggableOptionsInPreviewTab();
547
+ cy.log('checking inactive state of all dropzones');
548
+ matchingPage.steps.verifyInactiveStateOfAllDropzoneInPreviewTab();
549
+ });
550
+
551
+ it('When the user drops an option in one of the dropzone, the option should get removed from the respective group of the options container, the dropzone should get filled with that option and the other dropzone should return to inactive state', () => {
552
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Petals', dropzoneIndex: 0 }]);
553
+ matchingPage.steps.verifyDraggableOptionInDropzoneOfPreviewTab(0, ['Petals']);
554
+ matchingPage.steps.verifyGroupedContainerContentsInPreviewTab(0, ['Flower', 'Stem']);
555
+ matchingPage.steps.verifyGroupedContainerContentsInPreviewTab(1, groupedOptionsTwo);
556
+ matchingPage.steps.verifyInactiveStateOfAllDropzoneInPreviewTab();
557
+ });
558
+
559
+ it('When the user has dropped an option inside a dropzone, drag handle should not be displayed in the dropzone', () => {
560
+ matchingPage.steps.verifyDragHandleNotVisibleInFilledDropzoneOfPreviewTab(0);
561
+ });
562
+
563
+ it('CSS of filled dropzone', { tags: 'css' }, () => {
564
+ matchingPage.dropzonePreviewTab()
565
+ .eq(0)
566
+ .within(() => {
567
+ utilities.verifyCSS(matchingPage.droppedDraggableOptionInDropzonePreviewTab(), {
568
+ 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
569
+ 'background-color': css.color.transparent
570
+ });
571
+ utilities.verifyCSS(matchingPage.droppedDraggableOptionInDropzonePreviewTab().find('.question-text-wrapper'), {
572
+ 'color': css.color.text,
573
+ 'font-size': css.fontSize.default,
574
+ 'font-weight': css.fontWeight.regular,
575
+ });
576
+ });
577
+ });
578
+
579
+ it('Accessibility of filled dropzone', { tags: 'a11y' }, () => {
580
+ cy.checkAccessibility(matchingPage.dropzonePreviewTab().parents('.preview-container'));
581
+ });
582
+
583
+ it('When the user drops an option on a filled dropzone, then the dropzone should have newly dropped option and previously added option should be dropped in options container', () => {
584
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Flower', dropzoneIndex: 0 }]);
585
+ matchingPage.steps.verifyDraggableOptionInDropzoneOfPreviewTab(0, ['Flower']);
586
+ matchingPage.steps.verifyInactiveStateOfAllDropzoneInPreviewTab();
587
+ matchingPage.steps.verifyGroupedContainerContentsInPreviewTab(0, ['Petals', 'Stem']);
588
+ });
589
+
590
+ it('When the user selects an option from the filled dropzone, the dropzones should be in active state', () => {
591
+ matchingPage.steps.clickOnDraggableOptionInDropzoneOfPreviewTab('Flower', 0);
592
+ matchingPage.steps.verifyActiveStateOfAllDropzoneInPreviewTab(1);
593
+ });
594
+
595
+ it('CSS of option from the filled dropzone in selected state', { tags: 'css' }, () => {
596
+ matchingPage.dropzonePreviewTab()
597
+ .eq(0)
598
+ .within(() => {
599
+ utilities.verifyCSS(matchingPage.droppedDraggableOptionInDropzonePreviewTab(), {
600
+ 'border': `1px solid ${css.color.activeComponentBorder}`,
601
+ 'background-color': css.color.optionsBg
602
+ });
603
+ });
604
+ });
605
+
606
+ it('Accessibility of option from the filled dropzone in selected state', { tags: 'a11y' }, () => {
607
+ cy.checkAccessibility(matchingPage.dropzonePreviewTab().parents('.preview-container'));
608
+ });
609
+
610
+ it('When the user deselects an option from the filled dropzone, the option should return to the inactive state', () => {
611
+ matchingPage.steps.clickOnDraggableOptionInDropzoneOfPreviewTab('Flower', 0);
612
+ matchingPage.steps.verifyInactiveStateOfAllDraggableOptionsInPreviewTab();
613
+ matchingPage.steps.verifyInactiveStateOfAllDropzoneInPreviewTab();
614
+ });
615
+
616
+ it('The user should be able to move an option from one dropzone to another dropzone', () => {
617
+ matchingPage.steps.clickOnDraggableOptionInDropzoneOfPreviewTab('Flower', 0);
618
+ matchingPage.steps.clickOnDropzoneOfPreviewTab(1);
619
+ matchingPage.steps.verifyDraggableOptionInDropzoneOfPreviewTab(1, ['Flower']);
620
+ });
621
+
622
+ it('When the user selects a filled option and clicks in the options container, the selected option should get back in the options container', () => {
623
+ matchingPage.steps.clickAndDropDraggableOptionFromDropzoneToOptionsContainerPreviewTab('Flower', 1);
624
+ matchingPage.steps.verifyGroupedContainerContentsInPreviewTab(0, groupedOptions);
625
+ matchingPage.steps.verifyGroupedContainerContentsInPreviewTab(1, groupedOptionsTwo);
626
+ });
627
+
628
+ 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', () => {
629
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Petals', dropzoneIndex: 0 }, { optionText: 'Flower', dropzoneIndex: 1 }, { optionText: 'Stem', dropzoneIndex: 2 }]);
630
+ matchingPage.steps.verifyGroupedOptionsTitlePreviewTab(0, 'Group A')
631
+ matchingPage.steps.verifyEmptyGroupInPreviewTab(0);
632
+ });
633
+ });
634
+ });