itemengine-cypress-automation 1.0.555-IEI-7011-c2dcb32.0 → 1.0.555-IEI-7011-3dd44e2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cypress/e2e/ILC/MultipleSelection/allOrNothingWithAlternativeAnswer.js +83 -0
- package/cypress/pages/components/index.js +1 -0
- package/cypress/pages/components/showAlternativeAnswersComponent.js +169 -0
- package/cypress/pages/multipleSelectionPage.js +3 -1
- package/cypress/pages/singleSelectionPage.js +3 -155
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import { multipleSelectionPage } from "../../../pages";
|
|
|
2
2
|
import abortEarlySetup from "../../../support/helpers/abortEarly";
|
|
3
3
|
import utilities from "../../../support/helpers/utilities";
|
|
4
4
|
const css = Cypress.env('css');
|
|
5
|
+
const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT');
|
|
5
6
|
const options = ['Pollution caused by treating chemical waste', 'Pollution caused by cement production', 'Pollution caused by methane production', 'Pollution caused by cement and methane production', 'Pollution caused by electronic waste', 'Pollution caused by nuclear waste'];
|
|
6
7
|
|
|
7
8
|
describe('Create item page - Multiple selection: All or nothing with alternative answer', () => {
|
|
@@ -65,6 +66,9 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
65
66
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(5);
|
|
66
67
|
multipleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
|
|
67
68
|
multipleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
|
|
69
|
+
if (alternativeAnswerCheck === 'true') {
|
|
70
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
|
|
71
|
+
}
|
|
68
72
|
//multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
69
73
|
/*cy.log('When the user has attempted the question with responses from the correct accordion and clicks on \'Check answer\' button, then correct icons should be displayed besides correct responses, and status message \'Your answer is correct\' should be displayed below the question preview')
|
|
70
74
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -112,6 +116,9 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
112
116
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(5);
|
|
113
117
|
multipleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
|
|
114
118
|
multipleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
|
|
119
|
+
if (alternativeAnswerCheck === 'true') {
|
|
120
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
|
|
121
|
+
}
|
|
115
122
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
116
123
|
/*cy.log('When the user has attempted the question with responses from the alternative accordion and clicks on \'Check answer\' button, then correct icons should only be displayed besides correct responses from the alternative accordion, and status message \'Your answer is correct\' should be displayed below the question preview')
|
|
117
124
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -143,6 +150,10 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
143
150
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(3);
|
|
144
151
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(4);
|
|
145
152
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(5);
|
|
153
|
+
//show alternative answers
|
|
154
|
+
if (alternativeAnswerCheck === 'true') {
|
|
155
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 10);
|
|
156
|
+
}
|
|
146
157
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
147
158
|
/*cy.log('When the user has attempted the question with partially correct responses exclusively from the correct accordion and clicks on \'Check answer\' button, then correct icons should only be displayed besides correct responses from the correct accordion, correct icons should not be displayed besides unattempted correct options, incorrect icon should be displayed besides the incorrect responses, and status message \'Your answer is incorrect\' should be displayed below the question preview')
|
|
148
159
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -174,6 +185,10 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
174
185
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(3);
|
|
175
186
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(4);
|
|
176
187
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(5);
|
|
188
|
+
//show alternative answers
|
|
189
|
+
if (alternativeAnswerCheck === 'true') {
|
|
190
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 10);
|
|
191
|
+
}
|
|
177
192
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
178
193
|
/*cy.log('When the user has attempted the question with partially correct responses exclusively from the alternative accordion and clicks on \'Check answer\' button, then correct icons should only be displayed besides correct responses from the alternative accordion, correct icons should not be displayed besides unattempted correct options, incorrect icon should be displayed besides the incorrect responses, and status message \'Your answer is incorrect\' should be displayed below the question preview')
|
|
179
194
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -204,6 +219,10 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
204
219
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(3);
|
|
205
220
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(4);
|
|
206
221
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(5);
|
|
222
|
+
//show alternative answers
|
|
223
|
+
if (alternativeAnswerCheck === 'true') {
|
|
224
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 10);
|
|
225
|
+
}
|
|
207
226
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
208
227
|
/*cy.log('When the user has attempted the question with equal number of correct responses from correct accordion and alternative accordion, then correct icon should be displayed besides correct accordion answer responses, correct icons should not be displayed besides unattempted correct options, incorrect icon should be displayed besides alternative accordion answer responses, and status message \'Your answer is incorrect\' should be displayed below the question preview')
|
|
209
228
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -234,6 +253,10 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
234
253
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(3);
|
|
235
254
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(4);
|
|
236
255
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(5);
|
|
256
|
+
//show alternative answers
|
|
257
|
+
if (alternativeAnswerCheck === 'true') {
|
|
258
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 10);
|
|
259
|
+
}
|
|
237
260
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
238
261
|
/*cy.log('When the user has attempted the question with the common response between correct accordion and alternative accordion, and clicks on \'Check answer\' button, then correct icons should only be displayed besides correct responses from the correct accordion, correct icons should not be displayed besides unattempted correct options, and status message \'Your answer is incorrect\' should be displayed below the question preview')
|
|
239
262
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -262,6 +285,10 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
262
285
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(3);
|
|
263
286
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(4);
|
|
264
287
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(5);
|
|
288
|
+
//show alternative answers
|
|
289
|
+
if (alternativeAnswerCheck === 'true') {
|
|
290
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 10);
|
|
291
|
+
}
|
|
265
292
|
// multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
266
293
|
/*cy.log('When the user has attempted the question incorrectly and clicks on \'Check answer\' button, then incorrect icons should only be displayed besides incorrect responses, correct icons should not be displayed besides unattempted correct options, and status message \'Your answer is incorrect\' should be displayed below the question preview')
|
|
267
294
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -351,6 +378,10 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
351
378
|
multipleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(3);
|
|
352
379
|
multipleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(4);
|
|
353
380
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(5);
|
|
381
|
+
//show alternative answers
|
|
382
|
+
if (alternativeAnswerCheck === 'true') {
|
|
383
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 10);
|
|
384
|
+
}
|
|
354
385
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
355
386
|
});
|
|
356
387
|
|
|
@@ -368,6 +399,9 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
368
399
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(5);
|
|
369
400
|
multipleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
|
|
370
401
|
multipleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
|
|
402
|
+
if (alternativeAnswerCheck === 'true') {
|
|
403
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
|
|
404
|
+
}
|
|
371
405
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
372
406
|
/*cy.log('When the user has attempted the question with responses from the correct accordion and clicks on \'Check answer\' button, then correct icons should be displayed besides correct responses, and status message \'Your answer is correct\' should be displayed below the question preview')
|
|
373
407
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -394,6 +428,9 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
394
428
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(5);
|
|
395
429
|
multipleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
|
|
396
430
|
multipleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
|
|
431
|
+
if (alternativeAnswerCheck === 'true') {
|
|
432
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
|
|
433
|
+
}
|
|
397
434
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
398
435
|
/*cy.log('When the user has attempted the question with responses from the alternative accordion and clicks on \'Check answer\' button, then correct icons should only be displayed besides correct responses from the alternative accordion, and status message \'Your answer is correct\' should be displayed below the question preview')
|
|
399
436
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -426,6 +463,10 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
426
463
|
multipleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(3);
|
|
427
464
|
multipleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(4);
|
|
428
465
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(5);
|
|
466
|
+
//show alternative answers
|
|
467
|
+
if (alternativeAnswerCheck === 'true') {
|
|
468
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 10);
|
|
469
|
+
}
|
|
429
470
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
430
471
|
/*cy.log('When the user has attempted the question with partially correct responses exclusively from the correct accordion and clicks on \'Check answer\' button, then correct icons should only be displayed besides correct responses from the correct accordion, correct icons should not be displayed besides unattempted correct options, incorrect icon should be displayed besides the incorrect responses, and status message \'Your answer is incorrect\' should be displayed below the question preview')
|
|
431
472
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -456,6 +497,10 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
456
497
|
multipleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(3);
|
|
457
498
|
multipleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(4);
|
|
458
499
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(5);
|
|
500
|
+
//show alternative answers
|
|
501
|
+
if (alternativeAnswerCheck === 'true') {
|
|
502
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 10);
|
|
503
|
+
}
|
|
459
504
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
460
505
|
/*cy.log('When the user has attempted the question with partially correct responses exclusively from the alternative accordion and clicks on \'Check answer\' button, then correct icons should only be displayed besides correct responses from the alternative accordion, correct icons should not be displayed besides unattempted correct options, incorrect icon should be displayed besides the incorrect responses, and status message \'Your answer is incorrect\' should be displayed below the question preview')
|
|
461
506
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -486,6 +531,10 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
486
531
|
multipleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(3);
|
|
487
532
|
multipleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(4);
|
|
488
533
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(5);
|
|
534
|
+
//show alternative answers
|
|
535
|
+
if (alternativeAnswerCheck === 'true') {
|
|
536
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 10);
|
|
537
|
+
}
|
|
489
538
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
490
539
|
/*cy.log('When the user has attempted the question with equal number of correct responses from correct accordion and alternative accordion, then correct icon should be displayed besides alternative accordion answer responses, correct icons should not be displayed besides unattempted correct options, incorrect icon should be displayed besides correct accordion answer responses, and status message \'Your answer is incorrect\' should be displayed below the question preview')
|
|
491
540
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -515,6 +564,10 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
515
564
|
multipleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(3);
|
|
516
565
|
multipleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(4);
|
|
517
566
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(5);
|
|
567
|
+
//show alternative answers
|
|
568
|
+
if (alternativeAnswerCheck === 'true') {
|
|
569
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 10);
|
|
570
|
+
}
|
|
518
571
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
519
572
|
/*cy.log('When the user has attempted the question with the common response between correct accordion and alternative accordion, and clicks on \'Check answer\' button, then correct icons should only be displayed besides the common response, correct icons should not be displayed besides unattempted correct options, and status message \'Your answer is incorrect\' should be displayed below the question preview')
|
|
520
573
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -543,6 +596,10 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
543
596
|
multipleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(3);
|
|
544
597
|
multipleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(4);
|
|
545
598
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(5);
|
|
599
|
+
//show alternative answers
|
|
600
|
+
if (alternativeAnswerCheck === 'true') {
|
|
601
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 10);
|
|
602
|
+
}
|
|
546
603
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
547
604
|
/*cy.log('When the user has attempted the question incorrectly and clicks on \'Check answer\' button, then incorrect icons should be displayed besides incorrect responses, correct icons should not be displayed besides unattempted correct options, and status message \'Your answer is incorrect\' should be displayed below the question preview')
|
|
548
605
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -593,6 +650,10 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
593
650
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(3);
|
|
594
651
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(4);
|
|
595
652
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(5);
|
|
653
|
+
//show alternative answers
|
|
654
|
+
if (alternativeAnswerCheck === 'true') {
|
|
655
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 20);
|
|
656
|
+
}
|
|
596
657
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
597
658
|
});
|
|
598
659
|
|
|
@@ -610,6 +671,9 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
610
671
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(5);
|
|
611
672
|
multipleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
|
|
612
673
|
multipleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
|
|
674
|
+
if (alternativeAnswerCheck === 'true') {
|
|
675
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
|
|
676
|
+
}
|
|
613
677
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
614
678
|
/*cy.log('When the user has attempted the question with responses from the correct accordion and clicks on \'Check answer\' button, then correct icons should be displayed besides correct responses, and status message \'Your answer is correct\' should be displayed below the question preview')
|
|
615
679
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -636,6 +700,9 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
636
700
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(5);
|
|
637
701
|
multipleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
|
|
638
702
|
multipleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
|
|
703
|
+
if (alternativeAnswerCheck === 'true') {
|
|
704
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
|
|
705
|
+
}
|
|
639
706
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
640
707
|
/*cy.log('When the user has attempted the question with responses from the alternative accordion and clicks on \'Check answer\' button, then correct icons should only be displayed besides correct responses from the alternative accordion, and status message \'Your answer is correct\' should be displayed below the question preview')
|
|
641
708
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -667,6 +734,10 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
667
734
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(3);
|
|
668
735
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(4);
|
|
669
736
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(5);
|
|
737
|
+
//show alternative answers
|
|
738
|
+
if (alternativeAnswerCheck === 'true') {
|
|
739
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 20);
|
|
740
|
+
}
|
|
670
741
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
671
742
|
/*cy.log('When the user has attempted the question with partially correct responses exclusively from the correct accordion and clicks on \'Check answer\' button, then correct icons should only be displayed besides correct responses from the correct accordion, correct icons should not be displayed besides unattempted correct options, incorrect icon should be displayed besides the incorrect responses, and status message \'Your answer is incorrect\' should be displayed below the question preview')
|
|
672
743
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -698,6 +769,10 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
698
769
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(3);
|
|
699
770
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(4);
|
|
700
771
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(5);
|
|
772
|
+
//show alternative answers
|
|
773
|
+
if (alternativeAnswerCheck === 'true') {
|
|
774
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 20);
|
|
775
|
+
}
|
|
701
776
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
702
777
|
/*cy.log('When the user has attempted the question with partially correct responses exclusively from the alternative accordion and clicks on \'Check answer\' button, then correct icons should only be displayed besides correct responses from the alternative accordion, correct icons should not be displayed besides unattempted correct options, incorrect icon should be displayed besides the incorrect responses, and status message \'Your answer is incorrect\' should be displayed below the question preview')
|
|
703
778
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -728,6 +803,10 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
728
803
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(3);
|
|
729
804
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(4);
|
|
730
805
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(5);
|
|
806
|
+
//show alternative answers
|
|
807
|
+
if (alternativeAnswerCheck === 'true') {
|
|
808
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 20);
|
|
809
|
+
}
|
|
731
810
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
732
811
|
/*cy.log('When the user has attempted the question with equal number of correct responses from correct accordion and alternative accordion, then correct icon should be displayed besides correct accordion answer responses, correct icons should not be displayed besides unattempted correct options, incorrect icon should be displayed besides alternative accordion answer responses, and status message \'Your answer is incorrect\' should be displayed below the question preview')
|
|
733
812
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -785,6 +864,10 @@ describe('Create item page - Multiple selection: All or nothing with alternative
|
|
|
785
864
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(3);
|
|
786
865
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(4);
|
|
787
866
|
multipleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleCorrectAnswerSection(5);
|
|
867
|
+
//show alternative answers
|
|
868
|
+
if (alternativeAnswerCheck === 'true') {
|
|
869
|
+
multipleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 20);
|
|
870
|
+
}
|
|
788
871
|
multipleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
789
872
|
/*cy.log('When the user has attempted the question incorrectly and clicks on \'Check answer\' button, then incorrect icons should only be displayed besides incorrect responses, correct icons should not be displayed besides unattempted correct options, and status message \'Your answer is incorrect\' should be displayed below the question preview')
|
|
790
873
|
multipleSelectionPage.steps.checkAnswer();
|
|
@@ -3,6 +3,7 @@ export * from './commonComponents';
|
|
|
3
3
|
export * from './additionalSettingsPanel';
|
|
4
4
|
export * from './mcqAdditionalSettingsBase';
|
|
5
5
|
export * from './questionInstructionsComponent';
|
|
6
|
+
export * from './showAlternativeAnswersComponent';
|
|
6
7
|
export * from './ckEditorToolbar';
|
|
7
8
|
export * from './essayResponseCommonComponents';
|
|
8
9
|
export * from './optionsWrapperComponent';
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Show Alternative Answers Component
|
|
3
|
+
* Common functionality for managing and verifying alternative answers toggle and content
|
|
4
|
+
* across different question types (Single Selection, Multiple Selection, etc.)
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const showAlternativeAnswersComponent = {
|
|
8
|
+
// Selectors for the alternative answers toggle
|
|
9
|
+
showAlternativeAnswersToggleWrapper: () => cy.get('[class*="ShowAlternativeAnswerSwitch"][class*="SwitchWrapper"]'),
|
|
10
|
+
showAlternativeAnswersToggleInput: () => cy.get('[class*="ShowAlternativeAnswerSwitch"][class*="SwitchWrapper"] input[type="checkbox"]'),
|
|
11
|
+
showAlternativeAnswersToggleLabel: () => cy.get('[class*="ShowAlternativeAnswerSwitch"][class*="SwitchWrapper"] [class*="SwitchLabelWrapper"]'),
|
|
12
|
+
showAlternativeAnswersToggleButton: () => cy.get('[class*="ShowAlternativeAnswerSwitch"][class*="SwitchWrapper"] .MuiButtonBase-root'),
|
|
13
|
+
|
|
14
|
+
// Selectors for the alternative answers content section
|
|
15
|
+
alternativeAnswersSection: () => cy.get('[class*="CorrectAnswerLabelWrapper"]').contains('Alternative answer'),
|
|
16
|
+
alternativeAnswerLabelWrapper: () => cy.get('[class*="CorrectAnswerLabelWrapper"]:contains("Alternative answer")'),
|
|
17
|
+
alternativeAnswerGridWrapper: () => cy.get('[class*="CorrectAnswerGridWrapper"]'),
|
|
18
|
+
alternativeAnswerSelectionGrid: () => cy.get('.correct-ans-selection-grid'),
|
|
19
|
+
|
|
20
|
+
steps: {
|
|
21
|
+
/**
|
|
22
|
+
* Verifies that the "Show alternative answers" toggle is present and visible
|
|
23
|
+
*/
|
|
24
|
+
verifyShowAlternativeAnswersToggleExists: () => {
|
|
25
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
|
|
26
|
+
.should('be.visible');
|
|
27
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleLabel()
|
|
28
|
+
.should('contain.text', 'Show alternative answers');
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Verifies that the "Show alternative answers" toggle does not exist
|
|
33
|
+
*/
|
|
34
|
+
verifyShowAlternativeAnswersToggleNotExists: () => {
|
|
35
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
|
|
36
|
+
.should('not.exist');
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Verifies that the "Show alternative answers" toggle is in the checked (enabled) state
|
|
41
|
+
*/
|
|
42
|
+
verifyShowAlternativeAnswersToggleChecked: () => {
|
|
43
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
|
|
44
|
+
.should('be.checked')
|
|
45
|
+
.and('have.attr', 'aria-pressed', 'true');
|
|
46
|
+
// Verify the checked state visual indicator (tick icon)
|
|
47
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
|
|
48
|
+
.find('.icon-ILC-tick-icon')
|
|
49
|
+
.should('be.visible');
|
|
50
|
+
},
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Verifies that the "Show alternative answers" toggle is in the unchecked (disabled) state
|
|
54
|
+
*/
|
|
55
|
+
verifyShowAlternativeAnswersToggleUnchecked: () => {
|
|
56
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
|
|
57
|
+
.should('not.be.checked')
|
|
58
|
+
.and('have.attr', 'aria-pressed', 'false');
|
|
59
|
+
// Verify the unchecked state visual indicator (x-circle icon)
|
|
60
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
|
|
61
|
+
.find('.icon-x-circle')
|
|
62
|
+
.should('be.visible');
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Clicks the "Show alternative answers" toggle to change its state
|
|
67
|
+
*/
|
|
68
|
+
clickShowAlternativeAnswersToggle: () => {
|
|
69
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleButton()
|
|
70
|
+
.click();
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Enables the "Show alternative answers" toggle (clicks it if it's currently unchecked)
|
|
75
|
+
*/
|
|
76
|
+
enableShowAlternativeAnswersToggle: () => {
|
|
77
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
|
|
78
|
+
.then(($input) => {
|
|
79
|
+
if (!$input.prop('checked')) {
|
|
80
|
+
showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Disables the "Show alternative answers" toggle (clicks it if it's currently checked)
|
|
87
|
+
*/
|
|
88
|
+
disableShowAlternativeAnswersToggle: () => {
|
|
89
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
|
|
90
|
+
.then(($input) => {
|
|
91
|
+
if ($input.prop('checked')) {
|
|
92
|
+
showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Verifies that the alternative answers section is visible
|
|
99
|
+
* @param {number} index - The index of the alternative answer (e.g., 1 for "Alternative answer 1")
|
|
100
|
+
* @param {number} points - The expected points for the alternative answer
|
|
101
|
+
*/
|
|
102
|
+
verifyAlternativeAnswersSectionVisible: (index, points) => {
|
|
103
|
+
cy.get('[class*="CorrectAnswerLabelWrapper"]')
|
|
104
|
+
.contains(`Alternative answer ${index}`)
|
|
105
|
+
.should('be.visible');
|
|
106
|
+
|
|
107
|
+
if (points) {
|
|
108
|
+
cy.get('[class*="CorrectAnswerLabelWrapper"]')
|
|
109
|
+
.contains(`Alternative answer ${index}`)
|
|
110
|
+
.parent()
|
|
111
|
+
.find('p')
|
|
112
|
+
.should('contain.text', `(${points} points)`);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Verifies that the alternative answers section does not exist
|
|
118
|
+
*/
|
|
119
|
+
verifyAlternativeAnswersSectionNotExist: () => {
|
|
120
|
+
cy.get('[class*="CorrectAnswerLabelWrapper"]')
|
|
121
|
+
.contains('Alternative answer')
|
|
122
|
+
.should('not.exist');
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Verifies the complete alternative answers section including content and grid
|
|
127
|
+
* @param {number} index - The index of the alternative answer (e.g., 1 for "Alternative answer 1")
|
|
128
|
+
* @param {number} points - The expected points for the alternative answer
|
|
129
|
+
*/
|
|
130
|
+
verifyAlternativeAnswersSectionComplete: (index = 1, points) => {
|
|
131
|
+
// Verify the alternative answer label is visible
|
|
132
|
+
showAlternativeAnswersComponent.steps.verifyAlternativeAnswersSectionVisible(index, points);
|
|
133
|
+
|
|
134
|
+
// Verify the selection grid is visible
|
|
135
|
+
showAlternativeAnswersComponent.alternativeAnswerSelectionGrid()
|
|
136
|
+
.should('be.visible');
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Comprehensive test that verifies the complete toggle functionality
|
|
141
|
+
* @param {number} index - The index of the alternative answer to verify
|
|
142
|
+
* @param {number} points - The expected points for the alternative answer
|
|
143
|
+
*/
|
|
144
|
+
verifyShowAlternativeAnswersToggleFunctionality: (index, points) => {
|
|
145
|
+
// Start with ensuring toggle exists
|
|
146
|
+
showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleExists();
|
|
147
|
+
|
|
148
|
+
// Test unchecked state
|
|
149
|
+
showAlternativeAnswersComponent.steps.disableShowAlternativeAnswersToggle();
|
|
150
|
+
showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
|
|
151
|
+
|
|
152
|
+
// Verify the alternative answers section does not exist
|
|
153
|
+
showAlternativeAnswersComponent.steps.verifyAlternativeAnswersSectionNotExist();
|
|
154
|
+
|
|
155
|
+
// Test checked state
|
|
156
|
+
showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
|
|
157
|
+
showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleChecked();
|
|
158
|
+
|
|
159
|
+
// Verify the alternative answers section is visible
|
|
160
|
+
showAlternativeAnswersComponent.steps.verifyAlternativeAnswersSectionVisible(index, points);
|
|
161
|
+
|
|
162
|
+
// Test toggle back to unchecked
|
|
163
|
+
showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
|
|
164
|
+
showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export { showAlternativeAnswersComponent };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import constants from "../fixtures/constants";
|
|
2
2
|
import utilities from "../support/helpers/utilities"
|
|
3
|
-
import { autoScoredScoringSectionMultiResponseType, autoScoredSpecifyCorrectAnswerSection, commonComponents, createQuestionBasePage, optionsWrapperComponent, questionInstructionsComponent, scoringSectionBaseEditTab, autoScoredScoringPreviewTab, autoScoredStudentViewSettings, additionalSettingsPanel, ckEditorToolbar, equationEditorFlyout, mcqAdditionalSettingsBase, randomizeOptionsComponent, lockUnlockOptionComponent, additionalSettingsAccessibilitySectionComponent } from "./components"
|
|
3
|
+
import { autoScoredScoringSectionMultiResponseType, autoScoredSpecifyCorrectAnswerSection, commonComponents, createQuestionBasePage, optionsWrapperComponent, questionInstructionsComponent, scoringSectionBaseEditTab, autoScoredScoringPreviewTab, autoScoredStudentViewSettings, additionalSettingsPanel, ckEditorToolbar, equationEditorFlyout, mcqAdditionalSettingsBase, randomizeOptionsComponent, lockUnlockOptionComponent, additionalSettingsAccessibilitySectionComponent, showAlternativeAnswersComponent } from "./components"
|
|
4
4
|
import { ckEditorAudioPlayerComponent } from "../pages/components/ckEditorAudioPlayerComponent"
|
|
5
5
|
import { ckEditorEquationEditorComponent } from "../pages/components/ckEditorEquationEditorComponent"
|
|
6
6
|
import { ckEditorInsertTableComponent } from "../pages/components/ckEditorInsertTableComponent"
|
|
@@ -35,6 +35,7 @@ const selectors = {
|
|
|
35
35
|
...ckEditorLinkComponent,
|
|
36
36
|
...createItemPage,
|
|
37
37
|
...audioPlayerPage,
|
|
38
|
+
...showAlternativeAnswersComponent,
|
|
38
39
|
//Specify correct answer section
|
|
39
40
|
optionWrapperSpecifyCorrectAnswerSection: () => cy.get('.mcq-option-wrapper'),
|
|
40
41
|
optionsText: () => cy.get('.mcq-label'),
|
|
@@ -111,6 +112,7 @@ const steps = {
|
|
|
111
112
|
...ckEditorAudioPlayerComponent.steps,
|
|
112
113
|
...ckEditorEquationEditorComponent.steps,
|
|
113
114
|
...ckEditorInsertTableComponent.steps,
|
|
115
|
+
...showAlternativeAnswersComponent.steps,
|
|
114
116
|
...ckEditorInsertImageComponent.steps,
|
|
115
117
|
...ckEditorLinkComponent.steps,
|
|
116
118
|
...createItemPage.steps,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import constants from "../fixtures/constants";
|
|
2
2
|
import utilities from "../support/helpers/utilities";
|
|
3
|
-
import { additionalSettingsPanel, createQuestionBasePage, mcqAdditionalSettingsBase, scoringSectionBaseEditTab, autoScoredSpecifyCorrectAnswerSection, optionsWrapperComponent, commonComponents, autoScoredScoringPreviewTab, autoScoredStudentViewSettings, ckEditorToolbar, equationEditorFlyout, randomizeOptionsComponent, lockUnlockOptionComponent, questionInstructionsComponent, additionalSettingsAccessibilitySectionComponent } from "./components";
|
|
3
|
+
import { additionalSettingsPanel, createQuestionBasePage, mcqAdditionalSettingsBase, scoringSectionBaseEditTab, autoScoredSpecifyCorrectAnswerSection, optionsWrapperComponent, commonComponents, autoScoredScoringPreviewTab, autoScoredStudentViewSettings, ckEditorToolbar, equationEditorFlyout, randomizeOptionsComponent, lockUnlockOptionComponent, questionInstructionsComponent, additionalSettingsAccessibilitySectionComponent, showAlternativeAnswersComponent } from "./components";
|
|
4
4
|
import { createItemPage } from "./createItemPage";
|
|
5
5
|
import { selectQuestionResourceToolPage } from "./selectQuestionResourceToolPage";
|
|
6
6
|
const css = Cypress.env('css');
|
|
@@ -21,6 +21,7 @@ const selectors = {
|
|
|
21
21
|
...randomizeOptionsComponent,
|
|
22
22
|
...lockUnlockOptionComponent,
|
|
23
23
|
...createItemPage,
|
|
24
|
+
...showAlternativeAnswersComponent,
|
|
24
25
|
optionsRadioButton: () => cy.get('input[type="radio"]'),
|
|
25
26
|
optionsRadioButtonForSpecifyCorrectAnswer: () => cy.get('.radio-option-wrapper:visible input[type="radio"]'),
|
|
26
27
|
editTabOptionsWrapper: () => cy.get('.edit-mcq-option-wrapper'),
|
|
@@ -42,16 +43,6 @@ const selectors = {
|
|
|
42
43
|
correctIncorrectAnswerLabel: () => cy.get('[class*="style"][class*="__Status"]'),
|
|
43
44
|
answerStatusBanner: () => cy.get('[class*="StatusContainer"]'),
|
|
44
45
|
optionsInputFieldInQuestionPreviewTab: () => cy.get('.mcq-radio-control [data-testid="question-instruction-element"]'),
|
|
45
|
-
//Show alternative answers toggle
|
|
46
|
-
showAlternativeAnswersToggleWrapper: () => cy.get('[class*="ShowAlternativeAnswerSwitch"][class*="SwitchWrapper"]'),
|
|
47
|
-
showAlternativeAnswersToggleInput: () => cy.get('[class*="ShowAlternativeAnswerSwitch"][class*="SwitchWrapper"] input[type="checkbox"]'),
|
|
48
|
-
showAlternativeAnswersToggleLabel: () => cy.get('[class*="ShowAlternativeAnswerSwitch"][class*="SwitchWrapper"] [class*="SwitchLabelWrapper"]'),
|
|
49
|
-
showAlternativeAnswersToggleButton: () => cy.get('[class*="ShowAlternativeAnswerSwitch"][class*="SwitchWrapper"] .MuiButtonBase-root'),
|
|
50
|
-
//Alternative answers content section
|
|
51
|
-
alternativeAnswersSection: () => cy.get('[class*="CorrectAnswerLabelWrapper"]').contains('Alternative answer'),
|
|
52
|
-
alternativeAnswerLabelWrapper: () => cy.get('[class*="CorrectAnswerLabelWrapper"]:contains("Alternative answer")'),
|
|
53
|
-
alternativeAnswerGridWrapper: () => cy.get('[class*="CorrectAnswerGridWrapper"]'),
|
|
54
|
-
alternativeAnswerSelectionGrid: () => cy.get('.correct-ans-selection-grid'),
|
|
55
46
|
};
|
|
56
47
|
|
|
57
48
|
const steps = {
|
|
@@ -71,6 +62,7 @@ const steps = {
|
|
|
71
62
|
...lockUnlockOptionComponent.steps,
|
|
72
63
|
...createItemPage.steps,
|
|
73
64
|
...selectQuestionResourceToolPage.steps,
|
|
65
|
+
...showAlternativeAnswersComponent.steps,
|
|
74
66
|
/**
|
|
75
67
|
* Verifies the contents of an option wrapper in the 'Specify correct answer' section for single selection questions.
|
|
76
68
|
* @param {number} optionIndex - The index of the option wrapper to be verified.
|
|
@@ -739,151 +731,7 @@ const steps = {
|
|
|
739
731
|
singleSelectionPage.saveQuestionButton().click();
|
|
740
732
|
},
|
|
741
733
|
|
|
742
|
-
/**
|
|
743
|
-
* Verifies that the "Show alternative answers" toggle is present and visible
|
|
744
|
-
*/
|
|
745
|
-
verifyShowAlternativeAnswersToggleExists: () => {
|
|
746
|
-
singleSelectionPage.showAlternativeAnswersToggleWrapper()
|
|
747
|
-
.should('be.visible');
|
|
748
|
-
singleSelectionPage.showAlternativeAnswersToggleLabel()
|
|
749
|
-
.should('contain.text', 'Show alternative answers');
|
|
750
|
-
},
|
|
751
|
-
|
|
752
|
-
verifyShowAlternativeAnswersToggleNotExists: () => {
|
|
753
|
-
singleSelectionPage.showAlternativeAnswersToggleWrapper()
|
|
754
|
-
.should('not.exist');
|
|
755
|
-
},
|
|
756
|
-
|
|
757
|
-
/**
|
|
758
|
-
* Verifies that the "Show alternative answers" toggle is in the checked (enabled) state
|
|
759
|
-
*/
|
|
760
|
-
verifyShowAlternativeAnswersToggleChecked: () => {
|
|
761
|
-
singleSelectionPage.showAlternativeAnswersToggleInput()
|
|
762
|
-
.should('be.checked')
|
|
763
|
-
.and('have.attr', 'aria-pressed', 'true');
|
|
764
|
-
// Verify the checked state visual indicator (tick icon)
|
|
765
|
-
singleSelectionPage.showAlternativeAnswersToggleWrapper()
|
|
766
|
-
.find('.icon-ILC-tick-icon')
|
|
767
|
-
.should('be.visible');
|
|
768
|
-
},
|
|
769
|
-
|
|
770
|
-
/**
|
|
771
|
-
* Verifies that the "Show alternative answers" toggle is in the unchecked (disabled) state
|
|
772
|
-
*/
|
|
773
|
-
verifyShowAlternativeAnswersToggleUnchecked: () => {
|
|
774
|
-
singleSelectionPage.showAlternativeAnswersToggleInput()
|
|
775
|
-
.should('not.be.checked')
|
|
776
|
-
.and('have.attr', 'aria-pressed', 'false');
|
|
777
|
-
// Verify the unchecked state visual indicator (x-circle icon)
|
|
778
|
-
singleSelectionPage.showAlternativeAnswersToggleWrapper()
|
|
779
|
-
.find('.icon-x-circle')
|
|
780
|
-
.should('be.visible');
|
|
781
|
-
},
|
|
782
|
-
|
|
783
|
-
/**
|
|
784
|
-
* Clicks the "Show alternative answers" toggle to change its state
|
|
785
|
-
*/
|
|
786
|
-
clickShowAlternativeAnswersToggle: () => {
|
|
787
|
-
singleSelectionPage.showAlternativeAnswersToggleButton()
|
|
788
|
-
.click();
|
|
789
|
-
},
|
|
790
734
|
|
|
791
|
-
/**
|
|
792
|
-
* Enables the "Show alternative answers" toggle (clicks it if it's currently unchecked)
|
|
793
|
-
*/
|
|
794
|
-
enableShowAlternativeAnswersToggle: () => {
|
|
795
|
-
singleSelectionPage.showAlternativeAnswersToggleInput()
|
|
796
|
-
.then(($input) => {
|
|
797
|
-
if (!$input.prop('checked')) {
|
|
798
|
-
singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
|
|
799
|
-
}
|
|
800
|
-
});
|
|
801
|
-
},
|
|
802
|
-
|
|
803
|
-
/**
|
|
804
|
-
* Disables the "Show alternative answers" toggle (clicks it if it's currently checked)
|
|
805
|
-
*/
|
|
806
|
-
disableShowAlternativeAnswersToggle: () => {
|
|
807
|
-
singleSelectionPage.showAlternativeAnswersToggleInput()
|
|
808
|
-
.then(($input) => {
|
|
809
|
-
if ($input.prop('checked')) {
|
|
810
|
-
singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
|
|
811
|
-
}
|
|
812
|
-
});
|
|
813
|
-
},
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
/**
|
|
817
|
-
* Verifies that the alternative answers section is visible
|
|
818
|
-
*/
|
|
819
|
-
|
|
820
|
-
verifyAlternativeAnswersSectionVisible: (index, points) => {
|
|
821
|
-
// Build the expected points text: "(1 point)" or "(20 points)"
|
|
822
|
-
const pointsText = `(${points} point${points === 1 ? '' : 's'})`;
|
|
823
|
-
|
|
824
|
-
cy.get('[class*="CorrectAnswerLabelWrapper"]')
|
|
825
|
-
.eq(index) // pick the specific "Alternative answer" by index
|
|
826
|
-
.should('be.visible')
|
|
827
|
-
.should('contain.text', `Alternative answer ${index}`)
|
|
828
|
-
.should('contain.text', pointsText); // check points
|
|
829
|
-
},
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
/**
|
|
833
|
-
* Verifies that the alternative answers section does not exist
|
|
834
|
-
*/
|
|
835
|
-
verifyAlternativeAnswersSectionNotExist: () => {
|
|
836
|
-
cy.get('[class*="CorrectAnswerLabelWrapper"]')
|
|
837
|
-
.contains('Alternative answer')
|
|
838
|
-
.should('not.exist');
|
|
839
|
-
},
|
|
840
|
-
|
|
841
|
-
/**
|
|
842
|
-
* Verifies the complete alternative answers section including content and grid
|
|
843
|
-
*/
|
|
844
|
-
verifyAlternativeAnswersSectionComplete: () => {
|
|
845
|
-
// Verify the alternative answer label is visible
|
|
846
|
-
singleSelectionPage.alternativeAnswersSection()
|
|
847
|
-
.should('be.visible');
|
|
848
|
-
|
|
849
|
-
// Verify the selection grid is visible
|
|
850
|
-
singleSelectionPage.alternativeAnswerSelectionGrid()
|
|
851
|
-
.should('be.visible');
|
|
852
|
-
|
|
853
|
-
// Verify points are displayed
|
|
854
|
-
cy.get('[class*="CorrectAnswerLabelWrapper"]')
|
|
855
|
-
.contains('Alternative answer')
|
|
856
|
-
.parent()
|
|
857
|
-
.find('p')
|
|
858
|
-
.should('contain.text', 'points');
|
|
859
|
-
},
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
/**
|
|
863
|
-
* Verifies the toggle functionality by checking both states
|
|
864
|
-
*/
|
|
865
|
-
verifyShowAlternativeAnswersToggleFunctionality: (index, points) => {
|
|
866
|
-
// Start with ensuring toggle exists
|
|
867
|
-
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleExists();
|
|
868
|
-
|
|
869
|
-
// Test unchecked state
|
|
870
|
-
singleSelectionPage.steps.disableShowAlternativeAnswersToggle();
|
|
871
|
-
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
|
|
872
|
-
|
|
873
|
-
// Verify the alternative answers section do not exist
|
|
874
|
-
singleSelectionPage.steps.verifyAlternativeAnswersSectionNotExist();
|
|
875
|
-
|
|
876
|
-
// Test checked state
|
|
877
|
-
singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
|
|
878
|
-
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleChecked();
|
|
879
|
-
|
|
880
|
-
// Verify the alternative answers section is visible
|
|
881
|
-
singleSelectionPage.steps.verifyAlternativeAnswersSectionVisible(index, points);
|
|
882
|
-
|
|
883
|
-
// Test toggle back to unchecked
|
|
884
|
-
singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
|
|
885
|
-
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
|
|
886
|
-
},
|
|
887
735
|
};
|
|
888
736
|
|
|
889
737
|
const tests = {
|