itemengine-cypress-automation 1.0.579-IEI-7046-a317a6b.0 → 1.0.580-IEI-7040-1e744fc.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 (43) hide show
  1. package/cypress/config-files/ilprod.json +2 -1
  2. package/cypress/config-files/ilqa.json +2 -1
  3. package/cypress/config-files/ilstage.json +2 -1
  4. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/allOrNothingAlternativePointsGreaterThanCorrectPoints.js +8 -123
  5. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/allOrNothingCorrectPointsEqualToAlternativePoints.js +8 -123
  6. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +14 -131
  7. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perCorrectOptionAlternativePointsGreaterThanCorrectPoints.js +9 -138
  8. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perCorrectOptionCorrectPointsEqualToAlternativePoints.js +9 -138
  9. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perCorrectOptionCorrectPointsGreaterThanAlternativePoints.js +10 -153
  10. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perDropzoneAlternativePointsGreaterThanCorrectPoints.js +9 -138
  11. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perDropzoneCorrectPointsEqualToAlternativePoints.js +7 -108
  12. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perDropzoneCorrectPointsGreaterThanAlternativePoints.js +9 -138
  13. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/allOrNothingAlternativePointsGreaterThanCorrectPoints.js +135 -7
  14. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/allOrNothingCorrectPointsEqualToAlternativePoints.js +135 -7
  15. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +136 -9
  16. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/checkScoringLabelBannerAndCorrectAnswer.js +7 -2
  17. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialDifferentWeightsAlternativePointsGreaterThanCorrectPoints.js +154 -8
  18. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialDifferentWeightsWithCorrectPointsEqualToAlternativePoints.js +154 -8
  19. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialDifferentWeightsWithCorrectPointsGreaterThanAlternativePoints.js +154 -8
  20. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialEqualWeightsWithAlternativePointsGreaterThanCorrectPoints.js +135 -7
  21. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialEqualWeightsWithCorrectPointsEqualToAlternativePoints.js +116 -7
  22. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialEqualWeightsWithCorrectPointsGreaterThanAlternativePoints.js +136 -8
  23. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/responseLevelAlternateAnswerBasicScoring.js +21 -2
  24. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/allOrNothingForAllView.smoke.js +190 -2
  25. package/cypress/e2e/ILC/Matching/questionInstructionsAndPromptSection.js +17 -0
  26. package/cypress/e2e/ILC/MultipleSelection/previewContentsForAllViews.smoke.js +18 -0
  27. package/cypress/e2e/ILC/MultipleSelectionGridNew/previewContentsForAllViews.smoke.js +19 -0
  28. package/cypress/e2e/ILC/NumberLineLabel/editTabBasicSection.js +18 -0
  29. package/cypress/e2e/ILC/SingleSelection/previewContents.smoke.js +18 -0
  30. package/cypress/e2e/ILC/SingleSelectionGridNew/previewContentsForAllViews.smoke.js +19 -0
  31. package/cypress/e2e/ILC/TextEntryMath/editTabBasicSection.js +17 -0
  32. package/cypress/e2e/ILC/TextSelection/questionInstructionsAndQuestion.js +16 -0
  33. package/cypress/pages/components/ckEditorToolbar.js +20 -0
  34. package/cypress/pages/components/draggableOptionContainer.js +14 -0
  35. package/cypress/pages/components/gridQuestionCommonComponent.js +17 -1
  36. package/cypress/pages/components/optionsWrapperComponent.js +33 -2
  37. package/cypress/pages/components/questionInputFieldComponent.js +18 -2
  38. package/cypress/pages/dragAndDropIntoCategoriesPage.js +0 -38
  39. package/cypress/pages/fillInTheGapsDropdownPage.js +47 -2
  40. package/cypress/pages/matchingPage.js +18 -0
  41. package/cypress/pages/numberLineLabelPage.js +1 -0
  42. package/cypress/pages/textSelectionPage.js +17 -1
  43. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
1
  import { fillInTheGapsDropdownPage } from "../../../../pages";
2
2
  import abortEarlySetup from "../../../../support/helpers/abortEarly";
3
+ import { showAlternativeAnswersComponent } from "../../../../pages/components";
3
4
 
4
5
  const optionsForDropdown1 = ['Flower', 'Petal', 'Stem', 'Branch'];
5
6
  const optionsForDropdown2 = ['Leaf', 'Leaves', 'Stem', 'Seed'];
@@ -7,6 +8,7 @@ const optionsForDropdown3 = ['Flower', 'Leaf', 'Stem', 'Roots']; //Common answe
7
8
  const correctAnswerArray = ['Flower', 'Leaf', 'Stem'];
8
9
  const alternateAnswerArray = ['Petal', 'Leaves', 'Stem'];
9
10
  const incorrectAnswerArray = ['Branch', 'Seed', 'Roots'];
11
+ const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT') === 'true';
10
12
 
11
13
  describe('Create item page - Fill in the gaps with dropdown: All or nothing with alternative answers', () => {
12
14
  before(() => {
@@ -39,7 +41,25 @@ describe('Create item page - Fill in the gaps with dropdown: All or nothing with
39
41
  fillInTheGapsDropdownPage.steps.switchToGradingView();
40
42
  fillInTheGapsDropdownPage.steps.verifyDropdownNumerationPreviewTab();
41
43
  fillInTheGapsDropdownPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
42
- fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
44
+ if (alternativeAnswerCheck) {
45
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleExists();
46
+ showAlternativeAnswersComponent.steps.disableShowAlternativeAnswersToggle();
47
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
48
+ fillInTheGapsDropdownPage.steps.verifyAlternativeAnswersSectionNotExist();
49
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
50
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
51
+ {
52
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
53
+ points: ['(20 points)'],
54
+ },
55
+ {
56
+ correctAnswers: [['Petal'],['Leaves'],['Stem']],
57
+ points: ['(20 points)'],
58
+ }
59
+ ]);
60
+ } else {
61
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
62
+ }
43
63
  });
44
64
 
45
65
  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 dropdowns, a status message with text \'Your answer is correct\' and correct answer section should not be displayed', () => {
@@ -91,7 +111,25 @@ describe('Create item page - Fill in the gaps with dropdown: All or nothing with
91
111
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(1);
92
112
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(2);
93
113
  fillInTheGapsDropdownPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
94
- fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
114
+ if (alternativeAnswerCheck) {
115
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleExists();
116
+ showAlternativeAnswersComponent.steps.disableShowAlternativeAnswersToggle();
117
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
118
+ fillInTheGapsDropdownPage.steps.verifyAlternativeAnswersSectionNotExist();
119
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
120
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
121
+ {
122
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
123
+ points: ['(20 points)'],
124
+ },
125
+ {
126
+ correctAnswers: [['Petal'],['Leaves'],['Stem']],
127
+ points: ['(20 points)'],
128
+ }
129
+ ]);
130
+ } else {
131
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
132
+ }
95
133
  fillInTheGapsDropdownPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
96
134
  /*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 correctly answered dropdowns, no icon should be displayed beside unattempted dropdown, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed');
97
135
  fillInTheGapsDropdownPage.steps.checkAnswer();
@@ -112,7 +150,25 @@ describe('Create item page - Fill in the gaps with dropdown: All or nothing with
112
150
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(1);
113
151
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(2);
114
152
  fillInTheGapsDropdownPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
115
- fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
153
+ if (alternativeAnswerCheck) {
154
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleExists();
155
+ showAlternativeAnswersComponent.steps.disableShowAlternativeAnswersToggle();
156
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
157
+ fillInTheGapsDropdownPage.steps.verifyAlternativeAnswersSectionNotExist();
158
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
159
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
160
+ {
161
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
162
+ points: ['(20 points)'],
163
+ },
164
+ {
165
+ correctAnswers: [['Petal'],['Leaves'],['Stem']],
166
+ points: ['(20 points)'],
167
+ }
168
+ ]);
169
+ } else {
170
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
171
+ }
116
172
  fillInTheGapsDropdownPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
117
173
  /*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 correctly answered dropdowns, no icon should be displayed beside unattempted dropdown, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed');
118
174
  fillInTheGapsDropdownPage.steps.checkAnswer();
@@ -133,7 +189,25 @@ describe('Create item page - Fill in the gaps with dropdown: All or nothing with
133
189
  fillInTheGapsDropdownPage.steps.verifyCorrectOptionIcon(1);
134
190
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(2);
135
191
  fillInTheGapsDropdownPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
136
- fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
192
+ if (alternativeAnswerCheck) {
193
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleExists();
194
+ showAlternativeAnswersComponent.steps.disableShowAlternativeAnswersToggle();
195
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
196
+ fillInTheGapsDropdownPage.steps.verifyAlternativeAnswersSectionNotExist();
197
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
198
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
199
+ {
200
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
201
+ points: ['(20 points)'],
202
+ },
203
+ {
204
+ correctAnswers: [['Petal'],['Leaves'],['Stem']],
205
+ points: ['(20 points)'],
206
+ }
207
+ ]);
208
+ } else {
209
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
210
+ }
137
211
  fillInTheGapsDropdownPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
138
212
  /*cy.log('When the user has attempted the question with partially correct with all the response correct as per the alternative accordion but one response incomplete and clicks on \'Check answer\' button, then correct icon should be displayed besides the response from the alternative accordion, incorrect icon should be displayed besides the empty response, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed');
139
213
  fillInTheGapsDropdownPage.steps.checkAnswer();
@@ -153,7 +227,25 @@ describe('Create item page - Fill in the gaps with dropdown: All or nothing with
153
227
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(1);
154
228
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(2);
155
229
  fillInTheGapsDropdownPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
156
- fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
230
+ if (alternativeAnswerCheck) {
231
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleExists();
232
+ showAlternativeAnswersComponent.steps.disableShowAlternativeAnswersToggle();
233
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
234
+ fillInTheGapsDropdownPage.steps.verifyAlternativeAnswersSectionNotExist();
235
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
236
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
237
+ {
238
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
239
+ points: ['(20 points)'],
240
+ },
241
+ {
242
+ correctAnswers: [['Petal'],['Leaves'],['Stem']],
243
+ points: ['(20 points)'],
244
+ }
245
+ ]);
246
+ } else {
247
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
248
+ }
157
249
  fillInTheGapsDropdownPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
158
250
  /*cy.log('When the user has attempted the question with equal number of correct dropdowns from correct and alternative accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correctly answered dropdowns, incorrect icon should be displayed beside option from the alternative accordion a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed');
159
251
  fillInTheGapsDropdownPage.steps.checkAnswer();
@@ -173,7 +265,25 @@ describe('Create item page - Fill in the gaps with dropdown: All or nothing with
173
265
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(1);
174
266
  fillInTheGapsDropdownPage.steps.verifyCorrectOptionIcon(2);
175
267
  fillInTheGapsDropdownPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
176
- fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
268
+ if (alternativeAnswerCheck) {
269
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleExists();
270
+ showAlternativeAnswersComponent.steps.disableShowAlternativeAnswersToggle();
271
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
272
+ fillInTheGapsDropdownPage.steps.verifyAlternativeAnswersSectionNotExist();
273
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
274
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
275
+ {
276
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
277
+ points: ['(20 points)'],
278
+ },
279
+ {
280
+ correctAnswers: [['Petal'],['Leaves'],['Stem']],
281
+ points: ['(20 points)'],
282
+ }
283
+ ]);
284
+ } else {
285
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
286
+ }
177
287
  fillInTheGapsDropdownPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
178
288
  /*cy.log('When the user has attempted the question with equal number of correct dropdowns from correct and alternative accordion and clicks on \'Check answer\' button, then correct icon should be displayed besides the correctly answered dropdowns, no icon should be displayed beside unattempted dropdown, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed');
179
289
  fillInTheGapsDropdownPage.steps.checkAnswer();
@@ -193,7 +303,25 @@ describe('Create item page - Fill in the gaps with dropdown: All or nothing with
193
303
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(1);
194
304
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(2);
195
305
  fillInTheGapsDropdownPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
196
- fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
306
+ if (alternativeAnswerCheck) {
307
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleExists();
308
+ showAlternativeAnswersComponent.steps.disableShowAlternativeAnswersToggle();
309
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
310
+ fillInTheGapsDropdownPage.steps.verifyAlternativeAnswersSectionNotExist();
311
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
312
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
313
+ {
314
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
315
+ points: ['(20 points)'],
316
+ },
317
+ {
318
+ correctAnswers: [['Petal'],['Leaves'],['Stem']],
319
+ points: ['(20 points)'],
320
+ }
321
+ ]);
322
+ } else {
323
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
324
+ }
197
325
  fillInTheGapsDropdownPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
198
326
  /*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 dropdowns, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed');
199
327
  fillInTheGapsDropdownPage.steps.checkAnswer();
@@ -1,5 +1,5 @@
1
1
  import { fillInTheGapsDropdownPage } from "../../../../pages";
2
- import { commonComponents } from "../../../../pages/components";
2
+ import { commonComponents, showAlternativeAnswersComponent } from "../../../../pages/components";
3
3
  import abortEarlySetup from "../../../../support/helpers/abortEarly";
4
4
  import utilities from "../../../../support/helpers/utilities";
5
5
  const css = Cypress.env('css');
@@ -10,6 +10,7 @@ const optionsForDropdown3 = ['Flower', 'Leaf', 'Stem', 'Roots']; //Common answe
10
10
  const correctAnswerArray = ['Flower', 'Leaf', 'Stem'];
11
11
  const alternateAnswerArray = ['Petal', 'Leaves', 'Stem'];
12
12
  const incorrectAnswerArray = ['Branch', 'Seed', 'Roots'];
13
+ const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT') === 'true';
13
14
 
14
15
  describe('Create item page - Fill in the gaps with dropdown: All or nothing with alternative answers', () => {
15
16
  before(() => {
@@ -42,8 +43,26 @@ describe('Create item page - Fill in the gaps with dropdown: All or nothing with
42
43
  fillInTheGapsDropdownPage.steps.switchToGradingView();
43
44
  fillInTheGapsDropdownPage.steps.verifyDropdownNumerationPreviewTab();
44
45
  fillInTheGapsDropdownPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
45
- utilities.verifyInnerText(fillInTheGapsDropdownPage.correctAnswersLabel(), 'Correct answers');
46
- fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
46
+ if (alternativeAnswerCheck) {
47
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleExists();
48
+ showAlternativeAnswersComponent.steps.disableShowAlternativeAnswersToggle();
49
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
50
+ fillInTheGapsDropdownPage.steps.verifyAlternativeAnswersSectionNotExist();
51
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
52
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
53
+ {
54
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
55
+ points: ['(20 points)'],
56
+ },
57
+ {
58
+ correctAnswers: [['Petal'],['Leaves'],['Stem']],
59
+ points: ['(10 points)'],
60
+ }
61
+ ]);
62
+ } else {
63
+ utilities.verifyInnerText(fillInTheGapsDropdownPage.correctAnswersLabel(), 'Correct answers');
64
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
65
+ }
47
66
  });
48
67
 
49
68
  it('CSS of correct answer section and dropdown numeration', { tags: 'css' }, () => {
@@ -144,7 +163,25 @@ describe('Create item page - Fill in the gaps with dropdown: All or nothing with
144
163
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(1);
145
164
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(2);
146
165
  fillInTheGapsDropdownPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
147
- fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
166
+ if (alternativeAnswerCheck) {
167
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleExists();
168
+ showAlternativeAnswersComponent.steps.disableShowAlternativeAnswersToggle();
169
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
170
+ fillInTheGapsDropdownPage.steps.verifyAlternativeAnswersSectionNotExist();
171
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
172
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
173
+ {
174
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
175
+ points: ['(20 points)'],
176
+ },
177
+ {
178
+ correctAnswers: [['Petal'],['Leaves'],['Stem']],
179
+ points: ['(10 points)'],
180
+ }
181
+ ]);
182
+ } else {
183
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
184
+ }
148
185
  fillInTheGapsDropdownPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
149
186
  /*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 dropdowns, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed');
150
187
  fillInTheGapsDropdownPage.steps.checkAnswer();
@@ -164,7 +201,25 @@ describe('Create item page - Fill in the gaps with dropdown: All or nothing with
164
201
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(1);
165
202
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(2);
166
203
  fillInTheGapsDropdownPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
167
- fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
204
+ if (alternativeAnswerCheck) {
205
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleExists();
206
+ showAlternativeAnswersComponent.steps.disableShowAlternativeAnswersToggle();
207
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
208
+ fillInTheGapsDropdownPage.steps.verifyAlternativeAnswersSectionNotExist();
209
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
210
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
211
+ {
212
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
213
+ points: ['(20 points)'],
214
+ },
215
+ {
216
+ correctAnswers: [['Petal'],['Leaves'],['Stem']],
217
+ points: ['(10 points)'],
218
+ }
219
+ ]);
220
+ } else {
221
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
222
+ }
168
223
  fillInTheGapsDropdownPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
169
224
  /*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 dropdowns, no icon should be displayed beside unattempted dropdown, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed');
170
225
  fillInTheGapsDropdownPage.steps.checkAnswer();
@@ -184,7 +239,25 @@ describe('Create item page - Fill in the gaps with dropdown: All or nothing with
184
239
  fillInTheGapsDropdownPage.steps.verifyCorrectOptionIcon(1);
185
240
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(2);
186
241
  fillInTheGapsDropdownPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
187
- fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
242
+ if (alternativeAnswerCheck) {
243
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleExists();
244
+ showAlternativeAnswersComponent.steps.disableShowAlternativeAnswersToggle();
245
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
246
+ fillInTheGapsDropdownPage.steps.verifyAlternativeAnswersSectionNotExist();
247
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
248
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
249
+ {
250
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
251
+ points: ['(20 points)'],
252
+ },
253
+ {
254
+ correctAnswers: [['Petal'],['Leaves'],['Stem']],
255
+ points: ['(10 points)'],
256
+ }
257
+ ]);
258
+ } else {
259
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
260
+ }
188
261
  fillInTheGapsDropdownPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
189
262
  /*cy.log('When the user has attempted the question with partially correct with all the response correct as per the alternative accordion but one response incomplete and clicks on \'Check answer\' button, then correct icon should be displayed besides the correct accordion response, incorrect icon should be displayed besides the alternative accordion response and no icon should be displayed beside unattempted dropdown, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed');
190
263
  fillInTheGapsDropdownPage.steps.checkAnswer();
@@ -204,7 +277,25 @@ describe('Create item page - Fill in the gaps with dropdown: All or nothing with
204
277
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(1);
205
278
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(2);
206
279
  fillInTheGapsDropdownPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
207
- fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
280
+ if (alternativeAnswerCheck) {
281
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleExists();
282
+ showAlternativeAnswersComponent.steps.disableShowAlternativeAnswersToggle();
283
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
284
+ fillInTheGapsDropdownPage.steps.verifyAlternativeAnswersSectionNotExist();
285
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
286
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
287
+ {
288
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
289
+ points: ['(20 points)'],
290
+ },
291
+ {
292
+ correctAnswers: [['Petal'],['Leaves'],['Stem']],
293
+ points: ['(10 points)'],
294
+ }
295
+ ]);
296
+ } else {
297
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
298
+ }
208
299
  fillInTheGapsDropdownPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
209
300
  /*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 correctly answered dropdowns, incorrect icon should be displayed beside alternative accordion responses, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed');
210
301
  fillInTheGapsDropdownPage.steps.checkAnswer();
@@ -224,7 +315,25 @@ describe('Create item page - Fill in the gaps with dropdown: All or nothing with
224
315
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(1);
225
316
  fillInTheGapsDropdownPage.steps.verifyCorrectOptionIcon(2);
226
317
  fillInTheGapsDropdownPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
227
- fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
318
+ if (alternativeAnswerCheck) {
319
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleExists();
320
+ showAlternativeAnswersComponent.steps.disableShowAlternativeAnswersToggle();
321
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
322
+ fillInTheGapsDropdownPage.steps.verifyAlternativeAnswersSectionNotExist();
323
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
324
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
325
+ {
326
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
327
+ points: ['(20 points)'],
328
+ },
329
+ {
330
+ correctAnswers: [['Petal'],['Leaves'],['Stem']],
331
+ points: ['(10 points)'],
332
+ }
333
+ ]);
334
+ } else {
335
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
336
+ }
228
337
  fillInTheGapsDropdownPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
229
338
  /*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 correctly answered dropdowns, no icon should be displayed beside unattempted dropdown, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed');
230
339
  fillInTheGapsDropdownPage.steps.checkAnswer();
@@ -244,7 +353,25 @@ describe('Create item page - Fill in the gaps with dropdown: All or nothing with
244
353
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(1);
245
354
  fillInTheGapsDropdownPage.steps.verifyIncorrectOptionIcon(2);
246
355
  fillInTheGapsDropdownPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
247
- fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
356
+ if (alternativeAnswerCheck) {
357
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleExists();
358
+ showAlternativeAnswersComponent.steps.disableShowAlternativeAnswersToggle();
359
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
360
+ fillInTheGapsDropdownPage.steps.verifyAlternativeAnswersSectionNotExist();
361
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
362
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerSectionWithAlternateAnswer([
363
+ {
364
+ correctAnswers: [['Flower'],['Leaf'],['Stem']],
365
+ points: ['(20 points)'],
366
+ },
367
+ {
368
+ correctAnswers: [['Petal'],['Leaves'],['Stem']],
369
+ points: ['(10 points)'],
370
+ }
371
+ ]);
372
+ } else {
373
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(correctAnswerArray);
374
+ }
248
375
  fillInTheGapsDropdownPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
249
376
  /*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 dropdowns, no icon should be displayed beside unattempted dropdown, a status message with text \'Your answer is incorrect\' and correct answer section should not be displayed');
250
377
  fillInTheGapsDropdownPage.steps.checkAnswer();
@@ -1,10 +1,11 @@
1
1
  import { fillInTheGapsDropdownPage } from "../../../../pages";
2
2
  import abortEarlySetup from "../../../../support/helpers/abortEarly";
3
+ import { showAlternativeAnswersComponent } from "../../../../pages/components";
3
4
 
4
5
  const optionsForDropdown1 = ['Flower', 'Petal', 'Stem', 'Branch'];
5
6
  const optionsForDropdown2 = ['Leaf', 'Leaves', 'Stem', 'Seed'];
6
7
  const correctAnswerArray = ['Flower', 'Leaf'];
7
-
8
+ const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT') === 'true';
8
9
 
9
10
  describe('Create Item page - Fill in the gaps with dropdown', () => {
10
11
  before(() => {
@@ -65,7 +66,11 @@ describe('Create Item page - Fill in the gaps with dropdown', () => {
65
66
  fillInTheGapsDropdownPage.steps.selectResponseFromDropdownInPreviewTab([{ dropdownIndex: 0, dropdownOption: correctAnswerArray[0] }]);
66
67
  fillInTheGapsDropdownPage.steps.switchToGradingView();
67
68
  fillInTheGapsDropdownPage.steps.verifyAnswerStatusBannerExist();
68
- fillInTheGapsDropdownPage.steps.verifyCorrectAnswerSectionExist();
69
+ if (alternativeAnswerCheck) {
70
+ showAlternativeAnswersComponent.steps.verifyCorrectAnswersLabelAndPointVisible('');
71
+ } else {
72
+ fillInTheGapsDropdownPage.steps.verifyCorrectAnswerSectionExist();
73
+ }
69
74
  })
70
75
  });
71
76