itemengine-cypress-automation 1.0.584-IEI-7048-098328c.0 → 1.0.584

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 (16) hide show
  1. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/allOrNothingGroupedScoring.js +4 -1
  2. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/allOrNothingWithAlternativePointsGreaterThanCorrectPoints.js +109 -8
  3. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/allOrNothingWithCorrectPointsEqualToAlternativePoints.js +109 -8
  4. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/allOrNothingWithCorrectPointsGreaterThanAlternativePoints.js +109 -8
  5. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/blankResponseScoring.js +7 -2
  6. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialDifferentWeightsAlternativePointsGreaterThanCorrectPoints.js +139 -10
  7. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialDifferentWeightsBasic.js +4 -1
  8. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialDifferentWeightsWithCorrectPointsEqualToAlternativePoints.js +124 -9
  9. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialDifferentWeightsWithCorrectPointsGreaterThanAlternativePoints.js +139 -10
  10. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialEqualWeightsBasic.js +4 -1
  11. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialEqualWeightsWithAlternativePointsGreaterThanCorrectPoints.js +124 -9
  12. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialEqualWeightsWithCorrectPointsEqualToAlternativePoints.js +109 -8
  13. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialEqualWeightsWithCorrectPointsGreaterThanAlternativePoints.js +124 -9
  14. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/allOrNothingForAllViews.smoke.js +243 -2
  15. package/cypress/pages/components/fillInTheGapsDragAndDropCommonComponents.js +25 -1
  16. package/package.json +1 -1
@@ -1,6 +1,9 @@
1
1
  import { fillInTheGapsDragAndDropPage } from "../../../../pages";
2
2
  import abortEarlySetup from "../../../../support/helpers/abortEarly";
3
3
  import utilities from "../../../../support/helpers/utilities";
4
+ import { showAlternativeAnswersComponent } from "../../../../pages/components";
5
+
6
+ const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT') === 'true';
4
7
  const css = Cypress.env('css');
5
8
 
6
9
  describe('Create item page - Fill in the gaps with drag and drop: Partial equal with alternative answers', () => {
@@ -29,8 +32,22 @@ describe('Create item page - Fill in the gaps with drag and drop: Partial equal
29
32
  it('When the user selects \'Grading\' view without attempting the question, cell numeration should be displayed, correct answers section with a label \'Correct answers\' should be displayed with correct answers from the correct accordion and respective cell numeration', () => {
30
33
  fillInTheGapsDragAndDropPage.steps.switchToGradingView();
31
34
  fillInTheGapsDragAndDropPage.steps.verifyDropzoneNumeration();
32
- utilities.verifyInnerText(fillInTheGapsDragAndDropPage.correctAnswersLabel(), 'Correct answers');
33
- fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Petals'], ['Flower'], ['Leaves']]);
35
+ if (alternativeAnswerCheck) {
36
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
37
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerSectionWithAlternateAnswers([
38
+ {
39
+ correctAnswers: [['Petals'], ['Flower'], ['Leaves']],
40
+ points: ['(15 points)', '(5 points)', '(5 points)', '(5 points)'],
41
+ },
42
+ {
43
+ correctAnswers: [['Petals'], ['Stem'], ['Seed']],
44
+ points: ['(9 points)', '(3 points)', '(3 points)', '(3 points)'],
45
+ }
46
+ ]);
47
+ } else {
48
+ utilities.verifyInnerText(fillInTheGapsDragAndDropPage.correctAnswersLabel(), 'Correct answers');
49
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Petals'], ['Flower'], ['Leaves']]);
50
+ }
34
51
  });
35
52
 
36
53
  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, a status message and correct answer section should not be displayed', () => {
@@ -82,7 +99,21 @@ describe('Create item page - Fill in the gaps with drag and drop: Partial equal
82
99
  fillInTheGapsDragAndDropPage.steps.verifyCorrectOptionIcon(1);
83
100
  fillInTheGapsDragAndDropPage.steps.verifyCorrectOptionIcon(2);
84
101
  fillInTheGapsDragAndDropPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
85
- fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Petals'], ['Flower'], ['Leaves']]);
102
+ if (alternativeAnswerCheck) {
103
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
104
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerSectionWithAlternateAnswers([
105
+ {
106
+ correctAnswers: [['Petals'], ['Flower'], ['Leaves']],
107
+ points: ['(15 points)', '(5 points)', '(5 points)', '(5 points)'],
108
+ },
109
+ {
110
+ correctAnswers: [['Petals'], ['Stem'], ['Seed']],
111
+ points: ['(9 points)', '(3 points)', '(3 points)', '(3 points)'],
112
+ }
113
+ ]);
114
+ } else {
115
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Petals'], ['Flower'], ['Leaves']]);
116
+ }
86
117
  fillInTheGapsDragAndDropPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
87
118
  /*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, a status message should not be displayed and correct answer section should not be displayed')
88
119
  fillInTheGapsDragAndDropPage.steps.checkAnswer();
@@ -102,7 +133,21 @@ describe('Create item page - Fill in the gaps with drag and drop: Partial equal
102
133
  fillInTheGapsDragAndDropPage.steps.verifyCorrectOptionIcon(1);
103
134
  fillInTheGapsDragAndDropPage.steps.verifyCorrectOptionIcon(2);
104
135
  fillInTheGapsDragAndDropPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
105
- fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Petals'], ['Flower'], ['Leaves']]);
136
+ if (alternativeAnswerCheck) {
137
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
138
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerSectionWithAlternateAnswers([
139
+ {
140
+ correctAnswers: [['Petals'], ['Flower'], ['Leaves']],
141
+ points: ['(15 points)', '(5 points)', '(5 points)', '(5 points)'],
142
+ },
143
+ {
144
+ correctAnswers: [['Petals'], ['Stem'], ['Seed']],
145
+ points: ['(9 points)', '(3 points)', '(3 points)', '(3 points)'],
146
+ }
147
+ ]);
148
+ } else {
149
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Petals'], ['Flower'], ['Leaves']]);
150
+ }
106
151
  fillInTheGapsDragAndDropPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
107
152
  /*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 a status message should not be displayed and correct answer section should not be displayed')
108
153
  fillInTheGapsDragAndDropPage.steps.checkAnswer();
@@ -122,7 +167,21 @@ describe('Create item page - Fill in the gaps with drag and drop: Partial equal
122
167
  fillInTheGapsDragAndDropPage.steps.verifyCorrectOptionIcon(1);
123
168
  fillInTheGapsDragAndDropPage.steps.verifyIncorrectOptionIcon(2);
124
169
  fillInTheGapsDragAndDropPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
125
- fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Petals'], ['Flower'], ['Leaves']]);
170
+ if (alternativeAnswerCheck) {
171
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
172
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerSectionWithAlternateAnswers([
173
+ {
174
+ correctAnswers: [['Petals'], ['Flower'], ['Leaves']],
175
+ points: ['(15 points)', '(5 points)', '(5 points)', '(5 points)'],
176
+ },
177
+ {
178
+ correctAnswers: [['Petals'], ['Stem'], ['Seed']],
179
+ points: ['(9 points)', '(3 points)', '(3 points)', '(3 points)'],
180
+ }
181
+ ]);
182
+ } else {
183
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Petals'], ['Flower'], ['Leaves']]);
184
+ }
126
185
  fillInTheGapsDragAndDropPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
127
186
  /*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 correct accordion, incorrect icon should be displayed besides the responses from the alternative accordion and no icon should be displayed beside unattempted response, a status message should not be displayed and correct answer section should not be displayed')
128
187
  fillInTheGapsDragAndDropPage.steps.checkAnswer();
@@ -142,7 +201,21 @@ describe('Create item page - Fill in the gaps with drag and drop: Partial equal
142
201
  fillInTheGapsDragAndDropPage.steps.verifyCorrectOptionIcon(1);
143
202
  fillInTheGapsDragAndDropPage.steps.verifyIncorrectOptionIcon(2);
144
203
  fillInTheGapsDragAndDropPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
145
- fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Petals'], ['Flower'], ['Leaves']]);
204
+ if (alternativeAnswerCheck) {
205
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
206
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerSectionWithAlternateAnswers([
207
+ {
208
+ correctAnswers: [['Petals'], ['Flower'], ['Leaves']],
209
+ points: ['(15 points)', '(5 points)', '(5 points)', '(5 points)'],
210
+ },
211
+ {
212
+ correctAnswers: [['Petals'], ['Stem'], ['Seed']],
213
+ points: ['(9 points)', '(3 points)', '(3 points)', '(3 points)'],
214
+ }
215
+ ]);
216
+ } else {
217
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Petals'], ['Flower'], ['Leaves']]);
218
+ }
146
219
  fillInTheGapsDragAndDropPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
147
220
  /*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 a status message should not be displayed and correct answer section should not be displayed')
148
221
  fillInTheGapsDragAndDropPage.steps.checkAnswer();
@@ -162,7 +235,21 @@ describe('Create item page - Fill in the gaps with drag and drop: Partial equal
162
235
  fillInTheGapsDragAndDropPage.steps.verifyIncorrectOptionIcon(1);
163
236
  fillInTheGapsDragAndDropPage.steps.verifyIncorrectOptionIcon(2);
164
237
  fillInTheGapsDragAndDropPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
165
- fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Petals'], ['Flower'], ['Leaves']]);
238
+ if (alternativeAnswerCheck) {
239
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
240
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerSectionWithAlternateAnswers([
241
+ {
242
+ correctAnswers: [['Petals'], ['Flower'], ['Leaves']],
243
+ points: ['(15 points)', '(5 points)', '(5 points)', '(5 points)'],
244
+ },
245
+ {
246
+ correctAnswers: [['Petals'], ['Stem'], ['Seed']],
247
+ points: ['(9 points)', '(3 points)', '(3 points)', '(3 points)'],
248
+ }
249
+ ]);
250
+ } else {
251
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Petals'], ['Flower'], ['Leaves']]);
252
+ }
166
253
  fillInTheGapsDragAndDropPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
167
254
  /*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, no icon should be displayed beside unattempted response a status message should not be displayed and correct answer section should not be displayed')
168
255
  fillInTheGapsDragAndDropPage.steps.checkAnswer();
@@ -182,7 +269,21 @@ describe('Create item page - Fill in the gaps with drag and drop: Partial equal
182
269
  fillInTheGapsDragAndDropPage.steps.verifyIncorrectOptionIcon(1);
183
270
  fillInTheGapsDragAndDropPage.steps.verifyIncorrectOptionIcon(2);
184
271
  fillInTheGapsDragAndDropPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
185
- fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Petals'], ['Flower'], ['Leaves']]);
272
+ if (alternativeAnswerCheck) {
273
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
274
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerSectionWithAlternateAnswers([
275
+ {
276
+ correctAnswers: [['Petals'], ['Flower'], ['Leaves']],
277
+ points: ['(15 points)', '(5 points)', '(5 points)', '(5 points)'],
278
+ },
279
+ {
280
+ correctAnswers: [['Petals'], ['Stem'], ['Seed']],
281
+ points: ['(9 points)', '(3 points)', '(3 points)', '(3 points)'],
282
+ }
283
+ ]);
284
+ } else {
285
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Petals'], ['Flower'], ['Leaves']]);
286
+ }
186
287
  fillInTheGapsDragAndDropPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
187
288
  /*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 a status message should not be displayed and correct answer section should not be displayed')
188
289
  fillInTheGapsDragAndDropPage.steps.checkAnswer();
@@ -210,7 +311,21 @@ describe('Create item page - Fill in the gaps with drag and drop: Partial equal
210
311
  fillInTheGapsDragAndDropPage.steps.verifyIncorrectOptionIcon(1);
211
312
  fillInTheGapsDragAndDropPage.steps.verifyCorrectOptionIcon(2);
212
313
  fillInTheGapsDragAndDropPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
213
- fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Petals'], ['Flower'], ['Leaves']]);
314
+ if (alternativeAnswerCheck) {
315
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
316
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerSectionWithAlternateAnswers([
317
+ {
318
+ correctAnswers: [['Petals'], ['Flower'], ['Leaves']],
319
+ points: ['(23 points)', '(7.67 points)', '(7.67 points)', '(7.67 points)'],
320
+ },
321
+ {
322
+ correctAnswers: [['Roots'], ['Stem'], ['Seed']],
323
+ points: ['(5 points)', '(1.67 points)', '(1.67 points)', '(1.67 points)'],
324
+ }
325
+ ]);
326
+ } else {
327
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Petals'], ['Flower'], ['Leaves']]);
328
+ }
214
329
  fillInTheGapsDragAndDropPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
215
330
  /*cy.log('When user attempts the question correctly and clicks on the \'Check answer\' button, green check-mark icons should be displayed beside the correct responses from the correct accordion, red cross-mark icons should be displayed beside the incorrectly answered responses, correct/incorrect answer label and its border, correct answer container should not be displayed')
216
331
  fillInTheGapsDragAndDropPage.steps.checkAnswer();
@@ -1,10 +1,12 @@
1
1
  import { dialogBoxBase, fillInTheGapsDragAndDropPage, gradingViewPage, itemPreviewPage, studentViewPage } from "../../../pages";
2
+ import { showAlternativeAnswersComponent } from "../../../pages/components";
2
3
  import abortEarlySetup from "../../../support/helpers/abortEarly";
3
4
  import utilities from "../../../support/helpers/utilities";
4
5
  const grepTags = Cypress.env('grepTags');
5
6
  let correctAnswerViews = ['Question preview', 'Item preview', 'Grading view'];
6
7
  const views = utilities.getViews(correctAnswerViews);
7
8
  let itemReferenceID = "";
9
+ const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT') === 'true';
8
10
 
9
11
  describe('Create item page - Fill in the gaps - drag and drop: All or nothing ', () => {
10
12
  before(() => {
@@ -107,7 +109,9 @@ describe('Create item page - Fill in the gaps - drag and drop: All or nothing ',
107
109
  fillInTheGapsDragAndDropPage.steps.verifyPreviewTabPointsBackgroundForIncorrectOrPartiallyCorrectAnswer();
108
110
  };
109
111
  fillInTheGapsDragAndDropPage.steps.verifyDropzoneNumeration();
110
- utilities.verifyInnerText(fillInTheGapsDragAndDropPage.correctAnswersLabel(), 'Correct answers');
112
+ if (!alternativeAnswerCheck) {
113
+ utilities.verifyInnerText(fillInTheGapsDragAndDropPage.correctAnswersLabel(), 'Correct answers');
114
+ }
111
115
  fillInTheGapsDragAndDropPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
112
116
  fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Petals'], ['Leaves'], ['Stem']]);
113
117
  });
@@ -222,6 +226,241 @@ describe('Create item page - Fill in the gaps - drag and drop: All or nothing ',
222
226
  });
223
227
  });
224
228
 
229
+ if (alternativeAnswerCheck) {
230
+ views.forEach((view) => {
231
+ describe.only(`${view}: Auto scored - All or nothing scoring`, { tags: 'smoke' }, () => {
232
+ abortEarlySetup();
233
+ before(() => {
234
+ switch (view) {
235
+ case 'Question preview':
236
+ fillInTheGapsDragAndDropPage.steps.navigateToCreateQuestion('fill in the gaps with drag and drop');
237
+ cy.barsPreLoaderWait();
238
+ fillInTheGapsDragAndDropPage.steps.addTextInQuestionInstructionsInputField('Drag and drop options into correct dropzone');
239
+ fillInTheGapsDragAndDropPage.steps.addMultipleOptionFields(4);
240
+ fillInTheGapsDragAndDropPage.steps.addResponseArea();
241
+ fillInTheGapsDragAndDropPage.steps.addInputToOptionsInputField(['Petals', 'Leaves', 'Roots', 'Stem', 'Flower', 'Seed']);
242
+ fillInTheGapsDragAndDropPage.steps.allotPoints(20);
243
+ fillInTheGapsDragAndDropPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection({ 'Petals': 0, 'Flower': 1, 'Leaves': 2 });
244
+ fillInTheGapsDragAndDropPage.steps.addAlternativeAnswerAccordion(1);
245
+ fillInTheGapsDragAndDropPage.steps.allotPoints(10);
246
+ fillInTheGapsDragAndDropPage.steps.clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection({ 'Petals': 0, 'Stem': 1, 'Seed': 2 });
247
+ fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
248
+ break;
249
+ case 'Item preview':
250
+ cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
251
+ itemPreviewPage.steps.switchToPreviewTab();
252
+ break;
253
+ case 'Grading view':
254
+ cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
255
+ break;
256
+ };
257
+ });
258
+
259
+ beforeEach(() => {
260
+ switch (view) {
261
+ case 'Question preview':
262
+ fillInTheGapsDragAndDropPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
263
+ fillInTheGapsDragAndDropPage.steps.resetQuestionPreview();
264
+ break;
265
+ case 'Item preview':
266
+ fillInTheGapsDragAndDropPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
267
+ itemPreviewPage.steps.resetQuestionPreview();
268
+ break;
269
+ case 'Grading view':
270
+ cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
271
+ break;
272
+ }
273
+ });
274
+
275
+ if (view === 'Question preview') {
276
+ after(() => {
277
+ fillInTheGapsDragAndDropPage.steps.clickOnSaveQuestionButton();
278
+ utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
279
+ itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
280
+ });
281
+ };
282
+
283
+ it('When the user selects \'Grading\' view without attempting the question, dropzone numeration should be displayed, correct/incorrect status message should not be displayed, correct answers section with a label \'Correct answers\' should be displayed and respective option numeration', () => {
284
+ if (view === 'Grading view') {
285
+ studentViewPage.steps.submitResponse();
286
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
287
+ studentViewPage.steps.clickOnGoToGradingViewButton();
288
+ gradingViewPage.steps.verifyGradingViewScore(0, 20);
289
+ };
290
+ if (view === 'Question preview' || view === 'Item preview') {
291
+ fillInTheGapsDragAndDropPage.steps.verifyPreviewScore(0, 20);
292
+ fillInTheGapsDragAndDropPage.steps.switchToGradingView();
293
+ fillInTheGapsDragAndDropPage.steps.verifyPreviewTabPointsBackgroundForIncorrectOrPartiallyCorrectAnswer();
294
+ };
295
+ fillInTheGapsDragAndDropPage.steps.verifyDropzoneNumeration();
296
+ if (!alternativeAnswerCheck) {
297
+ utilities.verifyInnerText(fillInTheGapsDragAndDropPage.correctAnswersLabel(), 'Correct answers');
298
+ }
299
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
300
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
301
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerSectionWithAlternateAnswers([
302
+ {
303
+ correctAnswers: [['Petals'], ['Flower'], ['Leaves']],
304
+ points: ['(20 points)'],
305
+ },
306
+ {
307
+ correctAnswers: [['Petals'], ['Stem'], ['Seed']],
308
+ points: ['(10 points)'],
309
+ }
310
+ ]);
311
+ });
312
+
313
+ it('When the user attempts the question incorrectly, then the user should be awarded 0 points and on switching to \'Grading\' view, incorrect icons should be displayed besides all incorrect responses, a status message with text \'Your answer is incorrect\' and correct answer section with all correct answers along with numeration should be displayed', () => {
314
+ fillInTheGapsDragAndDropPage.steps.clickAndDropOptionInDropzonePreviewTab({ 'Leaves': 0, 'Petals': 1, 'Roots': 2 });
315
+ if (view === 'Grading view') {
316
+ studentViewPage.steps.submitResponse();
317
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
318
+ studentViewPage.steps.clickOnGoToGradingViewButton();
319
+ gradingViewPage.steps.verifyGradingViewScore(0, 20);
320
+ };
321
+ if (view === 'Question preview' || view === 'Item preview') {
322
+ fillInTheGapsDragAndDropPage.steps.verifyPreviewScore(0, 20);
323
+ fillInTheGapsDragAndDropPage.steps.switchToGradingView();
324
+ };
325
+ fillInTheGapsDragAndDropPage.steps.verifyIncorrectOptionIcon(0);
326
+ fillInTheGapsDragAndDropPage.steps.verifyIncorrectOptionIcon(1);
327
+ fillInTheGapsDragAndDropPage.steps.verifyIncorrectOptionIcon(2);
328
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
329
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
330
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerSectionWithAlternateAnswers([
331
+ {
332
+ correctAnswers: [['Petals'], ['Flower'], ['Leaves']],
333
+ points: ['(20 points)'],
334
+ },
335
+ {
336
+ correctAnswers: [['Petals'], ['Stem'], ['Seed']],
337
+ points: ['(10 points)'],
338
+ }
339
+ ]);
340
+ });
341
+
342
+ it('When the user attempts the question partially correct with some correct, some incomplete, some incorrect options, then the user should be awarded 0 points and on switching to \'Grading\' view, correct icon should be displayed besides the correct answer responses, incorrect icon should be displayed besides incorrect answer response, a status message with text \'Your answer is incorrect\' and correct answer section with all correct answers along with numeration should be displayed', () => {
343
+ if (view === 'Grading view') {
344
+ studentViewPage.steps.clearResponses();
345
+ };
346
+ fillInTheGapsDragAndDropPage.steps.clickAndDropOptionInDropzonePreviewTab({ 'Petals': 0, 'Roots': 2 });
347
+ if (view === 'Grading view') {
348
+ studentViewPage.steps.submitResponse();
349
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
350
+ studentViewPage.steps.clickOnGoToGradingViewButton();
351
+ gradingViewPage.steps.verifyGradingViewScore(0, 20);
352
+ };
353
+ if (view === 'Question preview' || view === 'Item preview') {
354
+ fillInTheGapsDragAndDropPage.steps.verifyPreviewScore(0, 20);
355
+ fillInTheGapsDragAndDropPage.steps.switchToGradingView();
356
+ };
357
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectOptionIcon(0);
358
+ fillInTheGapsDragAndDropPage.steps.verifyIncorrectOptionIcon(1);
359
+ fillInTheGapsDragAndDropPage.steps.verifyIncorrectOptionIcon(2);
360
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
361
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
362
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerSectionWithAlternateAnswers([
363
+ {
364
+ correctAnswers: [['Petals'], ['Flower'], ['Leaves']],
365
+ points: ['(20 points)'],
366
+ },
367
+ {
368
+ correctAnswers: [['Petals'], ['Stem'], ['Seed']],
369
+ points: ['(10 points)'],
370
+ }
371
+ ]);
372
+ });
373
+
374
+ it('When the user attempts the question partially correct with all the dropzone correctly attempted but one dropzone incomplete, then the user should be awarded 0 points and on switching to \'Grading\' view, correct icon should be displayed besides the correct answer responses, incorrect icon should be displayed besides incorrect answer response, a status message with text \'Your answer is incorrect\' and correct answer section with all correct answers along with numeration should be displayed', () => {
375
+ if (view === 'Grading view') {
376
+ studentViewPage.steps.clearResponses();
377
+ };
378
+ fillInTheGapsDragAndDropPage.steps.clickAndDropOptionInDropzonePreviewTab({ 'Leaves': 1, 'Stem': 2 })
379
+ if (view === 'Grading view') {
380
+ studentViewPage.steps.submitResponse();
381
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
382
+ studentViewPage.steps.clickOnGoToGradingViewButton();
383
+ gradingViewPage.steps.verifyGradingViewScore(0, 20);
384
+ };
385
+ if (view === 'Question preview' || view === 'Item preview') {
386
+ fillInTheGapsDragAndDropPage.steps.verifyPreviewScore(0, 20);
387
+ fillInTheGapsDragAndDropPage.steps.switchToGradingView();
388
+ };
389
+ fillInTheGapsDragAndDropPage.steps.verifyIncorrectOptionIcon(0);
390
+ fillInTheGapsDragAndDropPage.steps.verifyIncorrectOptionIcon(1);
391
+ fillInTheGapsDragAndDropPage.steps.verifyIncorrectOptionIcon(2);
392
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
393
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
394
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerSectionWithAlternateAnswers([
395
+ {
396
+ correctAnswers: [['Petals'], ['Flower'], ['Leaves']],
397
+ points: ['(20 points)'],
398
+ },
399
+ {
400
+ correctAnswers: [['Petals'], ['Stem'], ['Seed']],
401
+ points: ['(10 points)'],
402
+ }
403
+ ]);
404
+ });
405
+
406
+ it('When the user attempts the question partially correct with all the dropzone correctly attempted but with an extra option which is not set as correct answer, then the user should be awarded 0 points and on switching to \'Grading\' view, correct icon should be displayed besides the correct answer responses, incorrect icon should be displayed besides incorrect answer response, a status message with text \'Your answer is incorrect\' and correct answer section should be displayed along with numeration', () => {
407
+ if (view === 'Grading view') {
408
+ studentViewPage.steps.clearResponses();
409
+ };
410
+ fillInTheGapsDragAndDropPage.steps.clickAndDropOptionInDropzonePreviewTab({ 'Petals': 0, 'Leaves': 1, 'Roots': 1, 'Stem': 2 });
411
+ if (view === 'Grading view') {
412
+ studentViewPage.steps.submitResponse();
413
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
414
+ studentViewPage.steps.clickOnGoToGradingViewButton();
415
+ gradingViewPage.steps.verifyGradingViewScore(0, 20);
416
+ };
417
+ if (view === 'Question preview' || view === 'Item preview') {
418
+ fillInTheGapsDragAndDropPage.steps.verifyPreviewScore(0, 20);
419
+ fillInTheGapsDragAndDropPage.steps.switchToGradingView();
420
+ };
421
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectOptionIcon(0);
422
+ fillInTheGapsDragAndDropPage.steps.verifyIncorrectOptionIcon(1);
423
+ fillInTheGapsDragAndDropPage.steps.verifyIncorrectOptionIcon(2);
424
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
425
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
426
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerSectionWithAlternateAnswers([
427
+ {
428
+ correctAnswers: [['Petals'], ['Flower'], ['Leaves']],
429
+ points: ['(20 points)'],
430
+ },
431
+ {
432
+ correctAnswers: [['Petals'], ['Stem'], ['Seed']],
433
+ points: ['(10 points)'],
434
+ }
435
+ ]);
436
+ });
437
+
438
+ it('When user attempts the question correctly, the user should be awarded full points and on switching to \'Grading\' view, then correct icons should be displayed beside all the correct responses, correct icon should be displayed besides the correct answer responses, a status message with text \'Your answer is correct\' and correct answer section should not be displayed', () => {
439
+ if (view === 'Grading view') {
440
+ studentViewPage.steps.clearResponses();
441
+ };
442
+ fillInTheGapsDragAndDropPage.steps.clickAndDropOptionInDropzonePreviewTab({ 'Petals': 0, 'Flower': 1, 'Leaves': 2 });
443
+ if (view === 'Grading view') {
444
+ studentViewPage.steps.submitResponse();
445
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
446
+ studentViewPage.steps.clickOnGoToGradingViewButton();
447
+ gradingViewPage.steps.verifyGradingViewScore(20, 20);
448
+ };
449
+ if (view === 'Question preview' || view === 'Item preview') {
450
+ fillInTheGapsDragAndDropPage.steps.verifyPreviewScore(20, 20);
451
+ fillInTheGapsDragAndDropPage.steps.switchToGradingView();
452
+ fillInTheGapsDragAndDropPage.steps.verifyPreviewTabPointsBackgroundForCorrectAnswer();
453
+ };
454
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectOptionIcon(0);
455
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectOptionIcon(1);
456
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectOptionIcon(2);
457
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
458
+ fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerSectionNotExists();
459
+ });
460
+ });
461
+ });
462
+ }
463
+
225
464
  views.forEach((view) => {
226
465
  describe(`Fill in the Gaps with drag and drop - Manually scored: ${view}`, { tags: 'smoke' }, () => {
227
466
  abortEarlySetup();
@@ -361,7 +600,9 @@ describe('Create item page - Fill in the gaps - drag and drop: All or nothing ',
361
600
  fillInTheGapsDragAndDropPage.steps.switchToGradingView();
362
601
  fillInTheGapsDragAndDropPage.steps.verifyPreviewTabPointsBackgroundForIncorrectOrPartiallyCorrectAnswer();
363
602
  };
364
- utilities.verifyInnerText(fillInTheGapsDragAndDropPage.correctAnswersLabel(), 'Correct answers');
603
+ if (!alternativeAnswerCheck) {
604
+ utilities.verifyInnerText(fillInTheGapsDragAndDropPage.correctAnswersLabel(), 'Correct answers');
605
+ }
365
606
  fillInTheGapsDragAndDropPage.steps.verifyCorrectIncorrectIconsNotExist();
366
607
  fillInTheGapsDragAndDropPage.steps.verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount([['Petals'], ['Leaves'], ['Stem']]);
367
608
  });
@@ -11,13 +11,14 @@ const selectors = {
11
11
  specifyPointsForEachIncorrectDropzoneRadioButton: () => cy.get('input[aria-label*="Specify points for each incorrect"]'),
12
12
 
13
13
  correctAnswersNumeration: () => cy.get('[class*="__AnswerCell"] .answer-numeration-number-box'),
14
- correctAnswersOptions: () => cy.get('[class*="__AnswerWrapper"]'),
14
+ correctAnswersOptions: () => cy.get('[class*="ClozeWithDragAndDropstyles__AnswerWrapper"]'),
15
15
  correctAnswersLabel: () => cy.get('.correct-answers-label'),
16
16
  tickIconWrapper: () => cy.get('.tick-icon-wrapper'),
17
17
  correctAnswerContainer: () => cy.get('.dnd-correct-answer-wrapper'),
18
18
  correctIncorrectAnswerLabel: () => cy.get('[class*="CorrectIncorrectLabel"]'),
19
19
  correctAnswerResponseWrapperWithoutEnumeration: () => cy.get('[class*="CorrectAnswers"] [class*="AnswerStatusIconAndResponseWrapper"]'),
20
20
  answerStatusBanner: () => cy.get('[class*="AnswerStatusWrapper"]'),
21
+ correctAnswerPointsLabel: () => cy.get('[class*="CorrectAnswerSectionstyle__CorrectAnswerLabelWrapper"] p'),
21
22
 
22
23
  //additional settings
23
24
  enterAriaLabelInputField: () => cy.get('input[aria-label*="Enter ARIA label"]'),
@@ -39,6 +40,29 @@ const steps = {
39
40
  });
40
41
  },
41
42
 
43
+ verifyCorrectAnswerSectionWithAlternateAnswers: (correctAnswersArray) => {
44
+ let answerIndex = 0;
45
+ let pointsLabelIndex = 0;
46
+ correctAnswersArray.forEach(({
47
+ correctAnswers, points
48
+ }) => {
49
+ correctAnswers.forEach((correctAnswer, index) => {
50
+ utilities.verifyTextContent(utilities.getNthElement(fillInTheGapsDragAndDropCommonComponents.correctAnswersNumeration(), answerIndex), index + 1);
51
+ correctAnswer.forEach((answerOption) => {
52
+ utilities.verifyTextContent(utilities.getNthElement(fillInTheGapsDragAndDropCommonComponents.correctAnswersOptions(), answerIndex), answerOption);
53
+ });
54
+ answerIndex += 1;
55
+ });
56
+ points.forEach((pointsText) => {
57
+ fillInTheGapsDragAndDropCommonComponents.correctAnswerPointsLabel()
58
+ .eq(pointsLabelIndex)
59
+ .should('have.text', pointsText);
60
+ pointsLabelIndex += 1;
61
+ })
62
+ });
63
+ },
64
+
65
+
42
66
  verifyCorrectAnswerSectionNotExists: () => {
43
67
  utilities.verifyElementVisibilityState(fillInTheGapsDragAndDropCommonComponents.correctAnswerContainer(), 'notExist');
44
68
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.584-IEI-7048-098328c.0",
3
+ "version": "1.0.584",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {