itemengine-cypress-automation 1.0.588 → 1.0.589

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.
@@ -3,6 +3,7 @@ import abortEarlySetup from "../../../../support/helpers/abortEarly";
3
3
  import utilities from "../../../../support/helpers/utilities";
4
4
  const unselectedToolOption = ['Circle', 'Parabola', 'Sine', 'Polygon'];
5
5
  const css = Cypress.env('css');
6
+ const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT');
6
7
 
7
8
  describe('Create Item page - Graphing: All or nothing with alternative answer', () => {
8
9
  before(() => {
@@ -67,6 +68,26 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
67
68
  graphingPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
68
69
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
69
70
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
71
+
72
+ if (alternativeAnswerCheck === 'true') {
73
+ // Correct answer label and points
74
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
75
+ // Alternative answer toggle
76
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
77
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
78
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
79
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
80
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
81
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
82
+ // Alternate answer section
83
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(12 points)', 1);
84
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 2);
85
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
86
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
87
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 1);
88
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
89
+ utilities.verifyElementCount(graphingPage.graphPolygonAlternativeAnswerSection(), 1);
90
+ }
70
91
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
71
92
 
72
93
  /*cy.log('When the user switches to \'Grading view\' without attempting the question and clicks on \'Check answer\' button, status message and correct answer section should not be displayed')
@@ -100,6 +121,9 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
100
121
  //Correct/incorrect icon
101
122
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
102
123
  graphingPage.steps.verifyCorrectAnswerSectionNotExist();
124
+ if (alternativeAnswerCheck === 'true') {
125
+ graphingPage.steps.verifyShowAlternativeAnswersToggleNotExists();
126
+ }
103
127
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
104
128
 
105
129
  /*cy.log('When the user attempts the question with responses from the correct accordion and clicks on \'Check answer\' button, the attempted graph should be displayed correct, a status message with text \'Your answer is correct\' and correct answer section should not be displayed')
@@ -135,6 +159,9 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
135
159
  //Correct/incorrect icon
136
160
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('correct')
137
161
  graphingPage.steps.verifyCorrectAnswerSectionNotExist();
162
+ if (alternativeAnswerCheck === 'true') {
163
+ graphingPage.steps.verifyShowAlternativeAnswersToggleNotExists();
164
+ }
138
165
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
139
166
 
140
167
  /*cy.log('When the user attempts the question with responses from the alternative accordion and clicks on \'Check answer\' button, the attempted graph should be displayed correct, a status message with text \'Your answer is correct\' and correct answer section should not be displayed')
@@ -175,6 +202,26 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
175
202
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect')
176
203
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
177
204
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
205
+
206
+ if (alternativeAnswerCheck === 'true') {
207
+ // Correct answer label and points
208
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
209
+ // Alternative answer toggle
210
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
211
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
212
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
213
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
214
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
215
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
216
+ // Alternate answer section
217
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(12 points)', 1);
218
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 2);
219
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
220
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
221
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 1);
222
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
223
+ utilities.verifyElementCount(graphingPage.graphPolygonAlternativeAnswerSection(), 1);
224
+ }
178
225
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
179
226
 
180
227
  /*cy.log('When the user attempts the question with partially correct responses exclusively from the correct accordion and clicks on \'Check answer\' button, the attempted graph should be displayed correct, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed')
@@ -215,6 +262,26 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
215
262
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect')
216
263
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
217
264
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
265
+
266
+ if (alternativeAnswerCheck === 'true') {
267
+ // Correct answer label and points
268
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
269
+ // Alternative answer toggle
270
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
271
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
272
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
273
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
274
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
275
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
276
+ // Alternate answer section
277
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(12 points)', 1);
278
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 2);
279
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
280
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
281
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 1);
282
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
283
+ utilities.verifyElementCount(graphingPage.graphPolygonAlternativeAnswerSection(), 1);
284
+ }
218
285
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
219
286
 
220
287
  /*cy.log('When the user attempts the question with partially correct responses exclusively from the alternative accordion and clicks on \'Check answer\' button, the attempted graph should be displayed correct, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed')
@@ -257,6 +324,25 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
257
324
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect')
258
325
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
259
326
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
327
+ if (alternativeAnswerCheck === 'true') {
328
+ // Correct answer label and points
329
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
330
+ // Alternative answer toggle
331
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
332
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
333
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
334
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
335
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
336
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
337
+ // Alternate answer section
338
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(12 points)', 1);
339
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 2);
340
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
341
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
342
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 1);
343
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
344
+ utilities.verifyElementCount(graphingPage.graphPolygonAlternativeAnswerSection(), 1);
345
+ }
260
346
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
261
347
 
262
348
  /*cy.log('When the user attempts the question with equal number responses from the correct and alternative accordion and clicks on \'Check answer\' button, the attempted graph should be displayed correct, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed')
@@ -296,6 +382,25 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
296
382
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect')
297
383
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
298
384
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
385
+ if (alternativeAnswerCheck === 'true') {
386
+ // Correct answer label and points
387
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
388
+ // Alternative answer toggle
389
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
390
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
391
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
392
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
393
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
394
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
395
+ // Alternate answer section
396
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(12 points)', 1);
397
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 2);
398
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
399
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
400
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 1);
401
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
402
+ utilities.verifyElementCount(graphingPage.graphPolygonAlternativeAnswerSection(), 1);
403
+ }
299
404
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
300
405
 
301
406
  /*cy.log('When the user attempts the question with common response from the alternative accordion and clicks on \'Check answer\' button, the attempted graph should be displayed correct, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed')
@@ -334,6 +439,25 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
334
439
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect')
335
440
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
336
441
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
442
+ if (alternativeAnswerCheck === 'true') {
443
+ // Correct answer label and points
444
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
445
+ // Alternative answer toggle
446
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
447
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
448
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
449
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
450
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
451
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
452
+ // Alternate answer section
453
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(12 points)', 1);
454
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 2);
455
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
456
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
457
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 1);
458
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
459
+ utilities.verifyElementCount(graphingPage.graphPolygonAlternativeAnswerSection(), 1);
460
+ }
337
461
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
338
462
 
339
463
  /*cy.log('When the user has attempted the question with incorrect responses and clicks on \'Check answer\' button, then 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')
@@ -367,6 +491,9 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
367
491
  graphingPage.steps.switchToGradingView();
368
492
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
369
493
  graphingPage.steps.verifyCorrectAnswerSectionNotExist();
494
+ if (alternativeAnswerCheck === 'true') {
495
+ graphingPage.steps.verifyShowAlternativeAnswersToggleNotExists();
496
+ }
370
497
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
371
498
  });
372
499
 
@@ -379,6 +506,9 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
379
506
  graphingPage.steps.switchToGradingView();
380
507
  graphingPage.steps.verifyCorrectAnswerSectionNotExist();
381
508
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
509
+ if (alternativeAnswerCheck === 'true') {
510
+ graphingPage.steps.verifyShowAlternativeAnswersToggleNotExists();
511
+ }
382
512
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
383
513
  });
384
514
  });
@@ -407,6 +537,9 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
407
537
  graphingPage.steps.switchToGradingView();
408
538
  graphingPage.steps.verifyCorrectAnswerSectionNotExist();
409
539
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
540
+ if (alternativeAnswerCheck === 'true') {
541
+ graphingPage.steps.verifyShowAlternativeAnswersToggleNotExists();
542
+ }
410
543
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
411
544
  });
412
545
 
@@ -417,6 +550,9 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
417
550
  graphingPage.steps.switchToGradingView();
418
551
  graphingPage.steps.verifyCorrectAnswerSectionNotExist();
419
552
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
553
+ if (alternativeAnswerCheck === 'true') {
554
+ graphingPage.steps.verifyShowAlternativeAnswersToggleNotExists();
555
+ }
420
556
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
421
557
  });
422
558
  });
@@ -3,6 +3,7 @@ import abortEarlySetup from "../../../../support/helpers/abortEarly";
3
3
  import utilities from "../../../../support/helpers/utilities";
4
4
  const unselectedToolOption = ['Circle', 'Parabola', 'Sine', 'Polygon'];
5
5
  const css = Cypress.env('css');
6
+ const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT');
6
7
 
7
8
  describe('Create Item page - Graphing: All or nothing with alternative answer', () => {
8
9
  before(() => {
@@ -68,6 +69,24 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
68
69
  graphingPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
69
70
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
70
71
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
72
+ if (alternativeAnswerCheck === 'true') {
73
+ // Correct answer label and points
74
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
75
+ // Alternative answer toggle
76
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
77
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
78
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
79
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
80
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
81
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
82
+ // Alternate answer section
83
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(20 points)', 1);
84
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 2);
85
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
86
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
87
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 2);
88
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
89
+ }
71
90
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
72
91
 
73
92
  /*cy.log('When the user switches to \'Grading view\' without attempting the question and clicks on \'Check answer\' button, status message and correct answer section should not be displayed')
@@ -100,6 +119,9 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
100
119
  //Correct/incorrect icon
101
120
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
102
121
  graphingPage.steps.verifyCorrectAnswerSectionNotExist();
122
+ if (alternativeAnswerCheck === 'true') {
123
+ graphingPage.steps.verifyShowAlternativeAnswersToggleNotExists();
124
+ }
103
125
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
104
126
 
105
127
  /*cy.log('When the user attempts the question with responses from the correct accordion and clicks on \'Check answer\' button, the attempted graph should be displayed correct, a status message with text \'Your answer is correct\' and correct answer section should not be displayed')
@@ -135,6 +157,9 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
135
157
  //Correct/incorrect icon
136
158
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('correct')
137
159
  graphingPage.steps.verifyCorrectAnswerSectionNotExist();
160
+ if (alternativeAnswerCheck === 'true') {
161
+ graphingPage.steps.verifyShowAlternativeAnswersToggleNotExists();
162
+ }
138
163
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
139
164
 
140
165
  /*cy.log('When the user attempts the question with responses from the alternative accordion and clicks on \'Check answer\' button, the attempted graph should be displayed correct, a status message with text \'Your answer is correct\' and correct answer section should not be displayed')
@@ -176,6 +201,24 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
176
201
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect')
177
202
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
178
203
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
204
+ if (alternativeAnswerCheck === 'true') {
205
+ // Correct answer label and points
206
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
207
+ // Alternative answer toggle
208
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
209
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
210
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
211
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
212
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
213
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
214
+ // Alternate answer section
215
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(20 points)', 1);
216
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 2);
217
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
218
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
219
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 2);
220
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
221
+ }
179
222
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
180
223
 
181
224
  /*cy.log('When the user attempts the question with partially correct responses exclusively from the correct accordion and clicks on \'Check answer\' button, the attempted graph should be displayed correct, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed')
@@ -217,6 +260,24 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
217
260
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect')
218
261
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
219
262
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
263
+ if (alternativeAnswerCheck === 'true') {
264
+ // Correct answer label and points
265
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
266
+ // Alternative answer toggle
267
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
268
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
269
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
270
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
271
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
272
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
273
+ // Alternate answer section
274
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(20 points)', 1);
275
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 2);
276
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
277
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
278
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 2);
279
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
280
+ }
220
281
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
221
282
 
222
283
  /*cy.log('When the user attempts the question with partially correct responses exclusively from the alternative accordion and clicks on \'Check answer\' button, the attempted graph should be displayed correct, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed')
@@ -260,6 +321,24 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
260
321
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect')
261
322
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
262
323
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
324
+ if (alternativeAnswerCheck === 'true') {
325
+ // Correct answer label and points
326
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
327
+ // Alternative answer toggle
328
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
329
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
330
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
331
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
332
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
333
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
334
+ // Alternate answer section
335
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(20 points)', 1);
336
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 2);
337
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
338
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
339
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 2);
340
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
341
+ }
263
342
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
264
343
 
265
344
  /*cy.log('When the user attempts the question with equal number responses from the correct and alternative accordion and clicks on \'Check answer\' button, the attempted graph should be displayed correct, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed')
@@ -300,6 +379,24 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
300
379
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect')
301
380
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
302
381
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }]);
382
+ if (alternativeAnswerCheck === 'true') {
383
+ // Correct answer label and points
384
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
385
+ // Alternative answer toggle
386
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
387
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
388
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
389
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
390
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
391
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
392
+ // Alternate answer section
393
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(20 points)', 1);
394
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 2);
395
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
396
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
397
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 2);
398
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
399
+ }
303
400
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
304
401
 
305
402
  /*cy.log('When the user attempts the question with common response from the alternative accordion and clicks on \'Check answer\' button, the attempted graph should be displayed correct, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed')
@@ -339,6 +436,24 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
339
436
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect')
340
437
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
341
438
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
439
+ if (alternativeAnswerCheck === 'true') {
440
+ // Correct answer label and points
441
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
442
+ // Alternative answer toggle
443
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
444
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
445
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
446
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
447
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
448
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
449
+ // Alternate answer section
450
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(20 points)', 1);
451
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 2);
452
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
453
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
454
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 2);
455
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
456
+ }
342
457
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
343
458
 
344
459
  /*cy.log('When the user has attempted the question with incorrect responses and clicks on \'Check answer\' button, then 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')
@@ -377,6 +492,9 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
377
492
  graphingPage.steps.switchToGradingView();
378
493
  graphingPage.steps.verifyCorrectAnswerSectionNotExist();
379
494
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
495
+ if (alternativeAnswerCheck === 'true') {
496
+ graphingPage.steps.verifyShowAlternativeAnswersToggleNotExists();
497
+ }
380
498
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
381
499
  });
382
500
 
@@ -387,6 +505,9 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
387
505
  graphingPage.steps.switchToGradingView();
388
506
  graphingPage.steps.verifyCorrectAnswerSectionNotExist();
389
507
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
508
+ if (alternativeAnswerCheck === 'true') {
509
+ graphingPage.steps.verifyShowAlternativeAnswersToggleNotExists();
510
+ }
390
511
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
391
512
  });
392
513
  });
@@ -3,6 +3,7 @@ import abortEarlySetup from "../../../../support/helpers/abortEarly";
3
3
  import utilities from "../../../../support/helpers/utilities";
4
4
  const unselectedToolOption = ['Circle', 'Parabola', 'Sine', 'Polygon'];
5
5
  const css = Cypress.env('css');
6
+ const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT');
6
7
 
7
8
  describe('Create Item page - Graphing: All or nothing with alternative answer', () => {
8
9
  before(() => {
@@ -68,6 +69,24 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
68
69
  graphingPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
69
70
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
70
71
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
72
+ if (alternativeAnswerCheck === 'true') {
73
+ // Correct answer label and points
74
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
75
+ // Alternative answer toggle
76
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
77
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
78
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
79
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
80
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
81
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
82
+ // Alternate answer section
83
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(12 points)', 1);
84
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 2);
85
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
86
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
87
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 2);
88
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
89
+ }
71
90
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
72
91
 
73
92
  /*cy.log('When the user switches to \'Grading view\' without attempting the question and clicks on \'Check answer\' button, status message and correct answer section should not be displayed')
@@ -100,6 +119,9 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
100
119
  //Correct/incorrect icon
101
120
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
102
121
  graphingPage.steps.verifyCorrectAnswerSectionNotExist();
122
+ if (alternativeAnswerCheck === 'true') {
123
+ graphingPage.steps.verifyShowAlternativeAnswersToggleNotExists();
124
+ }
103
125
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
104
126
 
105
127
  /*cy.log('When the user attempts the question with responses from the correct accordion and clicks on \'Check answer\' button, the attempted graph should be displayed correct, a status message with text \'Your answer is correct\' and correct answer section should not be displayed')
@@ -161,6 +183,9 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
161
183
  //Correct/incorrect icon
162
184
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('correct')
163
185
  graphingPage.steps.verifyCorrectAnswerSectionNotExist();
186
+ if (alternativeAnswerCheck === 'true') {
187
+ graphingPage.steps.verifyShowAlternativeAnswersToggleNotExists();
188
+ }
164
189
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
165
190
 
166
191
  /*cy.log('When the user attempts the question with responses from the alternative accordion and clicks on \'Check answer\' button, the attempted graph should be displayed correct, a status message with text \'Your answer is correct\' and correct answer section should not be displayed')
@@ -202,6 +227,24 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
202
227
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect')
203
228
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
204
229
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
230
+ if (alternativeAnswerCheck === 'true') {
231
+ // Correct answer label and points
232
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
233
+ // Alternative answer toggle
234
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
235
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
236
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
237
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
238
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
239
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
240
+ // Alternate answer section
241
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(12 points)', 1);
242
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 2);
243
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
244
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
245
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 2);
246
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
247
+ }
205
248
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
206
249
 
207
250
  /*cy.log('When the user attempts the question with partially correct responses exclusively from the correct accordion and clicks on \'Check answer\' button, the attempted graph should be displayed correct, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed')
@@ -243,6 +286,24 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
243
286
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect')
244
287
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
245
288
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
289
+ if (alternativeAnswerCheck === 'true') {
290
+ // Correct answer label and points
291
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
292
+ // Alternative answer toggle
293
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
294
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
295
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
296
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
297
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
298
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
299
+ // Alternate answer section
300
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(12 points)', 1);
301
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 2);
302
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
303
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
304
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 2);
305
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
306
+ }
246
307
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
247
308
 
248
309
  /*cy.log('When the user attempts the question with partially correct responses exclusively from the alternative accordion and clicks on \'Check answer\' button, the attempted graph should be displayed correct, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed')
@@ -286,6 +347,24 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
286
347
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect')
287
348
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
288
349
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
350
+ if (alternativeAnswerCheck === 'true') {
351
+ // Correct answer label and points
352
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
353
+ // Alternative answer toggle
354
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
355
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
356
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
357
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
358
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
359
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
360
+ // Alternate answer section
361
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(12 points)', 1);
362
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 2);
363
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
364
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
365
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 2);
366
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
367
+ }
289
368
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
290
369
 
291
370
  /*cy.log('When the user attempts the question with equal number responses from the correct and alternative accordion and clicks on \'Check answer\' button, the attempted graph should be displayed correct, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed')
@@ -326,6 +405,24 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
326
405
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect')
327
406
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
328
407
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }]);
408
+ if (alternativeAnswerCheck === 'true') {
409
+ // Correct answer label and points
410
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
411
+ // Alternative answer toggle
412
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
413
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
414
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
415
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
416
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
417
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
418
+ // Alternate answer section
419
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(12 points)', 1);
420
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 2);
421
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
422
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
423
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 2);
424
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
425
+ }
329
426
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
330
427
 
331
428
  /*cy.log('When the user attempts the question with common response from the alternative accordion and clicks on \'Check answer\' button, the attempted graph should be displayed correct, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed')
@@ -365,6 +462,24 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
365
462
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect')
366
463
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
367
464
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
465
+ if (alternativeAnswerCheck === 'true') {
466
+ // Correct answer label and points
467
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
468
+ // Alternative answer toggle
469
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
470
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
471
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
472
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
473
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
474
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
475
+ // Alternate answer section
476
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(12 points)', 1);
477
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 2);
478
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
479
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 1, yRange: 20 }, { x: 0, xRange: 20, y: 2, yRange: 20 }]);
480
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 2);
481
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
482
+ }
368
483
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
369
484
 
370
485
  /*cy.log('When the user has attempted the question with incorrect responses and clicks on \'Check answer\' button, then 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')
@@ -423,6 +538,9 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
423
538
  graphingPage.steps.switchToGradingView();
424
539
  graphingPage.steps.verifyCorrectAnswerSectionNotExist();
425
540
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
541
+ if (alternativeAnswerCheck === 'true') {
542
+ graphingPage.steps.verifyShowAlternativeAnswersToggleNotExists();
543
+ }
426
544
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
427
545
  });
428
546
 
@@ -433,6 +551,9 @@ describe('Create Item page - Graphing: All or nothing with alternative answer',
433
551
  graphingPage.steps.switchToGradingView();
434
552
  graphingPage.steps.verifyCorrectAnswerSectionNotExist();
435
553
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
554
+ if (alternativeAnswerCheck === 'true') {
555
+ graphingPage.steps.verifyShowAlternativeAnswersToggleNotExists();
556
+ }
436
557
  graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
437
558
  });
438
559
  });
@@ -7,6 +7,7 @@ const unselectedToolOption = ['Circle', 'Parabola', 'Sine', 'Polygon'];
7
7
  const views = utilities.getViews(correctAnswerViews);
8
8
  var itemReferenceID = "";
9
9
  const css = Cypress.env('css');
10
+ const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT');
10
11
 
11
12
  describe('Create Item page - Graphing: All or nothing ', () => {
12
13
  before(() => {
@@ -297,10 +298,276 @@ describe('Create Item page - Graphing: All or nothing ', () => {
297
298
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphPreviewTab([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
298
299
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
299
300
  graphingPage.steps.verifyCorrectAnswerSectionNotExist();
301
+ if (alternativeAnswerCheck === 'true') {
302
+ graphingPage.steps.verifyShowAlternativeAnswersToggleNotExists();
303
+ }
300
304
  });
301
305
  });
302
306
  });
303
307
 
308
+ if (alternativeAnswerCheck === 'true') {
309
+ views.forEach((view) => {
310
+ describe(`Graphing: All or nothing scoring with alternative answer section - ${view}`, { tags: 'smoke' }, () => {
311
+ abortEarlySetup();
312
+ before(() => {
313
+ switch (view) {
314
+ case 'Question preview':
315
+ graphingPage.steps.navigateToCreateQuestion('Graphing');
316
+ cy.barsPreLoaderWait();
317
+ graphingPage.steps.allotPoints(20);
318
+ graphingPage.steps.addTextInQuestionInstructionsInputField('Plot the graph');
319
+ graphingPage.steps.selectToolOptions(unselectedToolOption);
320
+ graphingPage.steps.checkPatternBackground();
321
+ graphingPage.steps.selectGraphToolOptionEditTab('Line');
322
+ graphingPage.steps.plotPointsOnGraphEditTab([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
323
+ graphingPage.steps.verifyPointsPlottedOnEditTabGraph([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
324
+ graphingPage.steps.selectGraphToolOptionEditTab('Circle');
325
+ graphingPage.steps.plotPointsOnGraphEditTab([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
326
+ graphingPage.steps.verifyPointsPlottedOnEditTabGraph([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
327
+ graphingPage.steps.selectGraphToolOptionSpecifyCorrectAnswer('Polygon');
328
+ graphingPage.steps.plotPointsOnGraphSpecifyCorrectAnswerSection([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
329
+ graphingPage.steps.verifyPointsPlottedOnSpecifyCorrectAnswerSection([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
330
+ graphingPage.steps.selectGraphToolOptionSpecifyCorrectAnswer('Vector');
331
+ graphingPage.steps.plotPointsOnGraphSpecifyCorrectAnswerSection([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
332
+ graphingPage.steps.verifyPointsPlottedOnSpecifyCorrectAnswerSection([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
333
+ graphingPage.steps.addAlternativeAnswerAccordion(1);
334
+ graphingPage.steps.allotPoints(20);
335
+ graphingPage.steps.selectGraphToolOptionSpecifyCorrectAnswer('Vector');
336
+ graphingPage.steps.plotPointsOnGraphSpecifyCorrectAnswerSection([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
337
+ graphingPage.steps.verifyPointsPlottedOnSpecifyCorrectAnswerSection([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
338
+ graphingPage.steps.switchToPreviewTab();
339
+ break;
340
+ case 'Item preview':
341
+ cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
342
+ itemPreviewPage.steps.switchToPreviewTab();
343
+ break;
344
+ case 'Grading view':
345
+ cy.wait(5000);
346
+ cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
347
+ break;
348
+ }
349
+ });
350
+
351
+ beforeEach(() => {
352
+ switch (view) {
353
+ case 'Question preview':
354
+ graphingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
355
+ graphingPage.steps.resetQuestionPreview();
356
+ break;
357
+ case 'Item preview':
358
+ itemPreviewPage.steps.switchToStudentView();
359
+ itemPreviewPage.steps.resetQuestionPreview();
360
+ break;
361
+ case 'Grading view':
362
+ cy.wait(5000);
363
+ cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
364
+ break;
365
+ }
366
+ });
367
+
368
+ if (view === 'Question preview') {
369
+ after(() => {
370
+ graphingPage.steps.clickOnSaveQuestionButton();
371
+ utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
372
+ itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
373
+ });
374
+ };
375
+ // Not attempted
376
+ it('When the user selects \'Grading\' view without attempting the question, the correct answer should be displayed in the correct answer section graph and correct/incorrect status message should not be displayed', () => {
377
+ if (view === 'Grading view') {
378
+ studentViewPage.steps.submitResponse();
379
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
380
+ studentViewPage.steps.clickOnGoToGradingViewButton();
381
+ gradingViewPage.steps.verifyGradingViewScore(0, 20);
382
+ }
383
+ if (view === 'Question preview' || view === 'Item preview') {
384
+ graphingPage.steps.switchToGradingView();
385
+ graphingPage.steps.verifyPreviewScore(0, 20);
386
+ }
387
+ //Preview tab
388
+ utilities.verifyElementCount(graphingPage.graphCirclePreviewTab(), 1);
389
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
390
+ utilities.verifyElementCount(graphingPage.graphLinePreviewTab(), 1);
391
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
392
+
393
+ //Correct answer section
394
+ utilities.verifyElementCount(graphingPage.graphCircleCorrectAnswerSection(), 1);
395
+ graphingPage.steps.verifyPointsPlottedOnCorrectAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
396
+ utilities.verifyElementCount(graphingPage.graphLineCorrectAnswerSection(), 2);
397
+ graphingPage.steps.verifyPointsPlottedOnCorrectAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
398
+ utilities.verifyElementCount(graphingPage.graphPolygonCorrectAnswerSection(), 1);
399
+
400
+ //Correct/incorrect icon
401
+ //TODO: Remove comment after https://redmine.zeuslearning.com/issues/565569 is resolved
402
+ //graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
403
+ graphingPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
404
+ graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
405
+ graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
406
+ // Correct answer label and points
407
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
408
+ // Alternative answer toggle
409
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
410
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
411
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
412
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
413
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
414
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
415
+ // Alternate answer section
416
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(20 points)', 1);
417
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 1);
418
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
419
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 2);
420
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
421
+ });
422
+ // Attempted incorrectly
423
+ it('When the user attempts the question incorrectly then the user should be awarded with 0 points and on switching to grading view \'Your answer is incorrect\' should be displayed and the attempted graph should be displayed incorrect and the the correct answers should be displayed in the correct answer section graph', () => {
424
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Circle');
425
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: -2, xRange: 20, y: 1, yRange: 20 }, { x: -4, xRange: 20, y: 1, yRange: 20 }]);
426
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: -2, xRange: 20, y: 1, yRange: 20 }, { x: -4, xRange: 20, y: 1, yRange: 20 }]);
427
+ if (view === 'Grading view') {
428
+ studentViewPage.steps.submitResponse();
429
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
430
+ studentViewPage.steps.clickOnGoToGradingViewButton();
431
+ gradingViewPage.steps.verifyGradingViewScore(0, 20);
432
+ }
433
+ if (view === 'Question preview' || view === 'Item preview') {
434
+ graphingPage.steps.verifyPreviewScore(0, 20);
435
+ graphingPage.steps.switchToGradingView();
436
+ utilities.verifyElementCount(graphingPage.graphCirclePreviewTab(), 2);
437
+ }
438
+ //Preview tab
439
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
440
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: -2, xRange: 20, y: 1, yRange: 20 }, { x: -4, xRange: 20, y: 1, yRange: 20 }]);
441
+ utilities.verifyElementCount(graphingPage.graphLinePreviewTab(), 1);
442
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
443
+ graphingPage.steps.verifyIncorrectPointsPlottedOnGraphPreviewTab([{ x: -2, xRange: 20, y: 1, yRange: 20 }, { x: -4, xRange: 20, y: 1, yRange: 20 }]);
444
+
445
+ //Correct answer section
446
+ utilities.verifyElementCount(graphingPage.graphCircleCorrectAnswerSection(), 1);
447
+ graphingPage.steps.verifyPointsPlottedOnCorrectAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
448
+ utilities.verifyElementCount(graphingPage.graphLineCorrectAnswerSection(), 2);
449
+ graphingPage.steps.verifyPointsPlottedOnCorrectAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
450
+ graphingPage.steps.verifyPointsPlottedOnCorrectAnswerSection([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
451
+ utilities.verifyElementCount(graphingPage.graphPolygonCorrectAnswerSection(), 1);
452
+
453
+ //Correct/incorrect icon
454
+ graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
455
+ graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
456
+ graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
457
+
458
+ // Correct answer label and points
459
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
460
+ // Alternative answer toggle
461
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
462
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
463
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
464
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
465
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
466
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
467
+ // Alternate answer section
468
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(20 points)', 1);
469
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 1);
470
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
471
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 2);
472
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
473
+ });
474
+ // Attempted partially correct
475
+ it('When the user attempts the question partially correct with an incorrect response then the user should be awarded with 0 points and on switching to grading view \'Your answer is incorrect\' should be displayed and the attempted graph should be displayed correct for the correct response and incorrect for the incorrect response and the the correct answers should be displayed in the correct answer section graph', () => {
476
+ if (view === 'Grading view') {
477
+ studentViewPage.steps.clearResponses();
478
+ }
479
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Polygon');
480
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: -3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: -4, yRange: 20 }, { x: -3, xRange: 20, y: 4, yRange: 20 }]);
481
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Polygon');
482
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
483
+ if (view === 'Grading view') {
484
+ studentViewPage.steps.submitResponse();
485
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
486
+ studentViewPage.steps.clickOnGoToGradingViewButton();
487
+ gradingViewPage.steps.verifyGradingViewScore(0, 20);
488
+ }
489
+ if (view === 'Question preview' || view === 'Item preview') {
490
+ graphingPage.steps.verifyPreviewScore(0, 20);
491
+ graphingPage.steps.switchToGradingView();
492
+ utilities.verifyElementCount(graphingPage.graphCirclePreviewTab(), 1);
493
+ utilities.verifyElementCount(graphingPage.graphLinePreviewTab(), 1);
494
+ utilities.verifyElementCount(graphingPage.graphPolygonPreviewTab(), 2);
495
+ }
496
+ //Preview tab
497
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
498
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
499
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: -3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: -4, yRange: 20 }, { x: -3, xRange: 20, y: 4, yRange: 20 }]);
500
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
501
+ graphingPage.steps.verifyCorrectPointsPlottedOnGraphPreviewTab([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
502
+ graphingPage.steps.verifyIncorrectPointsPlottedOnGraphPreviewTab([{ x: -3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: -4, yRange: 20 }, { x: -3, xRange: 20, y: 4, yRange: 20 }]);
503
+
504
+ //Correct answer section
505
+ utilities.verifyElementCount(graphingPage.graphCircleCorrectAnswerSection(), 1);
506
+ graphingPage.steps.verifyPointsPlottedOnCorrectAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
507
+ utilities.verifyElementCount(graphingPage.graphLineCorrectAnswerSection(), 2);
508
+ graphingPage.steps.verifyPointsPlottedOnCorrectAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
509
+ graphingPage.steps.verifyPointsPlottedOnCorrectAnswerSection([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
510
+ utilities.verifyElementCount(graphingPage.graphPolygonCorrectAnswerSection(), 1);
511
+
512
+ //Correct/incorrect icon
513
+ graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
514
+ graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
515
+ graphingPage.steps.verifyCorrectPointsPlottedOnGraphCorrectAnswerSection([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
516
+ // Correct answer label and points
517
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(20 points)', 0);
518
+ // Alternative answer toggle
519
+ graphingPage.steps.verifyShowAlternativeAnswersToggleExists();
520
+ graphingPage.steps.disableShowAlternativeAnswersToggle();
521
+ graphingPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
522
+ graphingPage.steps.verifyAlternativeAnswersSectionNotExist();
523
+ graphingPage.steps.clickShowAlternativeAnswersToggle();
524
+ graphingPage.steps.verifyShowAlternativeAnswersToggleChecked();
525
+ // Alternate answer section
526
+ graphingPage.steps.verifyAnswerLabelAndPoints('Alternative answer', '(20 points)', 1);
527
+ utilities.verifyElementCount(graphingPage.graphCircleAlternativeAnswerSection(), 1);
528
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
529
+ utilities.verifyElementCount(graphingPage.graphLineAlternativeAnswerSection(), 2);
530
+ graphingPage.steps.verifyPointsPlottedOnAlternativeAnswerSection([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
531
+ });
532
+ // Attempted correctly
533
+ it('When the user attempts the question correctly then the user should be awarded with full points and on switching to grading view \'Your answer is correct\' should be displayed and the attempted graph should be displayed correct and the correct answer section graph should not be displayed', () => {
534
+ if (view === 'Grading view') {
535
+ studentViewPage.steps.clearResponses();
536
+ }
537
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Polygon');
538
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
539
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Vector');
540
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
541
+
542
+ if (view === 'Grading view') {
543
+ studentViewPage.steps.submitResponse();
544
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
545
+ studentViewPage.steps.clickOnGoToGradingViewButton();
546
+ gradingViewPage.steps.verifyGradingViewScore(20, 20);
547
+ }
548
+ if (view === 'Question preview' || view === 'Item preview') {
549
+ graphingPage.steps.verifyPreviewScore(20, 20);
550
+ graphingPage.steps.switchToGradingView();
551
+ utilities.verifyElementCount(graphingPage.graphCirclePreviewTab(), 1);
552
+ utilities.verifyElementCount(graphingPage.graphLinePreviewTab(), 2);
553
+ utilities.verifyElementCount(graphingPage.graphPolygonPreviewTab(), 1);
554
+ }
555
+ //Preview tab
556
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
557
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
558
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
559
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
560
+ graphingPage.steps.verifyCorrectPointsPlottedOnGraphPreviewTab([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
561
+ graphingPage.steps.verifyCorrectPointsPlottedOnGraphPreviewTab([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
562
+ graphingPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
563
+ graphingPage.steps.verifyShowAlternativeAnswersToggleNotExists();
564
+ graphingPage.steps.verifyCorrectAnswerSectionNotExist();
565
+ graphingPage.steps.verifyShowAlternativeAnswersToggleNotExists();
566
+ });
567
+ });
568
+ });
569
+ }
570
+
304
571
  describe('Graphing: Line tool - All or nothing', { tags: 'smoke' }, () => {
305
572
  abortEarlySetup();
306
573
  before(() => {
@@ -913,6 +1180,9 @@ describe('Create Item page - Graphing: All or nothing ', () => {
913
1180
  graphingPage.steps.verifyCorrectIncorrectIconsNotExist();
914
1181
  graphingPage.steps.verifyCorrectIncorrectBorderNotExists();
915
1182
  graphingPage.steps.verifyCorrectAnswerSectionNotExist();
1183
+ if (alternativeAnswerCheck === 'true') {
1184
+ graphingPage.steps.verifyShowAlternativeAnswersToggleNotExists();
1185
+ }
916
1186
  });
917
1187
  });
918
1188
  });
@@ -1047,6 +1317,9 @@ describe('Create Item page - Graphing: All or nothing ', () => {
1047
1317
  graphingPage.steps.verifyCorrectPointsPlottedOnGraphPreviewTab([{ x: 1, xRange: 20, y: 4, yRange: 20 }, { x: 1, xRange: 20, y: 2, yRange: 20 }, { x: 3, xRange: 20, y: 2, yRange: 20 }, { x: 3, xRange: 20, y: 4, yRange: 20 }, { x: 1, xRange: 20, y: 4, yRange: 20 }]);
1048
1318
  graphingPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
1049
1319
  graphingPage.steps.verifyCorrectAnswerSectionNotExist();
1320
+ if (alternativeAnswerCheck === 'true') {
1321
+ graphingPage.steps.verifyShowAlternativeAnswersToggleNotExists();
1322
+ }
1050
1323
  });
1051
1324
  });
1052
1325
  });
@@ -6,6 +6,7 @@ let gradingAndCorrectAnsView = ['Grading view', 'Correct answer view']
6
6
  const views = utilities.getViews(gradingAndCorrectAnsView);
7
7
  var itemReferenceID = "";
8
8
  const css = Cypress.env('css');
9
+ const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT');
9
10
 
10
11
  const unselectedToolOption = ['Circle', 'Parabola', 'Sine', 'Polygon'];
11
12
 
@@ -78,7 +79,11 @@ describe('Create item page - Graphing: Grading view, Correct answer view content
78
79
  });
79
80
 
80
81
  it('Correct answer label should be displayed', () => {
81
- utilities.verifyInnerText(graphingPage.correctAnswerLabel(), 'Correct answers');
82
+ if (alternativeAnswerCheck === 'true') {
83
+ graphingPage.steps.verifyAnswerLabelAndPoints('Correct answer', '(10 points)', 0);
84
+ } else {
85
+ utilities.verifyInnerText(graphingPage.correctAnswerLabel(), 'Correct answers');
86
+ }
82
87
  utilities.verifyElementVisibilityState(graphingPage.correctAnswerLabel(), 'visible');
83
88
  });
84
89
 
@@ -1,5 +1,5 @@
1
1
  import utilities from "../support/helpers/utilities";
2
- import { questionInstructionsComponent, createQuestionBasePage, scoringSectionBaseEditTab, autoScoredScoringPreviewTab, autoScoredStudentViewSettings, autoScoredSpecifyCorrectAnswerSection, commonComponents, backgroundImageUploadComponent, imageCanvasComponent, opacityComponent, autoScoredScoringSectionMultiResponseType, additionalSettingsPanel, additionalSettingsAccessibilitySectionComponent, toolsAndControlsComponent, resetPopupComponent, defaultToolDropdown } from "./components";
2
+ import { questionInstructionsComponent, createQuestionBasePage, scoringSectionBaseEditTab, autoScoredScoringPreviewTab, autoScoredStudentViewSettings, autoScoredSpecifyCorrectAnswerSection, commonComponents, backgroundImageUploadComponent, imageCanvasComponent, opacityComponent, autoScoredScoringSectionMultiResponseType, additionalSettingsPanel, additionalSettingsAccessibilitySectionComponent, toolsAndControlsComponent, resetPopupComponent, defaultToolDropdown, showAlternativeAnswersComponent } from "./components";
3
3
  import { createItemPage } from "./createItemPage";
4
4
  const css = Cypress.env('css');
5
5
 
@@ -17,6 +17,7 @@ const selectors = {
17
17
  ...toolsAndControlsComponent,
18
18
  ...resetPopupComponent,
19
19
  ...defaultToolDropdown,
20
+ ...showAlternativeAnswersComponent,
20
21
 
21
22
  //Edit tab
22
23
  graphEditTab: () => cy.get('[class*="GraphingWrapper"] .ngie-jxgbox svg'),
@@ -235,13 +236,18 @@ const selectors = {
235
236
  //Correct answer section
236
237
  correctAnswerLabel: () => cy.get('[class*="AnswerLabel"]'),
237
238
  graphCorrectAnswerSection: () => cy.get('[class*="GraphingQuestion"] .ngie-jxgbox svg'),
239
+ graphAlternativeAnswerSection: () => cy.get('[class*="GraphingQuestion"] .ngie-jxgbox svg').eq(1),
238
240
  graphCircleCorrectAnswerSection: () => cy.get('[class*="GraphingQuestion"] .ngie-jxgbox').eq(1).find('ellipse[fill-opacity="0"]'),
241
+ graphCircleAlternativeAnswerSection: () => cy.get('[class*="GraphingQuestion"] .ngie-jxgbox').eq(2).find('ellipse[fill-opacity="0"]'),
239
242
  graphLineCorrectAnswerSection: () => cy.get('[class*="GraphingQuestion"] .ngie-jxgbox').eq(1).find('line[tabindex="0"][stroke-width="2px"]'),
243
+ graphLineAlternativeAnswerSection: () => cy.get('[class*="GraphingQuestion"] .ngie-jxgbox').eq(2).find('line[tabindex="0"][stroke-width="2px"]'),
240
244
  graphPolygonCorrectAnswerSection: () => cy.get('[class*="GraphingQuestion"] .ngie-jxgbox').eq(1).find('polygon'),
245
+ graphPolygonAlternativeAnswerSection: () => cy.get('[class*="GraphingQuestion"] .ngie-jxgbox').eq(2).find('polygon'),
241
246
  graphSineWaveCorrectAnswerSection: () => cy.get('[class*="GraphingQuestion"] .ngie-jxgbox').eq(1).find('[pointer-events="visiblePainted"][tabindex="0"][fill-rule="evenodd"]'),
242
247
  correctIncorrectStatusMessageText: () => cy.get('[class*="Graphingstyles__CorrectIncorrectWrapper"]'),
243
248
  incorrectIcon: () => cy.get('[data-icon="Incorrect"]'),
244
249
  correctIcon: () => cy.get('[data-icon="CorrectAnswer"]'),
250
+ correctAnswerLabelWrapper: () => cy.get('[class*="CorrectAnswerLabelWrapper"]'),
245
251
 
246
252
  //Accept repeated points
247
253
  acceptRepeatedPointsToggle: () => cy.get('.repeated-points-wrapper input'),
@@ -266,6 +272,7 @@ const steps = {
266
272
  ...resetPopupComponent.steps,
267
273
  ...defaultToolDropdown.steps,
268
274
  ...createItemPage.steps,
275
+ ...showAlternativeAnswersComponent.steps,
269
276
 
270
277
  //Edit tab
271
278
  checkPatternBackground: () => {
@@ -1714,6 +1721,31 @@ const steps = {
1714
1721
  });
1715
1722
  },
1716
1723
 
1724
+ verifyPointsPlottedOnAlternativeAnswerSection: (coordinates) => {
1725
+ coordinates.forEach(({ x, xRange, y, yRange }) => {
1726
+ graphingPage.graphAlternativeAnswerSection()
1727
+ .then(($graphElement) => {
1728
+ const graphWidth = $graphElement[0].clientWidth;
1729
+ const graphHeight = $graphElement[0].clientHeight;
1730
+ const originX = graphWidth / 2;
1731
+ const originY = graphHeight / 2;
1732
+ const xPixel = originX + x * (graphWidth / (xRange + 1));
1733
+ const yPixel = originY - y * (graphHeight / (yRange + 1));
1734
+ cy.get('[class*="GraphingQuestion"] .ngie-jxgbox svg').eq(1).find(`ellipse[display="inline"][cx*="${xPixel}"][cy*="${yPixel}"]`)
1735
+ .should('be.visible');
1736
+ });
1737
+ });
1738
+ },
1739
+
1740
+ verifyAnswerLabelAndPoints: (expectedLabel, expectedPoints, sectionIndex = 0) => {
1741
+ graphingPage.correctAnswerLabelWrapper()
1742
+ .eq(sectionIndex)
1743
+ .within(() => {
1744
+ cy.contains(expectedLabel).should('be.visible');
1745
+ cy.get('p').should('contain.text', expectedPoints);
1746
+ });
1747
+ },
1748
+
1717
1749
  /**
1718
1750
  * This function verifies the plotted points are correct
1719
1751
  * @param {Object[]} coordinates - An array containing x and x coordinates along with their range
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.588",
3
+ "version": "1.0.589",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {