itemengine-cypress-automation 1.0.581-IEI-7178-328dd33.0 → 1.0.581-IEI-7046-ec54625.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/allOrNothingAlternativePointsGreaterThanCorrectPoints.js +123 -8
  2. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/allOrNothingCorrectPointsEqualToAlternativePoints.js +123 -8
  3. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +131 -14
  4. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perCorrectOptionAlternativePointsGreaterThanCorrectPoints.js +138 -9
  5. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perCorrectOptionCorrectPointsEqualToAlternativePoints.js +138 -9
  6. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perCorrectOptionCorrectPointsGreaterThanAlternativePoints.js +153 -10
  7. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perDropzoneAlternativePointsGreaterThanCorrectPoints.js +138 -9
  8. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perDropzoneCorrectPointsEqualToAlternativePoints.js +108 -7
  9. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perDropzoneCorrectPointsGreaterThanAlternativePoints.js +138 -9
  10. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/allOrNothingBasicForAllViews.smoke.js +272 -1
  11. package/cypress/e2e/ILC/ShortTextResponseNew/Scoring/allOrNothingAlternativePointsGreaterThanCorrectPoints.js +2 -30
  12. package/cypress/e2e/ILC/ShortTextResponseNew/Scoring/allOrNothingCorrectPointsEqualToAlternativePoints.js +2 -30
  13. package/cypress/e2e/ILC/ShortTextResponseNew/Scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +2 -30
  14. package/cypress/e2e/ILC/ShortTextResponseNew/Scoring/allOrNothingWeightsBasic.js +7 -7
  15. package/cypress/e2e/ILC/ShortTextResponseNew/allOrNothingBasicForAllViews.smoke.js +3 -130
  16. package/cypress/e2e/ILC/dataApi/fetchQuestion.js +39 -0
  17. package/cypress/e2e/ILC/dataApi/saveQuestions.js +53 -0
  18. package/cypress/pages/dragAndDropIntoCategoriesPage.js +38 -0
  19. package/cypress/pages/shortTextResponsePage.js +6 -20
  20. package/package.json +1 -1
@@ -1,5 +1,8 @@
1
1
  import { dragAndDropIntoCategoriesPage } from "../../../../pages";
2
2
  import abortEarlySetup from "../../../../support/helpers/abortEarly";
3
+ import { showAlternativeAnswersComponent } from "../../../../pages/components";
4
+
5
+ const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT') === 'true';
3
6
 
4
7
  describe('Create item page - Drag and drop into categories: Per correct option with alternative answers', () => {
5
8
  before(() => {
@@ -31,7 +34,21 @@ describe('Create item page - Drag and drop into categories: Per correct option w
31
34
  dragAndDropIntoCategoriesPage.steps.switchToGradingView();
32
35
  dragAndDropIntoCategoriesPage.steps.verifyDropzoneCellNumeration(['1', '2', '3', '4', '5', '6']);
33
36
  dragAndDropIntoCategoriesPage.steps.verifyPreviewScore(0, 30);
34
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
37
+ if (alternativeAnswerCheck) {
38
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
39
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
40
+ {
41
+ correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
42
+ pointsText: '(Points per correct option - 5 points)',
43
+ },
44
+ {
45
+ correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
46
+ pointsText: '(Points per correct option - 5 points)',
47
+ }
48
+ ]);
49
+ } else {
50
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
51
+ }
35
52
  });
36
53
 
37
54
  it('When the user attempts the question with responses from the correct accordion, then the user should be awarded full points and on switching to \'Grading\' view, correct icons should be displayed beside all the correct responses and proper icon should display beside empty container, correct/incorrect answer status message should not be displayed and correct answer section should not be displayed', () => {
@@ -122,7 +139,21 @@ describe('Create item page - Drag and drop into categories: Per correct option w
122
139
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(4);
123
140
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(5);
124
141
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
125
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
142
+ if (alternativeAnswerCheck) {
143
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
144
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
145
+ {
146
+ correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
147
+ pointsText: '(Points per correct option - 5 points)',
148
+ },
149
+ {
150
+ correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
151
+ pointsText: '(Points per correct option - 5 points)',
152
+ }
153
+ ]);
154
+ } else {
155
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
156
+ }
126
157
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
127
158
  /*cy.log('When the user has attempted the question with partially correct options exclusively from the alternative accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, correct/incorrect answer status message and correct answer section should not be displayed')
128
159
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -144,7 +175,21 @@ describe('Create item page - Drag and drop into categories: Per correct option w
144
175
  dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(4);
145
176
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(4);
146
177
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
147
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
178
+ if (alternativeAnswerCheck) {
179
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
180
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
181
+ {
182
+ correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
183
+ pointsText: '(Points per correct option - 5 points)',
184
+ },
185
+ {
186
+ correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
187
+ pointsText: '(Points per correct option - 5 points)',
188
+ }
189
+ ]);
190
+ } else {
191
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
192
+ }
148
193
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
149
194
  /*cy.log('When the user has attempted the question with partially correct with all the dropzones correct as per the alternative accordion but one dropzone incomplete and clicks on \'Check answer\' button, correct icon should be displayed besides the correct answer responses, correct/incorrect answer status message should not be displayed and and correct answer section should not be displayed')
150
195
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -169,7 +214,21 @@ describe('Create item page - Drag and drop into categories: Per correct option w
169
214
  dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(2);
170
215
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(5);
171
216
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
172
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
217
+ if (alternativeAnswerCheck) {
218
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
219
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
220
+ {
221
+ correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
222
+ pointsText: '(Points per correct option - 5 points)',
223
+ },
224
+ {
225
+ correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
226
+ pointsText: '(Points per correct option - 5 points)',
227
+ }
228
+ ]);
229
+ } else {
230
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
231
+ }
173
232
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
174
233
  /*cy.log('When the user has attempted the question with partially correct with more number of options exclusively from the alternative accordion but with one option common across both accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, correct/incorrect answer status message and correct answer section should not be displayed')
175
234
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -193,7 +252,21 @@ describe('Create item page - Drag and drop into categories: Per correct option w
193
252
  dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(4);
194
253
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectOptionIcon(6);
195
254
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
196
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
255
+ if (alternativeAnswerCheck) {
256
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
257
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
258
+ {
259
+ correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
260
+ pointsText: '(Points per correct option - 5 points)',
261
+ },
262
+ {
263
+ correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
264
+ pointsText: '(Points per correct option - 5 points)',
265
+ }
266
+ ]);
267
+ } else {
268
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
269
+ }
197
270
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
198
271
  /*cy.log('When the user has attempted the question with partially correct with all the cells correctly attempted as per the alternative accordion but with an extra incorrect option and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, incorrect icon should be displayed besides the incorrect answer responses, correct/incorrect answer status message and correct answer section should not be displayed')
199
272
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -220,7 +293,21 @@ describe('Create item page - Drag and drop into categories: Per correct option w
220
293
  dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(3);
221
294
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(5);
222
295
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
223
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
296
+ if (alternativeAnswerCheck) {
297
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
298
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
299
+ {
300
+ correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
301
+ pointsText: '(Points per correct option - 5 points)',
302
+ },
303
+ {
304
+ correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
305
+ pointsText: '(Points per correct option - 5 points)',
306
+ }
307
+ ]);
308
+ } else {
309
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
310
+ }
224
311
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
225
312
  /*cy.log('When the user has attempted the question with partially correct such that more number of correct options are exclusively from the alternative accordion but with one option exclusively from the correct accordion in the same cell and clicks on \'Check answer\' button, correct icon should be displayed besides the alternative accordion response, incorrect icon should be displayed besides the correct accordion response, correct/incorrect answer status message and correct answer section should not be displayed')
226
313
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -244,7 +331,21 @@ describe('Create item page - Drag and drop into categories: Per correct option w
244
331
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(4);
245
332
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIconForEmptyContainer(5);
246
333
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
247
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
334
+ if (alternativeAnswerCheck) {
335
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
336
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
337
+ {
338
+ correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
339
+ pointsText: '(Points per correct option - 5 points)',
340
+ },
341
+ {
342
+ correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
343
+ pointsText: '(Points per correct option - 5 points)',
344
+ }
345
+ ]);
346
+ } else {
347
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
348
+ }
248
349
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
249
350
  /*cy.log('When the user has attempted the question incorrectly and clicks on \'Check answer\' button, then incorrect icons should be displayed besides all incorrect responses, correct/incorrect answer status message and correct answer section should not be displayed')
250
351
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -265,7 +366,21 @@ describe('Create item page - Drag and drop into categories: Per correct option w
265
366
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(3);
266
367
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(4);
267
368
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
268
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
369
+ if (alternativeAnswerCheck) {
370
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
371
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
372
+ {
373
+ correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
374
+ pointsText: '(Points per correct option - 5 points)',
375
+ },
376
+ {
377
+ correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
378
+ pointsText: '(Points per correct option - 5 points)',
379
+ }
380
+ ]);
381
+ } else {
382
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
383
+ }
269
384
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
270
385
  /*cy.log('When the user has attempted the question partially correct with equal number of correct options exclusively from the alternative accordion and correct accordion in the different cell and clicks on \'Check answer\' button, then the correct icon should be displayed besides the correct accordion responses, incorrect icon should be displayed besides alternative accordion responses, correct/incorrect answer status message and correct answer section should not be displayed')
271
386
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -288,7 +403,21 @@ describe('Create item page - Drag and drop into categories: Per correct option w
288
403
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(4);
289
404
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIconForEmptyContainer(5);
290
405
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
291
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
406
+ if (alternativeAnswerCheck) {
407
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
408
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
409
+ {
410
+ correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
411
+ pointsText: '(Points per correct option - 5 points)',
412
+ },
413
+ {
414
+ correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
415
+ pointsText: '(Points per correct option - 5 points)',
416
+ }
417
+ ]);
418
+ } else {
419
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
420
+ }
292
421
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
293
422
  /*cy.log('When the user has attempted the question partially correct with equal number of correct options exclusively from the alternative accordion and correct accordion in the same cell and clicks on \'Check answer\' button, then correct icon should be displayed besides correct accordion responses, incorrect icon should be displayed besides alternative accordion responses, correct/incorrect answer status message and correct answer section should not be displayed')
294
423
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -1,5 +1,8 @@
1
1
  import { dragAndDropIntoCategoriesPage } from "../../../../pages";
2
2
  import abortEarlySetup from "../../../../support/helpers/abortEarly";
3
+ import { showAlternativeAnswersComponent } from "../../../../pages/components";
4
+
5
+ const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT') === 'true';
3
6
 
4
7
  describe('Create item page - Drag and drop into categories: Per correct option with alternative answers', () => {
5
8
  before(() => {
@@ -31,7 +34,21 @@ describe('Create item page - Drag and drop into categories: Per correct option w
31
34
  dragAndDropIntoCategoriesPage.steps.switchToGradingView();
32
35
  dragAndDropIntoCategoriesPage.steps.verifyDropzoneCellNumeration(['1', '2', '3', '4', '5', '6']);
33
36
  dragAndDropIntoCategoriesPage.steps.verifyPreviewScore(0, 30);
34
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
37
+ if (alternativeAnswerCheck) {
38
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
39
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
40
+ {
41
+ correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
42
+ pointsText: '(Points per correct option - 5 points)',
43
+ },
44
+ {
45
+ correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
46
+ pointsText: '(Points per correct option - 3 points)',
47
+ }
48
+ ]);
49
+ } else {
50
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
51
+ }
35
52
  });
36
53
 
37
54
  it('When the user attempts the question with responses from the correct accordion, then the user should be awarded full points and on switching to \'Grading\' view, correct icons should be displayed beside all the correct responses and proper icon should display beside empty container, correct/incorrect answer status message should not be displayed and correct answer section should not be displayed', () => {
@@ -99,7 +116,21 @@ describe('Create item page - Drag and drop into categories: Per correct option w
99
116
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(3);
100
117
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(4);
101
118
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIconForEmptyContainer(5);
102
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
119
+ if (alternativeAnswerCheck) {
120
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
121
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
122
+ {
123
+ correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
124
+ pointsText: '(Points per correct option - 5 points)',
125
+ },
126
+ {
127
+ correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
128
+ pointsText: '(Points per correct option - 3 points)',
129
+ }
130
+ ]);
131
+ } else {
132
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
133
+ }
103
134
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
104
135
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
105
136
  /*cy.log('When the user has attempted the question with partially correct options exclusively from the correct accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, correct/incorrect answer status message and correct answer section should not be displayed')
@@ -122,7 +153,21 @@ describe('Create item page - Drag and drop into categories: Per correct option w
122
153
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(4);
123
154
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(5);
124
155
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
125
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
156
+ if (alternativeAnswerCheck) {
157
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
158
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
159
+ {
160
+ correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
161
+ pointsText: '(Points per correct option - 5 points)',
162
+ },
163
+ {
164
+ correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
165
+ pointsText: '(Points per correct option - 3 points)',
166
+ }
167
+ ]);
168
+ } else {
169
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
170
+ }
126
171
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
127
172
  /*cy.log('When the user has attempted the question with partially correct options exclusively from the alternative accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, correct/incorrect answer status message and correct answer section should not be displayed')
128
173
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -144,7 +189,21 @@ describe('Create item page - Drag and drop into categories: Per correct option w
144
189
  dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(4);
145
190
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(4);
146
191
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
147
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
192
+ if (alternativeAnswerCheck) {
193
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
194
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
195
+ {
196
+ correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
197
+ pointsText: '(Points per correct option - 5 points)',
198
+ },
199
+ {
200
+ correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
201
+ pointsText: '(Points per correct option - 3 points)',
202
+ }
203
+ ]);
204
+ } else {
205
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
206
+ }
148
207
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
149
208
  /*cy.log('When the user has attempted the question with partially correct with all the dropzones correct as per the alternative accordion but one dropzone incomplete and clicks on \'Check answer\' button, correct icon should be displayed besides the correct answer responses, correct/incorrect answer status message should not be displayed and and correct answer section should not be displayed')
150
209
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -169,7 +228,21 @@ describe('Create item page - Drag and drop into categories: Per correct option w
169
228
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIconForEmptyContainer(2);
170
229
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(5);
171
230
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
172
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
231
+ if (alternativeAnswerCheck) {
232
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
233
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
234
+ {
235
+ correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
236
+ pointsText: '(Points per correct option - 5 points)',
237
+ },
238
+ {
239
+ correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
240
+ pointsText: '(Points per correct option - 3 points)',
241
+ }
242
+ ]);
243
+ } else {
244
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
245
+ }
173
246
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
174
247
  /*cy.log('When the user has attempted the question with partially correct with more number of options exclusively from the alternative accordion but with one option common across both accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, correct/incorrect answer status message and correct answer section should not be displayed')
175
248
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -194,7 +267,21 @@ describe('Create item page - Drag and drop into categories: Per correct option w
194
267
  dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(5);
195
268
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectOptionIcon(6);
196
269
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
197
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
270
+ if (alternativeAnswerCheck) {
271
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
272
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
273
+ {
274
+ correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
275
+ pointsText: '(Points per correct option - 5 points)',
276
+ },
277
+ {
278
+ correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
279
+ pointsText: '(Points per correct option - 3 points)',
280
+ }
281
+ ]);
282
+ } else {
283
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
284
+ }
198
285
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
199
286
  /*cy.log('When the user has attempted the question with partially correct with all the cells correctly attempted as per the alternative accordion but with an extra incorrect option and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, incorrect icon should be displayed besides the incorrect answer responses, correct/incorrect answer status message and correct answer section should not be displayed')
200
287
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -222,7 +309,21 @@ describe('Create item page - Drag and drop into categories: Per correct option w
222
309
  dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(3);
223
310
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(5);
224
311
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
225
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
312
+ if (alternativeAnswerCheck) {
313
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
314
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
315
+ {
316
+ correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
317
+ pointsText: '(Points per correct option - 5 points)',
318
+ },
319
+ {
320
+ correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
321
+ pointsText: '(Points per correct option - 3 points)',
322
+ }
323
+ ]);
324
+ } else {
325
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
326
+ }
226
327
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
227
328
  /*cy.log('When the user has attempted the question with partially correct such that more number of correct options are exclusively from the alternative accordion but with one option exclusively from the correct accordion in the same dropzone and clicks on \'Check answer\' button, correct icon should be displayed besides the alternative accordion response, incorrect icon should be displayed besides the correct accordion response, correct/incorrect answer status message and correct answer section should not be displayed')
228
329
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -246,7 +347,21 @@ describe('Create item page - Drag and drop into categories: Per correct option w
246
347
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(4);
247
348
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIconForEmptyContainer(5);
248
349
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
249
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
350
+ if (alternativeAnswerCheck) {
351
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
352
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
353
+ {
354
+ correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
355
+ pointsText: '(Points per correct option - 5 points)',
356
+ },
357
+ {
358
+ correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
359
+ pointsText: '(Points per correct option - 3 points)',
360
+ }
361
+ ]);
362
+ } else {
363
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
364
+ }
250
365
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
251
366
  /*cy.log('When the user has attempted the question incorrectly and clicks on \'Check answer\' button, then incorrect icons should be displayed besides all incorrect responses, correct/incorrect answer status message and correct answer section should not be displayed')
252
367
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -273,7 +388,21 @@ describe('Create item page - Drag and drop into categories: Per correct option w
273
388
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(2);
274
389
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIconForEmptyContainer(5);
275
390
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
276
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
391
+ if (alternativeAnswerCheck) {
392
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
393
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
394
+ {
395
+ correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
396
+ pointsText: '(Points per correct option - 5 points)',
397
+ },
398
+ {
399
+ correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
400
+ pointsText: '(Points per correct option - 3 points)',
401
+ }
402
+ ]);
403
+ } else {
404
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
405
+ }
277
406
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
278
407
  /*cy.log('When the user has attempted the question partially correct such that more number of options are exclusively from the alternative accordion but with one option common across both the accordions and clicks on \'Check answer\' button, then the correct icon should be displayed besides the common correct answer responses, incorrect icon should be displayed besides alternative accordion responses, correct/incorrect answer status message and correct answer section should not be displayed')
279
408
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -297,7 +426,21 @@ describe('Create item page - Drag and drop into categories: Per correct option w
297
426
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(3);
298
427
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIconForEmptyContainer(5);
299
428
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
300
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
429
+ if (alternativeAnswerCheck) {
430
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
431
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
432
+ {
433
+ correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
434
+ pointsText: '(Points per correct option - 5 points)',
435
+ },
436
+ {
437
+ correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
438
+ pointsText: '(Points per correct option - 3 points)',
439
+ }
440
+ ]);
441
+ } else {
442
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
443
+ }
301
444
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
302
445
  /*cy.log('When the user has attempted the question partially correct such that more number of options are exclusively from the alternative accordion but with one option exclusively from the correct accordion in the same dropzone and clicks on \'Check answer\' button, then correct icon should be displayed besides correct accordion responses, incorrect icon should be displayed besides alternative accordion responses, correct/incorrect answer status message and correct answer section should not be displayed')
303
446
  dragAndDropIntoCategoriesPage.steps.checkAnswer();