itemengine-cypress-automation 1.0.581-IEI-7046-ec54625.0 → 1.0.581

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 (18) hide show
  1. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/allOrNothingAlternativePointsGreaterThanCorrectPoints.js +8 -123
  2. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/allOrNothingCorrectPointsEqualToAlternativePoints.js +8 -123
  3. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +14 -131
  4. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perCorrectOptionAlternativePointsGreaterThanCorrectPoints.js +9 -138
  5. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perCorrectOptionCorrectPointsEqualToAlternativePoints.js +9 -138
  6. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perCorrectOptionCorrectPointsGreaterThanAlternativePoints.js +10 -153
  7. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perDropzoneAlternativePointsGreaterThanCorrectPoints.js +9 -138
  8. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perDropzoneCorrectPointsEqualToAlternativePoints.js +7 -108
  9. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perDropzoneCorrectPointsGreaterThanAlternativePoints.js +9 -138
  10. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/allOrNothingBasicForAllViews.smoke.js +1 -272
  11. package/cypress/e2e/ILC/ShortTextResponseNew/Scoring/allOrNothingAlternativePointsGreaterThanCorrectPoints.js +30 -2
  12. package/cypress/e2e/ILC/ShortTextResponseNew/Scoring/allOrNothingCorrectPointsEqualToAlternativePoints.js +30 -2
  13. package/cypress/e2e/ILC/ShortTextResponseNew/Scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +30 -2
  14. package/cypress/e2e/ILC/ShortTextResponseNew/Scoring/allOrNothingWeightsBasic.js +7 -7
  15. package/cypress/e2e/ILC/ShortTextResponseNew/allOrNothingBasicForAllViews.smoke.js +130 -3
  16. package/cypress/pages/dragAndDropIntoCategoriesPage.js +0 -38
  17. package/cypress/pages/shortTextResponsePage.js +20 -6
  18. package/package.json +1 -1
@@ -1,8 +1,5 @@
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';
6
3
 
7
4
  describe('Create item page - Drag and drop into categories: Per dropzone with alternative answers', () => {
8
5
  before(() => {
@@ -36,21 +33,7 @@ describe('Create item page - Drag and drop into categories: Per dropzone with al
36
33
  //Failing due to https://redmine.zeuslearning.com/issues/574339
37
34
  // dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectIconsForDropzone({ 'incorrect': 0, 'incorrect': 1, 'incorrect': 2, 'incorrect': 3, 'incorrect': 4, 'correct': 5 });
38
35
  dragAndDropIntoCategoriesPage.steps.verifyPreviewScore(0, 30);
39
- if (alternativeAnswerCheck) {
40
- showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
41
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
42
- {
43
- correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
44
- pointsText: '(Points per correct option - 5 points)',
45
- },
46
- {
47
- correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
48
- pointsText: '(Points per correct option - 3 points)',
49
- }
50
- ]);
51
- } else {
52
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
53
- }
36
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([[], [], [], [], ['Bat'], ['Eagle', 'Parrot'], [], ['Platypus'], ['Ostrich'], [], ['Whale'], []], ['1', '2', '3', '4', '1', '2', '7', '3', '4', '10', '5', '6']);
54
37
  });
55
38
 
56
39
  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, correct icons should be displayed for all correct dropzones proper icon should display beside empty dropzone, correct/incorrect answer status message should not be displayed and correct answer section should not be displayed', () => {
@@ -123,21 +106,7 @@ describe('Create item page - Drag and drop into categories: Per dropzone with al
123
106
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(4);
124
107
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIconForEmptyContainer(5);
125
108
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectIconsForDropzone({ 'correct': 0, 'incorrect': 1, 'incorrect': 2, 'incorrect': 3, 'incorrect': 4, 'correct': 5 });
126
- if (alternativeAnswerCheck) {
127
- showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
128
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
129
- {
130
- correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
131
- pointsText: '(Points per correct option - 5 points)',
132
- },
133
- {
134
- correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
135
- pointsText: '(Points per correct option - 3 points)',
136
- }
137
- ]);
138
- } else {
139
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
140
- }
109
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([[], [], [], [], ['Bat'], ['Eagle', 'Parrot'], [], ['Platypus'], ['Ostrich'], [], ['Whale'], []], ['1', '2', '3', '4', '1', '2', '7', '3', '4', '10', '5', '6']);
141
110
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
142
111
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
143
112
  /*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 icons should be displayed for all correct dropzones, incorrect icon should be displayed for incorrect dropzones, correct/incorrect answer status message and correct answer section should not be displayed')
@@ -162,21 +131,7 @@ describe('Create item page - Drag and drop into categories: Per dropzone with al
162
131
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(4);
163
132
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectIconsForDropzone({ 'correct': 0, 'incorrect': 1, 'correct': 2, 'incorrect': 3, 'incorrect': 4, 'correct': 5 });
164
133
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
165
- if (alternativeAnswerCheck) {
166
- showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
167
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
168
- {
169
- correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
170
- pointsText: '(Points per correct option - 5 points)',
171
- },
172
- {
173
- correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
174
- pointsText: '(Points per correct option - 3 points)',
175
- }
176
- ]);
177
- } else {
178
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
179
- }
134
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([[], [], [], [], ['Bat'], ['Eagle', 'Parrot'], [], ['Platypus'], ['Ostrich'], [], ['Whale'], []], ['1', '2', '3', '4', '1', '2', '7', '3', '4', '10', '5', '6']);
180
135
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
181
136
  /*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 icons should be displayed for all correct dropzones, incorrect icon should be displayed for incorrect dropzones, correct/incorrect answer status message and correct answer section should not be displayed')
182
137
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -201,21 +156,7 @@ describe('Create item page - Drag and drop into categories: Per dropzone with al
201
156
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIconForEmptyContainer(5);
202
157
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectIconsForDropzone({ 'incorrect': 0, 'incorrect': 1, 'incorrect': 2, 'incorrect': 3, 'incorrect': 4, 'correct': 5 });
203
158
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
204
- if (alternativeAnswerCheck) {
205
- showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
206
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
207
- {
208
- correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
209
- pointsText: '(Points per correct option - 5 points)',
210
- },
211
- {
212
- correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
213
- pointsText: '(Points per correct option - 3 points)',
214
- }
215
- ]);
216
- } else {
217
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
218
- }
159
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([[], [], [], [], ['Bat'], ['Eagle', 'Parrot'], [], ['Platypus'], ['Ostrich'], [], ['Whale'], []], ['1', '2', '3', '4', '1', '2', '7', '3', '4', '10', '5', '6']);
219
160
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
220
161
  /*cy.log('When the user has attempted the question with partially correct such that a dropzone is correctly attempted with both the correct and alternative answer options and clicks on \'Check answer\' button, then correct icon should be displayed besides correct accordion responses, incorrect icon should be displayed besides the alternative accordion responses, incorrect icon should be displayed for the dropzone containing options of alternative accordion and correct accordion in the same dropzone, correct/incorrect answer status message and correct answer section should not be displayed')
221
162
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -239,21 +180,7 @@ describe('Create item page - Drag and drop into categories: Per dropzone with al
239
180
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(4);
240
181
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectIconsForDropzone({ 'incorrect': 0, 'incorrect': 1, 'correct': 2, 'incorrect': 3, 'incorrect': 4, 'incorrect': 5 });
241
182
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
242
- if (alternativeAnswerCheck) {
243
- showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
244
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
245
- {
246
- correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
247
- pointsText: '(Points per correct option - 5 points)',
248
- },
249
- {
250
- correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
251
- pointsText: '(Points per correct option - 3 points)',
252
- }
253
- ]);
254
- } else {
255
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
256
- }
183
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([[], [], [], [], ['Bat'], ['Eagle', 'Parrot'], [], ['Platypus'], ['Ostrich'], [], ['Whale'], []], ['1', '2', '3', '4', '1', '2', '7', '3', '4', '10', '5', '6']);
257
184
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
258
185
  /*cy.log('When the user has attempted the question partially correct such that one dropzone is correctly attempted as per the correct accordion and another dropzone is correctly attempted as per the alternative accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides correct accordion responses, incorrect icon should be displayed besides the alternative accordion responses, correct icon should be displayed for correct dropzone, incorrect icon should be displayed for incorrect dropzone, correct/incorrect answer status message and correct answer section should not be displayed')
259
186
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -277,21 +204,7 @@ describe('Create item page - Drag and drop into categories: Per dropzone with al
277
204
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIconForEmptyContainer(5);
278
205
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectIconsForDropzone({ 'incorrect': 0, 'incorrect': 1, 'incorrect': 2, 'correct': 3, 'incorrect': 4, 'correct': 5 });
279
206
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
280
- if (alternativeAnswerCheck) {
281
- showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
282
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
283
- {
284
- correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
285
- pointsText: '(Points per correct option - 5 points)',
286
- },
287
- {
288
- correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
289
- pointsText: '(Points per correct option - 3 points)',
290
- }
291
- ]);
292
- } else {
293
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
294
- }
207
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([[], [], [], [], ['Bat'], ['Eagle', 'Parrot'], [], ['Platypus'], ['Ostrich'], [], ['Whale'], []], ['1', '2', '3', '4', '1', '2', '7', '3', '4', '10', '5', '6']);
295
208
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
296
209
  /*cy.log('When the user has attempted the question partially correct with only common options across both accordions and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, correct icon should be displayed for correct dropzone, incorrect icon should be displayed for incorrect dropzone. correct/incorrect answer status message and correct answer section should not be displayed')
297
210
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -315,21 +228,7 @@ describe('Create item page - Drag and drop into categories: Per dropzone with al
315
228
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIconForEmptyContainer(5);
316
229
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectIconsForDropzone({ 'incorrect': 0, 'correct': 1, 'incorrect': 2, 'correct': 3, 'incorrect': 4, 'correct': 5 });
317
230
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
318
- if (alternativeAnswerCheck) {
319
- showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
320
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
321
- {
322
- correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
323
- pointsText: '(Points per correct option - 5 points)',
324
- },
325
- {
326
- correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
327
- pointsText: '(Points per correct option - 3 points)',
328
- }
329
- ]);
330
- } else {
331
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
332
- }
231
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([[], [], [], [], ['Bat'], ['Eagle', 'Parrot'], [], ['Platypus'], ['Ostrich'], [], ['Whale'], []], ['1', '2', '3', '4', '1', '2', '7', '3', '4', '10', '5', '6']);
333
232
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
334
233
  /*cy.log('When the user has attempted the question partially correct such that equal number of dropzones are correct according to correct accordion and alternative accordion mappings 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 icon should be displayed for correct dropzone, incorrect icon should be displayed for incorrect dropzone. correct/incorrect answer status message and correct answer section should not be displayed')
335
234
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -357,21 +256,7 @@ describe('Create item page - Drag and drop into categories: Per dropzone with al
357
256
  dragAndDropIntoCategoriesPage.steps.verifyIncorrectIconForEmptyContainer(3);
358
257
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectIconsForDropzone({ 'correct': 0, 'incorrect': 1, 'correct': 2, 'incorrect': 3, 'correct': 4, 'correct': 5 });
359
258
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
360
- if (alternativeAnswerCheck) {
361
- showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
362
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
363
- {
364
- correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
365
- pointsText: '(Points per correct option - 5 points)',
366
- },
367
- {
368
- correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
369
- pointsText: '(Points per correct option - 3 points)',
370
- }
371
- ]);
372
- } else {
373
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
374
- }
259
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([[], [], [], [], ['Bat'], ['Eagle', 'Parrot'], [], ['Platypus'], ['Ostrich'], [], ['Whale'], []], ['1', '2', '3', '4', '1', '2', '7', '3', '4', '10', '5', '6']);
375
260
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
376
261
  /*cy.log('When the user has attempted the question such that more number of dropzones are correct as per the alternative accordion mapping than the correct accordion mapping and points achieved from the alternative accordion mapping is more than the points achieved from correct accordion mapping and clicks on \'Check answer\' button, then correct icon should be displayed besides alternative accordion responses, incorrect icon should be displayed besides the correct accordion responses, correct icon should be displayed for correct dropzone, incorrect icon should be displayed for incorrect dropzone. correct/incorrect answer status message and correct answer section should not be displayed')
377
262
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -406,21 +291,7 @@ describe('Create item page - Drag and drop into categories: Per dropzone with al
406
291
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIconForEmptyContainer(5);
407
292
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectIconsForDropzone({ 'incorrect': 0, 'incorrect': 1, 'incorrect': 2, 'correct': 3, 'incorrect': 4, 'correct': 5 });
408
293
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
409
- if (alternativeAnswerCheck) {
410
- showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
411
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
412
- {
413
- correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
414
- pointsText: '(Points per correct option - 5 points)',
415
- },
416
- {
417
- correctAnswers: [['Flying squirrel'], ['Eagle', 'Peacock'], ['Ostrich'], ['Platypus'], ['Octopus'], []],
418
- pointsText: '(Points per correct option - 3 points)',
419
- }
420
- ]);
421
- } else {
422
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
423
- }
294
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([[], [], [], [], ['Bat'], ['Eagle', 'Parrot'], [], ['Platypus'], ['Ostrich'], [], ['Whale'], []], ['1', '2', '3', '4', '1', '2', '7', '3', '4', '10', '5', '6']);
424
295
  dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
425
296
  /*cy.log('When the user has attempted the question such that more number of dropzones are correct according to the alternative accordion mapping and points achieved from the correct accordion mapping is equal to the points achieved from alternative accordion mapping and clicks on \'Check answer\' button, then correct icon should be displayed besides correct accordion responses, incorrect icon should be displayed besides the alternative accordion responses, correct icon should be displayed for correct dropzone, incorrect icon should be displayed for incorrect dropzone. correct/incorrect answer status message and correct answer section should not be displayed')
426
297
  dragAndDropIntoCategoriesPage.steps.checkAnswer();
@@ -1,12 +1,10 @@
1
1
  import { dialogBoxBase, dragAndDropIntoCategoriesPage, gradingViewPage, itemPreviewPage, studentViewPage } from "../../../pages";
2
- import { showAlternativeAnswersComponent } from "../../../pages/components";
3
2
  import abortEarlySetup from "../../../support/helpers/abortEarly";
4
3
  import utilities from "../../../support/helpers/utilities";
5
4
  const grepTags = Cypress.env('grepTags');
6
5
  let correctAnswerViews = ['Question preview', 'Item preview', 'Grading view'];
7
6
  const views = utilities.getViews(correctAnswerViews);
8
7
  let itemReferenceID = "";
9
- const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT') === 'true';
10
8
 
11
9
  describe('Create item page - Drag and drop into categories: All or nothing ', () => {
12
10
  before(() => {
@@ -118,11 +116,7 @@ describe('Create item page - Drag and drop into categories: All or nothing ', ()
118
116
  dragAndDropIntoCategoriesPage.steps.verifyPreviewTabPointsBackgroundForIncorrectOrPartiallyCorrectAnswer();
119
117
  };
120
118
  dragAndDropIntoCategoriesPage.steps.verifyDropzoneCellNumeration(['1', '2', '3', '4', '5', '6']);
121
- if (alternativeAnswerCheck) {
122
- showAlternativeAnswersComponent.steps.verifyCorrectAnswersLabelAndPointVisible('(20 points)');
123
- } else {
124
- utilities.verifyInnerText(dragAndDropIntoCategoriesPage.correctAnswersLabel(), 'Correct answers');
125
- }
119
+ utilities.verifyInnerText(dragAndDropIntoCategoriesPage.correctAnswersLabel(), 'Correct answers');
126
120
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
127
121
  dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectIconsNotExist();
128
122
  dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
@@ -248,271 +242,6 @@ describe('Create item page - Drag and drop into categories: All or nothing ', ()
248
242
  });
249
243
  });
250
244
 
251
- if (alternativeAnswerCheck) {
252
- views.forEach((view) => {
253
- describe(`${view}: Auto scored - All or nothing scoring`, { tags: 'smoke' }, () => {
254
- abortEarlySetup();
255
- before(() => {
256
- switch (view) {
257
- case 'Question preview':
258
- dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
259
- cy.barsPreLoaderWait();
260
- dragAndDropIntoCategoriesPage.steps.addTextInQuestionInstructionsInputField('Drag and drop options in correct categories');
261
- dragAndDropIntoCategoriesPage.steps.setRowsAndColumnsForQuestion();
262
- dragAndDropIntoCategoriesPage.steps.addMultipleOptionFields(5);
263
- dragAndDropIntoCategoriesPage.steps.allotPoints(20);
264
- dragAndDropIntoCategoriesPage.steps.addInputToOptionsInputField(['Bat', 'Eagle', 'Parrot', 'Whale', 'Platypus', 'Ostrich', 'Flying squirrel']);
265
- dragAndDropIntoCategoriesPage.steps.expandMaxCapacityPerDropzoneDropdown();
266
- dragAndDropIntoCategoriesPage.steps.selectOptionFromMaxCapacityPerDropzoneDropdown('4');
267
- dragAndDropIntoCategoriesPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection({ 'Bat': 0, 'Eagle': 1, 'Parrot': 1, 'Platypus': 2, 'Ostrich': 3, 'Whale': 4 });
268
- dragAndDropIntoCategoriesPage.steps.addAlternativeAnswerAccordion(1);
269
- dragAndDropIntoCategoriesPage.steps.allotPoints(10);
270
- dragAndDropIntoCategoriesPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection({ 'Flying squirrel': 0, 'Eagle': 1, 'Parrot': 1, 'Ostrich': 3, 'Platypus': 4 });
271
- dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
272
- break;
273
- case 'Item preview':
274
- cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
275
- itemPreviewPage.steps.switchToPreviewTab();
276
- break;
277
- case 'Grading view':
278
- cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
279
- break;
280
- };
281
- });
282
-
283
- beforeEach(() => {
284
- switch (view) {
285
- case 'Question preview':
286
- dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
287
- dragAndDropIntoCategoriesPage.steps.resetQuestionPreview();
288
- break;
289
- case 'Item preview':
290
- dragAndDropIntoCategoriesPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
291
- itemPreviewPage.steps.resetQuestionPreview();
292
- break;
293
- case 'Grading view':
294
- cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
295
- break;
296
- }
297
- });
298
-
299
- if (view === 'Question preview') {
300
- after(() => {
301
- dragAndDropIntoCategoriesPage.steps.clickOnSaveQuestionButton();
302
- utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
303
- itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
304
- });
305
- };
306
-
307
- it('When the user selects \'Grading\' view without attempting the question, cell numeration should be displayed, correct answers section should be displayed with correct answers, correct/incorrect status message should not be displayed and respective cell numeration', () => {
308
- if (view === 'Grading view') {
309
- studentViewPage.steps.submitResponse();
310
- utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
311
- studentViewPage.steps.clickOnGoToGradingViewButton();
312
- gradingViewPage.steps.verifyGradingViewScore(0, 20);
313
- };
314
- if (view === 'Question preview' || view === 'Item preview') {
315
- dragAndDropIntoCategoriesPage.steps.verifyPreviewScore(0, 20);
316
- dragAndDropIntoCategoriesPage.steps.switchToGradingView();
317
- dragAndDropIntoCategoriesPage.steps.verifyPreviewTabPointsBackgroundForIncorrectOrPartiallyCorrectAnswer();
318
- };
319
- dragAndDropIntoCategoriesPage.steps.verifyDropzoneCellNumeration(['1', '2', '3', '4', '5', '6']);
320
- dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
321
- dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectIconsNotExist();
322
- if (alternativeAnswerCheck) {
323
- showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
324
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
325
- {
326
- correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
327
- pointsText: '(20 points)',
328
- },
329
- {
330
- correctAnswers: [['Flying squirrel'], ['Eagle', 'Parrot'], ['Ostrich'], ['Platypus'], [], []],
331
- pointsText: '(10 points)',
332
- }
333
- ]);
334
- } else {
335
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
336
- }
337
- });
338
-
339
- it('When the user attempts the question incorrectly, then the user should be awarded 0 points and on switching to \'Grading\' view, incorrect icons should be displayed besides all incorrect responses, a status message with text \'Your answer is incorrect\' and correct answer section with all correct answers along with dropzone cell numeration should be displayed', () => {
340
- dragAndDropIntoCategoriesPage.steps.clickAndDropOptionInDropzonePreviewTab({ 'Platypus': 0 });
341
- if (view === 'Grading view') {
342
- studentViewPage.steps.submitResponse();
343
- utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
344
- studentViewPage.steps.clickOnGoToGradingViewButton();
345
- gradingViewPage.steps.verifyGradingViewScore(0, 20);
346
- };
347
- if (view === 'Question preview' || view === 'Item preview') {
348
- dragAndDropIntoCategoriesPage.steps.verifyPreviewScore(0, 20);
349
- dragAndDropIntoCategoriesPage.steps.switchToGradingView();
350
- };
351
- dragAndDropIntoCategoriesPage.steps.verifyIncorrectOptionIcon(0);
352
- dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
353
- if (alternativeAnswerCheck) {
354
- showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
355
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
356
- {
357
- correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
358
- pointsText: '(20 points)',
359
- },
360
- {
361
- correctAnswers: [['Flying squirrel'], ['Eagle', 'Parrot'], ['Ostrich'], ['Platypus'], [], []],
362
- pointsText: '(10 points)',
363
- }
364
- ]);
365
- } else {
366
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
367
- }
368
- });
369
-
370
- it('When the user attempts the question partially correct with some cells correct, some cells partially correct but incomplete, some cells partially correct with incorrect options, then the user should be awarded 0 points and on switching to \'Grading\' view, correct icon should be displayed besides the correct answer responses, incorrect icon should be displayed besides incorrect answer response, a status message with text \'Your answer is incorrect\' and correct answer section with all correct answers along with dropzone cell numeration should be displayed', () => {
371
- if (view === 'Grading view') {
372
- studentViewPage.steps.clearResponses();
373
- };
374
- dragAndDropIntoCategoriesPage.steps.clickAndDropOptionInDropzonePreviewTab({ 'Bat': 0, 'Eagle': 1, 'Parrot': 4, 'Whale': 4 });
375
- if (view === 'Grading view') {
376
- studentViewPage.steps.submitResponse();
377
- utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
378
- studentViewPage.steps.clickOnGoToGradingViewButton();
379
- gradingViewPage.steps.verifyGradingViewScore(0, 20);
380
- };
381
- if (view === 'Question preview' || view === 'Item preview') {
382
- dragAndDropIntoCategoriesPage.steps.verifyPreviewScore(0, 20);
383
- dragAndDropIntoCategoriesPage.steps.switchToGradingView();
384
- };
385
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(0);
386
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(1);
387
- dragAndDropIntoCategoriesPage.steps.verifyIncorrectOptionIcon(2);
388
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(3);
389
- dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
390
- if (alternativeAnswerCheck) {
391
- showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
392
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
393
- {
394
- correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
395
- pointsText: '(20 points)',
396
- },
397
- {
398
- correctAnswers: [['Flying squirrel'], ['Eagle', 'Parrot'], ['Ostrich'], ['Platypus'], [], []],
399
- pointsText: '(10 points)',
400
- }
401
- ]);
402
- } else {
403
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
404
- }
405
- });
406
-
407
- it('When the user attempts the question partially correct with all the cells correctly attempted but one cell incomplete, then the user should be awarded 0 points and on switching to \'Grading\' view, correct icon should be displayed besides the correct answer responses, incorrect icon should be displayed besides incorrect answer response, a status message with text \'Your answer is incorrect\' and correct answer section with all correct answers along with dropzone cell numeration should be displayed', () => {
408
- if (view === 'Grading view') {
409
- studentViewPage.steps.clearResponses();
410
- };
411
- dragAndDropIntoCategoriesPage.steps.clickAndDropOptionInDropzonePreviewTab({ 'Bat': 0, 'Eagle': 1, 'Platypus': 2, 'Ostrich': 3, 'Whale': 4 })
412
- if (view === 'Grading view') {
413
- studentViewPage.steps.submitResponse();
414
- utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
415
- studentViewPage.steps.clickOnGoToGradingViewButton();
416
- gradingViewPage.steps.verifyGradingViewScore(0, 20);
417
- };
418
- if (view === 'Question preview' || view === 'Item preview') {
419
- dragAndDropIntoCategoriesPage.steps.verifyPreviewScore(0, 20);
420
- dragAndDropIntoCategoriesPage.steps.switchToGradingView();
421
- };
422
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(0);
423
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(1);
424
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(2);
425
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(3);
426
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(4);
427
- dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
428
- if (alternativeAnswerCheck) {
429
- showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
430
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
431
- {
432
- correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
433
- pointsText: '(20 points)',
434
- },
435
- {
436
- correctAnswers: [['Flying squirrel'], ['Eagle', 'Parrot'], ['Ostrich'], ['Platypus'], [], []],
437
- pointsText: '(10 points)',
438
- }
439
- ]);
440
- } else {
441
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
442
- }
443
- });
444
-
445
- it('When the user attempts the question partially correct with all the cells correctly attempted but with an extra option which is not set as correct answer, then the user should be awarded 0 points and on switching to \'Grading\' view, correct icon should be displayed besides the correct answer responses, incorrect icon should be displayed besides incorrect answer response, a status message with text \'Your answer is incorrect\' and correct answer section with all correct answers along with dropzone cell numeration should be displayed', () => {
446
- if (view === 'Grading view') {
447
- studentViewPage.steps.clearResponses();
448
- };
449
- dragAndDropIntoCategoriesPage.steps.clickAndDropOptionInDropzonePreviewTab({ 'Bat': 0, 'Eagle': 1, 'Parrot': 1, 'Platypus': 2, 'Ostrich': 3, 'Whale': 4, 'Flying squirrel': 4 });
450
- if (view === 'Grading view') {
451
- studentViewPage.steps.submitResponse();
452
- utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
453
- studentViewPage.steps.clickOnGoToGradingViewButton();
454
- gradingViewPage.steps.verifyGradingViewScore(0, 20);
455
- };
456
- if (view === 'Question preview' || view === 'Item preview') {
457
- dragAndDropIntoCategoriesPage.steps.verifyPreviewScore(0, 20);
458
- dragAndDropIntoCategoriesPage.steps.switchToGradingView();
459
- };
460
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(0);
461
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(1);
462
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(2);
463
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(3);
464
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(4);
465
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(5);
466
- dragAndDropIntoCategoriesPage.steps.verifyIncorrectOptionIcon(6);
467
- dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
468
- if (alternativeAnswerCheck) {
469
- showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
470
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInAlternateAnswerSection([
471
- {
472
- correctAnswers: [['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []],
473
- pointsText: '(20 points)',
474
- },
475
- {
476
- correctAnswers: [['Flying squirrel'], ['Eagle', 'Parrot'], ['Ostrich'], ['Platypus'], [], []],
477
- pointsText: '(10 points)',
478
- }
479
- ]);
480
- } else {
481
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Bat'], ['Eagle', 'Parrot'], ['Platypus'], ['Ostrich'], ['Whale'], []], ['1', '2', '3', '4', '5', '6']);
482
- }
483
- });
484
-
485
- it(`${view} - When user attempts the question correctly, the user should be awarded full points and on switching to 'Grading' view, then correct icons should be displayed beside all the correct responses, correct icon should be displayed besides the correct answer responses, a status message with text 'Your answer is correct' and correct answer section should not be displayed`, () => {
486
- if (view === 'Grading view') {
487
- studentViewPage.steps.clearResponses();
488
- };
489
- dragAndDropIntoCategoriesPage.steps.clickAndDropOptionInDropzonePreviewTab({ 'Bat': 0, 'Eagle': 1, 'Parrot': 1, 'Platypus': 2, 'Ostrich': 3, 'Whale': 4 });
490
- if (view === 'Grading view') {
491
- studentViewPage.steps.submitResponse();
492
- utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
493
- studentViewPage.steps.clickOnGoToGradingViewButton();
494
- gradingViewPage.steps.verifyGradingViewScore(20, 20);
495
- };
496
- if (view === 'Question preview' || view === 'Item preview') {
497
- dragAndDropIntoCategoriesPage.steps.verifyPreviewScore(20, 20);
498
- dragAndDropIntoCategoriesPage.steps.switchToGradingView();
499
- dragAndDropIntoCategoriesPage.steps.verifyPreviewTabPointsBackgroundForCorrectAnswer();
500
- };
501
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(0);
502
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(1);
503
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(2);
504
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(3);
505
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(4);
506
- dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionIcon(5);
507
- //Need to remove comment once https://redmine.zeuslearning.com/issues/577009 is resolved
508
- // dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
509
- dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerSectionNotExists();
510
- cy.eyesCheckWindow(`${view} - DND - Correct attempt`);
511
- });
512
- });
513
- });
514
- }
515
-
516
245
  views.forEach((view) => {
517
246
  //https://weldnorthed.atlassian.net/browse/IEI-4998
518
247
  describe(`${view}: Drag and drop into categories - Manually scored`, { tags: 'smoke' }, () => {
@@ -1,6 +1,8 @@
1
1
  import { shortTextResponsePage } from "../../../../pages/shortTextResponsePage";
2
2
  import abortEarlySetup from "../../../../support/helpers/abortEarly";
3
+ import utilities from "../../../../support/helpers/utilities";
3
4
  const css = Cypress.env('css');
5
+ const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT') === 'true';
4
6
 
5
7
  describe('Create item page - Short text response: All or nothing with alternative answer', () => {
6
8
  before(() => {
@@ -24,7 +26,20 @@ describe('Create item page - Short text response: All or nothing with alternativ
24
26
  it('When the user selects \'Grading\' view without attempting the question, correct/incorrect icons should not be displayed and answer input field should have incorrect answer border and correct answer section should be displayed below response input field', () => {
25
27
  shortTextResponsePage.steps.switchToGradingView();
26
28
  shortTextResponsePage.steps.verifyCorrectIncorrectBorderNotExist();
27
- shortTextResponsePage.steps.verifyCorrectAnswerResponseInCorrectAnswerWrapper('Fossil fuel combustion');
29
+ if (alternativeAnswerCheck) {
30
+ utilities.verifyElementVisibilityState(shortTextResponsePage.previewTabCorrectAnswerWrapper(), 'visible');
31
+ utilities.verifyInnerText(shortTextResponsePage.previewTabCorrectAnswerResponse().eq(0), 'Fossil fuel combustion');
32
+ shortTextResponsePage.steps.verifyCorrectAnswersLabelAndPointVisible('(20 points)');
33
+ shortTextResponsePage.steps.verifyShowAlternativeAnswersToggleExists();
34
+ shortTextResponsePage.steps.disableShowAlternativeAnswersToggle();
35
+ shortTextResponsePage.steps.verifyShowAlternativeAnswersToggleUnchecked();
36
+ shortTextResponsePage.steps.verifyAlternativeAnswersSectionNotExist();
37
+ shortTextResponsePage.steps.clickShowAlternativeAnswersToggle();
38
+ utilities.verifyInnerText(shortTextResponsePage.previewTabCorrectAnswerResponse().eq(1), 'Buildings');
39
+ shortTextResponsePage.steps.verifyAlternativeAnswersLabelAndPointVisible(1, '(10 points)');
40
+ } else {
41
+ shortTextResponsePage.steps.verifyCorrectAnswerResponseInCorrectAnswerWrapper('Fossil fuel combustion');
42
+ }
28
43
  shortTextResponsePage.steps.switchToStudentView();
29
44
  });
30
45
 
@@ -56,7 +71,20 @@ describe('Create item page - Short text response: All or nothing with alternativ
56
71
  shortTextResponsePage.steps.switchToGradingView();
57
72
  shortTextResponsePage.steps.verifyIncorrectIcon();
58
73
  shortTextResponsePage.steps.verifyIncorrectAttemptBorder();
59
- shortTextResponsePage.steps.verifyCorrectAnswerResponseInCorrectAnswerWrapper('Fossil fuel combustion');
74
+ if (alternativeAnswerCheck) {
75
+ utilities.verifyElementVisibilityState(shortTextResponsePage.previewTabCorrectAnswerWrapper(), 'visible');
76
+ utilities.verifyInnerText(shortTextResponsePage.previewTabCorrectAnswerResponse().eq(0), 'Fossil fuel combustion');
77
+ shortTextResponsePage.steps.verifyCorrectAnswersLabelAndPointVisible('(20 points)');
78
+ shortTextResponsePage.steps.verifyShowAlternativeAnswersToggleExists();
79
+ shortTextResponsePage.steps.disableShowAlternativeAnswersToggle();
80
+ shortTextResponsePage.steps.verifyShowAlternativeAnswersToggleUnchecked();
81
+ shortTextResponsePage.steps.verifyAlternativeAnswersSectionNotExist();
82
+ shortTextResponsePage.steps.clickShowAlternativeAnswersToggle();
83
+ utilities.verifyInnerText(shortTextResponsePage.previewTabCorrectAnswerResponse().eq(1), 'Buildings');
84
+ shortTextResponsePage.steps.verifyAlternativeAnswersLabelAndPointVisible(1, '(10 points)');
85
+ } else {
86
+ shortTextResponsePage.steps.verifyCorrectAnswerResponseInCorrectAnswerWrapper('Fossil fuel combustion');
87
+ }
60
88
  shortTextResponsePage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
61
89
  });
62
90
  });