itemengine-cypress-automation 1.0.151-28MarchRepoUpdate-20de036.0 → 1.0.152-28th-March-fixes-6236e0e.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/editTabScoring.js +1 -0
  2. package/cypress/e2e/ILC/EditTabSettingPage/ItemPreviewSettingsTabContent.js +2 -2
  3. package/cypress/e2e/ILC/EditTabSettingPage/itemPreviewSettingsTabFunctionality.js +25 -25
  4. package/cypress/e2e/ILC/GridFill/customizeLayoutSectionShadeCellsGridBorders.js +506 -0
  5. package/cypress/e2e/ILC/GridFill/previewContentsForAllViews.smoke.js +3 -3
  6. package/cypress/e2e/ILC/Matching/Scoring/allOrNothingGroupedScoring.js +155 -0
  7. package/cypress/e2e/ILC/Matching/Scoring/manuallyAndNonScored.js +143 -0
  8. package/cypress/e2e/ILC/Matching/allOrNothingScoringForAllViews.smoke.js +1 -1
  9. package/cypress/e2e/ILC/Matching/checkAnswerFunctionalityForAllViews.smoke.js +1 -1
  10. package/cypress/e2e/ILC/Matching/draggableOptions.js +180 -0
  11. package/cypress/e2e/ILC/Matching/editTabScoring.js +221 -0
  12. package/cypress/e2e/ILC/Matching/manuallyAndNonScoredEditTab.js +68 -0
  13. package/cypress/e2e/ILC/Matching/minimumScoringPenaltyPointsAndRoundingDropdown.js +194 -0
  14. package/cypress/e2e/ILC/Matching/switchingCasesBetweenOptionsLayout.js +49 -0
  15. package/cypress/fixtures/theme/ilc.json +7 -1
  16. package/cypress/pages/components/autoScoredStudentViewSettings.js +1 -1
  17. package/cypress/pages/components/optionsWrapperComponent.js +1 -1
  18. package/cypress/pages/contentBlocksPage.js +30 -1
  19. package/cypress/pages/createItemPage.js +1 -1
  20. package/cypress/pages/essayResponsePage.js +1 -1
  21. package/cypress/pages/graphingPage.js +29 -29
  22. package/cypress/pages/gridFillPage.js +663 -15
  23. package/cypress/pages/itemPreviewSettingsPage.js +3 -3
  24. package/cypress/pages/matchingPage.js +466 -5
  25. package/cypress/pages/shortTextResponsePage.js +1 -0
  26. package/cypress/pages/textEntryMathPage.js +1 -1
  27. package/cypress/pages/textEntryMathWithImagePage.js +1 -1
  28. package/package.json +1 -1
@@ -0,0 +1,155 @@
1
+ import { matchingPage } from "../../../../pages";
2
+ import abortEarlySetup from "../../../../support/helpers/abortEarly";
3
+ import utilities from "../../../../support/helpers/utilities";
4
+
5
+ describe('Create item page - Matching: All or nothing with grouped options layout', () => {
6
+ before(() => {
7
+ cy.loginAs('admin');
8
+ });
9
+
10
+ describe('Auto scored - All or nothing scoring for grouped options', () => {
11
+ abortEarlySetup();
12
+ before(() => {
13
+ matchingPage.steps.navigateToCreateQuestion('matching');
14
+ cy.barsPreLoaderWait();
15
+ matchingPage.steps.addTextInQuestionInstructionsInputField('Fill the categories with the right answer.');
16
+ matchingPage.steps.expandMaxCapacityPerDropzoneDropdown();
17
+ matchingPage.steps.selectOptionFromMaxCapacityPerDropzoneDropdown('2');
18
+ matchingPage.steps.setGroupedOptions();
19
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ optionText: 'Elephant', dropzoneIndex: 0 }, { optionText: 'Fish', dropzoneIndex: 1 }, { optionText: 'Cat', dropzoneIndex: 2 }]);
20
+ matchingPage.steps.allotPoints(20);
21
+ matchingPage.steps.checkAllowStudentsToCheckAnswerCheckbox();
22
+ matchingPage.steps.switchToPreviewTab();
23
+ });
24
+
25
+ it('When the user selects \'Grading\' view without attempting the question, dropzone numeration should be displayed, correct answers section with a label \'Correct answers\' should be displayed with correct answers and respective option numeration', () => {
26
+ matchingPage.steps.verifyPreviewScore(0, 20);
27
+ matchingPage.steps.switchToGradingView();
28
+ matchingPage.steps.verifyPreviewTabPointsBackgroundForIncorrectOrPartiallyCorrectAnswer();
29
+ matchingPage.steps.verifyDropzoneNumeration();
30
+ utilities.verifyInnerText(matchingPage.correctAnswersLabel(), 'Correct answers');
31
+ matchingPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Elephant'], ['Fish'], ['Cat']]);
32
+ });
33
+
34
+ it('When the user attempts the question incorrectly, then the user should be awarded 0 points and on switching to \'Grading\' view, incorrect icons should be displayed besides all incorrect responses, a status message with text \'Your answer is incorrect\' and correct answer section with all correct answers along with numeration should be displayed', () => {
35
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Bear', dropzoneIndex: 0 }, { optionText: 'Eagle', dropzoneIndex: 1 }, { optionText: 'Fish', dropzoneIndex: 2 }]);
36
+ matchingPage.steps.verifyPreviewScore(0, 20);
37
+ matchingPage.steps.switchToGradingView();
38
+ matchingPage.steps.verifyIncorrectOptionIcon(0);
39
+ matchingPage.steps.verifyIncorrectOptionIcon(1);
40
+ matchingPage.steps.verifyIncorrectOptionIcon(2);
41
+ matchingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
42
+ matchingPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Elephant'], ['Fish'], ['Cat']]);
43
+ matchingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
44
+ cy.log('When the user has attempted the question incorrectly and clicks on \'Check answer\' button, then incorrect icon should be displayed besides the dropzone, a status message with text \'Your answer is incorrect\' should be displayed and correct answer section should not be displayed')
45
+ matchingPage.steps.checkAnswer();
46
+ matchingPage.steps.verifyIncorrectOptionIcon(0);
47
+ matchingPage.steps.verifyIncorrectOptionIcon(1);
48
+ matchingPage.steps.verifyIncorrectOptionIcon(2);
49
+ matchingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
50
+ matchingPage.steps.verifyCorrectAnswerSectionNotExists();
51
+ });
52
+
53
+ it('When the user attempts the question partially correct with some correct, some incomplete, some incorrect options, then the user should be awarded 0 points and on switching to \'Grading\' view, correct icon should be displayed besides the correct answer responses, incorrect icon should be displayed besides incorrect answer response, a status message with text \'Your answer is incorrect\' and correct answer section with all correct answers along with numeration should be displayed', () => {
54
+ matchingPage.steps.resetQuestionPreview();
55
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Elephant', dropzoneIndex: 0 }, { optionText: 'Eagle', dropzoneIndex: 2 }]);
56
+ matchingPage.steps.switchToGradingView();
57
+ matchingPage.steps.verifyCorrectOptionIcon(0);
58
+ matchingPage.steps.verifyCorrectIncorrectIconNotExist(1);
59
+ matchingPage.steps.verifyIncorrectOptionIcon(2);
60
+ matchingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
61
+ matchingPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Elephant'], ['Fish'], ['Cat']]);
62
+ matchingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
63
+ cy.log('When the user attempts the question partially correct with some correct, some incomplete, some incorrect options and clicks on \'Check answer\' button, then incorrect icon should be displayed besides the dropzone incorrect response and correct icon should be displayed beside the correct response, a status message with text \'Your answer is incorrect\' should be displayed and correct answer section should not be displayed')
64
+ matchingPage.steps.checkAnswer();
65
+ matchingPage.steps.verifyCorrectOptionIcon(0);
66
+ matchingPage.steps.verifyCorrectIncorrectIconNotExist(1);
67
+ matchingPage.steps.verifyIncorrectOptionIcon(2);
68
+ matchingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
69
+ matchingPage.steps.verifyCorrectAnswerSectionNotExists();
70
+ });
71
+
72
+ it('When the user attempts the question partially correct with all the dropzone correctly attempted but one dropzone incomplete, then the user should be awarded 0 points and on switching to \'Grading\' view, correct icon should be displayed besides the correct answer responses, incorrect icon should be displayed besides incorrect answer response, a status message with text \'Your answer is incorrect\' and correct answer section with all correct answers along with numeration should be displayed', () => {
73
+ matchingPage.steps.resetQuestionPreview();
74
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Fish', dropzoneIndex: 1 }, { optionText: 'Cat', dropzoneIndex: 2 }]);
75
+ matchingPage.steps.verifyPreviewScore(0, 20);
76
+ matchingPage.steps.switchToGradingView();
77
+ matchingPage.steps.verifyCorrectIncorrectIconNotExist(0);
78
+ matchingPage.steps.verifyCorrectOptionIcon(1);
79
+ matchingPage.steps.verifyCorrectOptionIcon(2);
80
+ matchingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
81
+ matchingPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Elephant'], ['Fish'], ['Cat']]);
82
+ matchingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
83
+ cy.log('When the user attempts the question partially correct with all the dropzone correctly attempted but one dropzone incomplete and clicks on \'Check answer\' button, then no icon should be displayed besides the incomplete and correct icon should be displayed beside the correct response, a status message with text \'Your answer is incorrect\' should be displayed and correct answer section should not be displayed')
84
+ matchingPage.steps.checkAnswer();
85
+ matchingPage.steps.verifyCorrectIncorrectIconNotExist(0);
86
+ matchingPage.steps.verifyCorrectOptionIcon(1);
87
+ matchingPage.steps.verifyCorrectOptionIcon(2);
88
+ matchingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
89
+ matchingPage.steps.verifyCorrectAnswerSectionNotExists();
90
+ });
91
+
92
+ it('When the user attempts the question partially correct with all the dropzone correctly attempted but with an extra option which is not set as correct answer, then the user should be awarded 0 points and on switching to \'Grading\' view, correct icon should be displayed besides the correct answer responses, incorrect icon should be displayed besides incorrect answer response, a status message with text \'Your answer is incorrect\' and correct answer section should be displayed along with numeration', () => {
93
+ matchingPage.steps.resetQuestionPreview();
94
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Elephant', dropzoneIndex: 0 }, { optionText: 'Bear', dropzoneIndex: 0 }, { optionText: 'Fish', dropzoneIndex: 1 }, { optionText: 'Cat', dropzoneIndex: 2 }]);
95
+ matchingPage.steps.verifyPreviewScore(0, 20);
96
+ matchingPage.steps.switchToGradingView();
97
+ matchingPage.steps.verifyCorrectOptionIcon(0);
98
+ matchingPage.steps.verifyIncorrectOptionIcon(0, 1);
99
+ matchingPage.steps.verifyCorrectOptionIcon(1);
100
+ matchingPage.steps.verifyCorrectOptionIcon(2);
101
+ matchingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
102
+ matchingPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Elephant'], ['Fish'], ['Cat']]);
103
+ matchingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
104
+ cy.log('When the user attempts the question partially correct with all the dropzone correctly attempted but with an extra option which is not set as correct answer and clicks on \'Check answer\' button, correct icon should be displayed besides the correct answer responses, incorrect icon should be displayed besides incorrect answer response, a status message with text \'Your answer is incorrect\' should be displayed and correct answer section should not be displayed')
105
+ matchingPage.steps.checkAnswer();
106
+ matchingPage.steps.verifyCorrectOptionIcon(0);
107
+ matchingPage.steps.verifyIncorrectOptionIcon(0, 1);
108
+ matchingPage.steps.verifyCorrectOptionIcon(1);
109
+ matchingPage.steps.verifyCorrectOptionIcon(2);
110
+ matchingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
111
+ matchingPage.steps.verifyCorrectAnswerSectionNotExists();
112
+ });
113
+
114
+ it('When the user attempts question with the common option from another group then the user should be awarded 0 points and on switching to \'Grading\' view, incorrect icon should be displayed besides incorrect answer response, a status message with text \'Your answer is incorrect\' and correct answer section should be displayed along with numeration', () => {
115
+ matchingPage.steps.resetQuestionPreview();
116
+ matchingPage.steps.clickAndDropOptionFromNthGroupInDropzonePreviewTab([{ responseText: 'Elephant', groupIndex: 2, dropzoneIndex: 0 }]);
117
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Fish', dropzoneIndex: 1 }, { optionText: 'Cat', dropzoneIndex: 2 }]);
118
+ matchingPage.steps.verifyPreviewScore(0, 20);
119
+ matchingPage.steps.switchToGradingView();
120
+ matchingPage.steps.verifyIncorrectOptionIcon(0);
121
+ matchingPage.steps.verifyCorrectOptionIcon(1);
122
+ matchingPage.steps.verifyCorrectOptionIcon(2);
123
+ matchingPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Elephant'], ['Fish'], ['Cat']]);
124
+ matchingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
125
+ cy.log('When the user attempts the question with the common option from another group then the user should be awarded and clicks on \'Check answer\' button, incorrect icon should be displayed besides incorrect answer response, a status message with text \'Your answer is incorrect\' should be displayed and correct answer section should not be displayed')
126
+ matchingPage.steps.checkAnswer();
127
+ matchingPage.steps.verifyIncorrectOptionIcon(0);
128
+ matchingPage.steps.verifyCorrectOptionIcon(1);
129
+ matchingPage.steps.verifyCorrectOptionIcon(2);
130
+ matchingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
131
+ matchingPage.steps.verifyCorrectAnswerSectionNotExists();
132
+ });
133
+
134
+ it('When user attempts the question correctly, the user should be awarded full points and on switching to \'Grading\' view, then correct icons should be displayed beside all the correct responses, correct icon should be displayed besides the correct answer responses, a status message with text \'Your answer is correct\' and correct answer section should not be displayed', () => {
135
+ matchingPage.steps.resetQuestionPreview();
136
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Elephant', dropzoneIndex: 0 }, { optionText: 'Fish', dropzoneIndex: 1 }, { optionText: 'Cat', dropzoneIndex: 2 }]);
137
+ matchingPage.steps.verifyPreviewScore(20, 20);
138
+ matchingPage.steps.switchToGradingView();
139
+ matchingPage.steps.verifyPreviewTabPointsBackgroundForCorrectAnswer();
140
+ matchingPage.steps.verifyCorrectOptionIcon(0);
141
+ matchingPage.steps.verifyCorrectOptionIcon(1);
142
+ matchingPage.steps.verifyCorrectOptionIcon(2);
143
+ matchingPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
144
+ matchingPage.steps.verifyCorrectAnswerSectionNotExists();
145
+ matchingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
146
+ cy.log('When user attempts the question correctly and clicks on \'Check answer\' button, correct icon should be displayed besides the correct answer responses, a status message with text \'Your answer is correct\' should be displayed and correct answer section should not be displayed')
147
+ matchingPage.steps.checkAnswer();
148
+ matchingPage.steps.verifyCorrectOptionIcon(0);
149
+ matchingPage.steps.verifyCorrectOptionIcon(1);
150
+ matchingPage.steps.verifyCorrectOptionIcon(2);
151
+ matchingPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
152
+ matchingPage.steps.verifyCorrectAnswerSectionNotExists();
153
+ });
154
+ });
155
+ });
@@ -0,0 +1,143 @@
1
+ import { matchingPage } from "../../../../pages";
2
+ import abortEarlySetup from "../../../../support/helpers/abortEarly";
3
+ import utilities from "../../../../support/helpers/utilities";
4
+ const promptTextArray = ['Wild', 'Aquatic', 'Pet'];
5
+ const optionsArray = ['Cat', 'Elephant', 'Fish', 'Bear', 'Eagle', 'Penguin'];
6
+
7
+ describe('Create Item page - Matching: Manually and non scored', () => {
8
+ before(() => {
9
+ cy.loginAs('admin');
10
+ });
11
+
12
+ describe('Question Preview: Manually Scored', () => {
13
+ abortEarlySetup();
14
+ before(() => {
15
+ matchingPage.steps.navigateToCreateQuestion('matching');
16
+ cy.barsPreLoaderWait();
17
+ matchingPage.steps.addTextInQuestionInstructionsInputField('Fill the categories with the right answer.');
18
+ matchingPage.steps.addMultipleOptionFields(3);
19
+ matchingPage.steps.enterTextInPromptInputField(promptTextArray);
20
+ matchingPage.steps.enterTextInOptionInputField(optionsArray);
21
+ matchingPage.steps.expandScoringTypeDropdown();
22
+ matchingPage.steps.selectOptionFromScoringTypeDropdown('Manually scored');
23
+ matchingPage.steps.switchToPreviewTab();
24
+ });
25
+
26
+ it('In Preview tab, question instructions, dropzone and options container should be displayed in the preview tab', () => {
27
+ matchingPage.steps.verifyQuestionInstructionsTextPreviewTab('Fill the categories with the right answer.');
28
+ utilities.verifyElementCount(matchingPage.dropzonePreviewTab(), 3);
29
+ utilities.verifyElementCount(matchingPage.draggableOption(), 6);
30
+ for (let index = 0; index < matchingPage.dropzonePreviewTab(); index++) {
31
+ matchingPage.steps.verifyDropzoneTextContentPreviewTab(index, '');
32
+ }
33
+ optionsArray.forEach((optionText, index) => {
34
+ utilities.verifyInnerText(utilities.getNthElement(matchingPage.draggableOption(), index), optionText);
35
+ });
36
+ });
37
+
38
+ matchingPage.tests.verifyGradingStudentViewRadioButtonAndScoringTypeInPreviewTab('Manually scored');
39
+ });
40
+
41
+ describe('Question Preview: Non Scored', () => {
42
+ abortEarlySetup();
43
+ before(() => {
44
+ matchingPage.steps.navigateToCreateQuestion('matching');
45
+ cy.barsPreLoaderWait();
46
+ matchingPage.steps.addTextInQuestionInstructionsInputField('Fill the categories with the right answer.');
47
+ matchingPage.steps.addMultipleOptionFields(3);
48
+ matchingPage.steps.enterTextInPromptInputField(promptTextArray);
49
+ matchingPage.steps.enterTextInOptionInputField(optionsArray);
50
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ optionText: 'Elephant', dropzoneIndex: 0 }, { optionText: 'Fish', dropzoneIndex: 1 }, { optionText: 'Cat', dropzoneIndex: 2 }]);
51
+ matchingPage.steps.expandScoringTypeDropdown();
52
+ matchingPage.steps.selectOptionFromScoringTypeDropdown('Non scored');
53
+ matchingPage.steps.checkAllowStudentToCheckAnswerCheckbox();
54
+ matchingPage.steps.switchToPreviewTab();
55
+ });
56
+
57
+ matchingPage.tests.verifyGradingStudentViewRadioButtonAndScoringTypeInPreviewTab('Non scored');
58
+
59
+ it('When the user selects \'Grading\' view without attempting the question, correct/incorrect icons should not be displayed and the correct answer section should be displayed with correct answers', () => {
60
+ matchingPage.steps.switchToGradingView();
61
+ matchingPage.steps.verifyCorrectIncorrectIconNotExist(0);
62
+ matchingPage.steps.verifyCorrectIncorrectIconNotExist(1);
63
+ matchingPage.steps.verifyCorrectIncorrectIconNotExist(2);
64
+ matchingPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Elephant'], ['Fish'], ['Cat']]);
65
+ matchingPage.steps.switchToStudentView();
66
+ });
67
+
68
+ it('When the user attempts the question incorrectly and on switching to \'Grading\' view, incorrect icons should be displayed besides all incorrect responses, a status message with text \'Your answer is incorrect\' and correct answer section with all correct answers along with numeration should be displayed', () => {
69
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Bear', dropzoneIndex: 0 }, { optionText: 'Eagle', dropzoneIndex: 1 }, { optionText: 'Fish', dropzoneIndex: 2 }]);
70
+ matchingPage.steps.switchToGradingView();
71
+ matchingPage.steps.verifyIncorrectOptionIcon(0);
72
+ matchingPage.steps.verifyIncorrectOptionIcon(1);
73
+ matchingPage.steps.verifyIncorrectOptionIcon(2);
74
+ matchingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
75
+ matchingPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Elephant'], ['Fish'], ['Cat']]);
76
+ matchingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
77
+ cy.log('When user clicks on Check answer button after he attempts the question incorrectly incorrect icons should be displayed besides all incorrect responses, status message \'Your answer is incorrect\' should be displayed and correct answer section should not be displayed')
78
+ matchingPage.steps.checkAnswer();
79
+ matchingPage.steps.verifyIncorrectOptionIcon(0);
80
+ matchingPage.steps.verifyIncorrectOptionIcon(1);
81
+ matchingPage.steps.verifyIncorrectOptionIcon(2);
82
+ matchingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
83
+ matchingPage.steps.verifyCorrectAnswerSectionNotExists();
84
+ });
85
+
86
+ it('When the user attempts the question partially correct with some correct, some incomplete, some incorrect options, then on switching to \'Grading\' view, correct icon should be displayed besides the correct answer responses, incorrect icon should be displayed besides incorrect answer response, a status message with text \'Your answer is incorrect\' and correct answer section with all correct answers along with numeration should be displayed', () => {
87
+ matchingPage.steps.resetQuestionPreview();
88
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Elephant', dropzoneIndex: 0 }, { optionText: 'Eagle', dropzoneIndex: 2 }]);
89
+ matchingPage.steps.switchToGradingView();
90
+ matchingPage.steps.verifyCorrectOptionIcon(0);
91
+ matchingPage.steps.verifyCorrectIncorrectIconNotExist(1);
92
+ matchingPage.steps.verifyIncorrectOptionIcon(2);
93
+ matchingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
94
+ matchingPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Elephant'], ['Fish'], ['Cat']]);
95
+ matchingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
96
+ cy.log('When user clicks on Check answer button after he attempts the question partially correct with some correct, some incomplete, some incorrect options, correct icon should be displayed besides the correct answer responses, incorrect icon should be displayed besides incorrect answer response, status message \'Your answer is incorrect\' should be displayed and correct answer section should not be displayed')
97
+ matchingPage.steps.checkAnswer();
98
+ matchingPage.steps.verifyCorrectOptionIcon(0);
99
+ matchingPage.steps.verifyCorrectIncorrectIconNotExist(1);
100
+ matchingPage.steps.verifyIncorrectOptionIcon(2);
101
+ matchingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
102
+ matchingPage.steps.verifyCorrectAnswerSectionNotExists();
103
+ });
104
+
105
+ it('When the user attempts the question partially correct with all the dropzone correctly attempted but one dropzone incomplete, then on switching to \'Grading\' view, correct icon should be displayed besides the correct answer responses, incorrect icon should be displayed besides incorrect answer response, a status message with text \'Your answer is incorrect\' and correct answer section with all correct answers along with numeration should be displayed', () => {
106
+ matchingPage.steps.resetQuestionPreview();
107
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Fish', dropzoneIndex: 1 }, { optionText: 'Cat', dropzoneIndex: 2 }]);
108
+ matchingPage.steps.switchToGradingView();
109
+ matchingPage.steps.verifyCorrectIncorrectIconNotExist(0);
110
+ matchingPage.steps.verifyCorrectOptionIcon(1);
111
+ matchingPage.steps.verifyCorrectOptionIcon(2);
112
+ matchingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
113
+ matchingPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Elephant'], ['Fish'], ['Cat']]);
114
+ matchingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
115
+ cy.log('When user clicks on Check answer button after he attempts the question partially correct with all the dropzone correctly attempted but one dropzone incomplete then correct icon should be displayed besides the correct answer responses, incorrect icon should be displayed besides incorrect answer response, status message \'Your answer is incorrect\' should be displayed and correct answer section should not be displayed')
116
+ matchingPage.steps.checkAnswer();
117
+ matchingPage.steps.verifyCorrectIncorrectIconNotExist(0);
118
+ matchingPage.steps.verifyCorrectOptionIcon(1);
119
+ matchingPage.steps.verifyCorrectOptionIcon(2);
120
+ matchingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
121
+ matchingPage.steps.verifyCorrectAnswerSectionNotExists();
122
+ });
123
+
124
+ it('When user attempts the question correctly, on switching to \'Grading\' view, then correct icons should be displayed beside all the correct responses, correct icon should be displayed besides the correct answer responses, a status message with text \'Your answer is correct\' and correct answer section should not be displayed', () => {
125
+ matchingPage.steps.resetQuestionPreview();
126
+ matchingPage.steps.clickAndDropOptionInDropzonePreviewTab([{ optionText: 'Elephant', dropzoneIndex: 0 }, { optionText: 'Fish', dropzoneIndex: 1 }, { optionText: 'Cat', dropzoneIndex: 2 }]);
127
+ matchingPage.steps.switchToGradingView();
128
+ matchingPage.steps.verifyCorrectOptionIcon(0);
129
+ matchingPage.steps.verifyCorrectOptionIcon(1);
130
+ matchingPage.steps.verifyCorrectOptionIcon(2);
131
+ matchingPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
132
+ matchingPage.steps.verifyCorrectAnswerSectionNotExists();
133
+ matchingPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
134
+ cy.log('When user clicks on Check answer button after he attempts the question correctly, then correct icon should be displayed besides the correct answer responses, status message \'Your answer is correct\' should be displayed and correct answer section should not be displayed')
135
+ matchingPage.steps.checkAnswer();
136
+ matchingPage.steps.verifyCorrectOptionIcon(0);
137
+ matchingPage.steps.verifyCorrectOptionIcon(1);
138
+ matchingPage.steps.verifyCorrectOptionIcon(2);
139
+ matchingPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
140
+ matchingPage.steps.verifyCorrectAnswerSectionNotExists();
141
+ });
142
+ });
143
+ });
@@ -9,7 +9,7 @@ var itemReferenceID = "";
9
9
  const promptTextArray = ['Wild', 'Aquatic', 'Pet'];
10
10
  const optionsArray = ['Cat', 'Elephant', 'Fish', 'Bear', 'Eagle'];
11
11
 
12
- describe('Create item page - Fill in the gaps over image - drag and drop: All or nothing ', () => {
12
+ describe('Create item page - Matching: All or nothing ', () => {
13
13
  before(() => {
14
14
  cy.loginAs('admin');
15
15
  });
@@ -7,7 +7,7 @@ const views = utilities.getViews(checkAnswerViews);
7
7
  const promptTextArray = ['Wild', 'Aquatic', 'Pet'];
8
8
  const optionsArray = ['Cat', 'Elephant', 'Fish', 'Bear', 'Eagle'];
9
9
 
10
- describe('Create item page - Fill in the gaps with text - Check answer functionality', () => {
10
+ describe('Create item page - Matching - Check answer functionality', () => {
11
11
  before(() => {
12
12
  cy.loginAs('admin');
13
13
  });
@@ -0,0 +1,180 @@
1
+ import { matchingPage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ import utilities from "../../../support/helpers/utilities";
4
+
5
+ const options = ['option 1', 'option 2', 'option 3'];
6
+
7
+ describe('Create Item page - matching into categories: Draggable options section', () => {
8
+ before(() => {
9
+ cy.loginAs('admin');
10
+ });
11
+
12
+ describe('Draggable options and Draggable options layout dropdown', () => {
13
+ abortEarlySetup();
14
+ before(() => {
15
+ matchingPage.steps.navigateToCreateQuestion('matching');
16
+ cy.barsPreLoaderWait();
17
+ });
18
+
19
+ matchingPage.tests.verifyDraggableOptionsLayoutDropdownSectionContents();
20
+ });
21
+
22
+ describe('Standard options layout - Edit tab section contents', () => {
23
+ abortEarlySetup();
24
+ before(() => {
25
+ matchingPage.steps.navigateToCreateQuestion('matching');
26
+ cy.barsPreLoaderWait();
27
+ });
28
+
29
+ matchingPage.tests.verifyOptionsSectionContents({ optionFieldsCount: 3, optionLabel: 'Options' });
30
+
31
+ matchingPage.tests.verifyDragHandleTooltip();
32
+
33
+ it('When only two options are present, the delete buttons should be in disabled state', () => {
34
+ matchingPage.steps.deleteOption(0);
35
+ matchingPage.steps.verifyDeleteOptionButtonDisabledState();
36
+ });
37
+
38
+ matchingPage.tests.verifyDisabledDeleteButtonTooltip();
39
+
40
+ matchingPage.tests.verifyAddOptionFunctionality();
41
+
42
+ matchingPage.tests.verifyOptionInputFieldErrorState(0);
43
+
44
+ matchingPage.tests.verifyEnabledDeleteButtonAndTooltip();
45
+
46
+ it('When user clicks on the \'Delete\' option button then the respective options input field should get deleted and option numeration should change accordingly', () => {
47
+ cy.log('Pre step: Adding text in all option input fields')
48
+ matchingPage.steps.enterTextInOneOptionInputField(1, 'option 2');
49
+ matchingPage.steps.enterTextInOneOptionInputField(2, 'option 3');
50
+ const optionsAfterDeleting = options.filter((el) => el !== 'option 2')
51
+ matchingPage.steps.deleteOption(1);
52
+ utilities.verifyElementCount(matchingPage.optionWrapper(), 2);
53
+ cy.log('Verifying the input text given to input fields after deletion of 2nd option')
54
+ optionsAfterDeleting.forEach((inputFieldText, optionIndex) => {
55
+ utilities.verifyTextContent(utilities.getNthElement(matchingPage.optionInputField(), optionIndex), inputFieldText);
56
+ });
57
+ });
58
+ });
59
+
60
+ describe('Standard options layout - Specify correct answer section contents', () => {
61
+ abortEarlySetup();
62
+ before(() => {
63
+ matchingPage.steps.navigateToCreateQuestion('matching');
64
+ cy.barsPreLoaderWait();
65
+ });
66
+
67
+ matchingPage.tests.verifyDraggableOptionsForStandardLayoutInSpecifyCorrectAnswerSection();
68
+
69
+ it('When the user deletes an option, then the deleted option should get removed from the options container as well as from the dropzone (if any) in the \'Specify correct answer section\' section', () => {
70
+ const optionsAfterDeleting = options.filter((el) => el !== 'option 3');
71
+ cy.log('Setting a correct answer option')
72
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ optionText: 'option 3', dropzoneIndex: 0 }]);
73
+ matchingPage.steps.deleteOption(2);
74
+ matchingPage.steps.verifyDropzoneTextSpecifyCorrectAnswerSection(0, '');
75
+ optionsAfterDeleting.forEach((inputFieldText, optionIndex) => {
76
+ matchingPage.steps.verifyOptionContainerOptionSpecifyCorrectAnswerSection([{ index: optionIndex, optionText: inputFieldText }]);
77
+ });
78
+ });
79
+ });
80
+
81
+ describe('Standard options layout - Preview tab contents', () => {
82
+ abortEarlySetup();
83
+ before(() => {
84
+ matchingPage.steps.navigateToCreateQuestion('matching');
85
+ cy.barsPreLoaderWait();
86
+ matchingPage.steps.switchToPreviewTab();
87
+ });
88
+
89
+ matchingPage.tests.verifyDraggableOptionsForStandardLayoutInPreviewTab();
90
+ });
91
+
92
+ describe('Grouped options layout - Edit tab section contents', () => {
93
+ abortEarlySetup();
94
+ before(() => {
95
+ matchingPage.steps.navigateToCreateQuestion('matching');
96
+ cy.barsPreLoaderWait();
97
+ });
98
+
99
+ matchingPage.tests.verifyGroupedOptionsLayoutSectionContents();
100
+
101
+ matchingPage.tests.verifyOptionsSectionContents({ optionFieldsCount: 2, optionLabel: 'Options for drag & drop' });
102
+
103
+ it('When only two options are present, the delete buttons should be in disabled state', () => {
104
+ matchingPage.steps.deleteOption(0);
105
+ matchingPage.steps.verifyDeleteOptionButtonDisabledState();
106
+ });
107
+
108
+ it('When the user clicks on \'Add group\' button without entering text in the option input fields, error message \'Error: Option is required\' should be displayed', () => {
109
+ matchingPage.steps.addGroup();
110
+ matchingPage.steps.verifyOptionsInputFieldErrorMessage(3);
111
+ matchingPage.steps.verifyOptionsInputFieldErrorMessage(4);
112
+ });
113
+
114
+ it('When the user enters text in the options input field, the error messages should disappear', () => {
115
+ matchingPage.steps.enterTextInOneOptionInputField(0, 'option 1');
116
+ matchingPage.steps.enterTextInOneOptionInputField(1, 'option 2');
117
+ matchingPage.steps.verifyOptionsInputFieldErrorMessageDoesNotExist(3);
118
+ matchingPage.steps.verifyOptionsInputFieldErrorMessageDoesNotExist(4);
119
+ });
120
+
121
+ matchingPage.tests.addGroupFunctionality();
122
+
123
+ it('User should be able to add another group using \'Add group\' button and the name for this new group should be \'Group 3\'', () => {
124
+ cy.log('Pre step: Set options in group 2 tab, then add new group');
125
+ matchingPage.steps.enterTextInOneOptionInputField(0, 'option 3');
126
+ matchingPage.steps.enterTextInOneOptionInputField(1, 'option 4');
127
+ matchingPage.steps.addGroup(2);
128
+ });
129
+
130
+ it('User should be able to delete a group by clicking on the \'Close\' icon button alongside group tab and the name of the group tabs should get updated accordingly', () => {
131
+ cy.log('Pre step: Set options in group 3 tab, then switch to group 2 tab and \'Close\' icon button');
132
+ matchingPage.steps.enterTextInOneOptionInputField(0, 'option 5');
133
+ matchingPage.steps.enterTextInOneOptionInputField(1, 'option 6');
134
+ matchingPage.steps.switchToGroupTab(1);
135
+ matchingPage.steps.deleteGroup(1);
136
+ utilities.verifyElementCount(matchingPage.groupTab(), 2);
137
+ matchingPage.steps.verifyGroupTabLabel(1);
138
+ });
139
+ });
140
+
141
+ describe('Grouped options layout - Specify correct answer section contents', () => {
142
+ abortEarlySetup();
143
+ before(() => {
144
+ matchingPage.steps.navigateToCreateQuestion('matching');
145
+ cy.barsPreLoaderWait();
146
+ matchingPage.steps.expandDraggableOptionsLayoutDropdown();
147
+ matchingPage.steps.selectOptionFromDraggableOptionsLayoutDropdown('Grouped');
148
+ });
149
+
150
+ matchingPage.tests.verifyDraggableOptionsForGroupedLayoutInSpecifyCorrectAnswerSection();
151
+
152
+ it('When the user deletes a group, then the deleted group should get removed from the options container as well as from the response areas (if any) of the specify correct answer section', () => {
153
+ cy.log('Pre step: Entering text into the text fields of group 2 response container')
154
+ matchingPage.steps.addInputToOptionsInputField(['option 3', 'option 4']);
155
+ matchingPage.steps.addGroupTitle('Group title B');
156
+ cy.log('Setting a correct answer option')
157
+ matchingPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection([{ 'optionText': 'option 1', 'dropzoneIndex': 0 }]);
158
+ cy.log('Deleting the 2nd group')
159
+ matchingPage.steps.switchToGroupTab(0);
160
+ matchingPage.steps.deleteGroup(0);
161
+ utilities.verifyElementCount(matchingPage.groupedOptionsContainerSpecifyCorrectAnswerSection(), 1);
162
+ matchingPage.steps.verifyDropzoneTextSpecifyCorrectAnswerSection(0, '');
163
+ cy.log('verifying the contents of group 2 after deleting group 1')
164
+ matchingPage.steps.verifyGroupedContainerContentsInSpecifyCorrectAnswerSection(0, ['option 3', 'option 4']);
165
+ utilities.verifyInnerText(matchingPage.groupedOptionsTitleSpecifyCorrectAnswerSection(), 'Group title B');
166
+ });
167
+ });
168
+
169
+ describe('Grouped options layout - Preview tab contents', () => {
170
+ abortEarlySetup();
171
+ before(() => {
172
+ matchingPage.steps.navigateToCreateQuestion('matching');
173
+ cy.barsPreLoaderWait();
174
+ matchingPage.steps.expandDraggableOptionsLayoutDropdown();
175
+ matchingPage.steps.selectOptionFromDraggableOptionsLayoutDropdown('Grouped');
176
+ });
177
+
178
+ matchingPage.tests.verifyDraggableOptionsForGroupedLayoutInPreviewTab();
179
+ });
180
+ });