itemengine-cypress-automation 1.0.204-graphQLUpdate-b0c0036.0 → 1.0.204

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/allOrNothingBasicForGroupedOptionsLayout.js +22 -22
  2. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/allOrNothingCorrectPointsEqualToAlternativePoints.js +1 -1
  3. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perCorrectOptionCorrectPointsEqualToAlternativePoints.js +1 -1
  4. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perDropzoneBasic.js +4 -4
  5. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perDropzoneCorrectPointsEqualToAlternativePoints.js +2 -2
  6. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perDropzoneCorrectPointsGreaterThanAlternativePoints.js +1 -1
  7. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/perDropzoneMinimumAndPenaltyScoring.js +2 -2
  8. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/clickAndDrop.js +2 -2
  9. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/specifyCorrectAnswerSection.js +1 -1
  10. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/studentViewSettings.js +8 -8
  11. package/cypress/e2e/ILC/DrawingResponse/drawingResponseAdditionalSettings.js +5 -1
  12. package/cypress/e2e/ILC/EditTabSettingPage/itemPreviewSettingsTabFunctionality.js +2 -0
  13. package/cypress/e2e/ILC/EssayResponse/createCustomCategory.smoke.js +19 -21
  14. package/cypress/e2e/ILC/EssayResponseMath/mathCharacters.js +2 -4
  15. package/cypress/e2e/ILC/FeedbackScaleNew/previewContentsForAllViews.smoke.js +1 -1
  16. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/backgroundImageAndCanvasProperties.js +14 -1
  17. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/dropdownOptionsSection.js +6 -2
  18. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/editTabBasicSection.js +4 -3
  19. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/Scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +3 -2
  20. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/Scoring/conditionalCheckboxScoring.js +56 -56
  21. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/Scoring/partialDifferentWeightsAlternativePointsGreaterThanCorrectPoints.js +1 -1
  22. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/Scoring/partialDifferentWeightsMinimumAndPenaltyScoring.js +6 -4
  23. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/editTabScoringSection.js +1 -1
  24. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsMinimumAndPenaltyScoring.js +4 -4
  25. package/cypress/e2e/ILC/FillInTheGapsTextNew/editTabScoringSection.js +3 -3
  26. package/cypress/e2e/ILC/FillInTheGapsTextNew/specifyCorrectAnswerSection.js +2 -2
  27. package/cypress/e2e/ILC/GridFill/customizeLayoutFillImageBackgroundImage.js +8 -3
  28. package/cypress/e2e/ILC/ImageHighlight/additionalSettingsBasic.js +1 -1
  29. package/cypress/e2e/ILC/Matching/Scoring/partialDifferentWeightsScoringBasic.js +2 -2
  30. package/cypress/e2e/ILC/Matching/toolSettings.js +1 -1
  31. package/cypress/e2e/ILC/MultipleSelection/additionalSettings.js +248 -0
  32. package/cypress/e2e/ILC/ReadingRuler/readingRulerEditTabBasicsSection.js +1 -1
  33. package/cypress/e2e/ILC/ShortTextResponseNew/editTabBasicSections.js +3 -0
  34. package/cypress/e2e/ILC/SingleSelection/additionalSettings.js +249 -0
  35. package/cypress/e2e/ILC/SingleSelectionGridNew/editTabBasicSection.js +1 -1
  36. package/cypress/e2e/ILC/TextEntryMath/evaluationMethodEquivalentStructures.js +6 -6
  37. package/cypress/e2e/ILC/TextEntryMath/evaluationMethodMatchValue.js +0 -1
  38. package/cypress/e2e/ILC/TextSelection/Scoring/partialDifferentWeightsBasic.js +1 -1
  39. package/cypress/e2e/ILC/chartsDotsPlot/allOrNothingForAllViews.smoke.js +4 -4
  40. package/cypress/e2e/ILC/chartsDotsPlot/dotTypeFunctionality.js +235 -0
  41. package/cypress/e2e/ILC/chartsDotsPlot/minimumScoringPenaltyPointsAndRoundingDropdown.js +5 -5
  42. package/cypress/e2e/ILC/chartsDotsPlot/numberLineAxisSettings.js +265 -0
  43. package/cypress/e2e/ILC/chartsDotsPlot/previewContentsForAllViews.smoke.js +6 -6
  44. package/cypress/e2e/ILC/chartsDotsPlot/scoring/manualAndNonScoredScoring.js +3 -3
  45. package/cypress/e2e/ILC/chartsDotsPlot/selectChartTypeSection.js +594 -0
  46. package/cypress/e2e/ILC/chartsDotsPlot/studentViewSettings.js +2 -3
  47. package/cypress/fixtures/drawingToolbarOptionsAdditionalOptionsAndSpecialAndMathCharacters.js +1 -1
  48. package/cypress/fixtures/fillColorDefaultProperties.js +2 -2
  49. package/cypress/pages/chartsDotPlotPage.js +588 -59
  50. package/cypress/pages/components/autoScoredScoringPreviewTab.js +1 -1
  51. package/cypress/pages/components/autoScoredScoringSectionMultiResponseType.js +1 -0
  52. package/cypress/pages/components/autoScoredSpecifyCorrectAnswerSection.js +1 -1
  53. package/cypress/pages/components/backgroundImageUploadComponent.js +1 -1
  54. package/cypress/pages/components/chartsCommonComponent.js +10 -1
  55. package/cypress/pages/components/customizeMathCharacterComponent.js +10 -5
  56. package/cypress/pages/components/fillInTheGapsDropdownCommonComponent.js +2 -2
  57. package/cypress/pages/components/fillInTheGapsTextCommonComponent.js +4 -3
  58. package/cypress/pages/components/gridQuestionCommonComponent.js +11 -11
  59. package/cypress/pages/components/imageCanvasComponent.js +2 -2
  60. package/cypress/pages/components/layoutSectionComponent.js +20 -18
  61. package/cypress/pages/components/mcqAdditionalSettingsBase.js +164 -24
  62. package/cypress/pages/dialogBoxBase.js +1 -1
  63. package/cypress/pages/dragAndDropIntoCategoriesPage.js +1 -5
  64. package/cypress/pages/drawingResponsePage.js +3 -3
  65. package/cypress/pages/feedbackScalePage.js +16 -9
  66. package/cypress/pages/fillInTheGapsOverImageDragAndDropPage.js +6 -1
  67. package/cypress/pages/fillInTheGapsOverImageDropdownPage.js +2 -1
  68. package/cypress/pages/gridFillPage.js +17 -14
  69. package/cypress/pages/itemPreviewSettingsPage.js +1 -0
  70. package/cypress/pages/matchingPage.js +1 -1
  71. package/cypress/pages/multipleSelectionPage.js +173 -1
  72. package/cypress/pages/singleSelectionPage.js +171 -1
  73. package/package.json +2 -2
@@ -15,19 +15,18 @@ const selectors = {
15
15
  ...studentViewSettingsLabelComponent,
16
16
  ...autoScoredScoringPreviewTab,
17
17
  ...autoScoredSpecifyCorrectAnswerSection,
18
+ ...layoutSectionComponent,
18
19
  ...selectQuestionResourceToolPage,
19
20
  ...dialogBoxBase,
20
21
 
21
22
  dotPlotToggleButton: () => cy.get('[data-ngie-testid="dot-plot-toggle-button"]'),
22
- minInputFieldSelectChartType: () => cy.get('input[aria-label="Min"]'),
23
- maxInputFieldSelectChartType: () => cy.get('input[aria-label="Max"]'),
24
23
  dotColumnSelectChartType: () => cy.get('.ngie-dot-plot-chart .ngie-chart-point'),
25
24
  lockUnlockButtonSelectChartType: () => cy.get('.ngie-dot-plot-chart .lock-reset-icon-wrapper button'),
26
25
  dotColumnLockIcon: () => cy.get('[class*="LockIconWrapper"]'),
27
26
  tooltipWrapperSelectChartType: () => cy.get('.ngie-dot-plot-chart .charts-tooltip-wrapper'),
28
27
  addButtonSelectChartType: () => cy.get('.ngie-dot-plot-chart .charts-tooltip-wrapper [aria-label*="plus"]'),
29
28
  minusButtonSelectChartType: () => cy.get('.ngie-dot-plot-chart .charts-tooltip-wrapper [aria-label*="minus"]'),
30
- dotIconSelectChartType: () => cy.get('.ngie-dot-plot-chart .dot-icon'),
29
+ dotIconSelectChartType: () => cy.get('.dot-icon'),
31
30
  controlOptionsWrapperSelectChartType: () => cy.get('.ngie-dot-plot-chart .charts-toolbar-wrapper'),
32
31
  controlOptionsSelectChartType: (toolOptionAriaLabel = null) => {
33
32
  if (toolOptionAriaLabel) {
@@ -38,6 +37,16 @@ const selectors = {
38
37
  },
39
38
  labelsNumberLineAxisSelectChartType: () => cy.get('.ngie-dot-plot-chart .label-wrapper [class*="DotPlotChartstyles__Label"]'),
40
39
  numberLineAxisSelectChartType: () => cy.get('.ngie-dot-plot-chart .number-line-wrapper'),
40
+ dotTypeLabel: () => cy.get('[class*="DotTypeWrapper"] [class*="ChartOptionsstyles__LabelText"]'),
41
+ dotLabel: () => cy.get('[class*="DotTypeWrapper"] .title-casing').eq(0),
42
+ dotRadioButton: () => cy.get('[class*="DotTypeWrapper"] input').eq(0),
43
+ xMarkLabel: () => cy.get('[class*="DotTypeWrapper"] .title-casing').eq(1),
44
+ xMarkRadioButton: () => cy.get('[class*="DotTypeWrapper"] input').eq(1),
45
+ labelOptionsLabel: () => cy.get('[class*="LabelOptionsWrapper"] .chart-option-label'),
46
+ allowStudentsToEditLabel: () => cy.get('[class*="LabelOptionsWrapper"] .additional-settings-label'),
47
+ xAxisLabelSelectChartType: () => cy.get('[class*="LabelOptionsWrapper"] .MuiFormControlLabel-label'),
48
+ xAxisCheckBox: () => cy.get('[class*="LabelOptionsWrapper"] input'),
49
+
41
50
  //Specify correct answer
42
51
  dotColumnSpecifyCorrectAnswer: () => cy.get('.ngie-accordion-detail .ngie-chart-point'),
43
52
  addButtonSpecifyCorrectAnswer: () => cy.get('.ngie-accordion-detail .charts-tooltip-wrapper [aria-label*="plus"]'),
@@ -60,6 +69,7 @@ const selectors = {
60
69
  dotColumnLockIconSpecifyCorrectAnswer: () => cy.get('[class*="LockIconWrapper"]'),
61
70
  dotPlotChartSpecifyCorrectAnswer: () => cy.get('.ngie-accordion-detail [class*="DotPlotChartstyles__ChartWrapper"]'),
62
71
 
72
+ //scoring
63
73
  toleranceThresholdLabel: () => cy.get('[class*="AllocatedPointsstyles__PointsWrapper"] .points-label'),
64
74
  toleranceThresholdInputField: () => cy.get('[class*="AllocatedPointsstyles__PointsWrapper"] input'),
65
75
 
@@ -131,46 +141,6 @@ const steps = {
131
141
  .click();
132
142
  },
133
143
 
134
- /**
135
- * Enters text into the minimum input field
136
- * @param {string} value - The value to be entered into the input field.
137
- */
138
- enterTextInMinInputField: (value) => {
139
- chartsDotPlotPage.minInputFieldSelectChartType()
140
- .clear()
141
- .type(value)
142
- .blur();
143
- },
144
-
145
- /**
146
- * Verifies text into the minimum input field.
147
- * @param {string} value - The value to be verified into the input field.
148
- */
149
- verifyTextInMinInputField: (value) => {
150
- chartsDotPlotPage.minInputFieldSelectChartType()
151
- .should('have.value', value)
152
- },
153
-
154
- /**
155
- * Enters text into the max input field.
156
- * @param {string} value - The value to be entered into the input field.
157
- */
158
- enterTextInMaxInputField: (value) => {
159
- chartsDotPlotPage.maxInputFieldSelectChartType()
160
- .clear()
161
- .type(value)
162
- .blur();
163
- },
164
-
165
- /**
166
- * Verifies text into the max input field.
167
- * @param {string} value - The value to be verified into the input field.
168
- */
169
- verifyTextInMaxInputField: (value) => {
170
- chartsDotPlotPage.maxInputFieldSelectChartType()
171
- .should('have.value', value)
172
- },
173
-
174
144
  /**
175
145
  * Selects a dot column in the chart type selection section based on the given point, minimum, and interval.
176
146
  * @param {object} options - The options for selecting the dot column.
@@ -312,8 +282,276 @@ const steps = {
312
282
  });
313
283
  },
314
284
 
315
- //specify correct answer
285
+ /**
286
+ * Verifies the labels on the number line axis
287
+ * @param {number} min - The minimum value.
288
+ * @param {number} max - The maximum value.
289
+ * @param {number} annotateEvery - value of annotate every
290
+ */
291
+ verifyLabelsOnNumberLineAxisSelectChartType: (min, max, annotateEvery) => {
292
+ let expectedLabelsIndex = [];
293
+ let indexForArray = 0;
294
+ chartsDotPlotPage.labelsNumberLineAxisSelectChartType()
295
+ .each((value, index) => {
296
+ if (index % annotateEvery === 0) {
297
+ expectedLabelsIndex.push(index.toString());
298
+ }
299
+ })
300
+ .then(() => {
301
+ cy.log(expectedLabelsIndex)
302
+ for (var i = min; i < max; i++) {
303
+ chartsDotPlotPage.labelsNumberLineAxisSelectChartType()
304
+ .eq(expectedLabelsIndex[indexForArray])
305
+ .should('have.text', i)
306
+ indexForArray += 1;
307
+ }
308
+ });
309
+ },
310
+
311
+ /**
312
+ * Verifies the display numbers orientation.
313
+ * @param {('Below' | 'Above')} numberOrientation - The orientation of the numbers ('Below' or 'Above').
314
+ * @throws {Error} Thrown if the number line orientation is invalid.
315
+ */
316
+ verifyDisplayNumbersOrientationOnChartSelectChartType: (numberOrientation) => {
317
+ let value;
318
+ switch (numberOrientation) {
319
+ case 'Below':
320
+ value = '-32px'
321
+ break;
322
+ case 'Above':
323
+ value = '-8px'
324
+ break;
325
+ default:
326
+ throw new Error('Invalid Number orientation');
327
+ }
328
+ chartsDotPlotPage.labelsNumberLineAxisSelectChartType()
329
+ .eq(0)
330
+ .should('have.css', 'margin-top', value);
331
+ },
332
+
333
+ /**
334
+ * Verifies the minimum value on the number line axis.
335
+ * @param {string} min - The expected minimum value.
336
+ */
337
+ verifyMinOnNumberLineAxisSelectChartType: (min) => {
338
+ chartsDotPlotPage.labelsNumberLineAxisSelectChartType()
339
+ .eq(0)
340
+ .should('have.text', min);
341
+ },
342
+
343
+ /**
344
+ * Verifies the maximum value on the number line axis.
345
+ * @param {string} max - The expected maximum value.
346
+ */
347
+ verifyMaxOnNumberLineAxisSelectChartType: (max) => {
348
+ chartsDotPlotPage.labelsNumberLineAxisSelectChartType()
349
+ .eq(-1)
350
+ .should('have.text', max);
351
+ },
352
+
353
+ /**
354
+ * Verifies the label on the number line axis.
355
+ * @param {Array} values - An array of objects containing the value and index of each label.
356
+ */
357
+ verifyLabelOnNumberLineAxisSelectChartType: (values) => {
358
+ values.forEach(({ value, index }) => {
359
+ chartsDotPlotPage.labelsNumberLineAxisSelectChartType()
360
+ .eq(index)
361
+ .then(($el) => {
362
+ const innerText = $el[0].innerText;
363
+ expect(innerText.trim()).to.equal(value.toString());
364
+ });
365
+ });
366
+ },
367
+
368
+ selectDotRadioButton: () => {
369
+ chartsDotPlotPage.dotRadioButton()
370
+ .click()
371
+ .should('be.checked');
372
+ },
373
+
374
+ selectXMarkRadioButton: () => {
375
+ chartsDotPlotPage.xMarkRadioButton()
376
+ .click()
377
+ .should('be.checked');
378
+ },
379
+
380
+ verifyDotRadioButtonSelected: () => {
381
+ chartsDotPlotPage.dotRadioButton()
382
+ .should('be.checked');
383
+ },
384
+
385
+ verifyXMarkRadioButtonSelected: () => {
386
+ chartsDotPlotPage.xMarkRadioButton()
387
+ .should('be.checked');
388
+ },
389
+
390
+ /**
391
+ * Verifies the dot type.
392
+ * @param {('Dot'| 'XMark')} type - Dot type.
393
+ * @param {object} options - Options for calculation of index.
394
+ * @param {number} options.point - The point value.
395
+ * @param {number} options.min - The minimum value.
396
+ * @param {number} options.interval - The interval value.
397
+ * @throws {Error} Throws an error if the provided type is invalid.
398
+ */
399
+ verifyDotTypeSelectChartType: (type, { point, min, interval }) => {
400
+ const index = Math.round((point - min) / interval);
401
+ switch (type) {
402
+ case 'Dot':
403
+ chartsDotPlotPage.dotColumnSelectChartType()
404
+ .eq(index)
405
+ .find('.dot-icon')
406
+ .should('exist');
407
+ break;
408
+ case 'XMark':
409
+ chartsDotPlotPage.dotColumnSelectChartType()
410
+ .eq(index)
411
+ .find('[data-name="Clear all"]')
412
+ .should('exist');
413
+ break;
414
+ default:
415
+ throw new Error('Invalid dot type');
416
+ }
417
+ },
418
+
419
+ /**
420
+ * Verifies the number of divisions on the number line axis.
421
+ * @param {object} options - The options object containing min, max, and interval values.
422
+ * @param {number} options.min - The minimum value.
423
+ * @param {number} options.max - The maximum value.
424
+ * @param {number} options.interval - The interval value.
425
+ */
426
+ verifyDivisionsOnNumberLineAxisSelectChartType: ({ min, max, interval }) => {
427
+ const expectedDivisions = Math.round((max - min) / interval);
428
+ chartsDotPlotPage.numberLineAxisSelectChartType()
429
+ .find('.number-line')
430
+ .its('length')
431
+ .then((len) => {
432
+ expect(len).to.equal(expectedDivisions);
433
+ });
434
+ },
435
+
436
+ checkXAxisCheckbox: () => {
437
+ chartsDotPlotPage.xAxisCheckBox()
438
+ .click()
439
+ .should('be.checked');
440
+ },
441
+
442
+ uncheckXAxisCheckbox: () => {
443
+ chartsDotPlotPage.xAxisCheckBox()
444
+ .click()
445
+ .should('not.be.checked');
446
+ },
447
+
448
+ verifyXAxisCheckboxChecked: () => {
449
+ chartsDotPlotPage.xAxisCheckBox()
450
+ .should('be.checked');
451
+ },
452
+
453
+ /**
454
+ * Verifies that the default dot column
455
+ * @param {object} options - The options object containing point, min, and interval.
456
+ * @param {number} options.point - The point value.
457
+ * @param {number} options.min - The minimum value.
458
+ * @param {number} options.interval - The interval value.
459
+ */
460
+ verifyLockedDotColumnSelectChartType: ({ point, min, interval }) => {
461
+ const index = Math.round((point - min) / interval);
462
+ utilities.getNthElement(chartsDotPlotPage.dotColumnSelectChartType(), index)
463
+ .within(() => {
464
+ utilities.verifyElementVisibilityState(chartsDotPlotPage.dotColumnLockIcon(), 'visible');
465
+ });
466
+ utilities.getNthElement(chartsDotPlotPage.dotColumnSelectChartType(), index)
467
+ .should('have.css', 'background-color', css.color.lockedDotColumnBg);
468
+ },
469
+
470
+ /**
471
+ * Adds dots using keyboard navigation
472
+ * @param {number} numberOfDots - The number of dots to subtract.
473
+ * @param {object} options - The options object containing point, min, and interval.
474
+ * @param {number} options.point - The point value.
475
+ * @param {number} options.min - The minimum value.
476
+ * @param {number} options.interval - The interval value.
477
+ */
478
+ increaseDotInDotColumnUsingKeyboardSelectChartType: (numberOfDots, { point, min, interval }) => {
479
+ const index = Math.round((point - min) / interval);
480
+ steps.selectDotColumnInSelectChartTypeSection({ point, min, interval });
481
+ for (let i = 0; i < numberOfDots; i++) {
482
+ chartsDotPlotPage.dotColumnSelectChartType()
483
+ .eq(index)
484
+ .type('{upArrow}');
485
+ }
486
+ },
487
+ /**
488
+ * removes dots using keyboard navigation
489
+ * @param {number} numberOfDots - The number of dots to subtract.
490
+ * @param {object} options - The options object containing point, min, and interval.
491
+ * @param {number} options.point - The point value.
492
+ * @param {number} options.min - The minimum value.
493
+ * @param {number} options.interval - The interval value.
494
+ */
495
+ decreaseDotInDotColumnUsingKeyboardSelectChartType: (numberOfDots, { point, min, interval }) => {
496
+ const index = Math.round((point - min) / interval);
497
+ steps.selectDotColumnInSelectChartTypeSection({ point, min, interval });
498
+ for (let i = 0; i < numberOfDots; i++) {
499
+ chartsDotPlotPage.dotColumnSelectChartType()
500
+ .eq(index)
501
+ .type('{downArrow}');
502
+ }
503
+ },
504
+
505
+ /**
506
+ * @description verifies ock unlock icon
507
+ * @param {('Locked'|'Unlocked')} action
508
+ */
509
+ verifyLockUnlockButtonIcon: (action) => {
510
+ if (action === 'Locked') {
511
+ chartsDotPlotPage.lockUnlockButtonSelectChartType()
512
+ .find('[id="Lock"]')
513
+ .should('exist');
514
+ }
515
+ else if (action === 'Unlocked') {
516
+ chartsDotPlotPage.lockUnlockButtonSelectChartType()
517
+ .find('[id="Unlock"]')
518
+ .should('exist');
519
+ } else {
520
+ cy.log('Incorrect string')
521
+ }
522
+ },
523
+
524
+ /**
525
+ * @description Unlock the bar in select chart type section
526
+ * @param {number} index Index of the bar to be locked
527
+ */
528
+ unlockDotColumn: ({ point, min, interval }) => {
529
+ const index = Math.round((point - min) / interval);
530
+ steps.selectDotColumnInSelectChartTypeSection({ point, min, interval });
531
+ chartsDotPlotPage.lockUnlockButtonSelectChartType()
532
+ .click();
533
+ chartsDotPlotPage.lockUnlockButtonSelectChartType()
534
+ .should('have.attr', 'aria-label', 'unlocked bar');
535
+ steps.unselectDotColumnInSelectChartTypeSection({ point, min, interval });
536
+ utilities.getNthElement(chartsDotPlotPage.dotColumnSelectChartType(), index)
537
+ .within(() => {
538
+ utilities.verifyElementVisibilityState(chartsDotPlotPage.dotColumnLockIcon(), 'notExist');
539
+ });
540
+ },
541
+
542
+ /**
543
+ * Verify the bar is unlocked
544
+ * @param {number} index index of the bar
545
+ */
546
+ verifyDotColumnIsUnlockedInSelectChartType: ({ point, min, interval }) => {
547
+ const index = Math.round((point - min) / interval);
548
+ utilities.getNthElement(chartsDotPlotPage.dotColumnSelectChartType(), index)
549
+ .within(() => {
550
+ utilities.verifyElementVisibilityState(chartsDotPlotPage.dotColumnLockIcon(), 'notExist');
551
+ });
552
+ },
316
553
 
554
+ //specify correct answer
317
555
  /**
318
556
  * selects a dot column in the chart type selection section based on the given point, minimum, and interval.
319
557
  * @param {object} options - The options for selecting the dot column.
@@ -325,10 +563,7 @@ const steps = {
325
563
  const index = Math.round((point - min) / interval);
326
564
  chartsDotPlotPage.dotColumnSpecifyCorrectAnswer()
327
565
  .eq(index)
328
- .click()
329
- .should('have.class', 'selected');
330
- chartsDotPlotPage.tooltipWrapperSpecifyCorrectAnswer()
331
- .should('exist');
566
+ .click();
332
567
  },
333
568
 
334
569
  /**
@@ -529,6 +764,144 @@ const steps = {
529
764
  utilities.verifyInnerText(chartsDotPlotPage.partialEqualWeightsPointsPerResponseScore(), points);
530
765
  },
531
766
 
767
+ /**
768
+ * Verifies the display numbers orientation.
769
+ * @param {('Below' | 'Above')} numberOrientation - The orientation of the numbers ('Below' or 'Above').
770
+ * @throws {Error} Thrown if the number line orientation is invalid.
771
+ */
772
+ verifyDisplayNumbersOrientationOnChartSpecifyCorrectAnswer: (numberOrientation) => {
773
+ let value;
774
+ switch (numberOrientation) {
775
+ case 'Below':
776
+ value = '-32px'
777
+ break;
778
+ case 'Above':
779
+ value = '-8px'
780
+ break;
781
+ default:
782
+ throw new Error('Invalid Number orientation');
783
+ }
784
+ chartsDotPlotPage.labelsNumberLineAxisSpecifyCorrectAnswer()
785
+ .eq(0)
786
+ .should('have.css', 'margin-top', value);
787
+ },
788
+
789
+ /**
790
+ * Verifies the minimum value on the number line axis.
791
+ * @param {string} min - The expected minimum value.
792
+ */
793
+ verifyMinOnNumberLineAxisSpecifyCorrectAnswer: (min) => {
794
+ chartsDotPlotPage.labelsNumberLineAxisSpecifyCorrectAnswer()
795
+ .eq(0)
796
+ .should('have.text', min);
797
+ },
798
+
799
+ /**
800
+ * Verifies the maximum value on the number line axis.
801
+ * @param {string} max - The expected maximum value.
802
+ */
803
+ verifyMaxOnNumberLineAxisSpecifyCorrectAnswer: (max) => {
804
+ chartsDotPlotPage.labelsNumberLineAxisSpecifyCorrectAnswer()
805
+ .eq(-1)
806
+ .should('have.text', max);
807
+ },
808
+
809
+ /**
810
+ * Verifies the label on the number line axis.
811
+ * @param {Array} values - An array of objects containing the value and index of each label.
812
+ */
813
+ verifyLabelOnNumberLineAxisSpecifyCorrectAnswer: (values) => {
814
+ values.forEach(({ value, index }) => {
815
+ chartsDotPlotPage.labelsNumberLineAxisSpecifyCorrectAnswer()
816
+ .eq(index)
817
+ .then(($el) => {
818
+ const innerText = $el[0].innerText;
819
+ expect(innerText.trim()).to.equal(value.toString());
820
+ });
821
+ });
822
+ },
823
+
824
+ /**
825
+ * Verifies the dot type.
826
+ * @param {('Dot'| 'XMark')} type - Dot type.
827
+ * @param {object} options - Options for calculation of index.
828
+ * @param {number} options.point - The point value.
829
+ * @param {number} options.min - The minimum value.
830
+ * @param {number} options.interval - The interval value.
831
+ * @throws {Error} Throws an error if the provided type is invalid.
832
+ */
833
+ verifyDotTypeSpecifyCorrectAnswer: (type, { point, min, interval }) => {
834
+ const index = Math.round((point - min) / interval);
835
+ switch (type) {
836
+ case 'Dot':
837
+ chartsDotPlotPage.dotColumnSpecifyCorrectAnswer()
838
+ .eq(index)
839
+ .find('.dot-icon')
840
+ .should('exist');
841
+ break;
842
+ case 'XMark':
843
+ chartsDotPlotPage.dotColumnSpecifyCorrectAnswer()
844
+ .eq(index)
845
+ .find('[data-name="Clear all"]')
846
+ .should('exist');
847
+ break;
848
+ default:
849
+ throw new Error('Invalid dot type');
850
+ }
851
+ },
852
+
853
+ /**
854
+ * Adds dots using keyboard navigation
855
+ * @param {number} numberOfDots - The number of dots to subtract.
856
+ * @param {object} options - The options object containing point, min, and interval.
857
+ * @param {number} options.point - The point value.
858
+ * @param {number} options.min - The minimum value.
859
+ * @param {number} options.interval - The interval value.
860
+ */
861
+ increaseDotInDotColumnUsingKeyboardSpecifyCorrectAnswer: (numberOfDots, { point, min, interval }) => {
862
+ const index = Math.round((point - min) / interval);
863
+ steps.selectDotColumnInSpecifyCorrectAnswer({ point, min, interval });
864
+ for (let i = 0; i < numberOfDots; i++) {
865
+ chartsDotPlotPage.dotColumnSpecifyCorrectAnswer()
866
+ .eq(index)
867
+ .type('{upArrow}');
868
+ }
869
+ },
870
+ /**
871
+ * removes dots using keyboard navigation
872
+ * @param {number} numberOfDots - The number of dots to remove.
873
+ * @param {object} options - The options object containing point, min, and interval.
874
+ * @param {number} options.point - The point value.
875
+ * @param {number} options.min - The minimum value.
876
+ * @param {number} options.interval - The interval value.
877
+ */
878
+ decreaseDotInDotColumnUsingKeyboardSpecifyCorrectAnswer: (numberOfDots, { point, min, interval }) => {
879
+ const index = Math.round((point - min) / interval);
880
+ steps.selectDotColumnInSpecifyCorrectAnswer({ point, min, interval });
881
+ for (let i = 0; i < numberOfDots; i++) {
882
+ chartsDotPlotPage.dotColumnSpecifyCorrectAnswer()
883
+ .eq(index)
884
+ .type('{downArrow}');
885
+ }
886
+ },
887
+
888
+ tooltipWrapperNotExistSpecifyCorrectAnswer: () => {
889
+ chartsDotPlotPage.tooltipWrapperSpecifyCorrectAnswer()
890
+ .should('not.exist');
891
+ },
892
+
893
+ /**
894
+ * Verify the bar is unlocked
895
+ * @param {number} index index of the bar
896
+ */
897
+ verifyDotColumnIsUnlockedInSpecifyCorrectAnswer: ({ point, min, interval }) => {
898
+ const index = Math.round((point - min) / interval);
899
+ utilities.getNthElement(chartsDotPlotPage.dotColumnSpecifyCorrectAnswer(), index)
900
+ .within(() => {
901
+ utilities.verifyElementVisibilityState(chartsDotPlotPage.dotColumnLockIconSpecifyCorrectAnswer(), 'notExist');
902
+ });
903
+ },
904
+
532
905
  //preview tab
533
906
  /**
534
907
  * Unselects a dot column based on the given point, minimum, and interval.
@@ -545,9 +918,9 @@ const steps = {
545
918
  },
546
919
 
547
920
  /**
548
- * Adds dots
549
- * @param {number} numberOfDots - The number of dots to add.
550
- */
921
+ * Adds dots
922
+ * @param {number} numberOfDots - The number of dots to add.
923
+ */
551
924
  increaseDotCountInDotColumnPreviewTab: (numberOfDots) => {
552
925
  for (let i = 0; i < numberOfDots; i++) {
553
926
  chartsDotPlotPage.addButtonPreviewTab()
@@ -901,6 +1274,7 @@ const steps = {
901
1274
  */
902
1275
  verifyLabelsOnNumberLineAxisPreviewTab: (min, max, annotateEvery) => {
903
1276
  let expectedLabelsIndex = [];
1277
+ let indexForArray = 0;
904
1278
  chartsDotPlotPage.labelsNumberLineAxisPreviewTab()
905
1279
  .each((value, index) => {
906
1280
  if (index % annotateEvery === 0) {
@@ -910,12 +1284,99 @@ const steps = {
910
1284
  .then(() => {
911
1285
  for (var i = min; i < max; i++) {
912
1286
  chartsDotPlotPage.labelsNumberLineAxisPreviewTab()
913
- .eq(expectedLabelsIndex[i - 1])
914
- .should('have.text', i)
1287
+ .eq(expectedLabelsIndex[indexForArray])
1288
+ .should('have.text', i);
1289
+ indexForArray += 1;
915
1290
  }
916
1291
  });
917
1292
  },
918
1293
 
1294
+ /**
1295
+ * Verifies the display numbers orientation on the preview tab.
1296
+ * @param {('Below' | 'Above')} numberOrientation - The orientation of displayed numbers ('Below' or 'Above').
1297
+ * @throws {Error} Throws an error if the provided number orientation is invalid.
1298
+ */
1299
+ verifyDisplayNumbersOrientationOnChartPreviewTab: (numberOrientation) => {
1300
+ let value;
1301
+ switch (numberOrientation) {
1302
+ case 'Below':
1303
+ value = '-32px'
1304
+ break;
1305
+ case 'Above':
1306
+ value = '-8px'
1307
+ break;
1308
+ default:
1309
+ throw new Error('Invalid Number orientation');
1310
+ }
1311
+ chartsDotPlotPage.labelsNumberLineAxisPreviewTab()
1312
+ .eq(0)
1313
+ .should('have.css', 'margin-top', value);
1314
+ },
1315
+
1316
+ /**
1317
+ * Verifies the minimum value on the number line axis.
1318
+ * @param {string} min - The expected minimum value.
1319
+ */
1320
+ verifyMinOnNumberLineAxisPreviewTab: (min) => {
1321
+ chartsDotPlotPage.labelsNumberLineAxisPreviewTab()
1322
+ .eq(0)
1323
+ .should('have.text', min);
1324
+ },
1325
+
1326
+ /**
1327
+ * Verifies the maximum value on the number line axis.
1328
+ * @param {string} max - The expected maximum value.
1329
+ */
1330
+ verifyMaxOnNumberLineAxisPreviewTab: (max) => {
1331
+ chartsDotPlotPage.labelsNumberLineAxisPreviewTab()
1332
+ .eq(-1)
1333
+ .should('have.text', max);
1334
+ },
1335
+
1336
+ /**
1337
+ * Verifies the label on the number line axis.
1338
+ * @param {Array} values - An array of objects containing the value and index of each label.
1339
+ */
1340
+ verifyLabelOnNumberLineAxisPreviewTab: (values) => {
1341
+ values.forEach(({ value, index }) => {
1342
+ chartsDotPlotPage.labelsNumberLineAxisPreviewTab()
1343
+ .eq(index)
1344
+ .then(($el) => {
1345
+ const innerText = $el[0].innerText;
1346
+ expect(innerText).to.equal(value.toString());
1347
+ });
1348
+ });
1349
+ },
1350
+
1351
+ /**
1352
+ * Verifies the dot type.
1353
+ * @param {('Dot'| 'XMark')} type - Dot type.
1354
+ * @param {object} options - Options for calculation of index.
1355
+ * @param {number} options.point - The point value.
1356
+ * @param {number} options.min - The minimum value.
1357
+ * @param {number} options.interval - The interval value.
1358
+ * @throws {Error} Throws an error if the provided type is invalid.
1359
+ */
1360
+ verifyDotTypePreviewTab: (type, { point, min, interval }) => {
1361
+ const index = Math.round((point - min) / interval);
1362
+ switch (type) {
1363
+ case 'Dot':
1364
+ chartsDotPlotPage.dotColumnPreviewTab()
1365
+ .eq(index)
1366
+ .find('.dot-icon')
1367
+ .should('exist');
1368
+ break;
1369
+ case 'XMark':
1370
+ chartsDotPlotPage.dotColumnPreviewTab()
1371
+ .eq(index)
1372
+ .find('[data-name="Clear all"]')
1373
+ .should('exist');
1374
+ break;
1375
+ default:
1376
+ throw new Error('Invalid dot type');
1377
+ }
1378
+ },
1379
+
919
1380
  //correct answer section
920
1381
  /**
921
1382
  * @param {("correct" | "incorrect")} answerStatus - The status of the answer.
@@ -1154,20 +1615,88 @@ const tests = {
1154
1615
  ...autoScoredSpecifyCorrectAnswerSection.tests,
1155
1616
  ...chartsCommonComponent.tests,
1156
1617
 
1618
+ /**
1619
+ * Verifies the contents and functionality of the 'Specify correct answer' accordion for multiple selection questions.
1620
+ * @param {{'Correct' | 'Alternative'}} accordionName - The name of the accordion to be used in the validation.
1621
+ * @example - verifySpecifyCorrectAnswerAccordionContentsAndFunctionality('Correct');
1622
+ */
1623
+ verifySpecifyCorrectAnswerAccordionContentsAndFunctionality: (accordionName) => {
1624
+ it('The number line axis should be displayed with labels from 1 to 6 with 20 divisions', () => {
1625
+ utilities.verifyElementVisibilityState(chartsDotPlotPage.numberLineAxisSpecifyCorrectAnswer(), 'exist');
1626
+ chartsDotPlotPage.steps.verifyDivisionsOnNumberLineAxisSpecifyCorrectAnswer({ min: 1, max: 6, interval: 0.25 });
1627
+ chartsDotPlotPage.steps.verifyLabelsOnNumberLineAxisSpecifyCorrectAnswer(0, 5, 4);
1628
+ });
1629
+
1630
+ it(`The user should be able to plot dots in dot column on number line axis in the specify correct answer section ${accordionName} accordion`, () => {
1631
+ steps.plotDotsInDotColumnSpecifyCorrectAnswer(2, { point: 0, min: 0, interval: 0.25, defaultDots: 0 })
1632
+ });
1633
+
1634
+ it(`When the user resets the number line in the ${accordionName} accordion, error message should not be thrown on the \'${accordionName}\' accordion`, () => {
1635
+ steps.selectControlOptionSpecifyCorrectAnswer('Reset');
1636
+ chartsDotPlotPage.steps.confirmReset();
1637
+ utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'notExist');
1638
+ if (accordionName == 'Correct') {
1639
+ autoScoredSpecifyCorrectAnswerSection.correctAnswerAccordion()
1640
+ .within(() => {
1641
+ utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.specifyCorrectAnswerErrorIcon(), 'notExist');
1642
+ });
1643
+ } else {
1644
+ autoScoredSpecifyCorrectAnswerSection.alternativeAnswerAccordion()
1645
+ .within(() => {
1646
+ utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.specifyCorrectAnswerErrorIcon(), 'notExist');
1647
+ });
1648
+ };
1649
+ });
1650
+
1651
+ tests.verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty(accordionName);
1652
+
1653
+ it('Accessibility of \'Correct\' accordion contents', { tags: 'a11y' }, () => {
1654
+ cy.checkAccessibility(chartsDotPlotPage.numberLineAxisSpecifyCorrectAnswer().parents('.ngie-accordion-detail'));
1655
+ });
1656
+ },
1657
+
1658
+ /**
1659
+ * @description Verifies the behavior of points input field and error messages when the points field is empty.
1660
+ * @param {{'Correct' | 'Alternative'}} accordionName - The name of the accordion to be used in the validation.
1661
+ * @example - verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty('Correct');
1662
+ */
1663
+ verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty: (accordionName) => {
1664
+ it(`When the user focuses in and out of the empty points input field, no points error message should be displayed below the points input field and error icon should not be displayed on the \'${accordionName}\' accordion`, () => {
1665
+ scoringSectionBaseEditTab.pointsInputField()
1666
+ .eq(0)
1667
+ .focus();
1668
+ scoringSectionBaseEditTab.pointsInputField()
1669
+ .eq(0)
1670
+ .blur();
1671
+ utilities.verifyElementVisibilityState(scoringSectionBaseEditTab.pleaseEnterPointsErrorMessage(), 'notExist')
1672
+ if (accordionName == 'Correct') {
1673
+ autoScoredSpecifyCorrectAnswerSection.correctAnswerAccordion()
1674
+ .within(() => {
1675
+ autoScoredSpecifyCorrectAnswerSection.steps.verifySpecifyCorrectAnswerErrorIconNotExists();
1676
+ });
1677
+ } else {
1678
+ autoScoredSpecifyCorrectAnswerSection.alternativeAnswerAccordion()
1679
+ .within(() => {
1680
+ autoScoredSpecifyCorrectAnswerSection.steps.verifySpecifyCorrectAnswerErrorIconNotExists();
1681
+ });
1682
+ };
1683
+ });
1684
+ },
1685
+
1157
1686
  verifyContentsOfSpecifyCorrectAnswerSection: () => {
1158
1687
  it('When user selects a scoring type then in the \'Correct\' accordion, all the contents should be displayed', () => {
1159
- chartsCommonComponent.steps.verifyGraphTitleInSpecifyCorrectAnswer('Five-day observation');
1160
- chartsCommonComponent.steps.verifyXAxisLabelInSpecifyCorrectAnswer('Days');
1688
+ chartsCommonComponent.steps.verifyGraphTitleInSpecifyCorrectAnswer('Graph title');
1689
+ chartsCommonComponent.steps.verifyXAxisLabelInSpecifyCorrectAnswer('Label');
1161
1690
  utilities.verifyElementVisibilityState(chartsDotPlotPage.numberLineAxisSpecifyCorrectAnswer(), 'exist');
1162
1691
  chartsDotPlotPage.steps.verifyLabelsOnNumberLineAxisSpecifyCorrectAnswer(1, 4, 1);
1163
1692
  });
1164
1693
  },
1165
1694
 
1166
1695
  /**
1167
- * Verifies the contents and functionality of the 'Specify correct answer' accordion for multiple selection questions.
1168
- * @param {{'Correct' | 'Alternative'}} accordionName - The name of the accordion to be used in the validation.
1169
- * @example - verifySpecifyCorrectAnswerAccordionContentsAndFunctionality('Correct');
1170
- */
1696
+ * Verifies the contents and functionality of the 'Specify correct answer' accordion for multiple selection questions.
1697
+ * @param {{'Correct' | 'Alternative'}} accordionName - The name of the accordion to be used in the validation.
1698
+ * @example - verifySpecifyCorrectAnswerAccordionContentsAndFunctionality('Correct');
1699
+ */
1171
1700
  verifySpecifyCorrectAnswerAccordionContentsAndFunctionality: (accordionName) => {
1172
1701
  it('The number line axis should be displayed with labels from 1 to 6 with 20 divisions', () => {
1173
1702
  utilities.verifyElementVisibilityState(chartsDotPlotPage.numberLineAxisSpecifyCorrectAnswer(), 'exist');