itemengine-cypress-automation 1.0.198-drawingResponseEnumUpdate-1aa98cf.0 → 1.0.198

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. package/cypress/e2e/ILC/ImageHighlight/editTabScoring.js +355 -0
  2. package/cypress/e2e/ILC/ImageHighlight/headerSection.js +83 -0
  3. package/cypress/e2e/ILC/ImageHighlight/minimumScoringPenaltyPointsAndRoundingDropdown.js +205 -0
  4. package/cypress/e2e/ILC/ImageHighlight/specifyCorrectAnswerSection.js +92 -0
  5. package/cypress/e2e/ILC/ImageHighlight/studentViewSettings.js +404 -0
  6. package/cypress/e2e/ILC/ImageHighlight/supportedFileTypes.js +42 -0
  7. package/cypress/e2e/ILC/ImageHighlight/toolSettings.js +73 -0
  8. package/cypress/e2e/ILC/ListOrderingNew/HorizontalOrientation/editTabScoring.js +253 -0
  9. package/cypress/e2e/ILC/ListOrderingNew/HorizontalOrientation/partialDifferentWeightsBasic.js +114 -0
  10. package/cypress/e2e/ILC/ListOrderingNew/HorizontalOrientation/partialDifferentWeightsCorrectPointsGreaterThanAlternativePoints.js +288 -0
  11. package/cypress/e2e/ILC/ListOrderingNew/HorizontalOrientation/partialEqualWeightsBasic.js +164 -0
  12. package/cypress/e2e/ILC/ListOrderingNew/HorizontalOrientation/previewContentsForAllViews.smoke.js +168 -0
  13. package/cypress/e2e/ILC/ListOrderingNew/HorizontalOrientation/setPointsPopup.js +83 -0
  14. package/cypress/e2e/ILC/ListOrderingNew/HorizontalOrientation/specifyCorrectAnswerSection.js +114 -0
  15. package/cypress/e2e/ILC/ListOrderingNew/HorizontalOrientation/studentViewSettings.js +179 -0
  16. package/cypress/e2e/ILC/ListOrderingNew/horizontalOrientationAllOrNothingForAllViews.smoke.js +214 -0
  17. package/cypress/e2e/ILC/ListOrderingNew/studentViewSettings.js +5 -21
  18. package/cypress/e2e/ILC/TextSelection/studentViewSettings.js +3 -37
  19. package/cypress/e2e/ILC/VideoResponseNew/previewContentsForAllViews.smoke.js +1 -1
  20. package/cypress/fixtures/uploads/sampleVirus.zip +0 -0
  21. package/cypress/pages/components/draggableOptionContainer.js +1 -1
  22. package/cypress/pages/components/enableOuterBorderComponent.js +16 -2
  23. package/cypress/pages/components/index.js +3 -1
  24. package/cypress/pages/components/scoringSectionBase.js +1 -1
  25. package/cypress/pages/components/setPointsPopupBase.js +7 -10
  26. package/cypress/pages/components/showAvailableOptionsToStudents.js +76 -0
  27. package/cypress/pages/components/showStudentMaximumNumberOfPossibleSelections.js +56 -0
  28. package/cypress/pages/imageHighlightPage.js +434 -4
  29. package/cypress/pages/listOrderingPage.js +287 -43
  30. package/cypress/pages/textSelectionPage.js +6 -71
  31. package/package.json +2 -2
@@ -0,0 +1,355 @@
1
+ import { imageHighlightPage } 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 flowerHighlightRegion = [[30, 10], [30, 20], [45, 20], [45, 10]];
7
+ const branchesHighlightRegion = [[45, 45], [45, 55], [57, 55], [57, 45]];
8
+ const leafHighlightRegion = [[26, 26], [26, 36], [48, 36], [48, 26]];
9
+
10
+ describe('Create item page - Image highlight: Scoring section', () => {
11
+ before(() => {
12
+ cy.loginAs('admin');
13
+ });
14
+
15
+ describe('Scoring section contents', () => {
16
+ abortEarlySetup();
17
+ before(() => {
18
+ imageHighlightPage.steps.navigateToCreateQuestion('image highlight');
19
+ cy.barsPreLoaderWait();
20
+ });
21
+
22
+ imageHighlightPage.tests.verifyScoringTypeLabelAndDropdown('Auto scored');
23
+
24
+ imageHighlightPage.tests.verifyScoringSubtypeContentsForMultipleResponseTypeQuestion();
25
+ });
26
+
27
+ describe('Scoring section sub types contents', () => {
28
+ abortEarlySetup();
29
+ before(() => {
30
+ imageHighlightPage.steps.navigateToCreateQuestion('image highlight');
31
+ cy.barsPreLoaderWait();
32
+ imageHighlightPage.steps.uploadFile('highlightImage.jpg');
33
+ imageHighlightPage.steps.verifyImageUploadedInSpecifyPossibleOptionsSection();
34
+ imageHighlightPage.steps.verifyImageUploadedSpecifyCorrectAnswer();
35
+ imageHighlightPage.steps.selectSingleSelectionToggle();
36
+ });
37
+
38
+ imageHighlightPage.tests.verifyScoringTypeLabelAndDropdown('Auto scored');
39
+
40
+ it('When user selects the \'Single selection\' radio button then the scoring subtypes should not be displayed', () => {
41
+ utilities.verifyElementVisibilityState(imageHighlightPage.allOrNothingRadioButtonLabel(), 'notExist');
42
+ utilities.verifyElementVisibilityState(imageHighlightPage.allOrNothingRadioButton(), 'notExist');
43
+ utilities.verifyElementVisibilityState(imageHighlightPage.partialDifferentWeightsRadioButtonLabel(), 'notExist');
44
+ utilities.verifyElementVisibilityState(imageHighlightPage.partialDifferentWeightsRadioButton(), 'notExist');
45
+ utilities.verifyElementVisibilityState(imageHighlightPage.partialEqualWeightsRadioButtonLabel(), 'notExist');
46
+ utilities.verifyElementVisibilityState(imageHighlightPage.partialEqualWeightsRadioButton(), 'notExist');
47
+ });
48
+ });
49
+
50
+ describe('Auto scored: All or nothing scoring - Scoring section', () => {
51
+ abortEarlySetup();
52
+ before(() => {
53
+ imageHighlightPage.steps.navigateToCreateQuestion('image highlight');
54
+ cy.barsPreLoaderWait();
55
+ imageHighlightPage.steps.allotPoints(10);
56
+ });
57
+
58
+ it('When the user has selected \'All or nothing\' scoring subtype, minimum scoring dropdown should be displayed in the scoring section', () => {
59
+ imageHighlightPage.steps.verifyMinimumScoringLabelAndDropdownDefaultState();
60
+ });
61
+ });
62
+
63
+ describe('Auto scored: All or nothing scoring - Specify correct answer section', () => {
64
+ abortEarlySetup();
65
+ before(() => {
66
+ imageHighlightPage.steps.navigateToCreateQuestion('image highlight');
67
+ cy.barsPreLoaderWait();
68
+ imageHighlightPage.steps.uploadFile('highlightImage.jpg');
69
+ imageHighlightPage.steps.verifyImageUploadedInSpecifyPossibleOptionsSection();
70
+ imageHighlightPage.steps.verifyImageUploadedSpecifyCorrectAnswer();
71
+ imageHighlightPage.steps.highlightRegionInImage(flowerHighlightRegion);
72
+ imageHighlightPage.steps.highlightRegionInImage(branchesHighlightRegion);
73
+ imageHighlightPage.steps.highlightRegionInImage(leafHighlightRegion);
74
+ });
75
+
76
+ imageHighlightPage.tests.verifyContentsOfSpecifyCorrectAnswerSection();
77
+
78
+ imageHighlightPage.tests.verifyPointsLabelAndInputField();
79
+ });
80
+
81
+ describe('Auto scored: Partial - equal weights scoring - Scoring section', () => {
82
+ abortEarlySetup();
83
+ before(() => {
84
+ imageHighlightPage.steps.navigateToCreateQuestion('image highlight');
85
+ cy.barsPreLoaderWait();
86
+ imageHighlightPage.steps.uploadFile('highlightImage.jpg');
87
+ imageHighlightPage.steps.verifyImageUploadedInSpecifyPossibleOptionsSection();
88
+ imageHighlightPage.steps.verifyImageUploadedSpecifyCorrectAnswer();
89
+ imageHighlightPage.steps.highlightRegionInImage(flowerHighlightRegion);
90
+ imageHighlightPage.steps.highlightRegionInImage(branchesHighlightRegion);
91
+ imageHighlightPage.steps.highlightRegionInImage(leafHighlightRegion);
92
+ });
93
+
94
+ it('User should be able to select \'Partial - equal weights\' scoring type', () => {
95
+ imageHighlightPage.steps.selectAutoScoredScoringSubtype('Partial equal weights');
96
+ });
97
+
98
+ it('When the user has switched to \'Partial - equal weights\' scoring, then \'Penalty scoring\', \'Minimum scoring\' and \'Rounding\' label and dropdown should be displayed in the \'Scoring\' section, \'Round negative scores to zero\' label and checkbox should not be displayed in the \'Scoring\' section', () => {
99
+ imageHighlightPage.steps.verifyPointsPerResponseLabel();
100
+ imageHighlightPage.steps.verifyMinimumScoringLabelAndDropdownDefaultState();
101
+ imageHighlightPage.steps.verifyPenaltyPointsLabelAndDropdownDefaultState();
102
+ imageHighlightPage.steps.verifyRoundingLabelAndDropdownDefaultState();
103
+ utilities.verifyElementVisibilityState(imageHighlightPage.roundNegativeScoresToZeroCheckbox(), 'notExist');
104
+ });
105
+ });
106
+
107
+ describe('Auto scored: Partial equal weights scoring type - Specify correct answer section', () => {
108
+ abortEarlySetup();
109
+ before(() => {
110
+ imageHighlightPage.steps.navigateToCreateQuestion('image highlight');
111
+ cy.barsPreLoaderWait();
112
+ imageHighlightPage.steps.uploadFile('highlightImage.jpg');
113
+ imageHighlightPage.steps.verifyImageUploadedInSpecifyPossibleOptionsSection();
114
+ imageHighlightPage.steps.verifyImageUploadedSpecifyCorrectAnswer();
115
+ imageHighlightPage.steps.selectAutoScoredScoringSubtype('Partial equal weights');
116
+ });
117
+
118
+ it('\'Points per response\' label should be displayed and a \'-\' should be displayed in the \'Specify correct answer\' section', () => {
119
+ imageHighlightPage.steps.verifyPointsPerResponseLabel();
120
+ });
121
+
122
+ it('When user allots points without highlighting any region points per response should be displayed as \'-\'', () => {
123
+ imageHighlightPage.steps.allotPoints(20);
124
+ utilities.verifyElementVisibilityState(imageHighlightPage.specifyCorrectAnswerSectionHighlight(), 'notExist');
125
+ imageHighlightPage.steps.verifyPartialEqualWeightsPointsPerResponseScore('-');
126
+ });
127
+
128
+ it('When user highlights region on the image without selecting them then points per response should be displayed as \'-\'', () => {
129
+ imageHighlightPage.steps.highlightRegionInImage(flowerHighlightRegion);
130
+ imageHighlightPage.steps.highlightRegionInImage(branchesHighlightRegion);
131
+ imageHighlightPage.steps.highlightRegionInImage(leafHighlightRegion);
132
+ imageHighlightPage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(0);
133
+ imageHighlightPage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(1);
134
+ imageHighlightPage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(2);
135
+ imageHighlightPage.steps.verifyPartialEqualWeightsPointsPerResponseScore('-');
136
+ });
137
+
138
+ imageHighlightPage.tests.verifyContentsOfSpecifyCorrectAnswerSection();
139
+
140
+ it('When user selects a highlight region the points should be equally divided among the selected responses', () => {
141
+ imageHighlightPage.steps.highlightARegionInSpecifyCorrectAnswerSection(0);
142
+ imageHighlightPage.steps.highlightARegionInSpecifyCorrectAnswerSection(1);
143
+ imageHighlightPage.steps.highlightARegionInSpecifyCorrectAnswerSection(2);
144
+ imageHighlightPage.steps.verifyPartialEqualWeightsPointsPerResponseScore(6.67);
145
+ });
146
+
147
+ it('When user de-selects a region then the points should be divided only among the selected highlight regions', () => {
148
+ imageHighlightPage.steps.removeHighlightOfARegionInSetCorrectAnswerSection(0);
149
+ imageHighlightPage.steps.verifyPartialEqualWeightsPointsPerResponseScore(10);
150
+ });
151
+
152
+ it('CSS of Partial equal weights points section', { tags: 'css' }, () => {
153
+ utilities.verifyCSS(imageHighlightPage.pointsLabel(), {
154
+ 'color': css.color.labels,
155
+ 'font-size': css.fontSize.normal,
156
+ 'font-weight': css.fontWeight.semibold
157
+ });
158
+ utilities.verifyCSS(imageHighlightPage.pointsInputField(), {
159
+ 'color': css.color.text,
160
+ 'font-size': css.fontSize.default,
161
+ 'font-weight': css.fontWeight.regular
162
+ });
163
+ utilities.verifyCSS(imageHighlightPage.pointsPerResponseLabel(), {
164
+ 'color': css.color.labels,
165
+ 'font-size': css.fontSize.normal,
166
+ 'font-weight': css.fontWeight.regular
167
+ });
168
+ utilities.verifyCSS(imageHighlightPage.partialEqualWeightsPointsPerResponseScore(), {
169
+ 'color': css.color.labels,
170
+ 'font-size': css.fontSize.normal,
171
+ 'font-weight': css.fontWeight.bold
172
+ });
173
+ });
174
+
175
+ it('When the user switches to \'All or nothing\' scoring, the \'Points per response\' label and the points displayed for individual highlight region should not be displayed and the points displayed in \'Points\' input field should remain unchanged', () => {
176
+ imageHighlightPage.steps.selectAutoScoredScoringSubtype('All or nothing')
177
+ utilities.verifyElementVisibilityState(imageHighlightPage.pointsPerResponseLabel(), 'notExist');
178
+ utilities.verifyElementVisibilityState(imageHighlightPage.partialEqualWeightsPointsPerResponseScore(), 'notExist');
179
+ imageHighlightPage.steps.verifyPointsFieldValue(20);
180
+ });
181
+
182
+ it('When user has entered points in \'All or nothing\' scoring type and switches to \'Partial equal weights\' scoring type, then the score should be equally divided and displayed beside the \'Points per response\' label', () => {
183
+ imageHighlightPage.steps.allotPoints(10);
184
+ imageHighlightPage.steps.selectAutoScoredScoringSubtype('Partial equal weights');
185
+ imageHighlightPage.steps.verifyPartialEqualWeightsPointsPerResponseScore(5);
186
+ });
187
+ });
188
+
189
+ describe('Auto scored: Partial - different weights scoring - Scoring section', () => {
190
+ abortEarlySetup();
191
+ before(() => {
192
+ imageHighlightPage.steps.navigateToCreateQuestion('image highlight');
193
+ cy.barsPreLoaderWait();
194
+ imageHighlightPage.steps.uploadFile('highlightImage.jpg');
195
+ imageHighlightPage.steps.verifyImageUploadedInSpecifyPossibleOptionsSection();
196
+ imageHighlightPage.steps.verifyImageUploadedSpecifyCorrectAnswer();
197
+ imageHighlightPage.steps.highlightRegionInImage(flowerHighlightRegion);
198
+ imageHighlightPage.steps.highlightRegionInImage(branchesHighlightRegion);
199
+ imageHighlightPage.steps.highlightRegionInImage(leafHighlightRegion);
200
+ });
201
+
202
+ it('User should be able to select \'Partial - different weights\' scoring', () => {
203
+ imageHighlightPage.steps.selectAutoScoredScoringSubtype('Partial different weights');
204
+ });
205
+
206
+ it('When the user has switched to \'Partial - different weights\' scoring, then \'Penalty scoring\', \'Minimum scoring\' and \'Rounding\' labels and dropdowns, \'Round negative scores to zero\' label and checkbox should not be displayed in the \'Scoring\' section', () => {
207
+ imageHighlightPage.steps.verifyMinimumScoringLabelAndDropdownDefaultState();
208
+ imageHighlightPage.steps.verifyPenaltyPointsLabelAndDropdownDefaultState();
209
+ imageHighlightPage.steps.verifyRoundingLabelAndDropdownDefaultState();
210
+ utilities.verifyElementVisibilityState(imageHighlightPage.roundNegativeScoresToZeroCheckbox(), 'notExist');
211
+ });
212
+ });
213
+
214
+ describe('Auto scored: Partial different weights scoring type - Specify correct answer section', () => {
215
+ abortEarlySetup();
216
+ before(() => {
217
+ imageHighlightPage.steps.navigateToCreateQuestion('image highlight');
218
+ cy.barsPreLoaderWait();
219
+ imageHighlightPage.steps.uploadFile('highlightImage.jpg');
220
+ imageHighlightPage.steps.verifyImageUploadedInSpecifyPossibleOptionsSection();
221
+ imageHighlightPage.steps.verifyImageUploadedSpecifyCorrectAnswer();
222
+ imageHighlightPage.steps.selectAutoScoredScoringSubtype('Partial different weights');
223
+ });
224
+
225
+ it('When user highlights a region then empty points input field should be displayed with label \'Option #\' and they should be in disabled state', () => {
226
+ imageHighlightPage.steps.highlightRegionInImage(flowerHighlightRegion);
227
+ imageHighlightPage.steps.highlightRegionInImage(branchesHighlightRegion);
228
+ imageHighlightPage.steps.highlightRegionInImage(leafHighlightRegion);
229
+ imageHighlightPage.steps.verifyDefaultPointsLabelAndInputField();
230
+ imageHighlightPage.steps.verifyPartialDifferentWeightsOptionLabelAndPoints(0, '');
231
+ imageHighlightPage.steps.verifyPartialDifferentWeightsOptionLabelAndPoints(1, '');
232
+ imageHighlightPage.steps.verifyPartialDifferentWeightsOptionLabelAndPoints(2, '');
233
+ imageHighlightPage.steps.verifyPartialDifferentWeightsPointsInputFieldIsDisabled(0);
234
+ imageHighlightPage.steps.verifyPartialDifferentWeightsPointsInputFieldIsDisabled(1);
235
+ imageHighlightPage.steps.verifyPartialDifferentWeightsPointsInputFieldIsDisabled(2);
236
+ });
237
+
238
+ imageHighlightPage.tests.verifyContentsOfSpecifyCorrectAnswerSection();
239
+
240
+ it('When user highlights a region then the points field of that highlight region should be displayed in enabled state', () => {
241
+ imageHighlightPage.steps.highlightARegionInSpecifyCorrectAnswerSection(0);
242
+ imageHighlightPage.steps.verifyPartialDifferentWeightsPointsInputFieldIsEnabled(0);
243
+ imageHighlightPage.steps.verifyPartialDifferentWeightsPointsInputFieldIsDisabled(1);
244
+ imageHighlightPage.steps.verifyPartialDifferentWeightsPointsInputFieldIsDisabled(2);
245
+ });
246
+
247
+ it('User should be able to enter points', () => {
248
+ imageHighlightPage.steps.allotPartialDifferentWeightsPoints({ 0: 2 });
249
+ });
250
+
251
+ it('CSS of Partial different weights points section', { tags: 'css' }, () => {
252
+ utilities.verifyCSS(imageHighlightPage.pointsInputField().eq(0), {
253
+ 'color': css.color.text,
254
+ 'font-size': css.fontSize.default,
255
+ 'font-weight': css.fontWeight.regular
256
+ });
257
+ cy.log('Disabled points input field')
258
+ utilities.verifyCSS(imageHighlightPage.pointsInputField().eq(1), {
259
+ 'opacity': '1'
260
+ });
261
+ });
262
+
263
+ it('Accessibility of partial different weights scoring section', { tags: 'a11y' }, () => {
264
+ cy.checkAccessibility(imageHighlightPage.pointsLabel().parents('.highlight-image-partial-points-form-control-wrapper'));
265
+ });
266
+
267
+ it('When user de-selects a selected highlight region the points field should change to disabled state', () => {
268
+ imageHighlightPage.steps.removeHighlightOfARegionInSetCorrectAnswerSection(0);
269
+ imageHighlightPage.steps.verifyPartialDifferentWeightsPointsInputFieldIsDisabled(0);
270
+ utilities.verifyInnerText(imageHighlightPage.pointsInputField(), '');
271
+ imageHighlightPage.steps.verifyPartialDifferentWeightsPointsInputFieldIsDisabled(1);
272
+ imageHighlightPage.steps.verifyPartialDifferentWeightsPointsInputFieldIsDisabled(2);
273
+ });
274
+
275
+ it('When the user switches to \'All or nothing\' scoring, the points added for individual responses in Partial - different weights scoring should get summed up in the All or nothing scoring Points input field', () => {
276
+ cy.log('Pre step: Selecting highlight regions and allotting points')
277
+ imageHighlightPage.steps.highlightARegionInSpecifyCorrectAnswerSection(0);
278
+ imageHighlightPage.steps.highlightARegionInSpecifyCorrectAnswerSection(1);
279
+ imageHighlightPage.steps.allotPartialDifferentWeightsPoints({ 1: 8 });
280
+ imageHighlightPage.steps.selectAutoScoredScoringSubtype('All or nothing');
281
+ utilities.verifyElementCount(imageHighlightPage.pointsInputField(), 1);
282
+ imageHighlightPage.steps.verifyPointsFieldValue(8);
283
+ });
284
+
285
+ it('When user has entered points in \'All or nothing\' scoring type and switches to \'Partial different weights\' scoring type, then the points should be equally divided among the selected highlight regions', () => {
286
+ imageHighlightPage.steps.clearPointsField();
287
+ imageHighlightPage.steps.allotPoints(9);
288
+ imageHighlightPage.steps.selectAutoScoredScoringSubtype('Partial different weights');
289
+ imageHighlightPage.steps.verifyPartialDifferentWeightsOptionLabelAndPoints(0, 4.5);
290
+ imageHighlightPage.steps.verifyPartialDifferentWeightsOptionLabelAndPoints(2, 4.5);
291
+ });
292
+ });
293
+
294
+ describe('Manually Scored scoring - Edit tab', () => {
295
+ abortEarlySetup();
296
+ before(() => {
297
+ imageHighlightPage.steps.navigateToCreateQuestion('image highlight');
298
+ cy.barsPreLoaderWait();
299
+ imageHighlightPage.steps.uploadFile('highlightImage.jpg');
300
+ imageHighlightPage.steps.verifyImageUploadedInSpecifyPossibleOptionsSection();
301
+ imageHighlightPage.steps.verifyImageUploadedSpecifyCorrectAnswer();
302
+ imageHighlightPage.steps.highlightRegionInImage(flowerHighlightRegion);
303
+ imageHighlightPage.steps.highlightRegionInImage(branchesHighlightRegion);
304
+ imageHighlightPage.steps.highlightRegionInImage(leafHighlightRegion);
305
+ });
306
+
307
+ it('When the user selects \'Manually scored\' option from the scoring Type dropdown then the \'Specify correct answer\' section should not be displayed; \'Points\' and \'Minimum scoring\' label and dropdown should be displayed', () => {
308
+ imageHighlightPage.steps.expandScoringTypeDropdown();
309
+ imageHighlightPage.steps.selectOptionFromScoringTypeDropdown('Manually scored')
310
+ utilities.verifyElementVisibilityState(imageHighlightPage.pointsLabel(), 'visible');
311
+ utilities.verifyElementVisibilityState(imageHighlightPage.pointsInputField(), 'visible');
312
+ imageHighlightPage.steps.verifyMinimumScoringLabelAndDropdownDefaultState();
313
+ utilities.verifyElementVisibilityState(imageHighlightPage.specifyCorrectAnswerLabel(), 'notExist');
314
+ utilities.verifyElementVisibilityState(imageHighlightPage.specifyCorrectAnswerSectionWrapper(), 'notExist');
315
+ utilities.verifyElementVisibilityState(imageHighlightPage.specifyCorrectAnswerSectionHighlight(), 'notExist');
316
+ });
317
+
318
+ imageHighlightPage.tests.verifyPointsFieldErrorState();
319
+ });
320
+
321
+ describe('Non scored scoring - Scoring section', () => {
322
+ abortEarlySetup();
323
+ before(() => {
324
+ imageHighlightPage.steps.navigateToCreateQuestion('image highlight');
325
+ cy.barsPreLoaderWait();
326
+ });
327
+
328
+ it('User should be able to select \'Non scored\' scoring type from scoring type dropdown', () => {
329
+ imageHighlightPage.steps.expandScoringTypeDropdown();
330
+ imageHighlightPage.steps.selectOptionFromScoringTypeDropdown('Non scored');
331
+ });
332
+
333
+ imageHighlightPage.tests.verifyScoringSectionContentsForNonScoredScoringType();
334
+ });
335
+
336
+ describe('Non scored scoring - Specify correct answer section', () => {
337
+ abortEarlySetup();
338
+ before(() => {
339
+ imageHighlightPage.steps.navigateToCreateQuestion('image highlight');
340
+ cy.barsPreLoaderWait();
341
+ imageHighlightPage.steps.uploadFile('highlightImage.jpg');
342
+ imageHighlightPage.steps.verifyImageUploadedInSpecifyPossibleOptionsSection();
343
+ imageHighlightPage.steps.verifyImageUploadedSpecifyCorrectAnswer();
344
+ imageHighlightPage.steps.highlightRegionInImage(flowerHighlightRegion);
345
+ imageHighlightPage.steps.highlightRegionInImage(branchesHighlightRegion);
346
+ imageHighlightPage.steps.highlightRegionInImage(leafHighlightRegion);
347
+ imageHighlightPage.steps.expandScoringTypeDropdown();
348
+ imageHighlightPage.steps.selectOptionFromScoringTypeDropdown('Non scored');
349
+ });
350
+
351
+ imageHighlightPage.tests.verifyContentsOfSpecifyCorrectAnswerSection();
352
+
353
+ imageHighlightPage.tests.verifyPointsLabelAndInputFieldForNonScoredScoringType();
354
+ });
355
+ });
@@ -0,0 +1,83 @@
1
+ import constants from "../../../fixtures/constants";
2
+ import { dialogBoxBase, imageHighlightPage } from "../../../pages";
3
+ import { uploadImageSectionComponent } from "../../../pages/components/uploadImageSectionComponent";
4
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
5
+ import utilities from "../../../support/helpers/utilities";
6
+
7
+ const flowerHighlightRegion = [[30, 10], [30, 20], [45, 20], [45, 10]];
8
+ const branchesHighlightRegion = [[45, 45], [45, 55], [57, 55], [57, 45]];
9
+
10
+ describe('Create question page - Highlight image: Header section and Saving question', () => {
11
+ before(() => {
12
+ cy.loginAs('admin');
13
+ });
14
+
15
+ describe('Header section contents', () => {
16
+ abortEarlySetup();
17
+ before(() => {
18
+ imageHighlightPage.steps.navigateToCreateQuestion('image highlight');
19
+ });
20
+
21
+ imageHighlightPage.tests.verifyCreateQuestionPageQuestionTypeHeader('Image highlight');
22
+ });
23
+
24
+ describe('Tabs section', () => {
25
+ abortEarlySetup();
26
+ before(() => {
27
+ imageHighlightPage.steps.navigateToCreateQuestion('image highlight');
28
+ });
29
+
30
+ imageHighlightPage.tests.verifyTabsSection();
31
+ });
32
+
33
+ describe('Cancel button', () => {
34
+ abortEarlySetup();
35
+ before(() => {
36
+ imageHighlightPage.steps.navigateToCreateQuestion('image highlight');
37
+ });
38
+
39
+ imageHighlightPage.tests.verifyCancelButton('image highlight');
40
+ });
41
+
42
+ describe('Save Question button', () => {
43
+ abortEarlySetup();
44
+ before(() => {
45
+ cy.log('Navigating to highlight image question type');
46
+ imageHighlightPage.steps.navigateToCreateQuestion('image highlight');
47
+ cy.barsPreLoaderWait();
48
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
49
+ imageHighlightPage.steps.verifyImageUploadedInSpecifyPossibleOptionsSection();
50
+ imageHighlightPage.steps.verifyImageUploadedSpecifyCorrectAnswer();
51
+ });
52
+
53
+ describe('Validation error messages', () => {
54
+ dialogBoxBase.tests.verifyRequiredFieldsWarningPopupOnClickingSaveButton();
55
+
56
+ it('Validation error messages should be displayed below required input fields', () => {
57
+ imageHighlightPage.steps.verifyQuestionInstructionsErrorMessageIsNotDisplayed();
58
+ imageHighlightPage.steps.verifyPointsFieldErrorMessageIsNotDisplayed();
59
+ imageHighlightPage.steps.verifySpecifyCorrectAnswerErrorMessage();
60
+ imageHighlightPage.steps.verifySpecifyCorrectAnswerErrorIconIsVisible();
61
+ });
62
+
63
+ it('Validation error messages should disappear when required input fields are filled', () => {
64
+ imageHighlightPage.steps.addQuestionInstructions();
65
+ imageHighlightPage.steps.highlightRegionInImage(flowerHighlightRegion);
66
+ imageHighlightPage.steps.highlightRegionInImage(branchesHighlightRegion);
67
+ imageHighlightPage.steps.highlightARegionInSpecifyCorrectAnswerSection(0);
68
+ imageHighlightPage.steps.allotPoints(10);
69
+ utilities.verifyElementVisibilityState(imageHighlightPage.errorMessage(), 'notExist');
70
+ imageHighlightPage.steps.verifySpecifyCorrectAnswerErrorIconNotExists();
71
+ });
72
+
73
+ imageHighlightPage.tests.verifyCreateItemWrapperContentsA11y();
74
+ });
75
+
76
+ describe('Saving a question', () => {
77
+ it('When user has filled all the mandatory fields then on clicking on Save Question button the question should get saved and a snackbar with text \'Saved successfully!\' should be displayed', () => {
78
+ imageHighlightPage.steps.saveAQuestionAndVerifySnackbar();
79
+ });
80
+ imageHighlightPage.tests.verifySavedSuccessfullySnackbarCSSAndA11y();
81
+ });
82
+ });
83
+ });
@@ -0,0 +1,205 @@
1
+ import { imageHighlightPage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ import utilities from "../../../support/helpers/utilities";
4
+ const css = Cypress.env('css');
5
+ const penaltyScoringTypeArray = ['No penalty points', 'Penalty points for the entire question', 'Penalty points for each incorrect answer'];
6
+
7
+ const flowerHighlightRegion = [[30, 10], [30, 20], [45, 20], [45, 10]];
8
+ const branchesHighlightRegion = [[45, 45], [45, 55], [57, 55], [57, 45]];
9
+ const leafHighlightRegion = [[26, 26], [26, 36], [48, 36], [48, 26]];
10
+
11
+ describe('Create item page - Image highlight: Minimum scoring, Penalty scoring, Rounding - Edit tab', () => {
12
+ before(() => {
13
+ cy.loginAs('admin');
14
+ });
15
+
16
+ describe('Scoring section: Minimum scoring - Edit tab', () => {
17
+ abortEarlySetup();
18
+ before(() => {
19
+ imageHighlightPage.steps.navigateToCreateQuestion('image highlight');
20
+ cy.barsPreLoaderWait();
21
+ imageHighlightPage.steps.allotPoints(10);
22
+ });
23
+
24
+ imageHighlightPage.tests.verifyMinimumScoringDropdown();
25
+
26
+ imageHighlightPage.tests.verifyMinimumPointsLabelAndInputField();
27
+
28
+ imageHighlightPage.tests.verifyMinimumPointsFieldErrorState();
29
+ });
30
+
31
+ describe('Scoring section: Penalty scoring - Edit tab', () => {
32
+ const additionalHighlightRegion = [[70, 5], [70, 15], [95, 15], [95, 5]];
33
+ abortEarlySetup();
34
+ before(() => {
35
+ imageHighlightPage.steps.navigateToCreateQuestion('image highlight');
36
+ cy.barsPreLoaderWait();
37
+ imageHighlightPage.steps.uploadFile('highlightImage.jpg');
38
+ imageHighlightPage.steps.verifyImageUploadedInSpecifyPossibleOptionsSection();
39
+ imageHighlightPage.steps.verifyImageUploadedSpecifyCorrectAnswer();
40
+ imageHighlightPage.steps.allotPoints(10);
41
+ imageHighlightPage.steps.highlightRegionInImage(flowerHighlightRegion);
42
+ imageHighlightPage.steps.highlightRegionInImage(branchesHighlightRegion);
43
+ imageHighlightPage.steps.highlightRegionInImage(leafHighlightRegion);
44
+ imageHighlightPage.steps.selectAutoScoredScoringSubtype('Partial equal weights');
45
+ });
46
+
47
+ imageHighlightPage.tests.verifyPenaltyScoringDropdown(penaltyScoringTypeArray);
48
+
49
+ imageHighlightPage.tests.verifyPenaltyPointsLabelAndInputField();
50
+
51
+ imageHighlightPage.tests.verifyPenaltyPointsErrorState();
52
+
53
+ it('When the user selects \'Penalty points for each incorrect answer\' from the penalty scoring dropdown, \'Automatically set penalty for each incorrect answer to total points / no. of incorrect answers\' label and checkbox should be displayed, by default the checkbox should be unchecked. Two radio buttons with labels - \'Specify total penalty points\' and \'Specify points for each incorrect answer\' should be displayed. By default, \'Specify total penalty points\' radio button should be checked', () => {
54
+ imageHighlightPage.steps.expandPenaltyScoringDropdown();
55
+ imageHighlightPage.steps.selectOptionFromPenaltyScoringDropdown('Penalty points for each incorrect answer');
56
+ utilities.verifyInnerText(imageHighlightPage.automaticallySetPenaltyPointsCheckboxLabel(), 'Automatically set penalty for each incorrect answer to total points / no. of incorrect answers');
57
+ utilities.verifyInnerText(imageHighlightPage.specifyTotalPenaltyPointsRadioButtonLabel(), 'Specify total penalty points');
58
+ utilities.verifyInnerText(imageHighlightPage.specifyPointsForEachIncorrectOptionRadioButtonLabel(), 'Specify points for each incorrect answer');
59
+ imageHighlightPage.steps.verifyAutomaticallySetPenaltyPointsCheckboxUncheckedState();
60
+ imageHighlightPage.steps.verifySpecifyTotalPenaltyPointsRadioButtonCheckedState();
61
+ imageHighlightPage.steps.verifySpecifyPointsForEachIncorrectOptionRadioButtonUncheckedState();
62
+ });
63
+
64
+ it('When \'Specify total penalty points\' is selected, a penalty points detail section with \'Total penalty points\' label and empty input field, \'Penalty points for each incorrect answer: -\' label should be displayed', () => {
65
+ utilities.verifyInnerText(imageHighlightPage.penaltyPointsDetailsSectionInputFieldLabel(), 'Total penalty points');
66
+ imageHighlightPage.steps.verifyTotalPenaltyPointsValue('');
67
+ utilities.verifyInnerText(imageHighlightPage.penaltyPointsDetailsSectionAllottedPointsLabel(), 'Penalty points for each incorrect answer: -');
68
+ });
69
+
70
+ it('When the user allots total penalty points, then \'points for each incorrect option\' should get updated as per the count of incorrect options available', () => {
71
+ imageHighlightPage.steps.allotTotalPenaltyPoints(5);
72
+ imageHighlightPage.steps.verifyPenaltyPointsForEachIncorrectOption(1.67);
73
+ });
74
+
75
+ it('When the user deletes an option, then \'points for each incorrect option\' should get updated accordingly', () => {
76
+ imageHighlightPage.steps.eraseAHighlightRegion(flowerHighlightRegion);
77
+ imageHighlightPage.steps.verifyPenaltyPointsForEachIncorrectOption(2.5);
78
+ });
79
+
80
+ it('When the user adds a new option, then \'points for each incorrect option\' should get updated accordingly', () => {
81
+ imageHighlightPage.steps.highlightRegionInImage(flowerHighlightRegion);
82
+ imageHighlightPage.steps.verifyPenaltyPointsForEachIncorrectOption(1.67);
83
+ });
84
+
85
+ it('CSS of the penalty points section - Total penalty points', { tags: 'css' }, () => {
86
+ utilities.verifyCSS(imageHighlightPage.automaticallySetPenaltyPointsCheckboxLabel(), {
87
+ 'color': css.color.labelText,
88
+ 'font-size': css.fontSize.default,
89
+ 'font-weight': css.fontWeight.regular
90
+ });
91
+ utilities.verifyCSS(imageHighlightPage.automaticallySetPenaltyPointsCheckbox().parent().find('svg'), {
92
+ 'fill': css.color.uncheckedCheckbox
93
+ });
94
+ utilities.verifyCSS(imageHighlightPage.specifyTotalPenaltyPointsRadioButton().parent().find('svg'), {
95
+ 'fill': css.color.activeButtons
96
+ });
97
+ utilities.verifyCSS(imageHighlightPage.specifyPointsForEachIncorrectOptionRadioButton().parent().find('svg path'), {
98
+ 'fill': css.color.uncheckedCheckbox
99
+ });
100
+ utilities.verifyCSS(imageHighlightPage.specifyTotalPenaltyPointsRadioButtonLabel(), {
101
+ 'color': css.color.labelText,
102
+ 'font-size': css.fontSize.default,
103
+ 'font-weight': css.fontWeight.regular
104
+ });
105
+ utilities.verifyCSS(imageHighlightPage.specifyPointsForEachIncorrectOptionRadioButtonLabel(), {
106
+ 'color': css.color.labelText,
107
+ 'font-size': css.fontSize.default,
108
+ 'font-weight': css.fontWeight.regular
109
+ });
110
+ utilities.verifyCSS(imageHighlightPage.penaltyPointsDetailsSectionInputFieldLabel(), {
111
+ 'color': css.color.labelText,
112
+ 'font-size': css.fontSize.default,
113
+ 'font-weight': css.fontWeight.regular
114
+ });
115
+ utilities.verifyCSS(imageHighlightPage.totalPenaltyPointsInputField(), {
116
+ 'color': css.color.text,
117
+ 'font-size': css.fontSize.default,
118
+ 'font-weight': css.fontWeight.regular
119
+ });
120
+ utilities.verifyCSS(imageHighlightPage.penaltyPointsDetailsSectionAllottedPointsLabel(), {
121
+ 'color': css.color.labelText,
122
+ 'font-size': css.fontSize.default,
123
+ 'font-weight': css.fontWeight.regular
124
+ });
125
+ });
126
+
127
+ it('Accessibility of the penalty points section - Total penalty points', { tags: 'a11y' }, () => {
128
+ cy.checkAccessibility(imageHighlightPage.automaticallySetPenaltyPointsCheckboxLabel().parents('.penalty-score-for-each-incorrect-wrapper'));
129
+ });
130
+
131
+ it('When the user selects \'Specify points for each incorrect answer\', a penalty points detail section with \'Penalty points for each incorrect answer:\' label and empty input field, \'Total penalty points: -\' label should be displayed', () => {
132
+ cy.log('Pre-step: Clearing the total penalty points input field')
133
+ imageHighlightPage.steps.clearTotalPenaltyPointsInputField();
134
+ imageHighlightPage.steps.selectPenaltyPointsForEachIncorrectOptionType('Specify points for each incorrect answer');
135
+ utilities.verifyInnerText(imageHighlightPage.penaltyPointsDetailsSectionInputFieldLabel(), 'Penalty points for each incorrect answer');
136
+ imageHighlightPage.steps.verifyPenaltyPointsForEachIncorrectOptionValue('');
137
+ utilities.verifyInnerText(imageHighlightPage.penaltyPointsDetailsSectionAllottedPointsLabel(), 'Total penalty points: -');
138
+ });
139
+
140
+ it('When the user allots Penalty points for each incorrect answer, then \'Total penalty points\' should get updated as per the count of incorrect options available', () => {
141
+ imageHighlightPage.steps.allotPenaltyPointsForEachIncorrectOption(1);
142
+ imageHighlightPage.steps.verifyTotalPenaltyPoints(3);
143
+ });
144
+
145
+ it('When the user adds a new option, then \'Total penalty points\' should get updated accordingly', () => {
146
+ imageHighlightPage.steps.highlightRegionInImage(additionalHighlightRegion);
147
+ imageHighlightPage.steps.verifyTotalPenaltyPoints(4);
148
+ });
149
+
150
+ it('When the user deletes an option, then \'points for each incorrect option\' should get updated accordingly', () => {
151
+ imageHighlightPage.steps.eraseAHighlightRegion(branchesHighlightRegion);
152
+ imageHighlightPage.steps.verifyTotalPenaltyPoints(3);
153
+ });
154
+
155
+ it('CSS of the penalty points section - Penalty points for each incorrect answer', { tags: 'css' }, () => {
156
+ utilities.verifyCSS(imageHighlightPage.penaltyPointsDetailsSectionInputFieldLabel(), {
157
+ 'color': css.color.labelText,
158
+ 'font-size': css.fontSize.default,
159
+ 'font-weight': css.fontWeight.regular
160
+ });
161
+ utilities.verifyCSS(imageHighlightPage.penaltyPointsForEachIncorrectOptionInputField(), {
162
+ 'color': css.color.text,
163
+ 'font-size': css.fontSize.default,
164
+ 'font-weight': css.fontWeight.regular
165
+ });
166
+ utilities.verifyCSS(imageHighlightPage.penaltyPointsDetailsSectionAllottedPointsLabel(), {
167
+ 'color': css.color.labelText,
168
+ 'font-size': css.fontSize.default,
169
+ 'font-weight': css.fontWeight.regular
170
+ });
171
+ });
172
+
173
+ it('Accessibility of the penalty points section - Penalty points for each incorrect answer', { tags: 'a11y' }, () => {
174
+ cy.checkAccessibility(imageHighlightPage.automaticallySetPenaltyPointsCheckboxLabel().parents('.penalty-score-for-each-incorrect-wrapper'));
175
+ });
176
+
177
+ it('When the user switches to the \'Specify total penalty points\' option, the total penalty points input field should be filled as per the total penalty points in \'Specify points for each incorrect answer\'', () => {
178
+ imageHighlightPage.steps.selectPenaltyPointsForEachIncorrectOptionType('Specify total penalty points');
179
+ imageHighlightPage.steps.verifyTotalPenaltyPointsValue(3);
180
+ utilities.verifyInnerText(imageHighlightPage.penaltyPointsDetailsSectionAllottedPointsLabel(), 'Penalty points for each incorrect answer: 1');
181
+ });
182
+
183
+ it('When the user checks the \'Automatically set penalty for each incorrect answer to total points / no. of incorrect answers\' checkbox, both radio buttons should get disabled, \'Specify points for each incorrect answer\' should get checked, in the penalty points details section, \'Penalty points for each incorrect answer: #\' and \'Total penalty points: #\' should be displayed as per the alloted points and available incorrect options', () => {
184
+ imageHighlightPage.steps.checkAutomaticallySetPenaltyPointsCheckbox();
185
+ imageHighlightPage.steps.verifySpecifyTotalPenaltyPointsDisabledState();
186
+ imageHighlightPage.steps.verifySpecifyPointsForEachIncorrectOptionRadioButtonSelectedAndDisabledState();
187
+ utilities.verifyInnerText(utilities.getNthElement(imageHighlightPage.penaltyPointsDetailsSectionAllottedPointsLabel(), 0), 'Penalty points for each incorrect answer: 3.33');
188
+ utilities.verifyInnerText(utilities.getNthElement(imageHighlightPage.penaltyPointsDetailsSectionAllottedPointsLabel(), 1), 'Total penalty points: 9.99');
189
+ });
190
+ });
191
+
192
+ describe('Scoring section: Rounding - Edit tab', () => {
193
+ abortEarlySetup();
194
+ before(() => {
195
+ imageHighlightPage.steps.navigateToCreateQuestion('image highlight');
196
+ cy.barsPreLoaderWait();
197
+ imageHighlightPage.steps.allotPoints(10);
198
+ imageHighlightPage.steps.selectAutoScoredScoringSubtype('Partial equal weights')
199
+ });
200
+
201
+ imageHighlightPage.tests.verifyRoundingDropdown();
202
+
203
+ imageHighlightPage.tests.verifyRoundNegativeScoreToZeroLabelAndCheckbox();
204
+ });
205
+ });