itemengine-cypress-automation 1.0.162-questionInsructionSelectorFix-15973d5.0 → 1.0.163-4AprilStagingFixes-01659c3.0

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 +1 -1
  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,453 @@
1
+
2
+ import { matchingPage } from "../../../pages";
3
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
4
+ import utilities from "../../../support/helpers/utilities";
5
+ const css = Cypress.env('css');
6
+ const options = ['Petals', 'Leaves', 'Roots', 'Stem', 'Seeds', 'Flower'];
7
+ const promptArray = ['option 1', 'option 2', 'option 3'];
8
+
9
+ describe('Create Item page - Matching : Student view settings', () => {
10
+ before(() => {
11
+ cy.loginAs('admin');
12
+ });
13
+
14
+ describe('Randomize options : Edit tab', () => {
15
+ abortEarlySetup();
16
+ before(() => {
17
+ matchingPage.steps.navigateToCreateQuestion('matching');
18
+ cy.barsPreLoaderWait();
19
+ matchingPage.steps.addTextInQuestionInstructionsInputField('Matching');
20
+ matchingPage.steps.addMultipleOptionFields(3);
21
+ matchingPage.steps.enterTextInOptionInputField(options);
22
+ matchingPage.steps.enterTextInPromptInputField(promptArray);
23
+ matchingPage.steps.allotPoints(5);
24
+ });
25
+
26
+ matchingPage.tests.verifyStudentViewSettingsLabelAndCSS();
27
+
28
+ it('\'Randomize options\' checkbox and label should be displayed and by default it should be unchecked', () => {
29
+ utilities.verifyInnerText(matchingPage.randomizeOptionsLabel(), 'Randomize options');
30
+ utilities.verifyElementVisibilityState(matchingPage.randomizeOptionsCheckbox(), 'exist');
31
+ matchingPage.steps.verifyRandomizeOptionsCheckboxUnchecked();
32
+ });
33
+
34
+ matchingPage.tests.verifyRandomizeOptionsCheckboxAndLabelUncheckedCSS();
35
+
36
+ it('When the \'Randomize options\' functionality is disabled, the question prompt and options in the specify correct answer section should be displayed in the order in which the user has set them in the \'Options\' section', () => {
37
+ matchingPage.steps.verifyRandomizeOptionsCheckboxUnchecked();
38
+ matchingPage.steps.verifyDraggableOptionInOptionsContainerSpecifyCorrectAnswerSection(options);
39
+ promptArray.forEach((prompt, index) => {
40
+ matchingPage.steps.verifyPromptContainerSpecifyCorrectAnswerSection([{ index: index, optionText: prompt }]);
41
+ });
42
+ });
43
+
44
+ it('When the user enables the \'Randomize options\' functionality, then the question prompt and options in the specify correct answer section should be in the order in which the user has set them in the \'Options\' section', () => {
45
+ matchingPage.steps.checkRandomizeOptionsCheckbox();
46
+ matchingPage.steps.verifyDraggableOptionInOptionsContainerSpecifyCorrectAnswerSection(options);
47
+ promptArray.forEach((prompt, index) => {
48
+ matchingPage.steps.verifyPromptContainerSpecifyCorrectAnswerSection([{ index: index, optionText: prompt }]);
49
+ });
50
+ });
51
+
52
+ matchingPage.tests.verifyRandomizeOptionsCheckboxCheckedCSSAndA11y();
53
+ });
54
+
55
+ describe('Randomize options : Preview tab', () => {
56
+ let optionsArray = [];
57
+ let promptTextArray = [];
58
+ abortEarlySetup();
59
+ before(() => {
60
+ matchingPage.steps.navigateToCreateQuestion('matching');
61
+ cy.barsPreLoaderWait();
62
+ matchingPage.steps.addMultipleOptionFields(3);
63
+ matchingPage.steps.enterTextInPromptInputField(promptArray);
64
+ matchingPage.steps.enterTextInOptionInputField(options);
65
+ matchingPage.steps.allotPoints(5);
66
+ });
67
+
68
+ it('When the \'Randomize options\' functionality is disabled, question prompt and options in the preview tab should be displayed in the order in which the user has set them in the \'Draggable options\' section', () => {
69
+ matchingPage.steps.verifyRandomizeOptionsCheckboxUnchecked();
70
+ matchingPage.steps.switchToPreviewTab();
71
+ promptArray.forEach((prompt, index) => {
72
+ matchingPage.steps.verifyPromptContainerPreviewTab([{ index: index, optionText: prompt }]);
73
+ });
74
+ matchingPage.steps.verifyDraggableOptionsInOptionsContainerPreviewTab(options);
75
+ });
76
+
77
+ it('When the user enables the \'Randomize options\' functionality, then question prompt and options in preview tab should be displayed in a random order', () => {
78
+ matchingPage.steps.switchToEditTab();
79
+ matchingPage.steps.checkRandomizeOptionsCheckbox();
80
+ matchingPage.steps.switchToPreviewTab();
81
+ matchingPage.steps.verifyRandomizeOptionOrder(options);
82
+ matchingPage.steps.verifyRandomizePromptOrder(promptArray);
83
+ optionsArray = matchingPage.steps.getOptionsArray();
84
+ promptTextArray = matchingPage.steps.getPromptArray();
85
+ });
86
+
87
+ it('When the user switches to \'Edit tab\' and does not modify any question properties, then the order of the question prompt and options should not change in the preview tab', () => {
88
+ matchingPage.steps.resetQuestionPreview();
89
+ matchingPage.steps.verifyDraggableOptionsInOptionsContainerPreviewTab(optionsArray);
90
+ promptTextArray.forEach((prompt, index) => {
91
+ matchingPage.steps.verifyPromptContainerPreviewTab([{ index: index, optionText: prompt }]);
92
+ });
93
+ });
94
+
95
+ it('When the user switches to \'Edit tab\' and modifies any of question properties, then the order of the question prompt and options should change from the previous random order', () => {
96
+ matchingPage.steps.switchToEditTab();
97
+ matchingPage.steps.allotPoints(12);
98
+ matchingPage.steps.addTextInQuestionInstructionsInputField('Question');
99
+ matchingPage.steps.switchToPreviewTab();
100
+ matchingPage.steps.verifyRandomizeOptionOrder(options);
101
+ matchingPage.steps.verifyRandomizePromptOrder(promptArray);
102
+ matchingPage.steps.verifyOptionsAreRerandomized(optionsArray);
103
+ matchingPage.steps.verifyPromptAreRerandomized(promptTextArray);
104
+ });
105
+
106
+ it('When the user disables the \'Randomize options\' functionality, then the question prompt and options in the preview tab should be displayed in the order in which the user has set them in the edit tab', () => {
107
+ matchingPage.steps.switchToEditTab()
108
+ matchingPage.steps.uncheckRandomizeOptionsCheckbox();
109
+ matchingPage.steps.switchToPreviewTab();
110
+ matchingPage.steps.verifyDraggableOptionsInOptionsContainerPreviewTab(options);
111
+ promptArray.forEach((prompt, index) => {
112
+ matchingPage.steps.verifyPromptContainerPreviewTab([{ index: index, optionText: prompt }]);
113
+ });
114
+ });
115
+ });
116
+
117
+ describe('Enable outer border for question: Edit tab', () => {
118
+ abortEarlySetup();
119
+ before(() => {
120
+ matchingPage.steps.navigateToCreateQuestion('matching');
121
+ cy.barsPreLoaderWait();
122
+ });
123
+
124
+ it('\'Enable outer border\' label and checkbox should be displayed. By default, \'Enable outer border for question\' checkbox should be in checked state', () => {
125
+ utilities.verifyInnerText(matchingPage.enableOuterBorderForQuestionLabel(), 'Enable outer border for question');
126
+ utilities.verifyElementVisibilityState(matchingPage.enableOuterBorderForQuestionLabel(), 'visible');
127
+ utilities.verifyElementVisibilityState(matchingPage.enableOuterBorderForQuestionCheckbox(), 'exist');
128
+ matchingPage.steps.verifyEnableOuterBorderForQuestionCheckboxCheckedState();
129
+ });
130
+
131
+ it('CSS of \'Enable outer border\' label and checkbox - checked state', { tags: 'css' }, () => {
132
+ utilities.verifyCSS(matchingPage.enableOuterBorderForQuestionLabel(), {
133
+ 'color': css.color.labelText,
134
+ 'font-size': css.fontSize.normal,
135
+ 'font-weight': css.fontWeight.regular
136
+ });
137
+ utilities.verifyCSS(matchingPage.enableOuterBorderForQuestionCheckbox().parent().find('svg g g').eq(0), {
138
+ 'fill': css.color.activeButtons
139
+ });
140
+ });
141
+ });
142
+
143
+ describe('Enable outer border for question: Preview tab', () => {
144
+ abortEarlySetup();
145
+ before(() => {
146
+ matchingPage.steps.navigateToCreateQuestion('matching');
147
+ cy.barsPreLoaderWait();
148
+ matchingPage.steps.addTextInQuestionInstructionsInputField('Matching');
149
+ matchingPage.steps.switchToPreviewTab();
150
+ });
151
+
152
+ it('When the \'Enable outer border for question\' checkbox is in checked state, an outer border over the question preview should be visible', () => {
153
+ utilities.verifyElementVisibilityState(matchingPage.questionBorderPreviewTab(), 'visible');
154
+ });
155
+
156
+ it('CSS of the outer border', { tags: 'css' }, () => {
157
+ utilities.verifyCSS(matchingPage.questionBorderPreviewTab(), {
158
+ 'border': `1px solid ${css.color.draggableOptionsContainerBorder}`
159
+ });
160
+ });
161
+
162
+ it('When the user unchecks the \'Enable outer border for question\' checkbox, then the outer border over the question preview should not be displayed', () => {
163
+ matchingPage.steps.switchToEditTab();
164
+ matchingPage.steps.uncheckEnableOuterBorderForQuestionCheckbox();
165
+ matchingPage.steps.switchToPreviewTab()
166
+ matchingPage.steps.verifyQuestionBorderNotExist();
167
+ });
168
+
169
+ it('CSS of \'Enable outer border for question\' checkbox - unchecked state', { tags: 'css' }, () => {
170
+ matchingPage.steps.switchToEditTab();
171
+ utilities.verifyCSS(matchingPage.enableOuterBorderForQuestionCheckbox().parent().find('svg'), {
172
+ 'fill': css.color.uncheckedCheckbox
173
+ });
174
+ });
175
+
176
+ it('Accessibility of \'Enable outer border for question\' checkbox - unchecked state', { tags: 'a11y' }, () => {
177
+ cy.checkAccessibility(matchingPage.enableOuterBorderForQuestionCheckbox().parents('[data-ngie-testid*="enable-outer-border-for-question-checkbox"]'));
178
+ });
179
+ });
180
+
181
+ describe('Allow multiple instances of same draggable option : Edit tab', () => {
182
+ abortEarlySetup();
183
+ before(() => {
184
+ matchingPage.steps.navigateToCreateQuestion('matching');
185
+ cy.barsPreLoaderWait();
186
+ matchingPage.steps.addTextInQuestionInstructionsInputField('Matching');
187
+ matchingPage.steps.addMultipleOptionFields(3);
188
+ matchingPage.steps.enterTextInOptionInputField(options);
189
+ });
190
+
191
+ it('When the \'Allow multiple instances of same draggable option\' functionality is disabled, then on dropping the option in a dropzone, the draggable options should get removed from the options container', () => {
192
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ optionText: 'Flower', dropzoneIndex: 0 }]);
193
+ matchingPage.steps.verifyDraggableOptionInOptionsContainerSpecifyCorrectAnswerSection(['Petals', 'Leaves', 'Roots', 'Stem', 'Seeds']);
194
+ });
195
+
196
+ matchingPage.tests.verifyAllowMultipleInstancesOfSameDraggableOptionCheckboxAndLabelUncheckedCSS();
197
+
198
+ it('When the user enables the \'Allow multiple instances of same draggable option\' functionality, then on setting correct answer in a dropzone, the draggable options should persist in the options container', () => {
199
+ matchingPage.steps.checkAllowMultipleInstancesOfSameDraggableOptionCheckbox();
200
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ optionText: 'Seeds', dropzoneIndex: 1 }]);
201
+ matchingPage.steps.verifyDraggableOptionInOptionsContainerSpecifyCorrectAnswerSection(options);
202
+ });
203
+
204
+ matchingPage.tests.verifyAllowMultipleInstancesOfSameDraggableOptionCheckboxCheckedCSSAndA11y();
205
+
206
+ it('The user should be able to use the same draggable option for multiple dropzone', () => {
207
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ optionText: 'Seeds', dropzoneIndex: 2 }]);
208
+ matchingPage.steps.verifyDraggableOptionInDropzoneSpecifyCorrectAnswerSection(1, 'Seeds');
209
+ matchingPage.steps.verifyDraggableOptionInDropzoneSpecifyCorrectAnswerSection(2, 'Seeds');
210
+ matchingPage.steps.verifyDraggableOptionInOptionsContainerSpecifyCorrectAnswerSection(options);
211
+ });
212
+
213
+ it('When the user removes the draggable option and moves it into the options container, only one option should be displayed in the options container', () => {
214
+ matchingPage.steps.clickAndDropOptionInOptionsContainerInSpecifyCorrectAnswerSection('Seeds');
215
+ matchingPage.steps.clickAndDropOptionInOptionsContainerInSpecifyCorrectAnswerSection('Seeds');
216
+ matchingPage.steps.verifyDraggableOptionInOptionsContainerSpecifyCorrectAnswerSection(options);
217
+ });
218
+
219
+ it('When the user disables the \'Allow multiple instances of same draggable option\' functionality, the duplicate option set as correct answer should get removed from a dropzone and the draggable option should also not exist in the options container of the \'Specify correct answer\' section', () => {
220
+ cy.log('Pre step: Setting identical options as correct responses')
221
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ optionText: 'Seeds', dropzoneIndex: 1 }]);
222
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ optionText: 'Seeds', dropzoneIndex: 2 }]);
223
+ matchingPage.steps.uncheckAllowMultipleInstancesOfSameDraggableOptionCheckbox();
224
+ matchingPage.steps.verifyDraggableOptionInDropzoneSpecifyCorrectAnswerSection(1, 'Seeds');
225
+ matchingPage.steps.verifyDropzoneTextSpecifyCorrectAnswerSection(2, '');
226
+ matchingPage.steps.verifyDraggableOptionInOptionsContainerSpecifyCorrectAnswerSection(['Petals', 'Leaves', 'Roots', 'Stem']);
227
+ });
228
+ });
229
+
230
+ describe('Allow multiple instances of same draggable option : Preview tab', () => {
231
+ abortEarlySetup();
232
+ before(() => {
233
+ matchingPage.steps.navigateToCreateQuestion('matching');
234
+ cy.barsPreLoaderWait();
235
+ matchingPage.steps.addTextInQuestionInstructionsInputField('Matching');
236
+ matchingPage.steps.addMultipleOptionFields(3);
237
+ matchingPage.steps.enterTextInOptionInputField(options);
238
+ matchingPage.steps.switchToPreviewTab();
239
+ });
240
+
241
+ it('When the \'Allow multiple instances of same draggable option\' functionality is disabled, then on dropping the option in a dropzone, the draggable options should get removed from the options container', () => {
242
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Flower', dropzoneIndex: 0 }]);
243
+ matchingPage.steps.verifyDraggableOptionsInOptionsContainerPreviewTab(['Petals', 'Leaves', 'Roots', 'Stem', 'Seeds']);
244
+ });
245
+
246
+ it('When the user enables the \'Allow multiple instances of same draggable option\' functionality, then on setting correct answer in a dropzone, the draggable options should persist in the options container', () => {
247
+ matchingPage.steps.switchToEditTab();
248
+ matchingPage.steps.checkAllowMultipleInstancesOfSameDraggableOptionCheckbox();
249
+ matchingPage.steps.switchToPreviewTab();
250
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Seeds', dropzoneIndex: 1 }]);
251
+ matchingPage.steps.verifyDraggableOptionsInOptionsContainerPreviewTab(options);
252
+ });
253
+
254
+ it('The user should be able to use the same draggable option for multiple dropzones', () => {
255
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Seeds', dropzoneIndex: 2 }]);
256
+ matchingPage.steps.verifyDraggableOptionInDropzoneOfPreviewTab(1, ['Seeds']);
257
+ matchingPage.steps.verifyDraggableOptionInDropzoneOfPreviewTab(2, ['Seeds']);
258
+ matchingPage.steps.verifyDraggableOptionsInOptionsContainerPreviewTab(options);
259
+ });
260
+
261
+ it('When the user removes the draggable option and moves it into the options container, only one option should be displayed in the options container', () => {
262
+ matchingPage.steps.clickAndDropOptionInOptionsContainerInPreviewTab('Seeds');
263
+ matchingPage.steps.clickAndDropOptionInOptionsContainerInPreviewTab('Seeds');
264
+ matchingPage.steps.verifyDropzoneTextPreviewTab(1, '');
265
+ matchingPage.steps.verifyDropzoneTextPreviewTab(2, '');
266
+ matchingPage.steps.verifyDraggableOptionsInOptionsContainerPreviewTab(options);
267
+ });
268
+ });
269
+
270
+ describe('Allow multiple instances of same draggable option - Scoring', () => {
271
+ before(() => {
272
+ matchingPage.steps.navigateToCreateQuestion('matching');
273
+ cy.barsPreLoaderWait();
274
+ matchingPage.steps.addTextInQuestionInstructionsInputField('Matching');
275
+ matchingPage.steps.enterTextInOptionInputField(options.slice(0, 3));
276
+ matchingPage.steps.checkAllowMultipleInstancesOfSameDraggableOptionCheckbox();
277
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ optionText: 'Petals', dropzoneIndex: 0 }]);
278
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ optionText: 'Petals', dropzoneIndex: 1 }]);
279
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ optionText: 'Leaves', dropzoneIndex: 2 }]);
280
+ matchingPage.steps.allotPoints(5);
281
+ matchingPage.steps.switchToPreviewTab();
282
+ });
283
+
284
+ 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', () => {
285
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Petals', dropzoneIndex: 0 }]);
286
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Petals', dropzoneIndex: 1 }]);
287
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Leaves', dropzoneIndex: 2 }]);
288
+ matchingPage.steps.verifyPreviewScore(5, 5);
289
+ matchingPage.steps.verifyPreviewTabPointsBackgroundForCorrectAnswer();
290
+ });
291
+ });
292
+
293
+ describe('Allow students to check answer: Edit tab', () => {
294
+ abortEarlySetup();
295
+ before(() => {
296
+ matchingPage.steps.navigateToCreateQuestion('matching');
297
+ cy.barsPreLoaderWait();
298
+ matchingPage.steps.addTextInQuestionInstructionsInputField('Matching');
299
+ matchingPage.steps.addMultipleOptionFields(3);
300
+ matchingPage.steps.enterTextInOptionInputField(options);
301
+ matchingPage.steps.allotPoints(5);
302
+ });
303
+
304
+ matchingPage.tests.verifyAllowStudentsToCheckAnswerLabelAndCheckboxCSS();
305
+
306
+ matchingPage.tests.verifyMaximumAttemptsDropdownDisplayedWhenAllowStudentsToCheckAnswerIsChecked();
307
+
308
+ matchingPage.tests.verifyMaxCheckAnswerAttemptsDropdown();
309
+
310
+ matchingPage.tests.verifyAllowStudentsToCheckAnswerContentsCSSAndA11y();
311
+ });
312
+
313
+ describe('Allow students to check answer: Preview tab', () => {
314
+ abortEarlySetup();
315
+ before(() => {
316
+ matchingPage.steps.navigateToCreateQuestion('matching');
317
+ cy.barsPreLoaderWait();
318
+ matchingPage.steps.addTextInQuestionInstructionsInputField('Matching');
319
+ matchingPage.steps.addMultipleOptionFields(3);
320
+ matchingPage.steps.enterTextInOptionInputField(options);
321
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ optionText: 'Petals', dropzoneIndex: 0 }, { optionText: 'Flower', dropzoneIndex: 1 }, { optionText: 'Leaves', dropzoneIndex: 2 }]);
322
+ matchingPage.steps.allotPoints(20);
323
+ });
324
+
325
+ it('When the user has added options and specified correct answer and points then on checking the \'Allow students to check answer\' checkbox the Check answer button should be displayed in the preview tab', () => {
326
+ matchingPage.steps.checkAllowStudentToCheckAnswerCheckbox();
327
+ matchingPage.steps.switchToPreviewTab();
328
+ utilities.verifyInnerText(matchingPage.checkAnswerButton(), 'Check answer');
329
+ });
330
+
331
+ it('When the user drops an option in the dropzone and checks the answer then an icon should be displayed beside the selected option and the check answer button should be in enabled state', () => {
332
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Petals', dropzoneIndex: 0 }]);
333
+ matchingPage.steps.checkAnswer();
334
+ matchingPage.steps.verifyCorrectOptionIcon(0);
335
+ matchingPage.steps.verifyCheckAnswerButtonEnabled();
336
+ });
337
+
338
+ it('When the user selects an option from the Maximum check answer attempts dropdown then the user should be able to check answer only those many times in the preview tab', () => {
339
+ matchingPage.steps.switchToEditTab();
340
+ matchingPage.steps.expandMaxCheckAnswerAttemptsDropdown();
341
+ matchingPage.steps.selectMaxCheckAnswerAttemptsDropdownListOption('1');
342
+ matchingPage.steps.switchToPreviewTab();
343
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Petals', dropzoneIndex: 0 }]);
344
+ matchingPage.steps.checkAnswer();
345
+ matchingPage.steps.verifyCheckAnswerButtonDisabled();
346
+ });
347
+
348
+ matchingPage.tests.verifyDisabledCheckAnswerButtonWithCSSAndA11y();
349
+
350
+ it('When the user updates the value of \'Maximum check answer attempts\' dropdown, it should get reflected on the Preview tab', () => {
351
+ matchingPage.steps.switchToEditTab();
352
+ matchingPage.steps.expandMaxCheckAnswerAttemptsDropdown();
353
+ matchingPage.steps.selectMaxCheckAnswerAttemptsDropdownListOption('3');
354
+ matchingPage.steps.switchToPreviewTab();
355
+ matchingPage.steps.verifyCheckAnswerButtonEnabled();
356
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Petals', dropzoneIndex: 0 }]);
357
+ matchingPage.steps.checkAnswer();
358
+ matchingPage.steps.verifyCheckAnswerButtonEnabled();
359
+ });
360
+
361
+ it('When the user selects \'No limit\' option from the dropdown then user should be able to check answer multiple times', () => {
362
+ matchingPage.steps.switchToEditTab();
363
+ matchingPage.steps.expandMaxCheckAnswerAttemptsDropdown();
364
+ matchingPage.steps.selectMaxCheckAnswerAttemptsDropdownListOption('no limit');
365
+ matchingPage.steps.switchToPreviewTab();
366
+ matchingPage.steps.verifyCheckAnswerButtonEnabled();
367
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Petals', dropzoneIndex: 0 }]);
368
+ matchingPage.steps.checkAnswer();
369
+ matchingPage.steps.verifyCheckAnswerButtonEnabled();
370
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Flower', dropzoneIndex: 1 }]);
371
+ matchingPage.steps.checkAnswer();
372
+ matchingPage.steps.verifyCheckAnswerButtonEnabled();
373
+ });
374
+ });
375
+
376
+ describe('Show students the dropzone limits: Edit tab', () => {
377
+ abortEarlySetup();
378
+ before(() => {
379
+ matchingPage.steps.navigateToCreateQuestion('matching');
380
+ cy.barsPreLoaderWait();
381
+ matchingPage.steps.allotPoints(5);
382
+ });
383
+
384
+ it('\'Show students the dropzone limits\' label and checkbox should be displayed. By default the checkbox should be unchecked', () => {
385
+ utilities.verifyInnerText(matchingPage.showStudentsDropzoneLimitsCheckboxLabel(), 'Show students the dropzone limits');
386
+ utilities.verifyElementVisibilityState(matchingPage.showStudentsDropzoneLimitsCheckboxLabel(), 'visible');
387
+ utilities.verifyElementVisibilityState(matchingPage.showStudentsDropzoneLimitsCheckbox(), 'exist');
388
+ matchingPage.steps.verifyShowStudentsDropzoneLimitsCheckboxUnchecked();
389
+ });
390
+
391
+ it('CSS of \'Show students the dropzone limits\' checkbox and label - unchecked state', { tags: 'css' }, () => {
392
+ utilities.verifyCSS(matchingPage.showStudentsDropzoneLimitsCheckboxLabel(), {
393
+ 'color': css.color.labelText,
394
+ 'font-size': css.fontSize.normal,
395
+ 'font-weight': css.fontWeight.regular
396
+ });
397
+ utilities.verifyCSS(matchingPage.showStudentsDropzoneLimitsCheckbox().parent().find('svg'), {
398
+ 'fill': css.color.uncheckedCheckbox
399
+ });
400
+ });
401
+
402
+ it('When the user checks the \'Show students the dropzone limits\' checkbox, help text should \'Maximum answers in each dropzone: #\' not be displayed in the specify correct answer section', () => {
403
+ matchingPage.steps.checkShowStudentsDropzoneLimitsCheckbox();
404
+ utilities.verifyElementVisibilityState(matchingPage.maxLimitInEachDropzoneHelpText(), 'notExist');
405
+ });
406
+
407
+ it('CSS of \'Show students the dropzone limits\' label and checkbox - checked state', { tags: 'css' }, () => {
408
+ utilities.verifyCSS(matchingPage.showStudentsDropzoneLimitsCheckbox().parent().find('svg g g').eq(0), {
409
+ 'fill': css.color.activeButtons
410
+ });
411
+ });
412
+
413
+ it('Accessibility of \'Show students the dropzone limits\' checkbox - checked state', { tags: 'a11y' }, () => {
414
+ cy.checkAccessibility(matchingPage.showStudentsDropzoneLimitsCheckbox().parents('[data-ngie-testid="show-students-the-dropzone-limits-checkbox"]'));
415
+ });
416
+ });
417
+
418
+ describe('Show students the dropzone limits: Preview tab', () => {
419
+ abortEarlySetup();
420
+ before(() => {
421
+ matchingPage.steps.navigateToCreateQuestion('matching');
422
+ cy.barsPreLoaderWait();
423
+ matchingPage.steps.allotPoints(5);
424
+ });
425
+
426
+ it('By default, \'Show students the dropzone limits\' checkbox is in unchecked state, then no help text should be displayed in the preview tab', () => {
427
+ utilities.verifyElementVisibilityState(matchingPage.maxLimitInEachDropzoneHelpText(), 'notExist');
428
+ });
429
+
430
+ it('When the user checks the \'Show students the dropzone limits\' checkbox, a help text \'Maximum answers in each dropzone: #\' should be displayed in the preview tab', () => {
431
+ matchingPage.steps.switchToEditTab();
432
+ matchingPage.steps.checkShowStudentsDropzoneLimitsCheckbox();
433
+ matchingPage.steps.switchToPreviewTab();
434
+ utilities.verifyInnerText(matchingPage.maxLimitInEachDropzoneHelpText(), 'Maximum answers in each dropzone:\n1');
435
+ });
436
+
437
+ it('When the user selects \'#\' from the \'Maximum capacity per dropzone\' dropdown, a help text \'Maximum answers in each dropzone: #\' should be displayed in the preview tab', () => {
438
+ matchingPage.steps.switchToEditTab();
439
+ matchingPage.steps.expandMaxCapacityPerDropzoneDropdown();
440
+ matchingPage.steps.selectOptionFromMaxCapacityPerDropzoneDropdown('2');
441
+ matchingPage.steps.switchToPreviewTab();
442
+ utilities.verifyInnerText(matchingPage.maxLimitInEachDropzoneHelpText(), 'Maximum answers in each dropzone:\n2');
443
+ });
444
+
445
+ it('When the user selects \'No limit\' from the \'Maximum capacity per dropzone\' dropdown, a help text \'Maximum answers in each dropzone: \' should be displayed in the preview tab', () => {
446
+ matchingPage.steps.switchToEditTab();
447
+ matchingPage.steps.expandMaxCapacityPerDropzoneDropdown();
448
+ matchingPage.steps.selectOptionFromMaxCapacityPerDropzoneDropdown('No limit');
449
+ matchingPage.steps.switchToPreviewTab();
450
+ utilities.verifyInnerText(matchingPage.maxLimitInEachDropzoneHelpText(), 'Maximum answers in each dropzone:');
451
+ });
452
+ });
453
+ });