itemengine-cypress-automation 1.0.571-scoring-fix-8676243.0 → 1.0.573-IEI-7011-17b1079.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/config-files/ilprod.json +2 -1
- package/cypress/config-files/ilqa.json +2 -1
- package/cypress/config-files/ilstage.json +2 -1
- package/cypress/e2e/ILC/MultipleSelection/allOrNothingWithAlternativeAnswer.js +353 -0
- package/cypress/e2e/ILC/MultipleSelection/partialDifferentWeightsWithAlternativeAnswer.js +464 -1
- package/cypress/e2e/ILC/MultipleSelection/partialEqualWeightsWithAlternativeAnswer.js +379 -0
- package/cypress/e2e/ILC/ShortTextResponseNew/conditionalCheckboxes.js +55 -73
- package/cypress/e2e/ILC/SingleSelection/allOrNothingWithAlternativeAnswer.js +103 -0
- package/cypress/pages/components/index.js +1 -0
- package/cypress/pages/components/showAlternativeAnswersComponent.js +145 -0
- package/cypress/pages/multipleSelectionPage.js +35 -1
- package/cypress/pages/singleSelectionPage.js +22 -1
- package/package.json +1 -1
- package/service.yaml +11 -3
|
@@ -67,79 +67,61 @@ describe('Create item page - Short text response: Conditional checkboxes', () =>
|
|
|
67
67
|
|
|
68
68
|
describe('Only \'Validate if answer is included in the response\' checkbox checked', () => {
|
|
69
69
|
abortEarlySetup();
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
shortTextResponsePage.steps.switchToGradingView();
|
|
126
|
-
shortTextResponsePage.steps.verifyCorrectIcon();
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
describe('Mathematical Expression Tests', () => {
|
|
131
|
-
before(() => {
|
|
132
|
-
shortTextResponsePage.steps.switchToEditTab();
|
|
133
|
-
shortTextResponsePage.steps.enterTextInAnswerInputFieldSpecifyCorrectAnswerSection('y=-2x+5');
|
|
134
|
-
shortTextResponsePage.steps.switchToPreviewTab();
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it('When user attempts the question with exact mathematical expression then full points should be awarded and when user switches to grading view, green check mark beside the response field should be displayed', () => {
|
|
138
|
-
shortTextResponsePage.steps.enterTextInAnswerInputFieldPreviewTab('y=-2x+5');
|
|
139
|
-
shortTextResponsePage.steps.verifyPreviewScore(10, 10);
|
|
140
|
-
shortTextResponsePage.steps.switchToGradingView();
|
|
141
|
-
shortTextResponsePage.steps.verifyCorrectIcon();
|
|
142
|
-
});
|
|
70
|
+
before(() => {
|
|
71
|
+
shortTextResponsePage.steps.navigateToCreateQuestion('short text response');
|
|
72
|
+
shortTextResponsePage.steps.allotPoints(10);
|
|
73
|
+
shortTextResponsePage.steps.enterTextInAnswerInputFieldSpecifyCorrectAnswerSection('Flower is displayed');
|
|
74
|
+
shortTextResponsePage.steps.checkConditionalCheckbox('Validate if answer is included in the response');
|
|
75
|
+
shortTextResponsePage.steps.uncheckConditionalCheckbox('Ignore extra spaces');
|
|
76
|
+
//shortTextResponsePage.steps.checkAllowStudentToCheckAnswerCheckbox();
|
|
77
|
+
shortTextResponsePage.steps.switchToPreviewTab();
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('When user attempts the question with a sentence which includes the answer then full points should be awarded and when user switches to grading view, green check mark beside the response field should be displayed', () => {
|
|
81
|
+
shortTextResponsePage.steps.enterTextInAnswerInputFieldPreviewTab('Flower is displayed in this image');
|
|
82
|
+
shortTextResponsePage.steps.verifyPreviewScore(10, 10);
|
|
83
|
+
shortTextResponsePage.steps.switchToGradingView();
|
|
84
|
+
shortTextResponsePage.steps.verifyCorrectIcon();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('When user attempts the question with a sentence that includes the answer with incorrect casing, then full score should be awarded and when user switches to grading view, a green check mark should be displayed beside response field', () => {
|
|
88
|
+
shortTextResponsePage.steps.resetQuestionPreview();
|
|
89
|
+
shortTextResponsePage.steps.enterTextInAnswerInputFieldPreviewTab('floweR is Displayed');
|
|
90
|
+
shortTextResponsePage.steps.verifyPreviewScore(10, 10);
|
|
91
|
+
shortTextResponsePage.steps.switchToGradingView();
|
|
92
|
+
shortTextResponsePage.steps.verifyCorrectIcon();
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('When user attempts the question with a sentence which includes the answer and correct casing with extra spaces in between the answer then zero points should be awarded and when user switches to grading view, red cross mark beside the response field should be displayed', () => {
|
|
96
|
+
shortTextResponsePage.steps.resetQuestionPreview();
|
|
97
|
+
shortTextResponsePage.steps.enterTextInAnswerInputFieldPreviewTab('Flower is displayed in the picture');
|
|
98
|
+
shortTextResponsePage.steps.verifyPreviewScore(0, 10);
|
|
99
|
+
shortTextResponsePage.steps.switchToGradingView();
|
|
100
|
+
shortTextResponsePage.steps.verifyIncorrectIcon();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('When user attempts the question with answer that has incorrect casing with extra spaces before and after correct answer then full points should be awarded and when user switches to grading view, green check mark beside the response field should be displayed', () => {
|
|
104
|
+
shortTextResponsePage.steps.resetQuestionPreview();
|
|
105
|
+
shortTextResponsePage.steps.enterTextInAnswerInputFieldPreviewTab(' flower is Displayed ');
|
|
106
|
+
shortTextResponsePage.steps.verifyPreviewScore(10, 10);
|
|
107
|
+
shortTextResponsePage.steps.switchToGradingView();
|
|
108
|
+
shortTextResponsePage.steps.verifyCorrectIcon();
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('When user attempts the question with answer that has correct casing with extra spaces before and after correct answer and then full points should be awarded and when user switches to grading view, green check mark beside the correct response field should be displayed', () => {
|
|
112
|
+
shortTextResponsePage.steps.resetQuestionPreview();
|
|
113
|
+
shortTextResponsePage.steps.enterTextInAnswerInputFieldPreviewTab(' Flower is displayed ');
|
|
114
|
+
shortTextResponsePage.steps.verifyPreviewScore(10, 10);
|
|
115
|
+
shortTextResponsePage.steps.switchToGradingView();
|
|
116
|
+
shortTextResponsePage.steps.verifyCorrectIcon();
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('When user attempts the question with exact answer then full points should be awarded and when user switches to grading view, green check mark beside the correct response field should be displayed', () => {
|
|
120
|
+
shortTextResponsePage.steps.resetQuestionPreview();
|
|
121
|
+
shortTextResponsePage.steps.enterTextInAnswerInputFieldPreviewTab('Flower is displayed');
|
|
122
|
+
shortTextResponsePage.steps.verifyPreviewScore(10, 10);
|
|
123
|
+
shortTextResponsePage.steps.switchToGradingView();
|
|
124
|
+
shortTextResponsePage.steps.verifyCorrectIcon();
|
|
143
125
|
});
|
|
144
126
|
});
|
|
145
127
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { singleSelectionPage } from "../../../pages/singleSelectionPage";
|
|
2
2
|
import abortEarlySetup from "../../../support/helpers/abortEarly";
|
|
3
3
|
const css = Cypress.env('css');
|
|
4
|
+
const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT');
|
|
4
5
|
|
|
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'];
|
|
6
7
|
|
|
@@ -35,6 +36,20 @@ describe('Create item page - Single selection: All or nothing with alternative a
|
|
|
35
36
|
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
36
37
|
//correct answer section
|
|
37
38
|
singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(1);
|
|
39
|
+
//show alternative answers
|
|
40
|
+
if (alternativeAnswerCheck === 'true') {
|
|
41
|
+
singleSelectionPage.steps.verifyCorrectAnswersLabelAndPointVisible('(20 points)');
|
|
42
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleExists();
|
|
43
|
+
singleSelectionPage.steps.disableShowAlternativeAnswersToggle();
|
|
44
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
|
|
45
|
+
singleSelectionPage.steps.verifyAlternativeAnswersSectionNotExist();
|
|
46
|
+
singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
|
|
47
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleChecked();
|
|
48
|
+
singleSelectionPage.steps.verifyAlternativeAnswersLabelAndPointVisible(1, '(10 points)');
|
|
49
|
+
singleSelectionPage.steps.verifyAlternateAnswerOptionIconCorrectAnswerSection(2);
|
|
50
|
+
singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
|
|
51
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
|
|
52
|
+
}
|
|
38
53
|
singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
39
54
|
});
|
|
40
55
|
|
|
@@ -49,6 +64,9 @@ describe('Create item page - Single selection: All or nothing with alternative a
|
|
|
49
64
|
singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
|
|
50
65
|
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
51
66
|
singleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
|
|
67
|
+
if (alternativeAnswerCheck === 'true') {
|
|
68
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
|
|
69
|
+
}
|
|
52
70
|
//singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
53
71
|
/*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, correct answer border and a label should not be displayed below the question preview')
|
|
54
72
|
singleSelectionPage.steps.checkAnswer();
|
|
@@ -74,6 +92,9 @@ describe('Create item page - Single selection: All or nothing with alternative a
|
|
|
74
92
|
singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
|
|
75
93
|
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
76
94
|
singleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
|
|
95
|
+
if (alternativeAnswerCheck === 'true') {
|
|
96
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
|
|
97
|
+
}
|
|
77
98
|
singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
78
99
|
/*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, correct answer border and a label should not be displayed below the question preview')
|
|
79
100
|
singleSelectionPage.steps.checkAnswer();
|
|
@@ -98,6 +119,20 @@ describe('Create item page - Single selection: All or nothing with alternative a
|
|
|
98
119
|
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
99
120
|
//correct answer section
|
|
100
121
|
singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(1);
|
|
122
|
+
//show alternative answers
|
|
123
|
+
if (alternativeAnswerCheck === 'true') {
|
|
124
|
+
singleSelectionPage.steps.verifyCorrectAnswersLabelAndPointVisible('(20 points)');
|
|
125
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleExists();
|
|
126
|
+
singleSelectionPage.steps.disableShowAlternativeAnswersToggle();
|
|
127
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
|
|
128
|
+
singleSelectionPage.steps.verifyAlternativeAnswersSectionNotExist();
|
|
129
|
+
singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
|
|
130
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleChecked();
|
|
131
|
+
singleSelectionPage.steps.verifyAlternativeAnswersLabelAndPointVisible(1, '(10 points)');
|
|
132
|
+
singleSelectionPage.steps.verifyAlternateAnswerOptionIconCorrectAnswerSection(2);
|
|
133
|
+
singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
|
|
134
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
|
|
135
|
+
}
|
|
101
136
|
//singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
102
137
|
/*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, incorrect answer border and a label should not be displayed below the question preview')
|
|
103
138
|
singleSelectionPage.steps.checkAnswer();
|
|
@@ -156,6 +191,20 @@ describe('Create item page - Single selection: All or nothing with alternative a
|
|
|
156
191
|
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
157
192
|
//correct answer section
|
|
158
193
|
singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(2);
|
|
194
|
+
// alternative answer section
|
|
195
|
+
if (alternativeAnswerCheck === 'true') {
|
|
196
|
+
singleSelectionPage.steps.verifyCorrectAnswersLabelAndPointVisible('(20 points)');
|
|
197
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleExists();
|
|
198
|
+
singleSelectionPage.steps.disableShowAlternativeAnswersToggle();
|
|
199
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
|
|
200
|
+
singleSelectionPage.steps.verifyAlternativeAnswersSectionNotExist();
|
|
201
|
+
singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
|
|
202
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleChecked();
|
|
203
|
+
singleSelectionPage.steps.verifyAlternativeAnswersLabelAndPointVisible(1, '(10 points)');
|
|
204
|
+
singleSelectionPage.steps.verifyAlternateAnswerOptionIconCorrectAnswerSection(1);
|
|
205
|
+
singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
|
|
206
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
|
|
207
|
+
}
|
|
159
208
|
singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
160
209
|
});
|
|
161
210
|
|
|
@@ -170,6 +219,9 @@ describe('Create item page - Single selection: All or nothing with alternative a
|
|
|
170
219
|
singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
|
|
171
220
|
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
172
221
|
singleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
|
|
222
|
+
if (alternativeAnswerCheck === 'true') {
|
|
223
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
|
|
224
|
+
}
|
|
173
225
|
singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
174
226
|
/*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, correct answer border and a label should not be displayed below the question preview')
|
|
175
227
|
singleSelectionPage.steps.checkAnswer();
|
|
@@ -193,6 +245,9 @@ describe('Create item page - Single selection: All or nothing with alternative a
|
|
|
193
245
|
singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
|
|
194
246
|
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
195
247
|
singleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
|
|
248
|
+
if (alternativeAnswerCheck === 'true') {
|
|
249
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
|
|
250
|
+
}
|
|
196
251
|
singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
197
252
|
/*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, correct answer border and a label should not be displayed below the question preview')
|
|
198
253
|
singleSelectionPage.steps.checkAnswer();
|
|
@@ -217,6 +272,20 @@ describe('Create item page - Single selection: All or nothing with alternative a
|
|
|
217
272
|
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
218
273
|
//correct answer section
|
|
219
274
|
singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(2);
|
|
275
|
+
// alternative answer section
|
|
276
|
+
if (alternativeAnswerCheck === 'true') {
|
|
277
|
+
singleSelectionPage.steps.verifyCorrectAnswersLabelAndPointVisible('(20 points)');
|
|
278
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleExists();
|
|
279
|
+
singleSelectionPage.steps.disableShowAlternativeAnswersToggle();
|
|
280
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
|
|
281
|
+
singleSelectionPage.steps.verifyAlternativeAnswersSectionNotExist();
|
|
282
|
+
singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
|
|
283
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleChecked();
|
|
284
|
+
singleSelectionPage.steps.verifyAlternativeAnswersLabelAndPointVisible(1, '(10 points)');
|
|
285
|
+
singleSelectionPage.steps.verifyAlternateAnswerOptionIconCorrectAnswerSection(1);
|
|
286
|
+
singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
|
|
287
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
|
|
288
|
+
}
|
|
220
289
|
singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
221
290
|
/*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, incorrect answer border and a label should not be displayed below the question preview')
|
|
222
291
|
singleSelectionPage.steps.checkAnswer();
|
|
@@ -255,6 +324,20 @@ describe('Create item page - Single selection: All or nothing with alternative a
|
|
|
255
324
|
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
256
325
|
//correct answer section
|
|
257
326
|
singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(1);
|
|
327
|
+
// alternative answer section
|
|
328
|
+
if (alternativeAnswerCheck === 'true') {
|
|
329
|
+
singleSelectionPage.steps.verifyCorrectAnswersLabelAndPointVisible('(20 points)');
|
|
330
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleExists();
|
|
331
|
+
singleSelectionPage.steps.disableShowAlternativeAnswersToggle();
|
|
332
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
|
|
333
|
+
singleSelectionPage.steps.verifyAlternativeAnswersSectionNotExist();
|
|
334
|
+
singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
|
|
335
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleChecked();
|
|
336
|
+
singleSelectionPage.steps.verifyAlternativeAnswersLabelAndPointVisible(1, '(20 points)');
|
|
337
|
+
singleSelectionPage.steps.verifyAlternateAnswerOptionIconCorrectAnswerSection(2);
|
|
338
|
+
singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
|
|
339
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
|
|
340
|
+
}
|
|
258
341
|
singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
259
342
|
});
|
|
260
343
|
|
|
@@ -269,6 +352,9 @@ describe('Create item page - Single selection: All or nothing with alternative a
|
|
|
269
352
|
singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
|
|
270
353
|
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
271
354
|
singleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
|
|
355
|
+
if (alternativeAnswerCheck === 'true') {
|
|
356
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
|
|
357
|
+
}
|
|
272
358
|
singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
273
359
|
/*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, correct answer border and a label should not be displayed below the question preview')
|
|
274
360
|
singleSelectionPage.steps.checkAnswer();
|
|
@@ -292,6 +378,9 @@ describe('Create item page - Single selection: All or nothing with alternative a
|
|
|
292
378
|
singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
|
|
293
379
|
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
294
380
|
singleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
|
|
381
|
+
if (alternativeAnswerCheck === 'true') {
|
|
382
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
|
|
383
|
+
}
|
|
295
384
|
singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
296
385
|
/*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, correct answer border and a label should not be displayed below the question preview')
|
|
297
386
|
singleSelectionPage.steps.checkAnswer();
|
|
@@ -316,6 +405,20 @@ describe('Create item page - Single selection: All or nothing with alternative a
|
|
|
316
405
|
singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
|
|
317
406
|
//correct answer section
|
|
318
407
|
singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(1);
|
|
408
|
+
//show alternative answers
|
|
409
|
+
if (alternativeAnswerCheck === 'true') {
|
|
410
|
+
singleSelectionPage.steps.verifyCorrectAnswersLabelAndPointVisible('(20 points)');
|
|
411
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleExists();
|
|
412
|
+
singleSelectionPage.steps.disableShowAlternativeAnswersToggle();
|
|
413
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
|
|
414
|
+
singleSelectionPage.steps.verifyAlternativeAnswersSectionNotExist();
|
|
415
|
+
singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
|
|
416
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleChecked();
|
|
417
|
+
singleSelectionPage.steps.verifyAlternativeAnswersLabelAndPointVisible(1, '(20 points)');
|
|
418
|
+
singleSelectionPage.steps.verifyAlternateAnswerOptionIconCorrectAnswerSection(2);
|
|
419
|
+
singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
|
|
420
|
+
singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
|
|
421
|
+
}
|
|
319
422
|
singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
|
|
320
423
|
/*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, incorrect answer border and a label should not be displayed below the question preview')
|
|
321
424
|
singleSelectionPage.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,145 @@
|
|
|
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"]').eq(1), // Alternative answer is typically the second wrapper
|
|
16
|
+
alternativeAnswerGridWrapper: () => cy.get('[class*="CorrectAnswerGridWrapper"]'),
|
|
17
|
+
alternativeAnswerSelectionGrid: () => cy.get('.correct-ans-selection-grid'),
|
|
18
|
+
correctAnswerLabelWrapper: () => cy.get('[class*="CorrectAnswerLabelWrapper"]').eq(0), // Correct answer is typically the first wrapper
|
|
19
|
+
|
|
20
|
+
steps: {
|
|
21
|
+
/**
|
|
22
|
+
* Verifies that the "Show alternative answers" toggle is present and visible
|
|
23
|
+
*/
|
|
24
|
+
verifyShowAlternativeAnswersToggleExists: () => {
|
|
25
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper().should('be.visible');
|
|
26
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleLabel()
|
|
27
|
+
.should('contain.text', 'Show alternative answers');
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Verifies that the "Show alternative answers" toggle does not exist
|
|
32
|
+
*/
|
|
33
|
+
verifyShowAlternativeAnswersToggleNotExists: () => {
|
|
34
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
|
|
35
|
+
.should('not.exist');
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Verifies that the "Show alternative answers" toggle is in the checked (enabled) state
|
|
40
|
+
*/
|
|
41
|
+
verifyShowAlternativeAnswersToggleChecked: () => {
|
|
42
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
|
|
43
|
+
.should('be.checked')
|
|
44
|
+
.and('have.attr', 'aria-pressed', 'true');
|
|
45
|
+
// Verify the checked state visual indicator (tick icon)
|
|
46
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
|
|
47
|
+
.find('.icon-ILC-tick-icon')
|
|
48
|
+
.should('be.visible');
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Verifies that the "Show alternative answers" toggle is in the unchecked (disabled) state
|
|
53
|
+
*/
|
|
54
|
+
verifyShowAlternativeAnswersToggleUnchecked: () => {
|
|
55
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
|
|
56
|
+
.should('not.be.checked')
|
|
57
|
+
.and('have.attr', 'aria-pressed', 'false');
|
|
58
|
+
// Verify the unchecked state visual indicator (x-circle icon)
|
|
59
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
|
|
60
|
+
.find('.icon-x-circle')
|
|
61
|
+
.should('be.visible');
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Clicks the "Show alternative answers" toggle to change its state
|
|
66
|
+
*/
|
|
67
|
+
clickShowAlternativeAnswersToggle: () => {
|
|
68
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleButton()
|
|
69
|
+
.click();
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Enables the "Show alternative answers" toggle (clicks it if it's currently unchecked)
|
|
74
|
+
*/
|
|
75
|
+
enableShowAlternativeAnswersToggle: () => {
|
|
76
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
|
|
77
|
+
.then(($input) => {
|
|
78
|
+
if (!$input.prop('checked')) {
|
|
79
|
+
showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Disables the "Show alternative answers" toggle (clicks it if it's currently checked)
|
|
86
|
+
*/
|
|
87
|
+
disableShowAlternativeAnswersToggle: () => {
|
|
88
|
+
showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
|
|
89
|
+
.then(($input) => {
|
|
90
|
+
if ($input.prop('checked')) {
|
|
91
|
+
showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Verifies that the alternative answers section is visible
|
|
98
|
+
* @param {number} index - The index of the alternative answer (e.g., 1 for "Alternative answer 1")
|
|
99
|
+
* @param {string} points - The expected points for the alternative answer
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
verifyAlternativeAnswersLabelAndPointVisible: (index, points) => {
|
|
103
|
+
showAlternativeAnswersComponent.alternativeAnswersSection().should('be.visible');
|
|
104
|
+
|
|
105
|
+
if (points) {
|
|
106
|
+
showAlternativeAnswersComponent.alternativeAnswersSection()
|
|
107
|
+
.parent()
|
|
108
|
+
.find('p')
|
|
109
|
+
.invoke('text')
|
|
110
|
+
.then((text) => {
|
|
111
|
+
expect(text.trim()).to.equal(points);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Verifies that the correct answers section is visible
|
|
118
|
+
* @param {number} points - The expected points for the alternative answer
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
verifyCorrectAnswersLabelAndPointVisible: (points) => {
|
|
122
|
+
showAlternativeAnswersComponent.correctAnswerLabelWrapper()
|
|
123
|
+
.should('be.visible');
|
|
124
|
+
|
|
125
|
+
if (points) {
|
|
126
|
+
showAlternativeAnswersComponent.correctAnswerLabelWrapper()
|
|
127
|
+
.parent()
|
|
128
|
+
.find('p')
|
|
129
|
+
.invoke('text')
|
|
130
|
+
.then((text) => {
|
|
131
|
+
expect(text.trim()).to.equal(points);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Verifies that the alternative answers section does not exist
|
|
138
|
+
*/
|
|
139
|
+
verifyAlternativeAnswersSectionNotExist: () => {
|
|
140
|
+
showAlternativeAnswersComponent.alternativeAnswersSection().should('not.exist');
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
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'),
|
|
@@ -78,6 +79,8 @@ const selectors = {
|
|
|
78
79
|
correctAnswersLabel: () => cy.get('[class*="question-preview-wrapper"] [class*="CorrectAnswerLabel"]'),
|
|
79
80
|
correctAnswerSectionWrapper: () => cy.get('[class*="question-preview-wrapper"] .mcq-checkbox-control.mcq-answer-checked').eq(1),
|
|
80
81
|
optionWrapperCorrectAnswerSection: () => cy.get('.mcq-option-wrapper'),
|
|
82
|
+
alternativeAnswerSectionWrapper: () => cy.get('[class*="CorrectAnswerLabelWrapper"]').eq(1).next(),
|
|
83
|
+
optionWrapperAlternativeAnswerSection: () => cy.get('.mcq-option-wrapper'),
|
|
81
84
|
answerStatusBanner: () => cy.get('[class*="StatusContainer"]'),
|
|
82
85
|
cancelButton: () => cy.get('.save-action-btn-wrapper .MuiButtonBase-root').eq(1),
|
|
83
86
|
optionsInputFieldInQuestionPreviewTab: () => cy.get('.mcq-option-wrapper [data-testid="question-instruction-element"]'),
|
|
@@ -111,6 +114,7 @@ const steps = {
|
|
|
111
114
|
...ckEditorAudioPlayerComponent.steps,
|
|
112
115
|
...ckEditorEquationEditorComponent.steps,
|
|
113
116
|
...ckEditorInsertTableComponent.steps,
|
|
117
|
+
...showAlternativeAnswersComponent.steps,
|
|
114
118
|
...ckEditorInsertImageComponent.steps,
|
|
115
119
|
...ckEditorLinkComponent.steps,
|
|
116
120
|
...createItemPage.steps,
|
|
@@ -859,6 +863,36 @@ const steps = {
|
|
|
859
863
|
.should('exist');
|
|
860
864
|
},
|
|
861
865
|
|
|
866
|
+
/**
|
|
867
|
+
* Verifies correct option icon in alternative answer section
|
|
868
|
+
* @param {number} optionIndex - The index of the option to verify
|
|
869
|
+
*/
|
|
870
|
+
verifyCorrectOptionIconAlternativeAnswerSection: (optionIndex) => {
|
|
871
|
+
multipleSelectionPage.alternativeAnswerSectionWrapper()
|
|
872
|
+
.within(() => {
|
|
873
|
+
multipleSelectionPage.optionWrapperAlternativeAnswerSection()
|
|
874
|
+
.eq(optionIndex)
|
|
875
|
+
.within(() => {
|
|
876
|
+
utilities.verifyElementVisibilityState(autoScoredScoringPreviewTab.correctIcon(), 'visible');
|
|
877
|
+
});
|
|
878
|
+
});
|
|
879
|
+
},
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* Verifies that correct/incorrect icon is not visible in alternative answer section
|
|
883
|
+
* @param {number} optionIndex - The index of the option to verify
|
|
884
|
+
*/
|
|
885
|
+
verifyCorrectIncorrectIconNotVisibleAlternativeAnswerSection: (optionIndex) => {
|
|
886
|
+
multipleSelectionPage.alternativeAnswerSectionWrapper()
|
|
887
|
+
.within(() => {
|
|
888
|
+
multipleSelectionPage.optionWrapperAlternativeAnswerSection()
|
|
889
|
+
.eq(optionIndex)
|
|
890
|
+
.within(() => {
|
|
891
|
+
autoScoredScoringPreviewTab.steps.verifyCorrectIncorrectIconsNotExist();
|
|
892
|
+
});
|
|
893
|
+
});
|
|
894
|
+
},
|
|
895
|
+
|
|
862
896
|
verifyAnswerBannerNotExist: () => {
|
|
863
897
|
multipleSelectionPage.answerStatusBanner()
|
|
864
898
|
.should('not.exist');
|
|
@@ -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,6 +43,8 @@ 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"]'),
|
|
46
|
+
//alternate answer section
|
|
47
|
+
alternativeAnswerSectionWrapper: () => cy.get('[class*="CorrectAnswerLabelWrapper"]').eq(1).next(),
|
|
45
48
|
};
|
|
46
49
|
|
|
47
50
|
const steps = {
|
|
@@ -61,6 +64,7 @@ const steps = {
|
|
|
61
64
|
...lockUnlockOptionComponent.steps,
|
|
62
65
|
...createItemPage.steps,
|
|
63
66
|
...selectQuestionResourceToolPage.steps,
|
|
67
|
+
...showAlternativeAnswersComponent.steps,
|
|
64
68
|
/**
|
|
65
69
|
* Verifies the contents of an option wrapper in the 'Specify correct answer' section for single selection questions.
|
|
66
70
|
* @param {number} optionIndex - The index of the option wrapper to be verified.
|
|
@@ -224,6 +228,21 @@ const steps = {
|
|
|
224
228
|
});
|
|
225
229
|
},
|
|
226
230
|
|
|
231
|
+
/**
|
|
232
|
+
* Verifies the presence of the correct option icon in the alternate answer section
|
|
233
|
+
* @param {number} optionIndex - The index of the option to verify in the alternate answer section
|
|
234
|
+
*/
|
|
235
|
+
verifyAlternateAnswerOptionIconCorrectAnswerSection: (optionIndex) => {
|
|
236
|
+
singleSelectionPage.alternativeAnswerSectionWrapper()
|
|
237
|
+
.within(() => {
|
|
238
|
+
singleSelectionPage.optionWrapperCorrectAnswerSection()
|
|
239
|
+
.eq(optionIndex)
|
|
240
|
+
.within(() => {
|
|
241
|
+
utilities.verifyElementVisibilityState(autoScoredScoringPreviewTab.correctIcon(), 'visible');
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
},
|
|
245
|
+
|
|
227
246
|
/**
|
|
228
247
|
* Verifies that the correct and incorrect icons are not visible in the correct answer section
|
|
229
248
|
* @param {number} optionIndex - The index of the option to verify in the correct answer section
|
|
@@ -728,6 +747,8 @@ const steps = {
|
|
|
728
747
|
singleSelectionPage.steps.setCorrectAnswer(correctAnswer);
|
|
729
748
|
singleSelectionPage.saveQuestionButton().click();
|
|
730
749
|
},
|
|
750
|
+
|
|
751
|
+
|
|
731
752
|
};
|
|
732
753
|
|
|
733
754
|
const tests = {
|