itemengine-cypress-automation 1.0.573-IEI-7065-Improve-test-coverage-for-essay-response-c25d1ee.0 → 1.0.574-IEI-7080-e6d1871.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.
Files changed (28) hide show
  1. package/cypress/e2e/ILC/EssayResponse/additionalSettings.js +2 -8
  2. package/cypress/e2e/ILC/EssayResponse/additionalSettingsBasic.js +0 -15
  3. package/cypress/e2e/ILC/EssayResponse/createCustomCategory.smoke.js +1 -14
  4. package/cypress/e2e/ILC/EssayResponse/editTabBasicSections.js +5 -155
  5. package/cypress/e2e/ILC/EssayResponse/essayResponseCustomizeFormattingOptions2.js +4 -116
  6. package/cypress/e2e/ILC/EssayResponse/essayResponseCustomizeFormattingOptions3.js +0 -93
  7. package/cypress/e2e/ILC/EssayResponse/essayResponseCustomizeFormattingOptions4.js +0 -114
  8. package/cypress/e2e/ILC/EssayResponse/essayResponseSpecialCharacters.js +1 -11
  9. package/cypress/e2e/ILC/EssayResponse/previewAddTable.js +2 -29
  10. package/cypress/e2e/ILC/EssayResponse/previewContentsForAllViews.smoke.js +1 -11
  11. package/cypress/e2e/ILC/EssayResponse/previewEditTable.js +0 -75
  12. package/cypress/e2e/ILC/EssayResponse/previewHyperlink.js +0 -13
  13. package/cypress/e2e/ILC/EssayResponse/studentViewSettings.js +0 -71
  14. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/allOrNothingAlternativePointsGreaterThanCorrectPoints.js +108 -7
  15. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/allOrNothingCorrectPointsEqualToAlternativePoints.js +108 -7
  16. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +108 -7
  17. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsAlternativePointsGreaterThanCorrectPoints.js +124 -9
  18. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsWithCorrectPointsEqualToAlternativePoints.js +123 -8
  19. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsWithCorrectPointsGreaterThanAlternativePoints.js +123 -8
  20. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialEqualWeightsWithAlternativePointsGreaterThanCorrectPoints.js +108 -7
  21. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialEqualWeightsWithCorrectPointsEqualToAlternativePoints.js +93 -6
  22. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialEqualWeightsWithCorrectPointsGreaterThanAlternativePoints.js +108 -7
  23. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/responseLevelAlternateAnswersBasicScoring.js +23 -2
  24. package/cypress/pages/components/equationEditorSectionCommonComponent.js +0 -21
  25. package/cypress/pages/components/essayResponseCommonComponents.js +1 -20
  26. package/cypress/pages/components/fillInTheGapsTextCommonComponent.js +36 -0
  27. package/cypress/pages/essayResponsePage.js +0 -2
  28. package/package.json +1 -1
@@ -1,6 +1,9 @@
1
1
  import { fillInTheGapsTextPage } from "../../../../pages";
2
+ import { showAlternativeAnswersComponent } from "../../../../pages/components";
2
3
  import abortEarlySetup from "../../../../support/helpers/abortEarly";
3
4
 
5
+ const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT') === 'true';
6
+
4
7
  describe('Create item page - Fill in the gaps with text: Partial different weights', () => {
5
8
  before(() => {
6
9
  cy.loginAs('admin');
@@ -25,7 +28,21 @@ describe('Create item page - Fill in the gaps with text: Partial different weigh
25
28
  it('When the user selects \'Grading\' view without attempting the question, response area numeration, correct answers section with correct answers from the correct accordion and respective response area numeration should be displayed', () => {
26
29
  fillInTheGapsTextPage.steps.switchToGradingView();
27
30
  fillInTheGapsTextPage.steps.verifyResponseAreaNumeration();
28
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
31
+ if (alternativeAnswerCheck) {
32
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
33
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
34
+ {
35
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
36
+ points: ['(15 points)', '(6 points)', '(5 points)', '(4 points)'],
37
+ },
38
+ {
39
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
40
+ points: ['(15 points)', '(7 points)', '(5 point)', '(3 points)'],
41
+ }
42
+ ]);
43
+ } else {
44
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
45
+ }
29
46
  });
30
47
 
31
48
  it('When the user attempts the question with responses from the correct accordion, then the user should be awarded full points and on switching to \'Grading\' view, correct icons should be displayed beside all the correct responses, correct/incorrect status message and correct answer section should not be displayed', () => {
@@ -77,7 +94,21 @@ describe('Create item page - Fill in the gaps with text: Partial different weigh
77
94
  fillInTheGapsTextPage.steps.verifyCorrectOptionIcon(1);
78
95
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(2);
79
96
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
80
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
97
+ if (alternativeAnswerCheck) {
98
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
99
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
100
+ {
101
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
102
+ points: ['(15 points)', '(6 points)', '(5 points)', '(4 points)'],
103
+ },
104
+ {
105
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
106
+ points: ['(15 points)', '(7 points)', '(5 point)', '(3 points)'],
107
+ }
108
+ ]);
109
+ } else {
110
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
111
+ }
81
112
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
82
113
  /*cy.log('When the user has attempted the question with partially correct options exclusively from the correct accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, correct/incorrect status message and correct answer section should not be displayed')
83
114
  fillInTheGapsTextPage.steps.checkAnswer();
@@ -97,7 +128,21 @@ describe('Create item page - Fill in the gaps with text: Partial different weigh
97
128
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(1);
98
129
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(2);
99
130
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
100
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
131
+ if (alternativeAnswerCheck) {
132
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
133
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
134
+ {
135
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
136
+ points: ['(15 points)', '(6 points)', '(5 points)', '(4 points)'],
137
+ },
138
+ {
139
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
140
+ points: ['(15 points)', '(7 points)', '(5 point)', '(3 points)'],
141
+ }
142
+ ]);
143
+ } else {
144
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
145
+ }
101
146
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
102
147
  /*cy.log('When the user has attempted the question with partially correct options exclusively from the alternative accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, no icon should be displayed beside unattempted response, correct/incorrect status message and correct answer section should not be displayed')
103
148
  fillInTheGapsTextPage.steps.checkAnswer();
@@ -117,7 +162,21 @@ describe('Create item page - Fill in the gaps with text: Partial different weigh
117
162
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(1);
118
163
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(2);
119
164
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
120
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
165
+ if (alternativeAnswerCheck) {
166
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
167
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
168
+ {
169
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
170
+ points: ['(15 points)', '(6 points)', '(5 points)', '(4 points)'],
171
+ },
172
+ {
173
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
174
+ points: ['(15 points)', '(7 points)', '(5 point)', '(3 points)'],
175
+ }
176
+ ]);
177
+ } else {
178
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
179
+ }
121
180
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
122
181
  /*cy.log('When the user has attempted the question with equal number of correct responses from correct and alternative accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, incorrect icon should be displayed beside empty responses correct/incorrect status message and correct answer section should not be displayed')
123
182
  fillInTheGapsTextPage.steps.checkAnswer();
@@ -137,7 +196,21 @@ describe('Create item page - Fill in the gaps with text: Partial different weigh
137
196
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(1);
138
197
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(2);
139
198
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
140
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
199
+ if (alternativeAnswerCheck) {
200
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
201
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
202
+ {
203
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
204
+ points: ['(15 points)', '(6 points)', '(5 points)', '(4 points)'],
205
+ },
206
+ {
207
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
208
+ points: ['(15 points)', '(7 points)', '(5 point)', '(3 points)'],
209
+ }
210
+ ]);
211
+ } else {
212
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
213
+ }
141
214
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
142
215
  /*cy.log('When the user has attempted the question with equal number of correct responses from correct and alternative accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the alternative responses, incorrect icon should be displayed beside correct accordion responses correct/incorrect status message and correct answer section should not be displayed')
143
216
  fillInTheGapsTextPage.steps.checkAnswer();
@@ -157,7 +230,21 @@ describe('Create item page - Fill in the gaps with text: Partial different weigh
157
230
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(1);
158
231
  fillInTheGapsTextPage.steps.verifyCorrectOptionIcon(2);
159
232
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
160
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
233
+ if (alternativeAnswerCheck) {
234
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
235
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
236
+ {
237
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
238
+ points: ['(15 points)', '(6 points)', '(5 points)', '(4 points)'],
239
+ },
240
+ {
241
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
242
+ points: ['(15 points)', '(7 points)', '(5 point)', '(3 points)'],
243
+ }
244
+ ]);
245
+ } else {
246
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
247
+ }
161
248
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
162
249
  /*cy.log('When the user has attempted the question with common response between correct and alternative accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, no icon should be displayed beside unattempted response, correct/incorrect status message and correct answer section should not be displayed')
163
250
  fillInTheGapsTextPage.steps.checkAnswer();
@@ -177,7 +264,21 @@ describe('Create item page - Fill in the gaps with text: Partial different weigh
177
264
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(1);
178
265
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(2);
179
266
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
180
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
267
+ if (alternativeAnswerCheck) {
268
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
269
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
270
+ {
271
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
272
+ points: ['(15 points)', '(6 points)', '(5 points)', '(4 points)'],
273
+ },
274
+ {
275
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
276
+ points: ['(15 points)', '(7 points)', '(5 point)', '(3 points)'],
277
+ }
278
+ ]);
279
+ } else {
280
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
281
+ }
181
282
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
182
283
  /*cy.log('When the user has attempted the question incorrectly and clicks on \'Check answer\' button, then incorrect icon should be displayed besides all incorrect responses, no icon should be displayed beside unattempted response, correct/incorrect status message and correct answer section should not be displayed')
183
284
  fillInTheGapsTextPage.steps.checkAnswer();
@@ -204,7 +305,21 @@ describe('Create item page - Fill in the gaps with text: Partial different weigh
204
305
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(1);
205
306
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(2);
206
307
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
207
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
308
+ if (alternativeAnswerCheck) {
309
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
310
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
311
+ {
312
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
313
+ points: ['(15 points)', '(4.1 points)', '(5.4 points)', '(5.5 points)'],
314
+ },
315
+ {
316
+ correctAnswers: [['Petals'],['Leaves'],['Branch']],
317
+ points: ['(11 points)', '(12.6 points)', '(1.2 point)', '(1.2 points)'],
318
+ }
319
+ ]);
320
+ } else {
321
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
322
+ }
208
323
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
209
324
  /*cy.log('When the user attempts the question with more number of correct responses from the alternative accordion than the correct accordion but the score of the individual response selected from the correct accordion overpowers the combined score of the alternative accordion answers and clicks on \'Check answer\' button, then correct icons should be displayed for the correct accordion response, incorrect icon should be displayed for the alternative accordion responses, correct/incorrect answer status message should not be displayed and correct answer section with all correct answers from the correct accordion along with response area numeration should be displayed')
210
325
  fillInTheGapsTextPage.steps.checkAnswer();
@@ -1,6 +1,9 @@
1
1
  import { fillInTheGapsTextPage } from "../../../../pages";
2
+ import { showAlternativeAnswersComponent } from "../../../../pages/components";
2
3
  import abortEarlySetup from "../../../../support/helpers/abortEarly";
3
4
 
5
+ const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT') === 'true';
6
+
4
7
  describe('Create item page - Fill in the gaps with text: Partial different weights', () => {
5
8
  before(() => {
6
9
  cy.loginAs('admin');
@@ -25,7 +28,21 @@ describe('Create item page - Fill in the gaps with text: Partial different weigh
25
28
  it('When the user selects \'Grading\' view without attempting the question, response area numeration should be displayed, correct answers section should be displayed with correct answers from the correct accordion and respective response area numeration', () => {
26
29
  fillInTheGapsTextPage.steps.switchToGradingView();
27
30
  fillInTheGapsTextPage.steps.verifyResponseAreaNumeration();
28
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
31
+ if (alternativeAnswerCheck) {
32
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
33
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
34
+ {
35
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
36
+ points: ['(15 points)', '(6 points)', '(4 points)', '(5 points)'],
37
+ },
38
+ {
39
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
40
+ points: ['(13 points)', '(7 points)', '(1 point)', '(5 points)'],
41
+ }
42
+ ]);
43
+ } else {
44
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
45
+ }
29
46
  });
30
47
 
31
48
  it('When the user attempts the question with responses from the correct accordion, then the user should be awarded full points and on switching to \'Grading\' view, correct icons should be displayed beside all the correct responses, correct/incorrect status message and correct answer section should not be displayed', () => {
@@ -77,7 +94,21 @@ describe('Create item page - Fill in the gaps with text: Partial different weigh
77
94
  fillInTheGapsTextPage.steps.verifyCorrectOptionIcon(1);
78
95
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(2);
79
96
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
80
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
97
+ if (alternativeAnswerCheck) {
98
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
99
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
100
+ {
101
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
102
+ points: ['(15 points)', '(6 points)', '(4 points)', '(5 points)'],
103
+ },
104
+ {
105
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
106
+ points: ['(13 points)', '(7 points)', '(1 point)', '(5 points)'],
107
+ }
108
+ ]);
109
+ } else {
110
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
111
+ }
81
112
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
82
113
  /*cy.log('When the user has attempted the question with partially correct options exclusively from the correct accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, correct/incorrect status message and correct answer section should not be displayed')
83
114
  fillInTheGapsTextPage.steps.checkAnswer();
@@ -97,7 +128,21 @@ describe('Create item page - Fill in the gaps with text: Partial different weigh
97
128
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(1);
98
129
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(2);
99
130
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
100
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
131
+ if (alternativeAnswerCheck) {
132
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
133
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
134
+ {
135
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
136
+ points: ['(15 points)', '(6 points)', '(4 points)', '(5 points)'],
137
+ },
138
+ {
139
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
140
+ points: ['(13 points)', '(7 points)', '(1 point)', '(5 points)'],
141
+ }
142
+ ]);
143
+ } else {
144
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
145
+ }
101
146
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
102
147
  /*cy.log('When the user has attempted the question with partially correct options exclusively from the alternative accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, no icon should be displayed beside unattempted response correct/incorrect status message and correct answer section should not be displayed')
103
148
  fillInTheGapsTextPage.steps.checkAnswer();
@@ -117,7 +162,21 @@ describe('Create item page - Fill in the gaps with text: Partial different weigh
117
162
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(1);
118
163
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(2);
119
164
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
120
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
165
+ if (alternativeAnswerCheck) {
166
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
167
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
168
+ {
169
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
170
+ points: ['(15 points)', '(6 points)', '(4 points)', '(5 points)'],
171
+ },
172
+ {
173
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
174
+ points: ['(13 points)', '(7 points)', '(1 point)', '(5 points)'],
175
+ }
176
+ ]);
177
+ } else {
178
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
179
+ }
121
180
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
122
181
  /*cy.log('When the user has attempted the question with equal number of correct responses from correct and alternative accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, incorrect should be displayed beside empty responses correct/incorrect status message and correct answer section should not be displayed')
123
182
  fillInTheGapsTextPage.steps.checkAnswer();
@@ -137,7 +196,21 @@ describe('Create item page - Fill in the gaps with text: Partial different weigh
137
196
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(1);
138
197
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(2);
139
198
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
140
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
199
+ if (alternativeAnswerCheck) {
200
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
201
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
202
+ {
203
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
204
+ points: ['(15 points)', '(6 points)', '(4 points)', '(5 points)'],
205
+ },
206
+ {
207
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
208
+ points: ['(13 points)', '(7 points)', '(1 point)', '(5 points)'],
209
+ }
210
+ ]);
211
+ } else {
212
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
213
+ }
141
214
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
142
215
  /*cy.log('When the user has attempted the question with equal number of correct responses from correct and alternative accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, incorrect should be displayed beside empty responses correct/incorrect status message and correct answer section should not be displayed')
143
216
  fillInTheGapsTextPage.steps.checkAnswer();
@@ -157,7 +230,21 @@ describe('Create item page - Fill in the gaps with text: Partial different weigh
157
230
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(1);
158
231
  fillInTheGapsTextPage.steps.verifyCorrectOptionIcon(2);
159
232
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
160
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
233
+ if (alternativeAnswerCheck) {
234
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
235
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
236
+ {
237
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
238
+ points: ['(15 points)', '(6 points)', '(4 points)', '(5 points)'],
239
+ },
240
+ {
241
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
242
+ points: ['(13 points)', '(7 points)', '(1 point)', '(5 points)'],
243
+ }
244
+ ]);
245
+ } else {
246
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
247
+ }
161
248
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
162
249
  /*cy.log('When the user has attempted the question with common response between correct and alternative accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, no icon should be displayed beside unattempted response correct/incorrect status message and correct answer section should not be displayed')
163
250
  fillInTheGapsTextPage.steps.checkAnswer();
@@ -177,7 +264,21 @@ describe('Create item page - Fill in the gaps with text: Partial different weigh
177
264
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(1);
178
265
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(2);
179
266
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
180
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
267
+ if (alternativeAnswerCheck) {
268
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
269
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
270
+ {
271
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
272
+ points: ['(15 points)', '(6 points)', '(4 points)', '(5 points)'],
273
+ },
274
+ {
275
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
276
+ points: ['(13 points)', '(7 points)', '(1 point)', '(5 points)'],
277
+ }
278
+ ]);
279
+ } else {
280
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
281
+ }
181
282
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
182
283
  /*cy.log('When the user has attempted the question incorrectly and clicks on \'Check answer\' button, then incorrect icon should be displayed besides all incorrect responses, no icon should be displayed beside unattempted response correct/incorrect status message and correct answer section should not be displayed')
183
284
  fillInTheGapsTextPage.steps.checkAnswer();
@@ -204,7 +305,21 @@ describe('Create item page - Fill in the gaps with text: Partial different weigh
204
305
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(1);
205
306
  fillInTheGapsTextPage.steps.verifyCorrectOptionIcon(2);
206
307
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
207
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
308
+ if (alternativeAnswerCheck) {
309
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
310
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
311
+ {
312
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
313
+ points: ['(23 points)', '(11.4 points)', '(1.2 points)', '(10.4 points)'],
314
+ },
315
+ {
316
+ correctAnswers: [['Petals'],['Leaves'],['Branch']],
317
+ points: ['(5 points)', '(1.2 points)', '(2.2 point)', '(1.6 points)'],
318
+ }
319
+ ]);
320
+ } else {
321
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Leaf', 'Stem']);
322
+ }
208
323
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
209
324
  /*cy.log('When the user attempts the question with more number of correct responses from the alternative accordion than the correct accordion but the score of the individual response selected from the correct accordion overpowers the combined score of the alternative accordion answers and clicks on the \'Check answer\' button, correct icon icons should be displayed for the correct accordion response, incorrect icon should be displayed for the alternative accordion responses, correct/incorrect answer status message and correct answer section should not be displayed')
210
325
  fillInTheGapsTextPage.steps.checkAnswer();
@@ -1,6 +1,9 @@
1
1
  import { fillInTheGapsTextPage } from "../../../../pages";
2
+ import { showAlternativeAnswersComponent } from "../../../../pages/components";
2
3
  import abortEarlySetup from "../../../../support/helpers/abortEarly";
3
4
 
5
+ const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT') === 'true';
6
+
4
7
  describe('Create item page - Fill in the gaps with text: Partial equal weights with alternative answers', () => {
5
8
  before(() => {
6
9
  cy.loginAs('admin');
@@ -25,7 +28,21 @@ describe('Create item page - Fill in the gaps with text: Partial equal weights w
25
28
  it('When the user selects \'Grading\' view without attempting the question, response area numeration should be displayed, correct answers section should be displayed with correct answers from the alternative accordion and respective response area numeration', () => {
26
29
  fillInTheGapsTextPage.steps.switchToGradingView();
27
30
  fillInTheGapsTextPage.steps.verifyResponseAreaNumeration();
28
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Petals', 'Leaves', 'Stem']);
31
+ if (alternativeAnswerCheck) {
32
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
33
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
34
+ {
35
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
36
+ points: ['(15 points)', '(5 points)', '(5 points)', '(5 points)'],
37
+ },
38
+ {
39
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
40
+ points: ['(9 points)', '(3 points)', '(3 point)', '(3 points)'],
41
+ }
42
+ ]);
43
+ } else {
44
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Petals', 'Leaves', 'Stem']);
45
+ }
29
46
  });
30
47
 
31
48
  it('When the user attempts the question with responses from the correct accordion, then the user should be awarded points of the correct accordion (less than full points) and on switching to \'Grading\' view, correct icons should be displayed beside all the correct responses, correct/incorrect status message and correct answer section should not be displayed', () => {
@@ -77,7 +94,21 @@ describe('Create item page - Fill in the gaps with text: Partial equal weights w
77
94
  fillInTheGapsTextPage.steps.verifyCorrectOptionIcon(1);
78
95
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(2);
79
96
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
80
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Petals', 'Leaves', 'Stem']);
97
+ if (alternativeAnswerCheck) {
98
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
99
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
100
+ {
101
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
102
+ points: ['(15 points)', '(5 points)', '(5 points)', '(5 points)'],
103
+ },
104
+ {
105
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
106
+ points: ['(9 points)', '(3 points)', '(3 point)', '(3 points)'],
107
+ }
108
+ ]);
109
+ } else {
110
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Petals', 'Leaves', 'Stem']);
111
+ }
81
112
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
82
113
  /*cy.log('When the user has attempted the question with partially correct options exclusively from the correct accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, correct/incorrect status message should not be displayed and correct answer section should not be displayed')
83
114
  fillInTheGapsTextPage.steps.checkAnswer();
@@ -97,7 +128,21 @@ describe('Create item page - Fill in the gaps with text: Partial equal weights w
97
128
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(1);
98
129
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(2);
99
130
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
100
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Petals', 'Leaves', 'Stem']);
131
+ if (alternativeAnswerCheck) {
132
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
133
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
134
+ {
135
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
136
+ points: ['(15 points)', '(5 points)', '(5 points)', '(5 points)'],
137
+ },
138
+ {
139
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
140
+ points: ['(9 points)', '(3 points)', '(3 point)', '(3 points)'],
141
+ }
142
+ ]);
143
+ } else {
144
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Petals', 'Leaves', 'Stem']);
145
+ }
101
146
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
102
147
  /*cy.log('When the user has attempted the question with partially correct options exclusively from the alternative accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, no icon should be displayed beside unattempted response, correct/incorrect status message should not be displayed and correct answer section should not be displayed')
103
148
  fillInTheGapsTextPage.steps.checkAnswer();
@@ -117,7 +162,21 @@ describe('Create item page - Fill in the gaps with text: Partial equal weights w
117
162
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(1);
118
163
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(2);
119
164
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
120
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Petals', 'Leaves', 'Stem']);
165
+ if (alternativeAnswerCheck) {
166
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
167
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
168
+ {
169
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
170
+ points: ['(15 points)', '(5 points)', '(5 points)', '(5 points)'],
171
+ },
172
+ {
173
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
174
+ points: ['(9 points)', '(3 points)', '(3 point)', '(3 points)'],
175
+ }
176
+ ]);
177
+ } else {
178
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Petals', 'Leaves', 'Stem']);
179
+ }
121
180
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
122
181
  /*cy.log('When the user has attempted the question with equal number of correct responses from correct and alternative accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, incorrect icon should be displayed beside empty responses correct/incorrect status message should not be displayed and correct answer section should not be displayed')
123
182
  fillInTheGapsTextPage.steps.checkAnswer();
@@ -137,7 +196,21 @@ describe('Create item page - Fill in the gaps with text: Partial equal weights w
137
196
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(1);
138
197
  fillInTheGapsTextPage.steps.verifyCorrectOptionIcon(2);
139
198
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
140
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Petals', 'Leaves', 'Stem']);
199
+ if (alternativeAnswerCheck) {
200
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
201
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
202
+ {
203
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
204
+ points: ['(15 points)', '(5 points)', '(5 points)', '(5 points)'],
205
+ },
206
+ {
207
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
208
+ points: ['(9 points)', '(3 points)', '(3 point)', '(3 points)'],
209
+ }
210
+ ]);
211
+ } else {
212
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Petals', 'Leaves', 'Stem']);
213
+ }
141
214
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
142
215
  /*cy.log('When the user has attempted the question with common response between correct and alternative accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct answer responses, no icon should be displayed beside unattempted response, correct/incorrect status message should not be displayed and correct answer section should not be displayed')
143
216
  fillInTheGapsTextPage.steps.checkAnswer();
@@ -157,7 +230,21 @@ describe('Create item page - Fill in the gaps with text: Partial equal weights w
157
230
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(1);
158
231
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(2);
159
232
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
160
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Petals', 'Leaves', 'Stem']);
233
+ if (alternativeAnswerCheck) {
234
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
235
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
236
+ {
237
+ correctAnswers: [['Petals'],['Leaves'],['Stem']],
238
+ points: ['(15 points)', '(5 points)', '(5 points)', '(5 points)'],
239
+ },
240
+ {
241
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
242
+ points: ['(9 points)', '(3 points)', '(3 point)', '(3 points)'],
243
+ }
244
+ ]);
245
+ } else {
246
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Petals', 'Leaves', 'Stem']);
247
+ }
161
248
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
162
249
  /*cy.log('When the user has attempted the question incorrectly and clicks on \'Check answer\' button, then incorrect icons should be displayed besides all incorrect responses, no icon should be displayed beside unattempted response, correct/incorrect status message should not be displayed and correct answer section should not be displayed')
163
250
  fillInTheGapsTextPage.steps.checkAnswer();
@@ -183,7 +270,21 @@ describe('Create item page - Fill in the gaps with text: Partial equal weights w
183
270
  fillInTheGapsTextPage.steps.verifyIncorrectOptionIcon(1);
184
271
  fillInTheGapsTextPage.steps.verifyCorrectOptionIcon(2);
185
272
  fillInTheGapsTextPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
186
- fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Petals', 'Leaves', 'Branch']);
273
+ if (alternativeAnswerCheck) {
274
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
275
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
276
+ {
277
+ correctAnswers: [['Petals'],['Leaves'],['Branch']],
278
+ points: ['(23 points)', '(7.67 points)', '(7.67 points)', '(7.67 points)'],
279
+ },
280
+ {
281
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
282
+ points: ['(5 points)', '(1.67 points)', '(1.67 point)', '(1.67 points)'],
283
+ }
284
+ ]);
285
+ } else {
286
+ fillInTheGapsTextPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Petals', 'Leaves', 'Branch']);
287
+ }
187
288
  fillInTheGapsTextPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
188
289
  /*cy.log('When the user has attempted the question with more number of correct responses from the correct accordion than the alternative accordion but the score of the individual response selected from the alternative accordion overpowers the combined score of the correct accordion answers and clicks on the \'Check answer\' button, correct icons should be displayed for the alternative accordion response, incorrect icon should be displayed for the correct accordion responses, correct/incorrect answer status message and correct answer section should not be displayed')
189
290
  fillInTheGapsTextPage.steps.checkAnswer();