itemengine-cypress-automation 1.0.543-fixes15-10-6c7408d.0 → 1.0.544-IEI-6994-Add-test-coverage-for-text-selection--d8792a9.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.
@@ -82,6 +82,20 @@ describe('Create item page - Text selection: Partial equal weights', () => {
82
82
  textSelectionPage.steps.verifyCorrectAnswerSectionNotExists();*/
83
83
  });
84
84
 
85
+ it('When the user attempts the question partially correct with some correct options, then the user should be awarded 0 points and on switching to \'Grading\' view, correct icon should be displayed besides the correct answer response, and a status message should not be displayed and correct answer section with all correct answers should be displayed', () => {
86
+ textSelectionPage.steps.resetQuestionPreview();
87
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[0]);
88
+ textSelectionPage.steps.verifyPreviewScore(10, 20);
89
+ textSelectionPage.steps.switchToGradingView();
90
+ textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[0]);
91
+ textSelectionPage.steps.verifyCorrectIncorrectIconForOptionNotExist(paragraphTextArray[1]);
92
+ textSelectionPage.steps.verifyOptionIsNotSelectedInPreviewTab(paragraphTextArray[3]);
93
+ textSelectionPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
94
+ textSelectionPage.steps.verifyCorrectIconForOptionCorrectAnswerSection(paragraphTextArray[0]);
95
+ textSelectionPage.steps.verifyCorrectIconForOptionCorrectAnswerSection(paragraphTextArray[1]);
96
+ textSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
97
+ });
98
+
85
99
  it('When the user attempts the question correctly then the user should be awarded full points and on switching to \'Grading\' view, correct icon should be displayed besides the correct answer responses, a status message and correct answer section should not be displayed', () => {
86
100
  textSelectionPage.steps.resetQuestionPreview();
87
101
  textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[0]);
@@ -65,6 +65,20 @@ describe('Create item page - Text selection - Selection mode - Sentence: Partial
65
65
  textSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
66
66
  });
67
67
 
68
+ it('When the user attempts the question partially correct with some correct options, then the user should be awarded points for that options and on switching to \'Grading\' view, correct icon should be displayed besides the correct answer response, incorrect icon should be displayed besides the containers not attempted and a status message should not be displayed and correct answer section with all correct answers should be displayed', () => {
69
+ textSelectionPage.steps.resetQuestionPreview();
70
+ textSelectionPage.steps.selectOptionInPreviewTab(sentenceTextArray[0]);
71
+ textSelectionPage.steps.verifyPreviewScore(10, 20);
72
+ textSelectionPage.steps.switchToGradingView();
73
+ textSelectionPage.steps.verifyCorrectIconForOption(sentenceTextArray[0]);
74
+ textSelectionPage.steps.verifyCorrectIncorrectIconForOptionNotExist(sentenceTextArray[1]);
75
+ textSelectionPage.steps.verifyOptionIsNotSelectedInPreviewTab(sentenceTextArray[3]);
76
+ textSelectionPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
77
+ textSelectionPage.steps.verifyCorrectIconForOptionCorrectAnswerSection(sentenceTextArray[0]);
78
+ textSelectionPage.steps.verifyCorrectIconForOptionCorrectAnswerSection(sentenceTextArray[1]);
79
+ textSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
80
+ });
81
+
68
82
  it('When the user attempts the question correctly then the user should be awarded full points and on switching to \'Grading\' view, correct icon should be displayed besides the correct answer responses, a status message and correct answer section should not be displayed', () => {
69
83
  textSelectionPage.steps.resetQuestionPreview();
70
84
  textSelectionPage.steps.selectOptionInPreviewTab(sentenceTextArray[0]);
@@ -519,11 +519,37 @@ describe('Create item page - Text selection: All or nothing ', () => {
519
519
  textSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
520
520
  });
521
521
 
522
+ it('When the user selects \'Award minimum score only if attempted\' from the minimum scoring dropdown, attempts the question and switches to grading view, then the user should be awarded with minimum points', () => {
523
+ textSelectionPage.steps.resetQuestionPreview();
524
+ textSelectionPage.steps.switchToPreviewTab();
525
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[2]);
526
+ textSelectionPage.steps.switchToGradingView();
527
+ textSelectionPage.steps.verifyPreviewScore(2, 20);
528
+ });
529
+
522
530
  it('When the user has selected \'Award minimum score\' from the minimum scoring dropdown, attempts the question incorrectly and switches to grading view, the user should be awarded with minimum points', () => {
531
+ textSelectionPage.steps.switchToEditTab();
532
+ textSelectionPage.steps.expandMinimumScoringDropdown();
533
+ textSelectionPage.steps.selectOptionFromMinimumScoringDropdown('Award minimum score');
534
+ textSelectionPage.steps.allotMinimumPoints(2);
523
535
  textSelectionPage.steps.resetQuestionPreview();
524
536
  textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[2]);
525
537
  textSelectionPage.steps.verifyPreviewScore(2, 20);
526
538
  });
539
+
540
+ it('When the user has selected \'Award minimum score\' from the minimum scoring dropdown, does not attempt the question incorrectly and switches to grading view, the user should be awarded with minimum points', () => {
541
+ textSelectionPage.steps.resetQuestionPreview();
542
+ textSelectionPage.steps.verifyPreviewScore(2, 20);
543
+ });
544
+
545
+ it('When the user has selected \'No minimum score\' from the minimum scoring dropdown, and attempts the question incorrectly, then the user should be awarded with 0 points', () => {
546
+ textSelectionPage.steps.switchToEditTab();
547
+ textSelectionPage.steps.expandMinimumScoringDropdown();
548
+ textSelectionPage.steps.selectOptionFromMinimumScoringDropdown('No minimum score');
549
+ textSelectionPage.steps.resetQuestionPreview();
550
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[2]);
551
+ textSelectionPage.steps.verifyPreviewScore(0, 20);
552
+ });
527
553
  });
528
554
  };
529
555
  });
@@ -1,4 +1,5 @@
1
1
  import { textSelectionPage } from "../../../pages";
2
+ import {autoScoredScoringSectionMultiResponseType} from "../../../pages/components";
2
3
  import abortEarlySetup from "../../../support/helpers/abortEarly";
3
4
  import utilities from "../../../support/helpers/utilities";
4
5
  const css = Cypress.env('css');
@@ -193,6 +194,91 @@ describe('Create item page - Fill in the gaps with drag and drop: Minimum scorin
193
194
  utilities.verifyInnerText(utilities.getNthElement(textSelectionPage.penaltyPointsDetailsSectionAllottedPointsLabel(), 0), 'Penalty points for each incorrect answer: 5');
194
195
  utilities.verifyInnerText(utilities.getNthElement(textSelectionPage.penaltyPointsDetailsSectionAllottedPointsLabel(), 1), 'Total penalty points: 10');
195
196
  });
197
+
198
+ it('When the user selects \'Penalty points for the entire question\' from the penalty scoring dropdown, and attempts the question incorrectly with only incorrect options, then the user should be awarded negative points and on switching to \'Grading\' view, incorrect icons should be displayed besides all incorrect responses, a status message should not be displayed and correct answer section with all correct answers should be displayed', () => {
199
+ textSelectionPage.steps.expandPenaltyScoringDropdown();
200
+ textSelectionPage.steps.selectOptionFromPenaltyScoringDropdown('Penalty points for the entire question');
201
+ autoScoredScoringSectionMultiResponseType.steps.clearPenaltyPoints();
202
+ autoScoredScoringSectionMultiResponseType.steps.allotPenaltyPoints('2');
203
+ autoScoredScoringSectionMultiResponseType.steps.uncheckRoundNegativeScoresToZeroCheckbox();
204
+ textSelectionPage.steps.switchToPreviewTab();
205
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[2]);
206
+ textSelectionPage.steps.verifyPreviewScore(-2,10);
207
+ textSelectionPage.steps.switchToGradingView();
208
+ textSelectionPage.steps.verifyIncorrectIconForOption(paragraphTextArray[2]);
209
+ textSelectionPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
210
+ textSelectionPage.steps.verifyCorrectIconForOptionCorrectAnswerSection(paragraphTextArray[0]);
211
+ textSelectionPage.steps.verifyCorrectIconForOptionCorrectAnswerSection(paragraphTextArray[1]);
212
+ });
213
+
214
+ it('When the user selects \'Penalty points for the entire question\' from the penalty scoring dropdown, and attempts the question correctly, then the user should be awarded full points and on switching to \'Grading\' view, correct icons should be displayed besides all correct responses, a status message should not be displayed and correct answer section with all correct answers should not be displayed', () => {
215
+ textSelectionPage.steps.resetQuestionPreview();
216
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[0]);
217
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[1]);
218
+ textSelectionPage.steps.verifyPreviewScore(10,10);
219
+ textSelectionPage.steps.switchToGradingView();
220
+ textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[0]);
221
+ textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[1]);
222
+ textSelectionPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
223
+ textSelectionPage.steps.verifyCorrectAnswerSectionNotExists();
224
+ });
225
+
226
+ it('When the user selects \'Penalty points for the entire question\' from the penalty scoring dropdown, and attempts the question incorrectly with both correct and incorrect options, then the user should be awarded negative points and on switching to \'Grading\' view, correct icons should be displayed besides all correct responses, incorrect icons should be displayed besides all incorrect responses, a status message should not be displayed and correct answer section with all correct answers should be displayed', () => {
227
+ textSelectionPage.steps.resetQuestionPreview();
228
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[0]);
229
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[1]);
230
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[2]);
231
+ textSelectionPage.steps.verifyPreviewScore(8,10);
232
+ textSelectionPage.steps.switchToGradingView();
233
+ textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[0]);
234
+ textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[1]);
235
+ textSelectionPage.steps.verifyIncorrectIconForOption(paragraphTextArray[2]);
236
+ textSelectionPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
237
+ textSelectionPage.steps.verifyCorrectIconForOptionCorrectAnswerSection(paragraphTextArray[0]);
238
+ textSelectionPage.steps.verifyCorrectIconForOptionCorrectAnswerSection(paragraphTextArray[1]);
239
+ });
240
+
241
+ it('When the user selects \'Penalty points for each incorrect answer\' from the penalty scoring dropdown, and attempts the question incorrectly, then the user should be awarded negative points for incorrect options and on switching to \'Grading\' view, incorrect icons should be displayed besides all incorrect responses, a status message should not be displayed and correct answer section with all correct answers should be displayed', () => {
242
+ textSelectionPage.steps.switchToEditTab();
243
+ textSelectionPage.steps.unSelectOptionInSpecifyCorrectAnswerSection(paragraphTextArray[1], true);
244
+ textSelectionPage.steps.expandPenaltyScoringDropdown();
245
+ textSelectionPage.steps.selectOptionFromPenaltyScoringDropdown('Penalty points for each incorrect answer');
246
+ autoScoredScoringSectionMultiResponseType.steps.uncheckAutomaticallySetPenaltyPointsCheckbox();
247
+ autoScoredScoringSectionMultiResponseType.steps.allotPenaltyPointsForEachIncorrectOption('2');
248
+ textSelectionPage.steps.switchToPreviewTab();
249
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[1]);
250
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[2]);
251
+ textSelectionPage.steps.verifyPreviewScore(-4,10);
252
+ textSelectionPage.steps.switchToGradingView();
253
+ textSelectionPage.steps.verifyIncorrectIconForOption(paragraphTextArray[1]);
254
+ textSelectionPage.steps.verifyIncorrectIconForOption(paragraphTextArray[2]);
255
+ textSelectionPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
256
+ textSelectionPage.steps.verifyCorrectIconForOptionCorrectAnswerSection(paragraphTextArray[0]);
257
+ });
258
+
259
+ it('When the user selects \'Penalty points for each incorrect answer\' from the penalty scoring dropdown, and attempts the question correctly, then the user should be awarded full points for correct options and on switching to \'Grading\' view, correct icons should be displayed besides all correct responses, a status message should not be displayed and correct answer section with all correct answers should not be displayed', () => {
260
+ textSelectionPage.steps.resetQuestionPreview();
261
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[0]);
262
+ textSelectionPage.steps.verifyPreviewScore(10,10);
263
+ textSelectionPage.steps.switchToGradingView();
264
+ textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[0]);
265
+ textSelectionPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
266
+ textSelectionPage.steps.verifyCorrectAnswerSectionNotExists();
267
+ });
268
+
269
+ it('When the user selects \'Penalty points for each incorrect answer\' from the penalty scoring dropdown, and attempts the question incorrectly with both correct and incorrect options, then the user should be awarded points deducted for incorrect responses and on switching to \'Grading\' view, correct icons should be displayed besides all correct responses, incorrect icons should be displayed besides all incorrect responses, a status message should not be displayed and correct answer section with all correct answers should be displayed', () => {
270
+ textSelectionPage.steps.resetQuestionPreview();
271
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[0]);
272
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[1]);
273
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[2]);
274
+ textSelectionPage.steps.verifyPreviewScore(6,10);
275
+ textSelectionPage.steps.switchToGradingView();
276
+ textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[0]);
277
+ textSelectionPage.steps.verifyIncorrectIconForOption(paragraphTextArray[1]);
278
+ textSelectionPage.steps.verifyIncorrectIconForOption(paragraphTextArray[2]);
279
+ textSelectionPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
280
+ textSelectionPage.steps.verifyCorrectIconForOptionCorrectAnswerSection(paragraphTextArray[0]);
281
+ });
196
282
  });
197
283
 
198
284
  describe('Scoring section: Rounding - Edit tab', () => {
@@ -200,12 +286,79 @@ describe('Create item page - Fill in the gaps with drag and drop: Minimum scorin
200
286
  before(() => {
201
287
  textSelectionPage.steps.navigateToCreateQuestion('text selection');
202
288
  cy.barsPreLoaderWait();
203
- textSelectionPage.steps.allotPoints(10);
204
- textSelectionPage.steps.selectAutoScoredScoringSubtype('Partial equal weights')
289
+ textSelectionPage.steps.clearQuestionInputField();
290
+ paragraphTextArray.forEach((paragraphText) => {
291
+ textSelectionPage.steps.addInputToQuestionInputField(`${paragraphText}{enter}`);
292
+ });
293
+ textSelectionPage.steps.addInputToQuestionInputField('{backspace}');
294
+ textSelectionPage.steps.switchTextSelectionMode('Paragraph');
295
+ textSelectionPage.steps.clickOnOptionInSpecifyPossibleOptionsSection(paragraphTextArray[0]);
296
+ textSelectionPage.steps.clickOnOptionInSpecifyPossibleOptionsSection(paragraphTextArray[1]);
297
+ textSelectionPage.steps.clickOnOptionInSpecifyPossibleOptionsSection(paragraphTextArray[2]);
298
+ textSelectionPage.steps.selectOptionInSpecifyCorrectAnswerSection(paragraphTextArray[0]);
299
+ textSelectionPage.steps.selectOptionInSpecifyCorrectAnswerSection(paragraphTextArray[1]);
300
+ textSelectionPage.steps.selectOptionInSpecifyCorrectAnswerSection(paragraphTextArray[2]);
301
+ textSelectionPage.steps.allotPoints(4);
302
+ textSelectionPage.steps.selectAutoScoredScoringSubtype('Partial equal weights');
205
303
  });
206
304
 
207
305
  textSelectionPage.tests.verifyRoundingDropdown();
208
306
 
209
307
  textSelectionPage.tests.verifyRoundNegativeScoreToZeroLabelAndCheckbox();
308
+
309
+ it("When the user selects rounding to \'Round down if <= 0.99\' then the score '<=0.99' should be rounded down to nearest whole number", () => {
310
+ textSelectionPage.steps.expandRoundingDropdown();
311
+ textSelectionPage.steps.switchToPreviewTab();
312
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[0]);
313
+ textSelectionPage.steps.verifyPreviewScore(1,4);
314
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[1]);
315
+ textSelectionPage.steps.verifyPreviewScore(2,4);
316
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[2]);
317
+ textSelectionPage.steps.verifyPreviewScore(4,4);
318
+ textSelectionPage.steps.switchToGradingView();
319
+ textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[0]);
320
+ textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[1]);
321
+ textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[2]);
322
+ textSelectionPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
323
+ textSelectionPage.steps.verifyCorrectAnswerSectionNotExists();
324
+ });
325
+
326
+ it("When the user selects rounding to \'Round down if <= 0.50\' then the score '<=0.50' should be rounded down to nearest whole number", () => {
327
+ textSelectionPage.steps.switchToEditTab();
328
+ textSelectionPage.steps.expandRoundingDropdown();
329
+ textSelectionPage.steps.selectOptionFromRoundingDropdown('round down if <= 0.50');
330
+ textSelectionPage.steps.switchToPreviewTab();
331
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[0]);
332
+ textSelectionPage.steps.verifyPreviewScore(1,4);
333
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[1]);
334
+ textSelectionPage.steps.verifyPreviewScore(2.6667,4);
335
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[2]);
336
+ textSelectionPage.steps.verifyPreviewScore(4,4);
337
+ textSelectionPage.steps.switchToGradingView();
338
+ textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[0]);
339
+ textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[1]);
340
+ textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[2]);
341
+ textSelectionPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
342
+ textSelectionPage.steps.verifyCorrectAnswerSectionNotExists();
343
+ });
344
+
345
+ it('When the user selects rounding to \'Round down if <= 0.50\' then the score \'<=0.50\' should be rounded down to nearest whole number and the score \'>0.50\' should be rounded up to nearest whole number', () => {
346
+ textSelectionPage.steps.switchToEditTab();
347
+ textSelectionPage.steps.expandRoundingDropdown();
348
+ textSelectionPage.steps.selectOptionFromRoundingDropdown('round down if <= 0.50; Round up if > 0.50');
349
+ textSelectionPage.steps.switchToPreviewTab();
350
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[0]);
351
+ textSelectionPage.steps.verifyPreviewScore(1,4);
352
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[1]);
353
+ textSelectionPage.steps.verifyPreviewScore(3,4);
354
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[2]);
355
+ textSelectionPage.steps.verifyPreviewScore(4,4);
356
+ textSelectionPage.steps.switchToGradingView();
357
+ textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[0]);
358
+ textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[1]);
359
+ textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[2]);
360
+ textSelectionPage.steps.verifyCorrectIncorrectStatusMessageNotExists();
361
+ textSelectionPage.steps.verifyCorrectAnswerSectionNotExists();
362
+ });
210
363
  });
211
364
  });
@@ -2,11 +2,11 @@ import { textSelectionPage, itemPreviewPage, studentViewPage } from "../../../pa
2
2
  import abortEarlySetup from "../../../support/helpers/abortEarly";
3
3
  import utilities from "../../../support/helpers/utilities";
4
4
  const css = Cypress.env('css');
5
- let previewContentViews = ['Question preview', 'Item view', 'Item preview', 'Student view', 'Grading view', 'Correct answer view'];
5
+ let previewContentViews = ['Question preview', 'Item view', 'Item preview', 'Student view', 'Grading view', 'Correct answer view', 'Print preview'];
6
6
  const views = utilities.getViews(previewContentViews);
7
7
  var itemReferenceID = "";
8
8
 
9
- const paragraphTextArray = ['All animals have a unique role to play in maintaining the balance of nature.', 'A lot of animal species exist in both, land and water. As a result, each of them has a purpose.', 'The animals divide into specific groups in biology. Amphibians are those which can live on both, land and water.', 'Mammals are ones which give birth to their offspring in the womb and have mammary glands.'];
9
+ const paragraphTextArray = ['All animals have a unique role to play in maintaining the balance of nature.', 'A lot of animal species exist in both, land and water. As a result, each of them has a purpose for their existence.', 'The animals divide into specific groups in biology. Amphibians are those which can live on both, land and water.', 'Mammals are ones which give birth to their offspring in the womb and have mammary glands.', 'Birds are creatures with feathers, beaks, and the ability to lay eggs.', 'Many animal species are undocumented even today.', 'Research is going on to discover new species in the far corners of the earth'];
10
10
 
11
11
  describe('Create item page - Text selection : Preview contents', () => {
12
12
  before(() => {
@@ -54,6 +54,9 @@ describe('Create item page - Text selection : Preview contents', () => {
54
54
  case 'Correct answer view':
55
55
  cy.visit(`/item-engine/demo/render-item/correct-answer-view/${utilities.base64Encoding(itemReferenceID)}`);
56
56
  break;
57
+ case 'Print preview':
58
+ cy.visit(`/item-engine/demo/render-item/print-view/${utilities.base64Encoding(itemReferenceID)}`);
59
+ break;
57
60
  default:
58
61
  throw new Error('Invalid view');
59
62
  }
@@ -71,64 +74,75 @@ describe('Create item page - Text selection : Preview contents', () => {
71
74
  }
72
75
  });
73
76
 
74
- it('Question instructions should be visible', () => {
75
- utilities.verifyInnerText(textSelectionPage.questionInstructionsText(), 'Select the correct statements.');
76
- utilities.verifyElementVisibilityState(textSelectionPage.questionInstructionsText(), 'visible');
77
- });
78
-
79
- it('The added text in Question input field should be displayed in the preview tab question', () => {
80
- paragraphTextArray.forEach((paragraphText, index) => {
81
- utilities.verifyInnerText(utilities.getNthElement(textSelectionPage.questionTextPreviewTab(), index), `${paragraphText}`);
77
+ if (view === 'Print preview') {
78
+ it('Question instructions should be visible', () => {
79
+ utilities.verifyInnerText(textSelectionPage.questionInstructionsPrintViewText(), 'Select the correct statements.');
80
+ utilities.verifyElementVisibilityState(textSelectionPage.questionInstructionsPrintViewText(), 'visible');
82
81
  });
83
- });
84
82
 
85
- it(`Text selection - ${view} - The text which is not available as option should not be interactive in preview tab`, () => {
86
- textSelectionPage.steps.verifyNonOptionTextIsNotInteractiveInPreviewTab(paragraphTextArray[3]);
87
- });
88
-
89
- if (view !== 'Grading view' && view !== 'Correct answer view') {
90
- it(`The selected options in specify possible options section should be displayed and by default all options should not be selected`, () => {
91
- for (let index = 0; index < 3; index++) {
92
- utilities.verifyInnerText(utilities.getNthElement(textSelectionPage.optionPreviewTab(), index), paragraphTextArray[index]);
93
- utilities.verifyElementVisibilityState(utilities.getNthElement(textSelectionPage.optionPreviewTab(), index), 'visible');
94
- textSelectionPage.steps.verifyOptionIsNotSelectedInPreviewTab(paragraphTextArray[index]);
95
- };
96
- utilities.verifyElementCount(textSelectionPage.optionPreviewTab(), 3);
83
+ it(`Text added in the question field should be displayed in the ${view}`, () => {
84
+ textSelectionPage.steps.verifyQuestionTextParagraphPrintView();
97
85
  });
98
-
99
- it(`When user hovers on the available options, then those options should be displayed in hover state highlight`, () => {
100
- for (let index = 0; index < 3; index++) {
101
- textSelectionPage.steps.verifyHoverStateOfOptionInPreviewTab(paragraphTextArray[index], "blue");
102
- };
86
+ } else {
87
+ it('Question instructions should be visible', () => {
88
+ utilities.verifyInnerText(textSelectionPage.questionInstructionsText(), 'Select the correct statements.');
89
+ utilities.verifyElementVisibilityState(textSelectionPage.questionInstructionsText(), 'visible');
103
90
  });
104
91
 
105
- it(`When user selects an option, then that option should be displayed in selected state`, () => {
106
- textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[0]);
107
- textSelectionPage.steps.verifySelectedStateOptionInPreviewTab(paragraphTextArray[0], "blue");
108
- textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[1]);
109
- textSelectionPage.steps.verifySelectedStateOptionInPreviewTab(paragraphTextArray[1], "blue");
92
+ it('The added text in Question input field should be displayed in the preview tab question', () => {
93
+ paragraphTextArray.forEach((paragraphText, index) => {
94
+ utilities.verifyInnerText(utilities.getNthElement(textSelectionPage.questionTextPreviewTab(), index), `${paragraphText}`);
95
+ });
110
96
  });
111
97
 
112
- it(`When user clicks on a selected option, then that option should be deselected`, () => {
113
- textSelectionPage.steps.deselectOptionInPreviewTab(paragraphTextArray[0]);
114
- textSelectionPage.steps.verifyStandardStateOptionInPreviewTab(paragraphTextArray[0]);
115
- });
116
- } else if (view === 'Grading view') {
117
- it(`The question text should be displayed with the selected correct options and status message 'Your answer is incorrect' should be displayed`, () => {
118
- textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[1]);
119
- textSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
98
+ it(`Text selection - ${view} - The text which is not available as option should not be interactive in preview tab`, () => {
99
+ textSelectionPage.steps.verifyNonOptionTextIsNotInteractiveInPreviewTab(paragraphTextArray[3]);
120
100
  });
121
101
 
122
- it(`The submitted answer options should not be editable`, () => {
123
- textSelectionPage.steps.verifyAnswerSectionNotEditableInPreviewTab();
124
- });
125
- } else {
126
- it(`The question text should be displayed with the selected correct options`, () => {
127
- for (let index = 0; index < 2; index++) {
128
- textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[index]);
129
- };
130
- textSelectionPage.steps.verifyOptionIsNotSelectedInPreviewTab(paragraphTextArray[2]);
131
- });
102
+ if (view !== 'Grading view' && view !== 'Correct answer view') {
103
+ it(`The selected options in specify possible options section should be displayed and by default all options should not be selected`, () => {
104
+ for (let index = 0; index < 3; index++) {
105
+ utilities.verifyInnerText(utilities.getNthElement(textSelectionPage.optionPreviewTab(), index), paragraphTextArray[index]);
106
+ utilities.verifyElementVisibilityState(utilities.getNthElement(textSelectionPage.optionPreviewTab(), index), 'visible');
107
+ textSelectionPage.steps.verifyOptionIsNotSelectedInPreviewTab(paragraphTextArray[index]);
108
+ };
109
+ utilities.verifyElementCount(textSelectionPage.optionPreviewTab(), 3);
110
+ });
111
+
112
+ it(`When user hovers on the available options, then those options should be displayed in hover state highlight`, () => {
113
+ for (let index = 0; index < 3; index++) {
114
+ textSelectionPage.steps.verifyHoverStateOfOptionInPreviewTab(paragraphTextArray[index], "blue");
115
+ };
116
+ });
117
+
118
+ it(`When user selects an option, then that option should be displayed in selected state`, () => {
119
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[0]);
120
+ textSelectionPage.steps.verifySelectedStateOptionInPreviewTab(paragraphTextArray[0], "blue");
121
+ textSelectionPage.steps.selectOptionInPreviewTab(paragraphTextArray[1]);
122
+ textSelectionPage.steps.verifySelectedStateOptionInPreviewTab(paragraphTextArray[1], "blue");
123
+ });
124
+
125
+ it(`When user clicks on a selected option, then that option should be deselected`, () => {
126
+ textSelectionPage.steps.deselectOptionInPreviewTab(paragraphTextArray[0]);
127
+ textSelectionPage.steps.verifyStandardStateOptionInPreviewTab(paragraphTextArray[0]);
128
+ });
129
+ } else if (view === 'Grading view') {
130
+ it(`The question text should be displayed with the selected correct options and status message 'Your answer is incorrect' should be displayed`, () => {
131
+ textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[1]);
132
+ textSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
133
+ });
134
+
135
+ it(`The submitted answer options should not be editable`, () => {
136
+ textSelectionPage.steps.verifyAnswerSectionNotEditableInPreviewTab();
137
+ });
138
+ } else {
139
+ it(`The question text should be displayed with the selected correct options`, () => {
140
+ for (let index = 0; index < 2; index++) {
141
+ textSelectionPage.steps.verifyCorrectIconForOption(paragraphTextArray[index]);
142
+ };
143
+ textSelectionPage.steps.verifyOptionIsNotSelectedInPreviewTab(paragraphTextArray[2]);
144
+ });
145
+ }
132
146
  }
133
147
  });
134
148
  });
@@ -17,6 +17,36 @@ describe('Create Item page - Text selection: Question Instructions and Question
17
17
  });
18
18
 
19
19
  textSelectionPage.tests.verifyQuestionInstructionsInputFieldEditTab();
20
+
21
+ it('Verify that users cannot add more than 20,000 characters to the question input field', () => {
22
+ const MAX_LIMIT = 20000;
23
+ const overflowString = 'x'.repeat(MAX_LIMIT + 500); // attempt to exceed by 500 chars
24
+
25
+ textSelectionPage.steps.clearQuestionInputField();
26
+ textSelectionPage.steps.focusInQuestionInputField();
27
+
28
+ // Type in manageable chunks to avoid performance issues
29
+ const chunkSize = 4000;
30
+ const chunks = overflowString.match(new RegExp(`.{1,${chunkSize}}`, 'g')) || [];
31
+ chunks.forEach(chunk => {
32
+ textSelectionPage.questionInputField().type(chunk, { delay: 0 });
33
+ });
34
+
35
+ // Assert content length does not exceed MAX_LIMIT
36
+ textSelectionPage.questionInputField()
37
+ .invoke('text')
38
+ .then(text => {
39
+ expect(text.length, `Question input length (${text.length}) should be <= ${MAX_LIMIT}`).to.be.at.most(MAX_LIMIT);
40
+ });
41
+
42
+ // Try adding extra characters beyond limit; length should remain capped
43
+ textSelectionPage.questionInputField().type('y'.repeat(200), { delay: 0 });
44
+ textSelectionPage.questionInputField()
45
+ .invoke('text')
46
+ .then(text => {
47
+ expect(text.length, 'Length after additional typing should still be capped').to.be.at.most(MAX_LIMIT);
48
+ });
49
+ });
20
50
  });
21
51
 
22
52
  describe('Question Instructions input field - Preview tab', () => {
@@ -110,7 +140,7 @@ describe('Create Item page - Text selection: Question Instructions and Question
110
140
  it('Image, equation, bold text and link added in Question input field should be properly displayed in specify correct answer section', () => {
111
141
  textSelectionPage.steps.verifyImageAndAltTextInSpecifyCorrectAnswerSection();
112
142
  textSelectionPage.steps.verifyEquationInSpecifyCorrectAnswerSection();
113
- textSelectionPage.steps.verifyBoldTextInSpecifyCorrectAnswerSection();
143
+ textSelectionPage.steps.verifyBoldTextInSpecifyCorrectAnswerSection('This is Bold text input.lorem');
114
144
  textSelectionPage.steps.verifyLinkInSpecifyCorrectAnswerSection();
115
145
  });
116
146
  });
@@ -0,0 +1,107 @@
1
+ import { textSelectionPage } from "../../../pages";
2
+ import { ckEditorToolbar } from "../../../pages/components";
3
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
4
+ import utilities from "../../../support/helpers/utilities";
5
+ const css = Cypress.env('css');
6
+
7
+ const textFormattingOptions = ['boldIcon', 'italicIcon', 'underlineIcon', 'strikeThroughIcon', 'removeFormatIcon', 'justifyLeftIcon', 'justifyCenterIcon', 'justifyRightIcon'];
8
+
9
+ describe('Create item page - Text Selection: CKeditor text formatting and text type options', () => {
10
+ before(() => {
11
+ cy.loginAs('admin');
12
+ });
13
+
14
+ describe('Text Selection : Text formatting and decoration options' , () => {
15
+ abortEarlySetup();
16
+ before(() => {
17
+ textSelectionPage.steps.navigateToCreateQuestion('text selection');
18
+ cy.barsPreLoaderWait();
19
+ });
20
+
21
+ it('When user focuses on the question field, CKEditor toolbar should be visible having all the text formatting and decoration toolbar options', () => {
22
+ textSelectionPage.steps.clearQuestionInputField();
23
+ textSelectionPage.steps.focusInQuestionInputField();
24
+ textFormattingOptions.forEach(option => {
25
+ utilities.verifyElementVisibilityState(ckEditorToolbar[option](), 'visible');
26
+ });
27
+ });
28
+
29
+ it('When user selects bold option from the toolbar, the text added should be bold', () => {
30
+ ckEditorToolbar.steps.selectBoldOptionFromCKEditorToolbar();
31
+ textSelectionPage.steps.addInputToQuestionInputField('This is Bold text input.');
32
+ textSelectionPage.steps.verifyBoldTextInQuestionInputField();
33
+ ckEditorToolbar.steps.selectBoldOptionFromCKEditorToolbar(); //to disable bold option
34
+ });
35
+
36
+ it('When user selects italic option from the toolbar, the text added should be in italic', () => {
37
+ textSelectionPage.steps.addInputToQuestionInputField('{enter}');
38
+ ckEditorToolbar.steps.selectItalicOptionFromCKEditorToolbar();
39
+ textSelectionPage.steps.addInputToQuestionInputField('This is Italic text input.');
40
+ textSelectionPage.steps.verifyItalicTextInQuestionInputField();
41
+ ckEditorToolbar.steps.selectItalicOptionFromCKEditorToolbar(); //to disable italic option
42
+ });
43
+
44
+ it('When user selects underline option from the toolbar, the text added should be underlined', () => {
45
+ textSelectionPage.steps.addInputToQuestionInputField('{enter}');
46
+ ckEditorToolbar.steps.selectUnderlineOptionFromCKEditorToolbar();
47
+ textSelectionPage.steps.addInputToQuestionInputField('This is Underline text input.');
48
+ textSelectionPage.steps.verifyUnderlineTextInQuestionInputField();
49
+ ckEditorToolbar.steps.selectUnderlineOptionFromCKEditorToolbar(); //to disable underline option
50
+ });
51
+
52
+ it('When user selects strikethrough option from the toolbar, the text added should be strikethrough', () => {
53
+ textSelectionPage.steps.addInputToQuestionInputField('{enter}');
54
+ ckEditorToolbar.steps.selectStrikeThroughOptionFromCKEditorToolbar();
55
+ textSelectionPage.steps.addInputToQuestionInputField('This is Strikethrough text input.');
56
+ textSelectionPage.steps.verifyStrikeThroughTextInQuestionInputField();
57
+ ckEditorToolbar.steps.selectStrikeThroughOptionFromCKEditorToolbar(); //to disable strikethrough option
58
+ });
59
+
60
+ it('When user adds equation using equation editor, then the math text added by user should be displayed in the question field', ()=>{
61
+ textSelectionPage.steps.addInputToQuestionInputField('{enter}');
62
+ textSelectionPage.steps.selectEquationEditorOptionFromCKEditorToolbar();
63
+ textSelectionPage.steps.addGenericEquationUsingEquationEditorToCKEditorInputField();
64
+ textSelectionPage.steps.verifyEquationInQuestionInputField();
65
+ textSelectionPage.steps.addInputToQuestionInputField('{rightarrow}{enter}');
66
+ });
67
+
68
+ it("Verify all the text decoration and text types options in 'Specify Possible options' section and 'Specify correct answer section'", () => {
69
+ textSelectionPage.steps.verifyBoldTextInSpecifyPossibleOptionsSection();
70
+ textSelectionPage.steps.verifyItalicTextInSpecifyPossibleOptionsSection();
71
+ textSelectionPage.steps.verifyUnderlineTextInSpecifyPossibleOptionsSection();
72
+ textSelectionPage.steps.verifyStrikeThroughTextInSpecifyPossibleOptionsSection();
73
+ textSelectionPage.steps.verifyEquationInSpecifyPossibleOptionsSection();
74
+ textSelectionPage.steps.verifyBoldTextInSpecifyCorrectAnswerSection('This is Bold text input.');
75
+ textSelectionPage.steps.verifyItalicTextInSpecifyCorrectAnswerSection();
76
+ textSelectionPage.steps.verifyUnderlineTextInSpecifyCorrectAnswerSection();
77
+ textSelectionPage.steps.verifyStrikeThroughTextInSpecifyCorrectAnswerSection();
78
+ textSelectionPage.steps.verifyEquationInSpecifyCorrectAnswerSection();
79
+ });
80
+
81
+ it('When user changes the text alignment options then it should change the alignment of the selected text in question field, specify correct answer section and specify possible options section', () => {
82
+ textSelectionPage.steps.clearQuestionInputField();
83
+ textSelectionPage.steps.addInputToQuestionInputField('Sample text to check text alignment');
84
+ ckEditorToolbar.steps.selectJustifyLeftOptionFromCKEditorToolbar();
85
+ textSelectionPage.steps.verifyQuestionInputFieldTextIsLeftAligned();
86
+ ckEditorToolbar.steps.selectJustifyLeftOptionFromCKEditorToolbar(); //to disable justify left option
87
+ ckEditorToolbar.steps.selectJustifyCenterOptionFromCKEditorToolbar();
88
+ textSelectionPage.steps.verifyQuestionInputFieldTextIsCenterAligned();
89
+ ckEditorToolbar.steps.selectJustifyCenterOptionFromCKEditorToolbar(); //to disable justify center option
90
+ ckEditorToolbar.steps.selectJustifyRightOptionFromCKEditorToolbar();
91
+ textSelectionPage.steps.verifyQuestionInputFieldTextIsRightAligned();
92
+ ckEditorToolbar.steps.selectJustifyRightOptionFromCKEditorToolbar(); //to disable justify right option
93
+ });
94
+
95
+ it('When user edits the font size and font color, then the changes should be reflected in the question field', () => {
96
+ textSelectionPage.steps.clearQuestionInputField();
97
+ ckEditorToolbar.steps.openFontColorDropdownFromCKEditorToolbar();
98
+ ckEditorToolbar.steps.clickOnAmethystColorInTextColorPopup();
99
+ textSelectionPage.steps.addInputToQuestionInputField('Sample text to check font size and color');
100
+ textSelectionPage.steps.verifyTextColorInCkeditorField('rgb(155, 89, 182)');
101
+ textSelectionPage.steps.clearQuestionInputField();
102
+ ckEditorToolbar.steps.openFontSizeDropdownFromCKEditorToolbar();
103
+ ckEditorToolbar.steps.selectFontSizeOptionFromCKEditorToolbar('22px');
104
+ textSelectionPage.steps.verifyFontSizeInQuestionInputField('22px');
105
+ });
106
+ });
107
+ });
@@ -300,6 +300,12 @@ const steps = {
300
300
  .should('be.checked');
301
301
  },
302
302
 
303
+ uncheckAutomaticallySetPenaltyPointsCheckbox: () => {
304
+ autoScoredScoringSectionMultiResponseType.automaticallySetPenaltyPointsCheckbox()
305
+ .click()
306
+ .should('not.be.checked');
307
+ },
308
+
303
309
  /**
304
310
  * @param {("Specify total penalty points" | "Specify points for each incorrect option")} radioOption option from the penalty points for each incorrect option radio buttons
305
311
  * @description this function selects radio button from the penalty points for each incorrect option section
@@ -373,6 +379,12 @@ const steps = {
373
379
  .should('have.class', 'radio-option-disabled');
374
380
  },
375
381
 
382
+ selectSpecifyTotalPenaltyPointsRadioButton: () => {
383
+ autoScoredScoringSectionMultiResponseType.specifyTotalPenaltyPointsRadioButton()
384
+ .click()
385
+ .should('be.checked');
386
+ },
387
+
376
388
  /**
377
389
  * verify the displayed penalty points for each incorrect option
378
390
  * @param {number} penaltyPoints displayed penalty points
@@ -3,6 +3,17 @@ import constants from "../../fixtures/constants";
3
3
  const selectors = {
4
4
  imageIcon: () => cy.get('a[title="Insert Image"]:visible'),
5
5
  boldIcon: () => cy.get('.cke_button__bold:visible'),
6
+ italicIcon: () => cy.get('.cke_button__italic:visible'),
7
+ underlineIcon: () => cy.get('.cke_button__underline:visible'),
8
+ strikeThroughIcon: () => cy.get('.cke_button__strike:visible'),
9
+ removeFormatIcon: () => cy.get('.cke_button__removeformat:visible'),
10
+ justifyLeftIcon: () => cy.get('.cke_button__justifyleft:visible'),
11
+ justifyCenterIcon: () => cy.get('.cke_button__justifycenter:visible'),
12
+ justifyRightIcon: () => cy.get('.cke_button__justifyright:visible'),
13
+ fontSizeIcon: () => cy.get('a[title="Font Size"]:visible'),
14
+ fontColorIcon: () => cy.get('a[title="Text Color"]:visible'),
15
+ amethystColorTileIconTextColorOption: () => cy.get('td a[title="Amethyst"]'),
16
+ fontColoriFrame: () => cy.get('.cke_panel_frame:visible'),
6
17
  equationEditorIcon: () => cy.get('.cke_button__nextgeneqneditor:visible'),
7
18
  linkIcon: () => cy.get('.cke_button__link:visible'),
8
19
  ckeDialogbox: () => cy.get('.cke_dialog_body:visible'),
@@ -76,7 +87,135 @@ const steps = {
76
87
  saveTableProperties: () => {
77
88
  ckEditorToolbar.ckeOkButton()
78
89
  .click();
79
- }
90
+ },
91
+
92
+ selectItalicOptionFromCKEditorToolbar: () => {
93
+ ckEditorToolbar.italicIcon()
94
+ .scrollIntoView()
95
+ .click();
96
+ },
97
+
98
+ selectUnderlineOptionFromCKEditorToolbar: () => {
99
+ ckEditorToolbar.underlineIcon()
100
+ .scrollIntoView()
101
+ .click();
102
+ },
103
+
104
+ selectStrikeThroughOptionFromCKEditorToolbar: () => {
105
+ ckEditorToolbar.strikeThroughIcon()
106
+ .scrollIntoView()
107
+ .click();
108
+ },
109
+
110
+ selectRemoveFormatOptionFromCKEditorToolbar: () => {
111
+ ckEditorToolbar.removeFormatIcon()
112
+ .scrollIntoView()
113
+ .click();
114
+ },
115
+
116
+ selectJustifyLeftOptionFromCKEditorToolbar: () => {
117
+ ckEditorToolbar.justifyLeftIcon()
118
+ .scrollIntoView()
119
+ .click();
120
+ },
121
+
122
+ selectJustifyCenterOptionFromCKEditorToolbar: () => {
123
+ ckEditorToolbar.justifyCenterIcon()
124
+ .scrollIntoView()
125
+ .click();
126
+ },
127
+
128
+ selectJustifyRightOptionFromCKEditorToolbar: () => {
129
+ ckEditorToolbar.justifyRightIcon()
130
+ .scrollIntoView()
131
+ .click();
132
+ },
133
+
134
+ openFontSizeDropdownFromCKEditorToolbar: () => {
135
+ ckEditorToolbar.fontSizeIcon()
136
+ .scrollIntoView()
137
+ .click();
138
+ },
139
+
140
+ openFontColorDropdownFromCKEditorToolbar: () => {
141
+ ckEditorToolbar.fontColorIcon()
142
+ .click();
143
+ },
144
+
145
+ clickOnAmethystColorInTextColorPopup: () => {
146
+ cy.getIframeBody('iframe.cke_panel_frame:visible')
147
+ .find('a[title="Amethyst"]')
148
+ .should('be.visible')
149
+ .click();
150
+ },
151
+
152
+ /**
153
+ * Selects a font size option from the CKEditor font size dropdown panel.
154
+ *
155
+ * This function is resilient to different CKEditor builds / HTML outputs:
156
+ * - Accepts values with or without the 'px' suffix (e.g. '10' or '10px').
157
+ * - Tries multiple selector variants for inline style differences (with / without spaces / semicolons).
158
+ * - Falls back to matching pure numeric text labels when the size is rendered as plain text.
159
+ * - As a final fallback, iterates spans that have an inline font-size style and compares the computed style.
160
+ *
161
+ * On success it scrolls the target into view and clicks it. On failure it throws an Error including
162
+ * the list of discovered size tokens to aid debugging.
163
+ *
164
+ * @param {string|number} fontSize - Desired font size (e.g. '10', '12px'). Will be normalized to '<value>px'.
165
+ * @example
166
+ * ckEditorToolbar.steps.selectFontSizeOptionFromCKEditorToolbar('10');
167
+ * ckEditorToolbar.steps.selectFontSizeOptionFromCKEditorToolbar('18px');
168
+ * @throws {Error} When the requested font size option cannot be located in the open panel.
169
+ */
170
+ selectFontSizeOptionFromCKEditorToolbar: (fontSize) => {
171
+ // Normalize requested font size (accept '10' or '10px')
172
+ const fontSizeValue = /px$/.test(fontSize) ? fontSize : `${fontSize}px`;
173
+
174
+ // Ensure panel iframe is visible and loaded
175
+ cy.get('.cke_panel_frame:visible', { timeout: 10000 })
176
+ .its('0.contentDocument.body')
177
+ .should('not.be.empty')
178
+ .then(cy.wrap)
179
+ .then($body => {
180
+ // Primary selector attempts (style attribute variants)
181
+ const selectors = [
182
+ `span[style*="font-size:${fontSizeValue}"]`,
183
+ `span[style*="font-size: ${fontSizeValue}"]`,
184
+ `a span[style*="font-size:${fontSizeValue}"]`
185
+ ];
186
+ let $match = null;
187
+ for (const sel of selectors) {
188
+ const found = $body.find(sel);
189
+ if (found.length) { $match = found.first(); break; }
190
+ }
191
+ // Fallback: match by text content (numeric part) inside anchors/spans
192
+ if (!$match) {
193
+ const numeric = fontSizeValue.replace('px', '').trim();
194
+ const textCandidates = $body.find('a, span').filter((_, el) => el.textContent.trim() === numeric);
195
+ if (textCandidates.length) {
196
+ $match = textCandidates.first();
197
+ }
198
+ }
199
+ // Final fallback: search spans that have inline font-size style and compare computed style
200
+ if (!$match) {
201
+ const inlineSpans = $body.find('span[style*="font-size"]');
202
+ const computedCandidate = inlineSpans.filter((_, el) => window.getComputedStyle(el).fontSize === fontSizeValue);
203
+ if (computedCandidate.length) {
204
+ $match = computedCandidate.first();
205
+ }
206
+ }
207
+ if ($match) {
208
+ cy.wrap($match)
209
+ .scrollIntoView()
210
+ .should('be.visible')
211
+ .click();
212
+ } else {
213
+ const available = Array.from($body.find('span[style*="font-size"], a span[style*="font-size"]')).map(el => el.textContent.trim()).filter(Boolean);
214
+ cy.log(`Font size '${fontSizeValue}' not found. Available (text tokens): ${available.join(', ')}`);
215
+ throw new Error(`Font size option '${fontSizeValue}' not found in CKEditor panel.`);
216
+ }
217
+ });
218
+ },
80
219
  }
81
220
  export const ckEditorToolbar = {
82
221
  ...selectors,
@@ -100,6 +100,8 @@ const selectors = {
100
100
  correctIncorrectAnswerLabel: () => cy.get('[class*="AnswerStatusText"]'),
101
101
  correctAnswersLabel: () => cy.get('[class*="Highlightstyles__CorrectAnswerHeader-"]'),
102
102
  optionsInputFieldInQuestionPreviewTab: () => cy.get('[class*="word-span highlight_option"]'),
103
+ questionInstructionsPrintViewText: () => cy.get('.question-text-wrapper').eq(0),
104
+ questionTextPrintViewParagraphs: () => cy.get('#nextgen-assess-print-view [data-testid="question-instruction-element"] p'),
103
105
  }
104
106
 
105
107
  const steps = {
@@ -186,6 +188,49 @@ const steps = {
186
188
  .should('have.text', '​​​​​​​This is Bold text input.');
187
189
  },
188
190
 
191
+ verifyItalicTextInQuestionInputField: () => {
192
+ textSelectionPage.questionInputField()
193
+ .find('em, i')
194
+ .should('exist')
195
+ .invoke('text')
196
+ .should('eq', '​​​​​​​This is Italic text input.');
197
+ },
198
+
199
+ verifyUnderlineTextInQuestionInputField: () => {
200
+ textSelectionPage.questionInputField()
201
+ .find('u')
202
+ .should('exist')
203
+ .invoke('text')
204
+ },
205
+
206
+ verifyStrikeThroughTextInQuestionInputField: () => {
207
+ textSelectionPage.questionInputField()
208
+ .find('s, strike, del')
209
+ .should('exist')
210
+ .invoke('text')
211
+ },
212
+
213
+ verifyQuestionInputFieldTextIsLeftAligned: () => {
214
+ textSelectionPage.questionInputField()
215
+ .find('p')
216
+ .each($p => {
217
+ const align = Cypress.$($p).css('text-align');
218
+ expect(['left', 'start']).to.include(align);
219
+ });
220
+ },
221
+
222
+ verifyQuestionInputFieldTextIsCenterAligned: () => {
223
+ textSelectionPage.questionInputField()
224
+ .find('p')
225
+ .should('have.css', 'text-align', 'center');
226
+ },
227
+
228
+ verifyQuestionInputFieldTextIsRightAligned: () => {
229
+ textSelectionPage.questionInputField()
230
+ .find('p')
231
+ .should('have.css', 'text-align', 'right');
232
+ },
233
+
189
234
  verifyImageAndAltTextInSpecifyPossibleOptionsSection: () => {
190
235
  textSelectionPage.specifyPossibleOptionsTextFieldWrapper()
191
236
  .find('img')
@@ -210,7 +255,29 @@ const steps = {
210
255
  textSelectionPage.specifyPossibleOptionsTextFieldWrapper()
211
256
  .find('strong')
212
257
  .should('exist')
213
- .should('have.text', 'This is Bold text input.lorem');
258
+ .should('have.text', 'This is Bold text input.');
259
+ },
260
+
261
+ verifyItalicTextInSpecifyPossibleOptionsSection: () => {
262
+ textSelectionPage.specifyPossibleOptionsTextFieldWrapper()
263
+ .find('em, i')
264
+ .should('exist')
265
+ .invoke('text')
266
+ .should('eq', 'This is Italic text input.');
267
+ },
268
+
269
+ verifyUnderlineTextInSpecifyPossibleOptionsSection: () => {
270
+ textSelectionPage.specifyPossibleOptionsTextFieldWrapper()
271
+ .find('u')
272
+ .should('exist')
273
+ .invoke('text')
274
+ },
275
+
276
+ verifyStrikeThroughTextInSpecifyPossibleOptionsSection: () => {
277
+ textSelectionPage.specifyPossibleOptionsTextFieldWrapper()
278
+ .find('s, strike, del')
279
+ .should('exist')
280
+ .invoke('text')
214
281
  },
215
282
 
216
283
  verifyImageAndAltTextInSpecifyCorrectAnswerSection: () => {
@@ -233,11 +300,33 @@ const steps = {
233
300
  .and('have.attr', 'href', `${Cypress.config().baseUrl}`);
234
301
  },
235
302
 
236
- verifyBoldTextInSpecifyCorrectAnswerSection: () => {
303
+ verifyBoldTextInSpecifyCorrectAnswerSection: (text) => {
237
304
  textSelectionPage.specifyCorrectAnswerTextWrapper()
238
305
  .find('strong')
239
306
  .should('exist')
240
- .should('have.text', 'This is Bold text input.lorem');
307
+ .should('have.text', text);
308
+ },
309
+
310
+ verifyItalicTextInSpecifyCorrectAnswerSection: () => {
311
+ textSelectionPage.specifyCorrectAnswerTextWrapper()
312
+ .find('em, i')
313
+ .should('exist')
314
+ .invoke('text')
315
+ .should('eq', 'This is Italic text input.');
316
+ },
317
+
318
+ verifyUnderlineTextInSpecifyCorrectAnswerSection: () => {
319
+ textSelectionPage.specifyCorrectAnswerTextWrapper()
320
+ .find('u')
321
+ .should('exist')
322
+ .invoke('text')
323
+ },
324
+
325
+ verifyStrikeThroughTextInSpecifyCorrectAnswerSection: () => {
326
+ textSelectionPage.specifyCorrectAnswerTextWrapper()
327
+ .find('s, strike, del')
328
+ .should('exist')
329
+ .invoke('text')
241
330
  },
242
331
 
243
332
  verifyImageAndAltTextInPreviewTab: () => {
@@ -268,6 +357,40 @@ const steps = {
268
357
  .should('have.text', 'This is Bold text input.lorem');
269
358
  },
270
359
 
360
+ verifyItalicTextInPreviewTab: () => {
361
+ textSelectionPage.questionTextWrapperPreviewTab()
362
+ .find('em, i')
363
+ .should('exist')
364
+ .invoke('text')
365
+ .should('eq', '​​​​​​​This is Italic text input.');
366
+ },
367
+
368
+ verifyUnderlineTextInPreviewTab: () => {
369
+ textSelectionPage.questionTextWrapperPreviewTab()
370
+ .find('u')
371
+ .should('exist')
372
+ .invoke('text')
373
+ },
374
+
375
+ verifyStrikeThroughTextInPreviewTab: () => {
376
+ textSelectionPage.questionTextWrapperPreviewTab()
377
+ .find('s, strike, del')
378
+ .should('exist')
379
+ .invoke('text')
380
+ },
381
+
382
+ verifyTextColorInCkeditorField(color) {
383
+ textSelectionPage.questionInputField()
384
+ .find('span[style*="color"]')
385
+ .should('have.css', 'color', color);
386
+ },
387
+
388
+ verifyFontSizeInQuestionInputField(fontSize) {
389
+ textSelectionPage.questionInputField()
390
+ .find('span[style*="font-size"]')
391
+ .should('have.css', 'font-size', fontSize);
392
+ },
393
+
271
394
  verifySpecifyPossibleOptionsFieldErrorMessage: () => {
272
395
  textSelectionPage.specifyPossibleOptionsTextFieldWrapper()
273
396
  .next()
@@ -527,6 +650,15 @@ const steps = {
527
650
  textSelectionPage.steps.verifyOptionIsSelectedInSpecifyCorrectAnswerSection(optionText);
528
651
  },
529
652
 
653
+ /**
654
+ * @param {*} optionText Text of the option in set correct answer section
655
+ * @description Unselect an option in set correct answer section
656
+ */
657
+ unSelectOptionInSpecifyCorrectAnswerSection: (optionText) => {
658
+ textSelectionPage.steps.clickOnOptionInSpecifyCorrectAnswerSection(optionText);
659
+ textSelectionPage.steps.verifyOptionIsNotSelectedInSpecifyCorrectAnswerSection(optionText);
660
+ },
661
+
530
662
  /**
531
663
  * @param {*} optionText Text of the option in set correct answer section
532
664
  * @description Deselect an option in set correct answer section
@@ -825,6 +957,17 @@ const steps = {
825
957
  .and('have.attr', 'aria-checked', 'true');
826
958
  },
827
959
 
960
+ /**
961
+ * @param {string} optionText Text of the option in set correct answer section
962
+ * @description Verify that option is in unselected state in set correct answer section
963
+ */
964
+ verifyOptionIsNotSelectedInSpecifyCorrectAnswerSection: (optionText) => {
965
+ textSelectionPage.optionSpecifyCorrectAnswer()
966
+ .contains(optionText)
967
+ .should('not.have.class', 'correct_answer')
968
+ .and('have.attr', 'aria-checked', 'false');
969
+ },
970
+
828
971
  /**
829
972
  * @param {string} optionText Text of the option in specify possible options section
830
973
  * @description Verify that option is not in selected state in specify possible options section
@@ -1248,6 +1391,12 @@ const steps = {
1248
1391
  .click({ force: true });
1249
1392
  utilities.verifyElementVisibilityState(commonComponents.dropdownList(), 'exist');
1250
1393
  },
1394
+
1395
+ verifyQuestionTextParagraphPrintView: () => {
1396
+ textSelectionPage.questionTextPrintViewParagraphs().each(($el, index) => {
1397
+ utilities.verifyInnerText(utilities.getNthElement(textSelectionPage.questionTextPrintViewParagraphs(), index), `${paragraphTextArray[index]}`);
1398
+ });
1399
+ }
1251
1400
  }
1252
1401
 
1253
1402
  const tests = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itemengine-cypress-automation",
3
- "version": "1.0.543-fixes15-10-6c7408d.0",
3
+ "version": "1.0.544-IEI-6994-Add-test-coverage-for-text-selection--d8792a9.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {