itemengine-cypress-automation 1.0.15 → 1.0.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (21) hide show
  1. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridAdditionalSettingsBasic.js +235 -0
  2. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridAutoScoredScoring.js +205 -0
  3. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridAutoScoredScoringWithAlternateAnswer.js +472 -0
  4. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridEditTabBasicSection.js +589 -0
  5. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridEditTabScoringSection.js +282 -0
  6. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridHeaderSection.js +97 -0
  7. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridManuallyAndNonScored.js +146 -0
  8. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridOptionsAdditionalSettings.js +345 -0
  9. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridPartialDifferentWeights.js +188 -0
  10. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridPartialDifferentWeightsWithAlternateAnswer.js +662 -0
  11. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridPartialEqualWeights.js +190 -0
  12. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridPartialEqualWeightsWIthAlternateAnswer.js +595 -0
  13. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridQuestionStemAdditionalSettings.js +258 -0
  14. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridRandomizeOptions.js +122 -0
  15. package/cypress/e2e/ILC/SingleSelectionGrid/singleSelectionGridSetCorrectAnswerSection.js +183 -0
  16. package/cypress/e2e/ILC/UploadResponse/uploadResponseAdditionalSettings.js +185 -0
  17. package/cypress/e2e/ILC/UploadResponse/uploadResponseEditTabBasicSections.js +250 -0
  18. package/cypress/e2e/ILC/UploadResponse/uploadResponseHeaderSection.js +80 -0
  19. package/cypress/e2e/ILC/UploadResponse/uploadResponsePreview.js +651 -0
  20. package/cypress/e2e/ILC/UploadResponse/uploadResponseScoringSection.js +60 -0
  21. package/package.json +1 -1
@@ -0,0 +1,282 @@
1
+ import { singleSelectionGridPage } from "../../../pages/singleSelectionGridPage";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ const css = Cypress.env('css');
4
+
5
+ const questionStems = ['Pollution caused by treating chemical waste', 'Pollution caused by cement production', 'Pollution caused by methane production', 'Pollution caused by cement and methane production'];
6
+ const options = ['True', 'False'];
7
+
8
+ describe('Create Item page - Single Selection Grid: Edit tab scoring types and set correct answer section (Correct answer tab)', () => {
9
+ before(() => {
10
+ cy.loginAs('admin');
11
+ });
12
+
13
+ describe('Scoring section contents', () => {
14
+ abortEarlySetup();
15
+ before(() => {
16
+ cy.log('Navigating to Single selection grid question type');
17
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
18
+ });
19
+
20
+ singleSelectionGridPage.tests.verifyScoringTypeLabelAndDropdown('autoScored');
21
+ });
22
+
23
+ describe('Edit tab \'Set correct answer\' section (Correct answer tab) and \'Scoring\' section for Auto scored: All or Nothing scoring type', () => {
24
+ abortEarlySetup();
25
+ before(() => {
26
+ cy.log('Add question instructions, question stem, options and set correct answers');
27
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
28
+ singleSelectionGridPage.steps.addQuestionInstructions();
29
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
30
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options);
31
+ });
32
+
33
+ singleSelectionGridPage.tests.verifyAutoScoredAllOrNothingPointsAndMinimumScoreAwardedLabelAndInputField();
34
+
35
+ singleSelectionGridPage.tests.verifyAllContentsOfSetCorrectAnswerTableForScoringType('All or nothing', questionStems, options);
36
+
37
+ singleSelectionGridPage.tests.verifyPointsFieldErrorState(10);
38
+
39
+ singleSelectionGridPage.tests.verifyMinimumScoreIfAttemptedFieldErrorState(10, 20, 10);
40
+ });
41
+
42
+ describe('Edit tab \'Set correct answer\' section (Correct answer tab) and \'Scoring\' section for Auto scored: Partial equal weights scoring type', () => {
43
+ abortEarlySetup();
44
+ before(() => {
45
+ cy.log('Navigating to Single selection grid question type');
46
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
47
+ singleSelectionGridPage.steps.addQuestionInstructions();
48
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
49
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options);
50
+ });
51
+
52
+ it('When user has selected Auto scored in the scoring type dropdown then user should be able to select \'Partial - equal weights\' scoring type', () => {
53
+ singleSelectionGridPage.scoringTypeDropdown()
54
+ .verifyInnerText('Auto scored');
55
+ singleSelectionGridPage.steps.selectPartialEqualWeightsCheckbox();
56
+ });
57
+
58
+ it('When the Points input field is empty and the user has switched to \'Partial - equal weights\' scoring, then \'Points per response\' label should be displayed and a \'-\' should be displayed besides column, \'Penalty Points\' and \'Minimum score awarded (if attempted)\' labels and input fields should be displayed and \'Round down score\' label and checkbox should be displayed and by default it should be checked', () => {
59
+ singleSelectionGridPage.steps.verifyDefaultPointsLabelAndInputField();
60
+ singleSelectionGridPage.pointsPerResponseLabel()
61
+ .verifyInnerText('Points per response')
62
+ .should('be.visible');
63
+ singleSelectionGridPage.steps.verifyPartialEqualWeightsPointsPerResponseScore('-');
64
+ singleSelectionGridPage.steps.verifyDefaultPenaltyPointsInputFieldAndLabel();
65
+ singleSelectionGridPage.steps.verifyDefaultMinimumScoreIfAttemptedLabelAndPointsField()
66
+ singleSelectionGridPage.steps.verifyDefaultRoundDownScoreCheckboxCheckedAndLabel()
67
+ });
68
+
69
+ it('When user gives a score input to \'Points\' input field, then the score should be equally divided and displayed besides each response under the \'Points per response\' label', () => {
70
+ singleSelectionGridPage.steps.allotPoints('20');
71
+ singleSelectionGridPage.steps.verifyPartialEqualWeightsPointsPerResponseScore('5');
72
+ });
73
+
74
+ singleSelectionGridPage.tests.verifyAllContentsOfSetCorrectAnswerTableForScoringType('Partial equal weights', questionStems, options);
75
+
76
+ it('When user adds a question stem then the Points per response should be updated accordingly', () => {
77
+ singleSelectionGridPage.steps.addQuestionStem();
78
+ singleSelectionGridPage.steps.addInputToQuestionStemField(4, questionStems[0]);
79
+ singleSelectionGridPage.steps.verifyPartialEqualWeightsPointsPerResponseScore('4');
80
+ });
81
+
82
+ it('When user deletes a question stem then the Points per response should be updated accordingly', () => {
83
+ singleSelectionGridPage.steps.deleteQuestionStem(0);
84
+ singleSelectionGridPage.steps.verifyPartialEqualWeightsPointsPerResponseScore('5');
85
+ });
86
+
87
+ it('User should be able to enter points in \'Penalty Points\' and \'Minimum score awarded (if attempted)\' input fields', () => {
88
+ singleSelectionGridPage.steps.allotPenaltyPoints(2);
89
+ singleSelectionGridPage.steps.allotMinimumScoreAwardedIfAttempted(1);
90
+ });
91
+
92
+ //https://redmine.zeuslearning.com/issues/529958
93
+ it('CSS of \'Points per response\' label and its displayed score, \'Penalty Points\' and \'Minimum score awarded (if attempted)\' and \'Round down score\' checkbox', { tags: 'css' }, () => {
94
+ singleSelectionGridPage.pointsPerResponseLabel()
95
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
96
+ singleSelectionGridPage.partialEqualWeightsPointsPerResponseScore()
97
+ .verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
98
+ singleSelectionGridPage.penaltyPointsLabel()
99
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
100
+ singleSelectionGridPage.minimumScoreIfAttemptedLabel()
101
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
102
+ singleSelectionGridPage.rounddownScoreCheckboxLabel()
103
+ .verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.regular);
104
+ });
105
+
106
+ it('Accessibility of \'Penalty Points\' and \'Minimum score awarded (if attempted)\' input field and \'Round down score\' checkbox', { tags: 'a11y' }, () => {
107
+ cy.checkAccessibility(singleSelectionGridPage.penaltyPointsInputField().parents('.points-container'));
108
+ cy.checkAccessibility(singleSelectionGridPage.rounddownScoreCheckbox().parents('.round-down-score-wrapper'));
109
+ });
110
+
111
+ it('When the user switches to \'All or nothing\' scoring, the \'Points per response\' label and the points displayed for individual responses should not be displayed and the points displayed in \'Points\' input field should remain unchanged', () => {
112
+ singleSelectionGridPage.steps.selectAllOrNothingCheckbox()
113
+ singleSelectionGridPage.pointsPerResponseLabel()
114
+ .should('not.exist');
115
+ singleSelectionGridPage.partialEqualWeightsPointsPerResponseScore()
116
+ .should('not.exist');
117
+ singleSelectionGridPage.steps.verifyPointsFieldValue('20');
118
+ });
119
+
120
+ it('When user has entered points in \'All or nothing\' scoring type and switches to \'Partial equal weights\' scoring type, then the score should be equally divided and displayed besides each response under the \'Points per response\' label', () => {
121
+ singleSelectionGridPage.steps.clearPointsField();
122
+ singleSelectionGridPage.steps.allotPoints('9');
123
+ singleSelectionGridPage.steps.selectPartialEqualWeightsCheckbox();
124
+ singleSelectionGridPage.steps.verifyPartialEqualWeightsPointsPerResponseScore('2.25');
125
+ });
126
+ });
127
+
128
+ describe('Edit tab \'Set correct answer\' section (Correct answer tab) and \'Scoring\' section for Auto scored: Partial different weights scoring type', () => {
129
+ abortEarlySetup();
130
+ before(() => {
131
+ cy.log('Navigating to Single selection grid question type');
132
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
133
+ cy.barsPreLoaderWait();
134
+ singleSelectionGridPage.steps.addQuestionInstructions();
135
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
136
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options);
137
+ });
138
+
139
+ it('When user has selected Auto scored in the scoring type dropdown then user should be able to select \'Partial - different weights\' scoring', () => {
140
+ singleSelectionGridPage.scoringTypeDropdown()
141
+ .verifyInnerText('Auto scored');
142
+ singleSelectionGridPage.steps.selectPartialDifferentWeightsCheckbox();
143
+ });
144
+
145
+ it('When the user has switched to \'Partial - different weights\' scoring, then \'Points per response\' label should be displayed and a points input field should be displayed besides each response option, \'Penalty Points\' and \'Minimum score awarded (if attempted)\' labels and input fields should be displayed and \'Round down score\' checkbox should be displayed and by default it should be checked', () => {
146
+ singleSelectionGridPage.pointsPerResponseLabel()
147
+ .verifyInnerText('Points per response')
148
+ .should('be.visible');
149
+ singleSelectionGridPage.steps.verifyPartialDifferentWeightsPointsInputFieldIsEmpty();
150
+ });
151
+
152
+ it('When the user has not selected any radio button in the table, then the \'Points per response\' input field should be disabled', () => {
153
+ singleSelectionGridPage.steps.verifyPartialDifferentWeightsPointsInputFieldIsDisabled()
154
+ });
155
+
156
+ it('CSS of disabled points input field', { tags: 'css' }, () => {
157
+ singleSelectionGridPage.partialDifferentWeightsPointsInputField()
158
+ .should('have.css', 'opacity', '1')
159
+ .next('fieldset')
160
+ .verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular)
161
+ });
162
+
163
+ it('Accessibility of disabled Points field', { tags: 'a11y' }, () => {
164
+ cy.checkAccessibility(singleSelectionGridPage.partialDifferentWeightsPointsInputField().parents('.partial-different-points-wrapper'));
165
+ });
166
+
167
+ singleSelectionGridPage.tests.verifyAllContentsOfSetCorrectAnswerTableForScoringType('Partial different weights', questionStems, options);
168
+
169
+ it('When user selects a radio in the table then the \'Points per response\' input field should be enabled and user should be able to give a score input to \'Points per response\' input fields', () => {
170
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInSetCorrectAnswerTable([1, 0, 0, 1]);
171
+ for (let index = 0; index < 4; index++) {
172
+ singleSelectionGridPage.steps.verifyPartialDifferentWeightsPointsInputFieldIsEnabled(index);
173
+ };
174
+ singleSelectionGridPage.steps.allotPartialDifferentWeightsToAllPointsFields([4.2, 1.8, 3.7, 2.3]);
175
+ });
176
+
177
+ it('User should be able to enter points in \'Penalty Points\' and \'Minimum score awarded (if attempted)\' input fields', () => {
178
+ singleSelectionGridPage.steps.allotPenaltyPoints(2);
179
+ singleSelectionGridPage.steps.allotMinimumScoreAwardedIfAttempted(1);
180
+ });
181
+
182
+ it('CSS of \'Points per response\' label, \'Penalty Points\' and \'Minimum score awarded (if attempted)\' and \'Round down score\' checkbox', { tags: 'css' }, () => {
183
+ singleSelectionGridPage.partialDifferentWeightsPointsInputField()
184
+ .next('fieldset')
185
+ .verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
186
+ singleSelectionGridPage.pointsPerResponseLabel()
187
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
188
+ singleSelectionGridPage.penaltyPointsLabel()
189
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
190
+ singleSelectionGridPage.minimumScoreIfAttemptedLabel()
191
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
192
+ singleSelectionGridPage.rounddownScoreCheckboxLabel()
193
+ .verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.regular);
194
+ });
195
+
196
+ it('Accessibility of \'Points per response\', \'Penalty Points\' and \'Minimum score awarded (if attempted)\' input fields and \'Round down score\' checkbox', { tags: 'a11y' }, () => {
197
+ cy.checkAccessibility(singleSelectionGridPage.partialDifferentWeightsPointsInputField());
198
+ cy.checkAccessibility(singleSelectionGridPage.penaltyPointsInputField().parents('.points-container'));
199
+ cy.checkAccessibility(singleSelectionGridPage.rounddownScoreCheckbox().parents('.round-down-score-wrapper'));
200
+ });
201
+
202
+ it('When the user switches to \'All or nothing\' scoring, the points added for individual responses in Partial - different weights scoring should get summed up in the All or nothing scoring Points input field', () => {
203
+ singleSelectionGridPage.steps.selectAllOrNothingCheckbox()
204
+ singleSelectionGridPage.pointsPerResponseLabel()
205
+ .should('not.exist');
206
+ singleSelectionGridPage.partialDifferentWeightsPointsInputField()
207
+ .should('not.exist');
208
+ singleSelectionGridPage.steps.verifyPointsFieldValue('12');
209
+ });
210
+
211
+ //TODO: https://redmine.zeuslearning.com/issues/528890 update below case after issue gets fixed if needed
212
+ it('When user has entered points in \'All or nothing\' scoring type and switches to \'Partial different weights\' scoring type, then the points input field displayed besides each response should be blank.', () => {
213
+ singleSelectionGridPage.steps.allotPoints('7');
214
+ singleSelectionGridPage.steps.selectPartialDifferentWeightsCheckbox();
215
+ singleSelectionGridPage.steps.verifyPartialDifferentWeightsPointsInputFieldIsEmpty();
216
+ });
217
+ });
218
+
219
+ describe('Edit tab \'Set correct answer\' section (Correct answer tab) and \'Scoring\' section for Manually Scored scoring type', () => {
220
+ abortEarlySetup();
221
+ before(() => {
222
+ cy.log('Navigating to Single selection grid question type');
223
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
224
+ singleSelectionGridPage.steps.addQuestionInstructions();
225
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
226
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options);
227
+ });
228
+
229
+ it('User should be able to select \'Manually scored\' scoring type from scoring type dropdown', () => {
230
+ singleSelectionGridPage.steps.selectAScoringTypeFromScoringTypeDropdown('Manually scored')
231
+ });
232
+
233
+ //Failing due to https://redmine.zeuslearning.com/issues/542358
234
+ it('When the user has selected \'Manually Scored\' option from the Scoring Type dropdown then the \'Set Correct Answer\' section should not be displayed; \'All or Nothing\', \'Partial - equal weights\' and \'Partial - different weights\' radio buttons should not be displayed; \'Points\' and \'Minimum score awarded (if attempted)\' labels and input fields should be displayed; and inside Additional Settings accordion Check Answer section i.e. \'Allow students to check answer\' checkbox should not be displayed', () => {
235
+ singleSelectionGridPage.setCorrectAnswerLabel()
236
+ .should('not.exist');
237
+ singleSelectionGridPage.allOrNothingCheckbox()
238
+ .should('not.exist');
239
+ singleSelectionGridPage.partialEqualWeightsCheckbox()
240
+ .should('not.exist');
241
+ singleSelectionGridPage.partialDifferentWeightsCheckbox()
242
+ .should('not.exist');
243
+ singleSelectionGridPage.penaltyPointsInputField()
244
+ .should('not.exist');
245
+ singleSelectionGridPage.penaltyPointsLabel()
246
+ .should('not.exist');
247
+ singleSelectionGridPage.rounddownScoreCheckbox()
248
+ .should('not.exist');
249
+ singleSelectionGridPage.rounddownScoreCheckboxLabel()
250
+ .should('not.exist');
251
+ singleSelectionGridPage.randomizeOptionsCheckbox()
252
+ .should('exist');
253
+ singleSelectionGridPage.randomizeOptionsCheckboxLabel()
254
+ .should('be.visible');
255
+ singleSelectionGridPage.steps.verifyDefaultMinimumScoreIfAttemptedLabelAndPointsField()
256
+ singleSelectionGridPage.steps.expandAdditonalSettings()
257
+ singleSelectionGridPage.checkAnswerLabel()
258
+ .should('not.exist');
259
+ singleSelectionGridPage.allowStudentsToCheckAnswerLabel()
260
+ .should('not.exist');
261
+ });
262
+
263
+ singleSelectionGridPage.tests.verifyPointsFieldErrorState(10);
264
+
265
+ singleSelectionGridPage.tests.verifyMinimumScoreIfAttemptedFieldErrorState(10, 20, 10);
266
+ });
267
+
268
+ describe('Edit tab \'Set correct answer\' section (Correct answer tab) and \'Scoring\' section for Non Scored scoring type', () => {
269
+ abortEarlySetup();
270
+ before(() => {
271
+ cy.log('Navigating to Single selection grid question type');
272
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
273
+ singleSelectionGridPage.steps.addQuestionInstructions();
274
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
275
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options);
276
+ });
277
+
278
+ singleSelectionGridPage.tests.verifyEditTabNonScoredScoringSectionContents();
279
+
280
+ singleSelectionGridPage.tests.verifyAllContentsOfSetCorrectAnswerTableForScoringType('Non scored', questionStems, options);
281
+ });
282
+ });
@@ -0,0 +1,97 @@
1
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
2
+ import { dialogBoxBase } from "../../../pages";
3
+ import { singleSelectionGridPage } from "../../../pages/singleSelectionGridPage";
4
+
5
+ let optionsForQuestionStem = ['Pollution caused by treating chemical waste', 'Pollution caused by cement production', 'Pollution caused by methane production', 'Pollution caused by cement and methane production'];
6
+ let options = ['True', 'False'];
7
+
8
+ describe('Create question page - Single selection grid: Header section and Saving question', () => {
9
+ before(() => {
10
+ cy.loginAs('admin');
11
+ });
12
+
13
+ describe('Header section contents', () => {
14
+ abortEarlySetup();
15
+ before(() => {
16
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid')
17
+ });
18
+
19
+ singleSelectionGridPage.tests.verifyCreateQuestionPageQuestionTypeHeader('Single selection grid');
20
+ });
21
+
22
+ describe('Tabs section', () => {
23
+ abortEarlySetup();
24
+ before(() => {
25
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid')
26
+ });
27
+
28
+ singleSelectionGridPage.tests.verifyTabsSection();
29
+ });
30
+
31
+ describe('Cancel button', () => {
32
+ abortEarlySetup();
33
+ before(() => {
34
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid')
35
+ });
36
+
37
+ singleSelectionGridPage.tests.verifyCancelButton('single selection grid');
38
+ });
39
+
40
+ describe('Save Question button', () => {
41
+ abortEarlySetup();
42
+ before(() => {
43
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid')
44
+ cy.barsPreLoaderWait();
45
+ });
46
+
47
+ describe('Validation error messages', () => {
48
+ dialogBoxBase.tests.verifyRequiredFieldsWarningPopupOnClickingSaveButton();
49
+
50
+ it('Validation error messages should be displayed below required input fields', () => {
51
+ singleSelectionGridPage.steps.verifyQuestionInstructionsErrorMessage()
52
+ for (let index = 0; index < 4; index++) {
53
+ singleSelectionGridPage.steps.verifyQuestionStemErrorMessageIsDisplayed(index)
54
+ }
55
+ for (let index = 0; index < 2; index++) {
56
+ singleSelectionGridPage.steps.verifyOptionsErrorMessageIsDisplayed(index)
57
+ }
58
+ singleSelectionGridPage.steps.verifyPointsFieldErrorMessage();
59
+ singleSelectionGridPage.steps.verifySetCorrectAnswerErrorIconIsDisplayed()
60
+ singleSelectionGridPage.errorMessage()
61
+ .last()
62
+ .verifyInnerText('Error: Please set a correct answer.');
63
+ });
64
+
65
+ it('Validation error messages should disappear when required input fields are filled', () => {
66
+ singleSelectionGridPage.steps.addQuestionInstructions();
67
+ singleSelectionGridPage.steps.verifyQuestionInstructionsErrorMessageIsNotDisplayed();
68
+ singleSelectionGridPage.steps.allotPoints(20);
69
+ singleSelectionGridPage.steps.verifyPointsFieldErrorMessageIsNotDisplayed();
70
+ cy.log('Pre step: Adding response options')
71
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(optionsForQuestionStem)
72
+ for (let index = 0; index < 4; index++) {
73
+ singleSelectionGridPage.steps.verifyQuestionStemErrorMessageIsNotDisplayed(index);
74
+ }
75
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options)
76
+ for (let index = 0; index < 2; index++) {
77
+ singleSelectionGridPage.steps.verifyOptionsErrorMessageIsNotDisplayed(index)
78
+ }
79
+ singleSelectionGridPage.steps.selectOptionFromSetCorrectAnswerTable(0, 1);
80
+ singleSelectionGridPage.steps.selectOptionFromSetCorrectAnswerTable(1, 1);
81
+ singleSelectionGridPage.steps.selectOptionFromSetCorrectAnswerTable(2, 0);
82
+ singleSelectionGridPage.steps.selectOptionFromSetCorrectAnswerTable(3, 1);
83
+ singleSelectionGridPage.steps.verifyErrorMessageIsNotDisplayed()
84
+ singleSelectionGridPage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed()
85
+ });
86
+
87
+ singleSelectionGridPage.tests.verifya11yOfCreateItemWrapperContents();
88
+ });
89
+
90
+ describe('Saving a question', () => {
91
+ it('When user has filled all the mandatory fields then on clicking on Save Question button the question should get saved and a snackbar with text \'Saved successfully!\' should be displayed', () => {
92
+ singleSelectionGridPage.steps.saveAQuestionAndVerifySnackbar();
93
+ });
94
+ singleSelectionGridPage.tests.verifySavedSuccessfullySnackbarCSSanda11y();
95
+ });
96
+ });
97
+ });
@@ -0,0 +1,146 @@
1
+ import { singleSelectionGridPage } from "../../../pages/singleSelectionGridPage";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ const css = Cypress.env('css');
4
+
5
+ const questionStems = ['Pollution caused by treating chemical waste', 'Pollution caused by cement production', 'Pollution caused by methane production', 'Pollution caused by cement and methane production'];
6
+ const options = ['Fully agree as true', 'Fully agree as false'];
7
+
8
+ describe('Create Item page - Single Selection Grid: Preview tab Scoring Section', () => {
9
+ before(() => {
10
+ cy.loginAs('admin');
11
+ });
12
+
13
+ describe('Question Preview: Manually scored', () => {
14
+ abortEarlySetup();
15
+ before(() => {
16
+ cy.log('Navigating to Single selection grid question type');
17
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
18
+ cy.log('Adding question instructions, question stems, options, setting correct answer and adding points for Autoscored Partial equal weights scoring type and switching to Preview tab');
19
+ singleSelectionGridPage.steps.addQuestionInstructions();
20
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
21
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options);
22
+ singleSelectionGridPage.steps.selectAScoringTypeFromScoringTypeDropdown('Manually scored')
23
+ singleSelectionGridPage.steps.switchToPreviewTab();
24
+ });
25
+
26
+ it('When the user switches to the Preview tab, the question instruction should be displayed and the question stems and options along with radio buttons should be displayed in the preview tab', () => {
27
+ singleSelectionGridPage.steps.verifyQuestionInstructionsText();
28
+ singleSelectionGridPage.steps.verifyQuestionStemsInPreviewTabAnswerTable(questionStems);
29
+ singleSelectionGridPage.steps.verifyTableHeaderContentsInPreviewTabAnswerTable(options);
30
+ singleSelectionGridPage.steps.verifyRadioButtonsUncheckedInPreviewTabAnswerTable();
31
+ });
32
+
33
+ singleSelectionGridPage.tests.verifyShowCorrectAnswerAndPointsNotDisplayedInPreviewTab()
34
+ });
35
+
36
+ describe('Question Preview: Non scored', () => {
37
+ abortEarlySetup();
38
+ before(() => {
39
+ cy.log('Navigating to Single selection grid question type');
40
+ singleSelectionGridPage.steps.navigateToCreateQuestion('single selection grid');
41
+ cy.log('Adding question instructions, question stems, options, setting correct answer and adding points for Autoscored Partial equal weights scoring type and switching to Preview tab');
42
+ singleSelectionGridPage.steps.addQuestionInstructions();
43
+ singleSelectionGridPage.steps.addInputToAllQuestionStemFields(questionStems);
44
+ singleSelectionGridPage.steps.addInputToAllOptionsFields(options);
45
+ singleSelectionGridPage.steps.selectAScoringTypeFromScoringTypeDropdown('Non scored')
46
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInSetCorrectAnswerTable([0, 1, 0, 1]);
47
+ singleSelectionGridPage.steps.expandAdditonalSettings();
48
+ singleSelectionGridPage.steps.checkAllowStudentsToCheckAnswerCheckbox()
49
+ singleSelectionGridPage.steps.switchToPreviewTab();
50
+ });
51
+
52
+ singleSelectionGridPage.tests.verifyShowCorrectAnswerLabelAndCheckboxExistAndPreviewScoreNotExistInPreviewTab();
53
+
54
+ it('When the user selects \'Show correct answer\' checkbox without attempting the question, green check-mark icons should be displayed beside the correct answer options, no incorrect icons or label should be displayed below the table', () => {
55
+ singleSelectionGridPage.steps.checkShowCorrectAnswerCheckbox()
56
+ singleSelectionGridPage.steps.verifyCorrectOptionCheckmarkIconForAllQuestionStems([0, 1, 0, 1]);
57
+ singleSelectionGridPage.incorrectIcon()
58
+ .should('not.exist');
59
+ singleSelectionGridPage.correctIncorectAnswerLabel()
60
+ .should('not.exist');
61
+ singleSelectionGridPage.steps.verifyCorrectIncorrectBorderNotVisible()
62
+ });
63
+
64
+ it('When user selects Check answer button without attempting the question, then then red cross-mark icon or green check-mark should not be displayed anywhere, correct/incorrect answer label and its border should not be displayed', () => {
65
+ cy.log('Post step: Unchecking the show correct answer checkbox')
66
+ singleSelectionGridPage.steps.uncheckShowCorrectAnswerCheckbox()
67
+ singleSelectionGridPage.steps.checkAnswer()
68
+ singleSelectionGridPage.correctIcon()
69
+ .should('not.exist');
70
+ singleSelectionGridPage.incorrectIcon()
71
+ .should('not.exist');
72
+ singleSelectionGridPage.correctIncorectAnswerLabel()
73
+ .should('not.exist');
74
+ singleSelectionGridPage.steps.verifyCorrectIncorrectBorderNotVisible()
75
+ });
76
+
77
+ it('Case: When user adds incorrect response', () => {
78
+ cy.log('User selects incorrect options')
79
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInPreviewTabAnswerTable([1, 0, 1, 0]);
80
+
81
+ cy.log('When the user selects \'Show correct answer\' checkbox, red cross-mark icon should be displayed besides the selected incorrect answer options, green check-mark should be displayed beside correct answer options, incorrect answer border should appear, a label \'Incorrect Answer\' should be displayed below the table')
82
+ singleSelectionGridPage.steps.checkShowCorrectAnswerCheckbox()
83
+ singleSelectionGridPage.steps.verifyIncorrectOptionCrossmarkIconForAllQuestionStems([1, 0, 1, 0]);
84
+ singleSelectionGridPage.steps.verifyCorrectOptionCheckmarkIconForAllQuestionStems([0, 1, 0, 1]);
85
+ singleSelectionGridPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect')
86
+ singleSelectionGridPage.steps.verifyIncorrectAttemptBorder()
87
+
88
+ singleSelectionGridPage.steps.verifyQuestionPreviewStateWhenShowCorrectAnswerIsUnchecked()
89
+
90
+ cy.log('When the user clicks on \'Check answer\' button, red cross-mark icon should be displayed besides the incorrect response field, incorrect answer border should appear and a label \'Incorrect Answer\' should be displayed below the table')
91
+ singleSelectionGridPage.steps.checkAnswer()
92
+ singleSelectionGridPage.steps.verifyIncorrectOptionCrossmarkIconForAllQuestionStems([1, 0, 1, 0]);
93
+ singleSelectionGridPage.correctIcon()
94
+ .should('not.exist');
95
+ singleSelectionGridPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect')
96
+ singleSelectionGridPage.steps.verifyIncorrectAttemptBorder()
97
+ });
98
+
99
+ it('Case: When user enters partially correct response', () => {
100
+ cy.log('Selecting parially correct options');
101
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInPreviewTabAnswerTable([1, 1, 1, 1]);
102
+
103
+ cy.log('When user selects \'Show correct answer\' checkbox, red cross-mark icon should be displayed besides the selected incorrect answer options, green check-mark should be displayed beside correct answer options, incorrect answer border should appear, a label \'Incorrect Answer\' should be displayed below the table')
104
+ singleSelectionGridPage.steps.checkShowCorrectAnswerCheckbox()
105
+ singleSelectionGridPage.steps.verifyIncorrectOptionCrossmarkIcon(0, 1)
106
+ singleSelectionGridPage.steps.verifyIncorrectOptionCrossmarkIcon(2, 1)
107
+ singleSelectionGridPage.steps.verifyCorrectOptionCheckmarkIconForAllQuestionStems([0, 1, 0, 1]);
108
+ singleSelectionGridPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect')
109
+ singleSelectionGridPage.steps.verifyIncorrectAttemptBorder()
110
+
111
+ singleSelectionGridPage.steps.verifyQuestionPreviewStateWhenShowCorrectAnswerIsUnchecked()
112
+
113
+ cy.log('When the user clicks on \'Check answer\' button, red cross-mark icon should be displayed besides the selected incorrect options, green checkmark should be displayed beside selected correct options and incorrect answer border should appear and a label \'Incorrect Answer\' should be displayed below the table')
114
+ singleSelectionGridPage.steps.checkAnswer()
115
+ singleSelectionGridPage.steps.verifyIncorrectOptionCrossmarkIcon(0, 1)
116
+ singleSelectionGridPage.steps.verifyCorrectOptionCheckmarkIcon(1, 1)
117
+ singleSelectionGridPage.steps.verifyIncorrectOptionCrossmarkIcon(2, 1)
118
+ singleSelectionGridPage.steps.verifyCorrectOptionCheckmarkIcon(3, 1)
119
+ singleSelectionGridPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect')
120
+ singleSelectionGridPage.steps.verifyIncorrectAttemptBorder()
121
+ });
122
+
123
+ it('Case: When user adds correct response', () => {
124
+ cy.log('Selecting correct options');
125
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInPreviewTabAnswerTable([0, 1, 0, 1]);
126
+
127
+ cy.log('When user selects show correct answer then green check-mark icons should be displayed besides correct answer options and a label \'Correct answer\' should be displayed below the table')
128
+ singleSelectionGridPage.steps.checkShowCorrectAnswerCheckbox()
129
+ singleSelectionGridPage.steps.verifyCorrectOptionCheckmarkIconForAllQuestionStems([0, 1, 0, 1]);
130
+ singleSelectionGridPage.incorrectIcon()
131
+ .should('not.exist');
132
+ singleSelectionGridPage.steps.verifyCorrectIncorrectAnswerLabel('Correct')
133
+ singleSelectionGridPage.steps.verifyCorrectAttemptBorder()
134
+
135
+ singleSelectionGridPage.steps.verifyQuestionPreviewStateWhenShowCorrectAnswerIsUnchecked()
136
+
137
+ cy.log('When the user clicks on the \'Check answer\' button, then green check-mark icons should be displayed besides correct answer options and a label \'Correct answer\' should be displayed below the table');
138
+ singleSelectionGridPage.steps.checkAnswer()
139
+ singleSelectionGridPage.steps.verifyCorrectOptionCheckmarkIconForAllQuestionStems([0, 1, 0, 1]);
140
+ singleSelectionGridPage.incorrectIcon()
141
+ .should('not.exist');
142
+ singleSelectionGridPage.steps.verifyCorrectIncorrectAnswerLabel('Correct')
143
+ singleSelectionGridPage.steps.verifyCorrectAttemptBorder()
144
+ });
145
+ });
146
+ });