itemengine-cypress-automation 1.0.24 → 1.0.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAdditionalSettingsAdvanceSettingsForAllResponseAreas.js +511 -0
  2. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAdditionalSettingsBasic.js +263 -0
  3. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAdditionalSettingsResponseAccordions.js +734 -0
  4. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAdditionalSettingsStudentResponseAreaAndLayout.js +603 -0
  5. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAllOrNothingWithAlternateAnswer.js +54 -0
  6. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAutoScoredScoring.js +0 -46
  7. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextPartialDifferentWeights.js +47 -0
  8. package/cypress/e2e/ILC/FillInTheGapsText/{fillInTheGapsTextScoringPartialDifferentWeights.js → fillInTheGapsTextPartialDifferentWeightsWithAlternateAnswer.js} +1 -38
  9. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextPartialEqualWeights.js +45 -0
  10. package/cypress/e2e/ILC/FillInTheGapsText/{fillInTheGapsTextScoringPartialEqualWeights.js → fillInTheGapsTextPartialEqualWeightsWithAlternateAnswer.js} +0 -37
  11. package/cypress/e2e/ILC/HighlightImage/highlightImageAdditionalSettings.js +447 -0
  12. package/cypress/e2e/ILC/HighlightImage/highlightImageAllOrNothingScoring.js +1029 -0
  13. package/cypress/e2e/ILC/HighlightImage/highlightImageCustomizeHighlightProperties.js +1010 -0
  14. package/cypress/e2e/ILC/HighlightImage/highlightImageEditTabBasic.js +200 -0
  15. package/cypress/e2e/ILC/HighlightImage/highlightImageEditTabHighlightSectionContents.js +318 -0
  16. package/cypress/e2e/ILC/HighlightImage/highlightImageEditTabScoring.js +403 -0
  17. package/cypress/e2e/ILC/HighlightImage/highlightImageHeaderSection.js +86 -0
  18. package/cypress/e2e/ILC/HighlightImage/highlightImageManuallyAndNonScoredScoring.js +176 -0
  19. package/cypress/e2e/ILC/HighlightImage/highlightImagePartialDifferentWeightsScoring.js +1093 -0
  20. package/cypress/e2e/ILC/HighlightImage/highlightImagePartialEqualWeightsScoring.js +1087 -0
  21. package/cypress/e2e/ILC/HighlightImage/highlightImagePreviewTab.js +88 -0
  22. package/cypress/e2e/ILC/HighlightImage/highlightImageSetCorrectAnswerCheckboxes.js +244 -0
  23. package/cypress/e2e/ILC/HighlightImage/highlightImageSetCorrectAnswerSection.js +186 -0
  24. package/cypress/e2e/ILC/HighlightImage/highlightImageToolsFunctionality.js +309 -0
  25. package/package.json +1 -1
  26. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAdditionalSettings.js +0 -2060
@@ -0,0 +1,403 @@
1
+ import { highlightImagePage } from "../../../pages";
2
+ import { uploadImageSectionComponent } from "../../../pages/components/uploadImageSectionComponent";
3
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
4
+ import utilities from "../../../support/helpers/utilities";
5
+ const css = Cypress.env('css');
6
+
7
+ const flowerHighlightRegion = [[24, 6], [24, 24], [56, 24], [56, 6]];
8
+ const branchesHighlightRegion = [[36, 36], [36, 46], [58, 46], [58, 36]];
9
+ const leafHighlightRegion = [[54, 48], [54, 72], [82, 72], [82, 48]];
10
+
11
+ describe('Create Item page - Highlight image: Edit tab scoring types and set correct answer section (Correct answer tab)', () => {
12
+ before(() => {
13
+ cy.loginAs('admin');
14
+ });
15
+
16
+ describe('Scoring section contents', () => {
17
+ abortEarlySetup();
18
+ before(() => {
19
+ cy.log('Navigating to Highlight image question type');
20
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
21
+ cy.barsPreLoaderWait();
22
+ });
23
+
24
+ highlightImagePage.tests.verifyScoringTypeLabelAndDropdown('autoScored');
25
+
26
+ it('When user has not uploaded any image then the scoring sub types should not be displayed', () => {
27
+ utilities.verifyElementVisibilityState(highlightImagePage.pointsLabel(), 'notExist');
28
+ utilities.verifyElementVisibilityState(highlightImagePage.pointsInputField(), 'notExist');
29
+ utilities.verifyElementVisibilityState(highlightImagePage.allOrNothingCheckboxLabel(), 'notExist');
30
+ utilities.verifyElementVisibilityState(highlightImagePage.allOrNothingCheckbox(), 'notExist');
31
+ utilities.verifyElementVisibilityState(highlightImagePage.partialDifferentWeightsCheckboxLabel(), 'notExist');
32
+ utilities.verifyElementVisibilityState(highlightImagePage.partialDifferentWeightsCheckbox(), 'notExist');
33
+ utilities.verifyElementVisibilityState(highlightImagePage.partialEqualWeightsCheckboxLabel(), 'notExist');
34
+ utilities.verifyElementVisibilityState(highlightImagePage.partialEqualWeightsCheckbox(), 'notExist');
35
+ });
36
+ });
37
+
38
+ describe('Scoring section sub types contents', () => {
39
+ abortEarlySetup();
40
+ before(() => {
41
+ cy.log('Navigating to Highlight image question type');
42
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
43
+ cy.barsPreLoaderWait();
44
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
45
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
46
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
47
+ cy.log('Checking multiple selection checkbox to check scoring sub types')
48
+ highlightImagePage.steps.checkMultipleSelectionCheckbox();
49
+ });
50
+
51
+ highlightImagePage.tests.verifyAutoScoredScoringTypeSectionWithCSSAnda11y();
52
+
53
+ it('When user unchecks the \'Multiple selection\' checkbox then the scoring subtypes should not be displayed', () => {
54
+ highlightImagePage.steps.uncheckMultipleSelectionCheckbox();
55
+ utilities.verifyElementVisibilityState(highlightImagePage.allOrNothingCheckboxLabel(), 'notExist');
56
+ utilities.verifyElementVisibilityState(highlightImagePage.allOrNothingCheckbox(), 'notExist');
57
+ utilities.verifyElementVisibilityState(highlightImagePage.partialDifferentWeightsCheckboxLabel(), 'notExist');
58
+ utilities.verifyElementVisibilityState(highlightImagePage.partialDifferentWeightsCheckbox(), 'notExist');
59
+ utilities.verifyElementVisibilityState(highlightImagePage.partialEqualWeightsCheckboxLabel(), 'notExist');
60
+ utilities.verifyElementVisibilityState(highlightImagePage.partialEqualWeightsCheckbox(), 'notExist');
61
+ });
62
+ });
63
+
64
+ describe('Edit tab \'Set correct answer\' section (Correct answer tab) and \'Scoring\' section for Auto scored: All or nothing scoring type', () => {
65
+ abortEarlySetup();
66
+ before(() => {
67
+ cy.log('Navigating to Highlight image question type');
68
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
69
+ cy.barsPreLoaderWait();
70
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
71
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
72
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
73
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
74
+ highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
75
+ highlightImagePage.steps.checkMultipleSelectionCheckbox();
76
+ highlightImagePage.steps.highlightRegionInImage(flowerHighlightRegion);
77
+ highlightImagePage.steps.highlightRegionInImage(branchesHighlightRegion);
78
+ highlightImagePage.steps.highlightRegionInImage(leafHighlightRegion);
79
+ });
80
+
81
+ highlightImagePage.tests.verifyResponseContentsOfSetCorrectAnswerSection();
82
+
83
+ highlightImagePage.tests.verifyAutoScoredAllOrNothingPointsAndMinimumScoreAwardedLabelAndInputField();
84
+
85
+ highlightImagePage.tests.verifyPointsFieldErrorState(10);
86
+
87
+ highlightImagePage.tests.verifyMinimumScoreIfAttemptedFieldErrorState(10, 20, 10);
88
+ });
89
+
90
+ describe('Edit tab \'Set correct answer\' section (Correct answer tab) and \'Scoring\' section for Auto scored: Partial equal weights scoring type', () => {
91
+ abortEarlySetup();
92
+ before(() => {
93
+ cy.log('Navigating to Highlight image question type');
94
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
95
+ cy.barsPreLoaderWait();
96
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
97
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
98
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
99
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
100
+ highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
101
+ highlightImagePage.steps.checkMultipleSelectionCheckbox();
102
+ });
103
+
104
+ it('When Scoring type dropdown has Auto scored selected then user should be able to select \'Partial - equal weights\' scoring type', () => {
105
+ utilities.verifyInnerText(highlightImagePage.scoringTypeDropdown(), 'Auto scored')
106
+ highlightImagePage.steps.selectPartialEqualWeightsCheckbox();
107
+ });
108
+
109
+ it('When the user switches to \'Partial - equal weights\' then points input field should be displayed with \'Points per response:\' label and score, the score should be displayed as \'-\' when points field is empty', () => {
110
+ highlightImagePage.steps.verifyDefaultPointsLabelAndInputField();
111
+ utilities.verifyInnerText(highlightImagePage.pointsPerResponseLabel(), 'Points per response:');
112
+ utilities.verifyElementVisibilityState(highlightImagePage.pointsPerResponseLabel(), 'visible');
113
+ highlightImagePage.steps.verifyPartialEqualWeightsPointsPerResponseScore('-');
114
+ highlightImagePage.steps.verifyDefaultPenaltyPointsInputFieldAndLabel();
115
+ highlightImagePage.steps.verifyDefaultMinimumScoreIfAttemptedLabelAndPointsField()
116
+ highlightImagePage.steps.verifyDefaultRoundDownScoreCheckboxCheckedAndLabel();
117
+ });
118
+
119
+ //Failing due to - https://redmine.zeuslearning.com/issues/543228
120
+ it('When user allots points without highlighting any region points per response should be displayed as \'-\'', () => {
121
+ highlightImagePage.steps.allotPoints(20);
122
+ utilities.verifyElementVisibilityState(highlightImagePage.setCorrectAnswerSectionHighlight(), 'notExist');
123
+ highlightImagePage.steps.verifyPartialEqualWeightsPointsPerResponseScore('-');
124
+ });
125
+
126
+ it('When user highlights region on the image without selecting them then points per response should be displayed as \'-\'', () => {
127
+ highlightImagePage.steps.highlightRegionInImage(flowerHighlightRegion);
128
+ highlightImagePage.steps.highlightRegionInImage(branchesHighlightRegion);
129
+ highlightImagePage.steps.highlightRegionInImage(leafHighlightRegion);
130
+ highlightImagePage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(0);
131
+ highlightImagePage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(1);
132
+ highlightImagePage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(2);
133
+ highlightImagePage.steps.verifyPartialEqualWeightsPointsPerResponseScore('-');
134
+ });
135
+
136
+ highlightImagePage.tests.verifyResponseContentsOfSetCorrectAnswerSection();
137
+
138
+ it('When user selects a highlight region the points should be equally divided among the selected responses', () => {
139
+ highlightImagePage.steps.highlightARegionInSetCorrectAnswerSection(0);
140
+ highlightImagePage.steps.highlightARegionInSetCorrectAnswerSection(1);
141
+ highlightImagePage.steps.highlightARegionInSetCorrectAnswerSection(2);
142
+ highlightImagePage.steps.verifyPartialEqualWeightsPointsPerResponseScore(6.67);
143
+ });
144
+
145
+ it('When user de-selects a region then the points should be divided only among the selected highlight regions', () => {
146
+ highlightImagePage.steps.removeHighlightOfARegionInSetCorrectAnswerSection(0);
147
+ highlightImagePage.steps.verifyPartialEqualWeightsPointsPerResponseScore(10);
148
+ });
149
+
150
+ it('User should be able to enter points in \'Penalty Points\' and \'Minimum score awarded (if attempted)\' input fields', () => {
151
+ highlightImagePage.steps.allotPenaltyPoints(2);
152
+ highlightImagePage.steps.allotMinimumScoreAwardedIfAttempted(1);
153
+ });
154
+
155
+ it('CSS of Partial equal weights points section', { tags: 'css' }, () => {
156
+ utilities.verifyCSS(highlightImagePage.pointsLabel(), {
157
+ 'color': css.color.labels,
158
+ 'font-size': css.fontSize.normal,
159
+ 'font-weight': css.fontWeight.semibold
160
+ });
161
+ utilities.verifyCSS(highlightImagePage.pointsInputField(), {
162
+ 'color': css.color.text,
163
+ 'font-size': css.fontSize.default,
164
+ 'font-weight': css.fontWeight.regular
165
+ });
166
+ utilities.verifyCSS(highlightImagePage.pointsPerResponseLabel(), {
167
+ 'color': css.color.labels,
168
+ 'font-size': css.fontSize.normal,
169
+ 'font-weight': css.fontWeight.regular
170
+ });
171
+ utilities.verifyCSS(highlightImagePage.partialEqualWeightsPointsPerResponseScore(), {
172
+ 'color': css.color.labels,
173
+ 'font-size': css.fontSize.normal,
174
+ 'font-weight': css.fontWeight.bold
175
+ });
176
+ utilities.verifyCSS(highlightImagePage.penaltyPointsLabel(), {
177
+ 'color': css.color.labels,
178
+ 'font-size': css.fontSize.normal,
179
+ 'font-weight': css.fontWeight.semibold
180
+ });
181
+ utilities.verifyCSS(highlightImagePage.minimumScoreIfAttemptedLabel(), {
182
+ 'color': css.color.labels,
183
+ 'font-size': css.fontSize.normal,
184
+ 'font-weight': css.fontWeight.semibold
185
+ });
186
+ utilities.verifyCSS(highlightImagePage.rounddownScoreCheckboxLabel(), {
187
+ 'color': css.color.labelText,
188
+ 'font-size': css.fontSize.normal,
189
+ 'font-weight': css.fontWeight.regular
190
+ });
191
+ });
192
+
193
+ it('Accessibility of Partial equal weights points section', { tags: 'a11y' }, () => {
194
+ cy.checkAccessibility(highlightImagePage.pointsPerResponseLabel().parents('.set-correct-answer-points-wrapper'));
195
+ });
196
+
197
+ 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', () => {
198
+ highlightImagePage.steps.selectAllOrNothingCheckbox()
199
+ utilities.verifyElementVisibilityState(highlightImagePage.pointsPerResponseLabel(), 'notExist');
200
+ utilities.verifyElementVisibilityState(highlightImagePage.partialEqualWeightsPointsPerResponseScore(), 'notExist');
201
+ highlightImagePage.steps.verifyPointsFieldValue(20);
202
+ });
203
+
204
+ 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', () => {
205
+ highlightImagePage.steps.allotPoints(10);
206
+ highlightImagePage.steps.selectPartialEqualWeightsCheckbox();
207
+ highlightImagePage.steps.verifyPartialEqualWeightsPointsPerResponseScore(5);
208
+ });
209
+ });
210
+
211
+ describe('Edit tab \'Set correct answer\' section (Correct answer tab) and \'Scoring\' section for Auto scored: Partial different weights scoring type', () => {
212
+ abortEarlySetup();
213
+ before(() => {
214
+ cy.log('Navigating to Highlight image question type');
215
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
216
+ cy.barsPreLoaderWait();
217
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
218
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
219
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
220
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
221
+ highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
222
+ highlightImagePage.steps.checkMultipleSelectionCheckbox();
223
+ });
224
+
225
+ it('When scoring type dropdown has Auto scored selected then user should be able to select \'Partial - different weights\' scoring', () => {
226
+ utilities.verifyInnerText(highlightImagePage.scoringTypeDropdown(), 'Auto scored');
227
+ highlightImagePage.steps.selectPartialDifferentWeightsCheckbox();
228
+ });
229
+
230
+ it('When user switches to \'Partial different weights\' then \'Points\' label should be displayed and no input fields should be displayed when no region is highlighted', () => {
231
+ utilities.verifyInnerText(highlightImagePage.pointsLabel(), 'Points');
232
+ utilities.verifyElementVisibilityState(highlightImagePage.pointsLabel(), 'visible');
233
+ utilities.verifyElementVisibilityState(highlightImagePage.pointsInputField(), 'notExist');
234
+ utilities.verifyElementVisibilityState(highlightImagePage.partialDifferentWeightsPointsOptionsLabel(), 'notExist');
235
+ });
236
+
237
+ it('When user highlights a region then empty points input field should be displayed with label \'Option #\' and they should be in disabled state', () => {
238
+ highlightImagePage.steps.highlightRegionInImage(flowerHighlightRegion);
239
+ highlightImagePage.steps.highlightRegionInImage(branchesHighlightRegion);
240
+ highlightImagePage.steps.highlightRegionInImage(leafHighlightRegion);
241
+ highlightImagePage.steps.verifyPartialDifferentWeightsOptionLabelAndPoints(0, '');
242
+ highlightImagePage.steps.verifyPartialDifferentWeightsOptionLabelAndPoints(1, '');
243
+ highlightImagePage.steps.verifyPartialDifferentWeightsOptionLabelAndPoints(2, '');
244
+ highlightImagePage.steps.verifyPartialDifferentWeightsPointsInputFieldDisabled(0);
245
+ highlightImagePage.steps.verifyPartialDifferentWeightsPointsInputFieldDisabled(1);
246
+ highlightImagePage.steps.verifyPartialDifferentWeightsPointsInputFieldDisabled(2);
247
+ });
248
+
249
+ highlightImagePage.tests.verifyResponseContentsOfSetCorrectAnswerSection();
250
+
251
+ it('When user highlights a region then the points field of that highlight region should be displayed in enabled state', () => {
252
+ highlightImagePage.steps.highlightARegionInSetCorrectAnswerSection(0);
253
+ highlightImagePage.steps.verifyPartialDifferentWeightsPointsInputFieldEnabled(0);
254
+ highlightImagePage.steps.verifyPartialDifferentWeightsPointsInputFieldDisabled(1);
255
+ highlightImagePage.steps.verifyPartialDifferentWeightsPointsInputFieldDisabled(2);
256
+ });
257
+
258
+ it('When the user focuses in and out of the enabled empty points input field, \'Please enter points.\' validation text should be displayed below the Points input field with a error icon on the correct tab', () => {
259
+ highlightImagePage.steps.focusInAndFocusOutOfPointsInputField(0)
260
+ utilities.verifyInnerText(highlightImagePage.errorMessage(), 'Error: Please enter points.');
261
+ highlightImagePage.steps.verifySetCorrectAnswerErrorIconIsDisplayed();
262
+ });
263
+
264
+ it('When user enters points the error message and error icon should disappear', () => {
265
+ highlightImagePage.steps.addPartialDifferentWeightsPoints([20]);
266
+ utilities.verifyElementVisibilityState(highlightImagePage.errorMessage(), 'notExist');
267
+ highlightImagePage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
268
+ });
269
+
270
+ it('User should be able to enter points in \'Penalty Points\' and \'Minimum score awarded (if attempted)\' input fields', () => {
271
+ highlightImagePage.steps.allotPenaltyPoints(2);
272
+ highlightImagePage.steps.allotMinimumScoreAwardedIfAttempted(1);
273
+ });
274
+
275
+ it('CSS of Partial different weights points section', { tags: 'css' }, () => {
276
+ utilities.verifyCSS(highlightImagePage.pointsInputField().eq(0), {
277
+ 'color': css.color.text,
278
+ 'font-size': css.fontSize.default,
279
+ 'font-weight': css.fontWeight.regular
280
+ });
281
+ cy.log('Disabled points input field')
282
+ utilities.verifyCSS(highlightImagePage.pointsInputField().eq(1), {
283
+ 'opacity': '1'
284
+ });
285
+ utilities.verifyCSS(highlightImagePage.partialDifferentWeightsPointsOptionsLabel().eq(0), {
286
+ 'color': css.color.labels,
287
+ 'font-size': css.fontSize.default,
288
+ 'font-weight': css.fontWeight.regular
289
+ });
290
+ utilities.verifyCSS(highlightImagePage.penaltyPointsLabel(), {
291
+ 'color': css.color.labels,
292
+ 'font-size': css.fontSize.normal,
293
+ 'font-weight': css.fontWeight.semibold
294
+ });
295
+ utilities.verifyCSS(highlightImagePage.minimumScoreIfAttemptedLabel(), {
296
+ 'color': css.color.labels,
297
+ 'font-size': css.fontSize.normal,
298
+ 'font-weight': css.fontWeight.semibold
299
+ });
300
+ utilities.verifyCSS(highlightImagePage.rounddownScoreCheckboxLabel(), {
301
+ 'color': css.color.labelText,
302
+ 'font-size': css.fontSize.normal,
303
+ 'font-weight': css.fontWeight.regular
304
+ });
305
+ });
306
+
307
+ it('Accessibility of partial different weights scoring section', { tags: 'a11y' }, () => {
308
+ cy.checkAccessibility(highlightImagePage.pointsLabel().parents('.highlight-image-partial-points-form-control-wrapper'));
309
+ });
310
+
311
+ it('When user de-selects a selected highlight region the points field should change to disabled state', () => {
312
+ highlightImagePage.steps.removeHighlightOfARegionInSetCorrectAnswerSection(0);
313
+ highlightImagePage.steps.verifyPartialDifferentWeightsPointsInputFieldDisabled(0);
314
+ utilities.verifyInnerText(highlightImagePage.pointsInputField(), '');
315
+ highlightImagePage.steps.verifyPartialDifferentWeightsPointsInputFieldDisabled(1);
316
+ highlightImagePage.steps.verifyPartialDifferentWeightsPointsInputFieldDisabled(2);
317
+ });
318
+
319
+ 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', () => {
320
+ cy.log('Pre step: Selecting highlight regions and allotting points')
321
+ highlightImagePage.steps.highlightARegionInSetCorrectAnswerSection(0);
322
+ highlightImagePage.steps.highlightARegionInSetCorrectAnswerSection(1);
323
+ highlightImagePage.steps.addPartialDifferentWeightsPoints([12, 8]);
324
+ highlightImagePage.steps.selectAllOrNothingCheckbox();
325
+ utilities.verifyElementCount(highlightImagePage.pointsInputField(), 1);
326
+ highlightImagePage.steps.verifyPointsFieldValue(20);
327
+ });
328
+
329
+ //Failing due to https://redmine.zeuslearning.com/issues/541788
330
+ 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', () => {
331
+ highlightImagePage.steps.clearPointsField();
332
+ highlightImagePage.steps.allotPoints(9);
333
+ highlightImagePage.steps.selectPartialDifferentWeightsCheckbox();
334
+ highlightImagePage.steps.verifyPartialDifferentWeightsOptionLabelAndPoints(0, 3);
335
+ highlightImagePage.steps.verifyPartialDifferentWeightsOptionLabelAndPoints(1, 3);
336
+ highlightImagePage.steps.verifyPartialDifferentWeightsOptionLabelAndPoints(2, 3);
337
+ });
338
+ });
339
+
340
+ describe('Edit tab \'Set correct answer\' section (Correct answer tab) and \'Scoring\' section for Manually Scored scoring type', () => {
341
+ abortEarlySetup();
342
+ before(() => {
343
+ cy.log('Navigating to Highlight image question type');
344
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
345
+ cy.barsPreLoaderWait();
346
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
347
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
348
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
349
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
350
+ highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
351
+ highlightImagePage.steps.checkMultipleSelectionCheckbox();
352
+ });
353
+
354
+ it('User should be able to select \'Manually scored\' scoring type from scoring type dropdown', () => {
355
+ highlightImagePage.steps.selectAScoringTypeFromScoringTypeDropdown('Manually scored');
356
+ });
357
+
358
+ it('When the user has selected \'Manually Scored\' option from the Scoring Type dropdown then the \'Set Correct Answer\' section should not be displayed, \'All or Nothing\', \'Partial - equal weights\' and \'Partial - different weights\' radio buttons should not be displayed, \'Points\' and \'Minimum score awarded (if attempted)\' labels and input fields should be displayed, round down score label and checkbox should not be displayed and inside Additional Settings accordion Check Answer section i.e. \'Allow students to check answer\' checkbox should not be displayed', () => {
359
+ utilities.verifyElementVisibilityState(highlightImagePage.setCorrectAnswerLabel(), 'notExist');
360
+ utilities.verifyElementVisibilityState(highlightImagePage.setCorrectAnswerHelpText(), 'notExist');
361
+ utilities.verifyElementVisibilityState(highlightImagePage.correctTab(), 'notExist');
362
+ utilities.verifyElementVisibilityState(highlightImagePage.alternateAnswerButton(), 'notExist');
363
+ utilities.verifyElementVisibilityState(highlightImagePage.allOrNothingCheckbox(), 'notExist');
364
+ utilities.verifyElementVisibilityState(highlightImagePage.partialEqualWeightsCheckbox(), 'notExist');
365
+ utilities.verifyElementVisibilityState(highlightImagePage.partialDifferentWeightsCheckbox(), 'notExist');
366
+ utilities.verifyElementVisibilityState(highlightImagePage.penaltyPointsInputField(), 'notExist');
367
+ utilities.verifyElementVisibilityState(highlightImagePage.penaltyPointsLabel(), 'notExist');
368
+ utilities.verifyElementVisibilityState(highlightImagePage.rounddownScoreCheckbox(), 'notExist');
369
+ utilities.verifyElementVisibilityState(highlightImagePage.rounddownScoreCheckboxLabel(), 'notExist');
370
+ highlightImagePage.steps.verifyDefaultMinimumScoreIfAttemptedLabelAndPointsField();
371
+ highlightImagePage.steps.expandAdditonalSettings();
372
+ utilities.verifyElementVisibilityState(highlightImagePage.checkAnswerLabel(), 'notExist');
373
+ utilities.verifyElementVisibilityState(highlightImagePage.allowStudentsToCheckAnswerLabel(), 'notExist');
374
+ utilities.verifyElementVisibilityState(highlightImagePage.setCorrectAnswerSectionImage(), 'notExist');
375
+ });
376
+
377
+ highlightImagePage.tests.verifyPointsFieldErrorState(10);
378
+
379
+ highlightImagePage.tests.verifyMinimumScoreIfAttemptedFieldErrorState(10, 20, 10);
380
+ });
381
+
382
+ describe('Edit tab \'Set correct answer\' section (Correct answer tab) and \'Scoring\' section for Non Scored scoring type', () => {
383
+ abortEarlySetup();
384
+ before(() => {
385
+ cy.log('Navigating to Highlight image question type');
386
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
387
+ cy.barsPreLoaderWait();
388
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
389
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
390
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
391
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
392
+ highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
393
+ highlightImagePage.steps.checkMultipleSelectionCheckbox();
394
+ highlightImagePage.steps.highlightRegionInImage(flowerHighlightRegion);
395
+ highlightImagePage.steps.highlightRegionInImage(branchesHighlightRegion);
396
+ highlightImagePage.steps.highlightRegionInImage(leafHighlightRegion);
397
+ });
398
+
399
+ highlightImagePage.tests.verifyResponseContentsOfSetCorrectAnswerSection();
400
+
401
+ highlightImagePage.tests.verifyEditTabNonScoredScoringSectionContents();
402
+ });
403
+ });
@@ -0,0 +1,86 @@
1
+ import constants from "../../../fixtures/constants";
2
+ import { dialogBoxBase, highlightImagePage } from "../../../pages";
3
+ import { uploadImageSectionComponent } from "../../../pages/components/uploadImageSectionComponent";
4
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
5
+
6
+ const flowerHighlightRegion = [[24, 6], [24, 24], [56, 24], [56, 6]];
7
+ const branchesHighlightRegion = [[36, 36], [36, 46], [58, 46], [58, 36]];
8
+
9
+ describe('Create question page - Highlight image: Header section and Saving question', () => {
10
+ before(() => {
11
+ cy.loginAs('admin');
12
+ });
13
+
14
+ describe('Header section contents', () => {
15
+ abortEarlySetup();
16
+ before(() => {
17
+ cy.log('Navigating to highlight image question type');
18
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
19
+ });
20
+
21
+ highlightImagePage.tests.verifyCreateQuestionPageQuestionTypeHeader('Highlight image');
22
+ });
23
+
24
+ describe('Tabs section', () => {
25
+ abortEarlySetup();
26
+ before(() => {
27
+ cy.log('Navigating to highlight image question type');
28
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
29
+ });
30
+
31
+ highlightImagePage.tests.verifyTabsSection();
32
+ });
33
+
34
+ describe('Cancel button', () => {
35
+ abortEarlySetup();
36
+ before(() => {
37
+ cy.log('Navigating to highlight image question type');
38
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
39
+ });
40
+
41
+ highlightImagePage.tests.verifyCancelButton('highlight image');
42
+ });
43
+
44
+ describe('Save Question button', () => {
45
+ abortEarlySetup();
46
+ before(() => {
47
+ cy.log('Navigating to highlight image question type');
48
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
49
+ cy.barsPreLoaderWait();
50
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
51
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
52
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
53
+ highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
54
+ });
55
+
56
+ describe('Validation error messages', () => {
57
+ dialogBoxBase.tests.verifyRequiredFieldsWarningPopupOnClickingSaveButton();
58
+
59
+ it('Validation error messages should be displayed below required input fields', () => {
60
+ highlightImagePage.steps.verifyQuestionInstructionsErrorMessage();
61
+ highlightImagePage.steps.verifyPointsFieldErrorMessage();
62
+ highlightImagePage.steps.verifySetCorrectAnswerSectionErrorMessage();
63
+ highlightImagePage.steps.verifySetCorrectAnswerErrorIconIsDisplayed();
64
+ });
65
+
66
+ it('Validation error messages should disappear when required input fields are filled', () => {
67
+ highlightImagePage.steps.addQuestionInstructions();
68
+ highlightImagePage.steps.highlightRegionInImage(flowerHighlightRegion);
69
+ highlightImagePage.steps.highlightRegionInImage(branchesHighlightRegion);
70
+ highlightImagePage.steps.highlightARegionInSetCorrectAnswerSection(0);
71
+ highlightImagePage.steps.allotPoints(10);
72
+ highlightImagePage.steps.verifyErrorMessageIsNotDisplayed();
73
+ highlightImagePage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
74
+ });
75
+
76
+ highlightImagePage.tests.verifya11yOfCreateItemWrapperContents();
77
+ });
78
+
79
+ describe('Saving a question', () => {
80
+ 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', () => {
81
+ highlightImagePage.steps.saveAQuestionAndVerifySnackbar();
82
+ });
83
+ highlightImagePage.tests.verifySavedSuccessfullySnackbarCSSanda11y();
84
+ });
85
+ });
86
+ });