itemengine-cypress-automation 1.0.184-e2e-execution-crash-3b9d0d0.0 → 1.0.185-repoUpdate26April-b17eb46.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. package/cypress/e2e/ILC/AudioPlayerNew/allSupportedFileTypes.js +79 -0
  2. package/cypress/e2e/ILC/AudioPlayerNew/barAudioPlayerStyle.js +345 -0
  3. package/cypress/e2e/ILC/AudioPlayerNew/compactAudioPlayerStyle.js +429 -0
  4. package/cypress/e2e/ILC/AudioPlayerNew/previewContents.smoke.js +162 -0
  5. package/cypress/e2e/ILC/AudioPlayerNew/standardAudioPlayerStyle.js +489 -0
  6. package/cypress/e2e/ILC/AudioPlayerNew/uploadAndAddAudioFile.js +313 -0
  7. package/cypress/e2e/ILC/AudioResponseNew/barRecorderStyle.smoke.js +1 -1
  8. package/cypress/e2e/ILC/AudioResponseNew/compactRecorderStyle.smoke.js +1 -1
  9. package/cypress/e2e/ILC/AudioResponseNew/standardRecorderStyle.smoke.js +1 -1
  10. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/clickAndDrop.js +1 -1
  11. package/cypress/e2e/ILC/DrawingResponse/drawingResponseGradingViewAndCorrectAnswerViewContents.smoke.js +5 -8
  12. package/cypress/e2e/ILC/EditTabSettingPage/itemPreviewSettingsTabFunctionality.js +417 -28
  13. package/cypress/e2e/ILC/EssayResponse/editCategoryFlyout.js +1 -1
  14. package/cypress/e2e/ILC/FeedbackScaleNew/headerSection.js +29 -1
  15. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/previewContentsForAllViews.smoke.js +2 -2
  16. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/studentViewSettings.js +1 -1
  17. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/studentViewSettings.js +1 -1
  18. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/editTabScoring.js +1 -0
  19. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/previewContentsForAllViews.smoke.js +2 -2
  20. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/studentViewSettings.js +1 -1
  21. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/studentViewSettings.js +1 -1
  22. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/Scoring/partialDifferentWeightsWithCorrectPointsEqualToAlternativePoints.js +4 -4
  23. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/Scoring/partialEqualWeightsWithAlternativePointsGreaterThanCorrectPoints.js +1 -1
  24. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/studentViewSettings.js +1 -1
  25. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsAlternativePointsGreaterThanCorrectPoints.js +5 -5
  26. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsWithCorrectPointsEqualToAlternativePoints.js +3 -4
  27. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialEqualWeightsWithAlternativePointsGreaterThanCorrectPoints.js +1 -1
  28. package/cypress/e2e/ILC/FillInTheGapsTextNew/headerSection.js +1 -0
  29. package/cypress/e2e/ILC/FillInTheGapsTextNew/studentViewSettings.js +1 -1
  30. package/cypress/e2e/ILC/Graphing/Scoring/allOrNothingWithAlternativePointsGreaterThanCorrectPoints.js +2 -2
  31. package/cypress/e2e/ILC/Graphing/Scoring/allOrNothingWithCorrectPointsEqualToAlternatePoints.js +2 -2
  32. package/cypress/e2e/ILC/Graphing/Scoring/allOrNothingWithCorrectPointsGreaterThanAlternativePoints.js +2 -2
  33. package/cypress/e2e/ILC/Graphing/addBackgroundShapesSection.js +2 -2
  34. package/cypress/e2e/ILC/Graphing/studentViewSettings.js +1 -1
  35. package/cypress/e2e/ILC/GridFill/checkAnswerFunctionalityForAllViews.smoke.js +2 -2
  36. package/cypress/e2e/ILC/GridFill/gridLayoutContents.js +11 -3
  37. package/cypress/e2e/ILC/GridFill/previewContentsForAllViews.smoke.js +3 -3
  38. package/cypress/e2e/ILC/GridFill/studentViewSettingsSection.js +1 -1
  39. package/cypress/e2e/ILC/ListOrderingDropdown/allOrNothingForAllViews.smoke.js +230 -0
  40. package/cypress/e2e/ILC/ListOrderingDropdown/checkAnswerFunctionalityForAllViews.smoke.js +124 -0
  41. package/cypress/e2e/ILC/ListOrderingDropdown/previewContentsForAllViews.smoke.js +201 -0
  42. package/cypress/e2e/ILC/ListOrderingNew/Scoring/allOrNothingAlternativePointsGreaterThanCorrectPoints.js +216 -0
  43. package/cypress/e2e/ILC/ListOrderingNew/Scoring/allOrNothingCorrectPointsEqualToAlternativePoints.js +214 -0
  44. package/cypress/e2e/ILC/ListOrderingNew/Scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +251 -0
  45. package/cypress/e2e/ILC/ListOrderingNew/Scoring/allOrNothingPenaltyScoring.js +52 -0
  46. package/cypress/e2e/ILC/ListOrderingNew/Scoring/manuallyAndNonScored.js +128 -0
  47. package/cypress/e2e/ILC/ListOrderingNew/Scoring/partialDifferentWeightsAlternativePointsGreaterThanCorrectPoints.js +279 -0
  48. package/cypress/e2e/ILC/ListOrderingNew/Scoring/partialDifferentWeightsBasic.js +109 -0
  49. package/cypress/e2e/ILC/ListOrderingNew/Scoring/partialDifferentWeightsCorrectPointsEqualToAlternativePoints.js +278 -0
  50. package/cypress/e2e/ILC/ListOrderingNew/Scoring/partialDifferentWeightsCorrectPointsGreaterThanAlternativePoints.js +278 -0
  51. package/cypress/e2e/ILC/ListOrderingNew/Scoring/partialDifferentWeightsMinimumAndPenaltyScoring.js +335 -0
  52. package/cypress/e2e/ILC/ListOrderingNew/Scoring/partialEqualWeightsAlternativePointsGreaterThanCorrectPoints.js +250 -0
  53. package/cypress/e2e/ILC/ListOrderingNew/Scoring/partialEqualWeightsBasic.js +161 -0
  54. package/cypress/e2e/ILC/ListOrderingNew/Scoring/partialEqualWeightsCorrectPointsEqualToAlternativePoints.js +216 -0
  55. package/cypress/e2e/ILC/ListOrderingNew/Scoring/partialEqualWeightsCorrectPointsGreaterThanAlternativePoints.js +252 -0
  56. package/cypress/e2e/ILC/ListOrderingNew/additionalSettings.js +118 -0
  57. package/cypress/e2e/ILC/ListOrderingNew/allOrNothingForAllViews.smoke.js +243 -0
  58. package/cypress/e2e/ILC/ListOrderingNew/checkAnswerFunctionalityForAllViews.smoke.js +128 -0
  59. package/cypress/e2e/ILC/ListOrderingNew/editTabBasicSection.js +155 -0
  60. package/cypress/e2e/ILC/ListOrderingNew/editTabScoring.js +195 -0
  61. package/cypress/e2e/ILC/ListOrderingNew/headerSection.js +78 -0
  62. package/cypress/e2e/ILC/ListOrderingNew/minimumScoringPenaltyPointsAndRoundingDropdown.js +194 -0
  63. package/cypress/e2e/ILC/ListOrderingNew/previewContentsForAllViews.smoke.js +176 -0
  64. package/cypress/e2e/ILC/ListOrderingNew/specifyCorrectAnswerSection.js +112 -0
  65. package/cypress/e2e/ILC/ListOrderingNew/studentViewSettings.js +244 -0
  66. package/cypress/e2e/ILC/Matching/studentViewSettings.js +1 -1
  67. package/cypress/e2e/ILC/MultipleSelection/allOrNothingWithAlternativeAnswer.js +1 -0
  68. package/cypress/e2e/ILC/MultipleSelectionGridNew/studentViewSettings.js +1 -1
  69. package/cypress/e2e/ILC/NumberLine/LayoutSection.js +181 -0
  70. package/cypress/e2e/ILC/NumberLine/Scoring/allOrNothingWithCorrectPointsGreaterThanAlternativePoints.js +3 -3
  71. package/cypress/e2e/ILC/NumberLine/allOrNothingScoringForAllViews.smoke.js +57 -1
  72. package/cypress/e2e/ILC/NumberLine/lineSettingsSection.js +33 -0
  73. package/cypress/e2e/ILC/NumberLine/numberLineSection.js +46 -0
  74. package/cypress/e2e/ILC/NumberLine/previewTabContentsForAllViews.smoke.js +1 -1
  75. package/cypress/e2e/ILC/NumberLine/studentViewSettings.js +1 -1
  76. package/cypress/e2e/ILC/NumberLine/toolSettings.js +2 -1
  77. package/cypress/e2e/ILC/NumberLine/verticalNumberLine/allOrNothingScoringForAllViews.smoke.js +696 -0
  78. package/cypress/e2e/ILC/NumberLine/verticalNumberLine/gradingViewAndCorrectAnswerView.smoke.js +173 -0
  79. package/cypress/e2e/ILC/NumberLine/verticalNumberLine/layoutSection.js +183 -0
  80. package/cypress/e2e/ILC/NumberLine/verticalNumberLine/numberLineSection.js +73 -0
  81. package/cypress/e2e/ILC/NumberLine/verticalNumberLine/previewTabContentsForAllViews.smoke.js +204 -0
  82. package/cypress/e2e/ILC/NumberLineLabel/allOrNothingForAllViews.smoke.js +288 -0
  83. package/cypress/e2e/ILC/NumberLineLabel/checkAnswerFunctionalityForAllViews.smoke.js +153 -0
  84. package/cypress/e2e/ILC/NumberLineLabel/gradingViewAndCorrectAnswerView.smoke.js +164 -0
  85. package/cypress/e2e/ILC/NumberLineLabel/previewContentsForAllViews.smoke.js +120 -0
  86. package/cypress/e2e/ILC/Protractor/protractorPreviewContents.smoke.js +1 -1
  87. package/cypress/e2e/ILC/ReadingRuler/readingRulerEditTabBasicsSection.js +49 -1
  88. package/cypress/e2e/ILC/ShortTextResponseNew/studentViewSettings.js +1 -1
  89. package/cypress/e2e/ILC/SingleSelectionGridNew/studentViewSettings.js +1 -1
  90. package/cypress/e2e/ILC/TextEntryMath/responseEvaluationMethodsAndCustomSettings.js +2 -2
  91. package/cypress/e2e/ILC/TextSelection/Scoring/allOrNothingAlternatePointsMoreThanCorrectPoints.js +0 -1
  92. package/cypress/e2e/ILC/TextSelection/Scoring/allOrNothingCorrectPointsEqualToAlternatePoints.js +0 -1
  93. package/cypress/e2e/ILC/TextSelection/Scoring/allOrNothingCorrectPointsMoreThanAlternatePoints.js +0 -1
  94. package/cypress/e2e/ILC/TextSelection/Scoring/basicScoringForAllTextSelectionTypes.smoke.js +0 -1
  95. package/cypress/e2e/ILC/TextSelection/additionalSettings.js +125 -0
  96. package/cypress/e2e/ILC/TextSelection/allOrNothingScoringForAllViews.smoke.js +0 -1
  97. package/cypress/e2e/ILC/TextSelection/checkAnswerFunctionalityForAllViews.smoke.js +1 -2
  98. package/cypress/e2e/ILC/TextSelection/editTabScoringSection.js +5 -4
  99. package/cypress/e2e/ILC/TextSelection/headerSection.js +73 -0
  100. package/cypress/e2e/ILC/TextSelection/previewContentsForAllViews.smoke.js +6 -7
  101. package/cypress/e2e/ILC/TextSelection/questionInstructionsAndQuestion.js +179 -0
  102. package/cypress/e2e/ILC/TextSelection/specifyCorrectAnswerSection.js +89 -0
  103. package/cypress/e2e/ILC/TextSelection/studentViewSettings.js +436 -0
  104. package/cypress/e2e/ILC/TextSelection/styleAndLayoutCustomizationAccordion.js +277 -0
  105. package/cypress/e2e/ILC/TextSelection/textSelectionModesInPreviewTab.js +222 -0
  106. package/cypress/e2e/ILC/TextSelection/textSelectionModesInSpecifyCorrectAnswerSection.js +260 -0
  107. package/cypress/e2e/ILC/TextSelection/textSelectionModesInSpecifyPossibleOptionsSection.js +380 -0
  108. package/cypress/e2e/ILC/ToolSettings/toolSettingsContent.js +5 -5
  109. package/cypress/e2e/ILC/ToolSettings/toolSettingsPreviewContents.smoke.js +3 -3
  110. package/cypress/fixtures/constants.js +1 -1
  111. package/cypress/fixtures/equationEditorCategoriesAndSymbols .js +20 -20
  112. package/cypress/fixtures/theme/ilc.json +20 -18
  113. package/cypress/pages/audioPlayerPage.js +274 -504
  114. package/cypress/pages/brainingCampManipulativePage.js +1 -1
  115. package/cypress/pages/components/autoScoredSpecifyCorrectAnswerSection.js +3 -3
  116. package/cypress/pages/components/autoScoredStudentViewSettings.js +5 -5
  117. package/cypress/pages/components/commonComponents.js +1 -0
  118. package/cypress/pages/components/draggableOptionContainer.js +1 -0
  119. package/cypress/pages/components/equationEditorFlyout.js +3 -2
  120. package/cypress/pages/components/essayResponseCommonComponents.js +8 -2
  121. package/cypress/pages/components/fillInTheGapsDropdownCommonComponent.js +1 -0
  122. package/cypress/pages/components/imageCanvasComponent.js +2 -1
  123. package/cypress/pages/components/index.js +3 -0
  124. package/cypress/pages/components/layoutSectionComponent.js +1191 -0
  125. package/cypress/pages/components/numberLineCommonComponent.js +36 -0
  126. package/cypress/pages/components/optionsWrapperComponent.js +13 -2
  127. package/cypress/pages/components/playbackControlsBaseComponent.js +20 -13
  128. package/cypress/pages/components/styleAndLayoutCustomizationAccordionComponent.js +46 -0
  129. package/cypress/pages/components/toolSettingsComponent.js +6 -0
  130. package/cypress/pages/contentBlocksPage.js +18 -2
  131. package/cypress/pages/createItemPage.js +75 -8
  132. package/cypress/pages/dialogBoxBase.js +2 -2
  133. package/cypress/pages/drawingResponsePage.js +24 -4
  134. package/cypress/pages/feedbackScalePage.js +3 -0
  135. package/cypress/pages/graphingPage.js +19 -1
  136. package/cypress/pages/gridFillPage.js +25 -8
  137. package/cypress/pages/index.js +2 -1
  138. package/cypress/pages/itemPreviewSettingsPage.js +4 -0
  139. package/cypress/pages/listOrderingPage.js +435 -557
  140. package/cypress/pages/matchingPage.js +1 -1
  141. package/cypress/pages/multipleSelectionPage.js +23 -1
  142. package/cypress/pages/numberLineLabelPage.js +333 -0
  143. package/cypress/pages/numberLinePage.js +1370 -132
  144. package/cypress/pages/rulerPage.js +6 -2
  145. package/cypress/pages/textSelectionPage.js +461 -23
  146. package/package.json +1 -1
@@ -955,7 +955,7 @@ const steps = {
955
955
  draggableOptionsSectionComponent.steps.addGroup();
956
956
  draggableOptionsSectionComponent.steps.addGroupTitle(groupTitle);
957
957
  for (let i = 0; i < numOptionsToAdd; i++) {
958
- matchingPage.steps.addOptionButton();
958
+ matchingPage.steps.addOption();
959
959
  }
960
960
  matchingPage.steps.enterTextInOptionInputField(optionArray);
961
961
  },
@@ -25,6 +25,7 @@ const selectors = {
25
25
  optionsText: () => cy.get('.mcq-label'),
26
26
  optionsCheckboxWrapperSpecifyCorrectAnswerSection: () => cy.get('[data-ngie-testid="response-option-checkbox"]:visible'),
27
27
  optionsCheckboxWrapperPreviewTab: () => cy.get('[class*="question-preview-wrapper"] [data-ngie-testid="response-option-checkbox"]:visible'),
28
+ penaltyPointsForEachIncorrectOptionInputField: () => cy.get('.penlty-points-input-field input'),
28
29
  //TODO: Need to update below selectors, once https://redmine.zeuslearning.com/issues/553983 gets resolved
29
30
  optionsCheckbox: () => cy.get('[data-ngie-testid="response-option-checkbox"]:visible [type="checkbox"]'),
30
31
  optionsCheckboxPreviewTab: () => cy.get('[class*="question-preview-wrapper"] [data-ngie-testid="response-option-checkbox"] [type="checkbox"]'),
@@ -545,7 +546,28 @@ const steps = {
545
546
  .eq(index)
546
547
  .parents('.ngie-checkbox')
547
548
  .should('have.class', 'checkbox-option-disabled');
548
- }
549
+ },
550
+
551
+ /**
552
+ * Verifies the penalty points value for each incorrect option in the multiple selection question.
553
+ * @param {number} points - The expected penalty points value for each incorrect option.
554
+ */
555
+ verifyPenaltyPointsForEachIncorrectOptionValue: (points) => {
556
+ multipleSelectionPage.penaltyPointsForEachIncorrectOptionInputField()
557
+ .should('have.value', points);
558
+ },
559
+
560
+ /**
561
+ * Allots penalty points for each incorrect option in the multiple selection question.
562
+ * @param {number} points - The penalty points to be allotted for each incorrect option.
563
+ */
564
+ allotPenaltyPointsForEachIncorrectOption: (points) => {
565
+ multipleSelectionPage.penaltyPointsForEachIncorrectOptionInputField()
566
+ .clear()
567
+ .type(`${points}`)
568
+ .should('have.value', points)
569
+ .blur();
570
+ },
549
571
  }
550
572
 
551
573
  const tests = {
@@ -0,0 +1,333 @@
1
+ import constants from '../fixtures/constants';
2
+ import utilities from '../support/helpers/utilities';
3
+ import { createQuestionBasePage, questionInstructionsComponent, scoringSectionBaseEditTab, ckEditorToolbar, equationEditorFlyout, autoScoredScoringPreviewTab, autoScoredStudentViewSettings, numberLineCommonComponent, autoScoredSpecifyCorrectAnswerSection, autoScoredScoringSectionMultiResponseType } from './components';
4
+ const css = Cypress.env('css');
5
+
6
+ const selectors = {
7
+ ...questionInstructionsComponent,
8
+ ...numberLineCommonComponent,
9
+ //Label section
10
+ labelInputField: () => cy.get('.edit-question-enter-option-form-element [role="textbox"]'),
11
+ addLabelButton: () => cy.get('.inline-add-option-button-wrapper button'),
12
+ labelNumberLineTab: () => cy.get('[data-ngie-testid="label-number-line-tab"]'),
13
+ //Specify correct answer section
14
+ draggableLabelsSpecifyCorrectAnswer: () => cy.get('.label-tool'),
15
+
16
+ //Preview tab
17
+ draggableLabelsPreviewTab: () => cy.get('[class*="question-preview-wrapper"] .label-tool'),
18
+ labelContainerPreviewTab: () => cy.get('[class*="question-preview-wrapper"] .items-container'),
19
+
20
+ //Correct answer section
21
+ numberLineCorrectAnswerSection: () => cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox svg').eq(2),
22
+ numberLinePointCorrectAnswerSection: () => cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').last().find('svg ellipse[display="inline"]')
23
+ }
24
+
25
+ const steps = {
26
+ ...createQuestionBasePage.steps,
27
+ ...questionInstructionsComponent.steps,
28
+ ...scoringSectionBaseEditTab.steps,
29
+ ...ckEditorToolbar.steps,
30
+ ...equationEditorFlyout.steps,
31
+ ...autoScoredScoringPreviewTab.steps,
32
+ ...autoScoredStudentViewSettings.steps,
33
+ ...numberLineCommonComponent.steps,
34
+ ...autoScoredSpecifyCorrectAnswerSection.steps,
35
+ ...autoScoredScoringSectionMultiResponseType.steps,
36
+
37
+ navigateToLabelNumberLineTab: () => {
38
+ numberLineLabelPage.labelNumberLineTab()
39
+ .click();
40
+ },
41
+
42
+ addLabel: () => {
43
+ numberLineLabelPage.addLabelButton()
44
+ .click()
45
+ },
46
+
47
+ /**
48
+ * This function is used to focus in the label input field
49
+ * @param {number} index of the label input field
50
+ */
51
+ focusInLabelInputField: (index) => {
52
+ utilities.getNthElement(numberLineLabelPage.labelInputField(), index)
53
+ .click();
54
+ },
55
+
56
+ /**
57
+ * @param {number} index of label input field
58
+ * @param {string} textContent to enter text in the label input field
59
+ */
60
+ enterTextInLabelInputField: (index, textContent) => {
61
+ numberLineLabelPage.labelInputField()
62
+ .eq(index)
63
+ .type(textContent)
64
+ },
65
+
66
+ enterTextInMultipleLabelInputFields: (labelsArray) => {
67
+ labelsArray.forEach((label, index) => {
68
+ numberLineLabelPage.labelInputField()
69
+ .eq(index)
70
+ .type(label)
71
+ .blur()
72
+ .should('have.text', label)
73
+ });
74
+ },
75
+
76
+ //Specify correct answer section
77
+ /**
78
+ * This function clicks and drops label on the specify correct answer section line
79
+ * @param {string} label to be dropped on the number line
80
+ * @param {(horizontal|vertical)} orientation of the number line
81
+ * @param {number} range of the number line
82
+ * @param {number} coordinate of the number line to drop the label
83
+ */
84
+ clickAndDropLabelOnNumberLineSpecifyCorrectAnswer: (label, orientation, range, coordinate) => {
85
+ numberLineLabelPage.draggableLabelsSpecifyCorrectAnswer()
86
+ .contains(label)
87
+ .click();
88
+ numberLineLabelPage.numberLineSpecifyCorrectAnswer()
89
+ .then(($graphElement) => {
90
+ const graphWidth = $graphElement[0].clientWidth;
91
+ const graphHeight = 180;
92
+ const originX = graphWidth / 2;
93
+ const originY = graphHeight / 2;
94
+ if (orientation === 'horizontal') {
95
+ const xPixel = originX + coordinate * (graphWidth / range);
96
+ numberLineLabelPage.numberLineSpecifyCorrectAnswer()
97
+ .click(xPixel, originY, { force: true });
98
+ } else {
99
+ const yPixel = originY - coordinate * (graphWidth / range);
100
+ numberLineLabelPage.numberLineSpecifyCorrectAnswer()
101
+ .click(originX, yPixel, { force: true });
102
+ }
103
+ });
104
+ },
105
+
106
+ /**
107
+ * This function verifies plotted points on the number line on the Edit tab.
108
+ * @param {number} range - The range of x coordinates.
109
+ * @param {number[]} coordinates - An array containing x coordinates to be plotted on the graph.
110
+ */
111
+ verifyPointsPlottedOnNumberLineSpecifyCorrectAnswer: (range, coordinates) => {
112
+ coordinates.forEach(x => {
113
+ numberLineLabelPage.numberLineSpecifyCorrectAnswer()
114
+ .then(($graphElement) => {
115
+ let graphWidth = $graphElement[0].clientWidth;
116
+ const originX = graphWidth / 2;
117
+ const xPixel = originX + x * (graphWidth / range);
118
+ cy.get(`.ngie-accordion .ngie-jxgbox svg ellipse[cx*="${Math.floor(xPixel)}"]`)
119
+ .should('exist');
120
+ });
121
+ });
122
+ },
123
+
124
+ /**
125
+ * @description Verifies that the image in the Preview tab has the correct source and alt text.
126
+ * @param {number} index - The index of the option in the Preview tab.
127
+ */
128
+ verifyImageInPreviewTab: (index) => {
129
+ numberLineLabelPage.draggableLabelsPreviewTab()
130
+ .eq(index)
131
+ .find('img')
132
+ .should('have.attr', 'src', constants.foxImageLink)
133
+ .and('have.attr', 'alt', constants.foxImageAltText);
134
+ },
135
+
136
+ /**
137
+ * @description Verifies that the bold text in the Preview tab is correct.
138
+ * @param {number} index - The index of the option in the Preview tab.
139
+ */
140
+ verifyBoldTextInPreviewTab: (index) => {
141
+ numberLineLabelPage.draggableLabelsPreviewTab()
142
+ .eq(index)
143
+ .find('strong')
144
+ .should('have.text', 'This is a bold option');
145
+ },
146
+
147
+ /**
148
+ * @description Verifies that the equation text in the Preview tab is correct.
149
+ * @param {number} index - The index of the option in the Preview tab.
150
+ */
151
+ verifyEquationTextInPreviewTab: (index) => {
152
+ numberLineLabelPage.draggableLabelsPreviewTab()
153
+ .eq(index)
154
+ .find('[role="math"]')
155
+ .should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
156
+ .contains(constants.CKEditorInputFieldEnteredEquationText);
157
+ },
158
+
159
+ /**
160
+ * This function verifies the text content of label
161
+ * @param {number} index of the draggable label
162
+ * @param {string} textContent of the label
163
+ */
164
+ verifyLabelTextContentPreviewTab: (index, textContent) => {
165
+ utilities.verifyInnerText(utilities.getNthElement(numberLineLabelPage.draggableLabelsPreviewTab(), index), textContent)
166
+ },
167
+
168
+ //Preview tab
169
+ /**
170
+ * This function clicks and drops label on the specify correct answer section line
171
+ * @param {string} label to be dropped on the number line
172
+ * @param {(horizontal|vertical)} orientation of the number line
173
+ * @param {number} range of the number line
174
+ * @param {number} coordinate of the number line to drop the label
175
+ */
176
+ clickAndDropLabelOnNumberLinePreviewTab: (label, orientation, range, coordinate) => {
177
+ numberLineLabelPage.draggableLabelsPreviewTab()
178
+ .contains(label)
179
+ .click();
180
+ numberLineLabelPage.numberLinePreviewTab()
181
+ .then(($graphElement) => {
182
+ const graphWidth = $graphElement[0].clientWidth;
183
+ const graphHeight = 120;
184
+ const originX = graphWidth / 2;
185
+ const originY = graphHeight / 2;
186
+ if (orientation === 'horizontal') {
187
+ const xPixel = originX + coordinate * (graphWidth / range);
188
+ numberLineLabelPage.numberLinePreviewTab()
189
+ .click(xPixel, originY, { force: true });
190
+ } else {
191
+ const yPixel = originY - coordinate * (graphWidth / range);
192
+ numberLineLabelPage.numberLinePreviewTab()
193
+ .click(originX, yPixel, { force: true });
194
+ }
195
+ });
196
+ },
197
+
198
+ /**
199
+ * This function verifies plotted points on the number line on the preview tab.
200
+ * @param {number} range - The range of x coordinates.
201
+ * @param {number[]} coordinates - An array containing x coordinates to be plotted on the graph.
202
+ */
203
+ verifyPointsPlottedOnNumberLinePreviewTab: (range, coordinates) => {
204
+ coordinates.forEach(x => {
205
+ numberLineLabelPage.numberLinePreviewTab()
206
+ .then(($graphElement) => {
207
+ const graphWidth = $graphElement[0].clientWidth;
208
+ const originX = graphWidth / 2;
209
+ const xPixel = originX + x * (graphWidth / range);
210
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(0).find(`svg ellipse[cx*="${Math.floor(xPixel)}"]`)
211
+ .should('exist');
212
+ });
213
+ });
214
+ },
215
+
216
+ /**
217
+ * This function verifies plotted points on the number line on the preview tab.
218
+ * @param {number} range - The range of x coordinates.
219
+ * @param {number[]} coordinates - An array containing x coordinates to be plotted on the graph.
220
+ */
221
+ verifyIncorrectResponseOnNumberLinePreviewTab: (label, range, coordinate) => {
222
+ numberLineLabelPage.numberLinePreviewTab()
223
+ .then(($graphElement) => {
224
+ const graphWidth = $graphElement[0].clientWidth;
225
+ const originX = graphWidth / 2;
226
+ const xPixel = originX + coordinate * (graphWidth / range);
227
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(0).find(`svg ellipse[cx*="${Math.floor(xPixel)}"]`)
228
+ .should('have.css', 'stroke', css.color.incorrectAnswer);
229
+ });
230
+ numberLineLabelPage.numberLinePreviewTab()
231
+ .parents('.ngie-jxgbox')
232
+ .within(() => {
233
+ numberLineLabelPage.draggableLabelsSpecifyCorrectAnswer()
234
+ .contains(label)
235
+ .should('have.class', 'icon-incorrect-cross')
236
+ .should('have.css', 'border', `1px solid ${css.color.incorrectAnswer}`)
237
+ .verifyPseudoClassBeforeProperty('color', css.color.incorrectAnswer);
238
+ });
239
+ },
240
+
241
+ /**
242
+ * This function verifies plotted points on the number line on the preview tab.
243
+ * @param {number} range - The range of x coordinates.
244
+ * @param {number[]} coordinates - An array containing x coordinates to be plotted on the graph.
245
+ */
246
+ verifyCorrectResponseOnNumberLinePreviewTab: (label, range, coordinate) => {
247
+ numberLineLabelPage.numberLinePreviewTab()
248
+ .then(($graphElement) => {
249
+ const graphWidth = $graphElement[0].clientWidth;
250
+ const originX = graphWidth / 2;
251
+ const xPixel = originX + coordinate * (graphWidth / range);
252
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(0).find(`svg ellipse[cx*="${Math.floor(xPixel)}"]`)
253
+ .should('have.css', 'stroke', css.color.correctAnswer);
254
+ });
255
+ numberLineLabelPage.numberLinePreviewTab()
256
+ .parents('.ngie-jxgbox')
257
+ .within(() => {
258
+ numberLineLabelPage.draggableLabelsSpecifyCorrectAnswer()
259
+ .contains(label)
260
+ .should('have.class', 'icon-correct-tick')
261
+ .should('have.css', 'border', `1px solid ${css.color.correctAnswer}`)
262
+ .verifyPseudoClassBeforeProperty('color', css.color.correctAnswer);
263
+ });
264
+ },
265
+
266
+ /**
267
+ * This function verifies plotted points on the number line do not exist on the preview tab.
268
+ * @param {number} range - The range of x coordinates.
269
+ * @param {number[]} coordinates - An array containing x coordinates to be plotted on the graph.
270
+ */
271
+ verifyPointsNotExistOnNumberLinePreviewTab: (range, coordinates) => {
272
+ coordinates.forEach(x => {
273
+ numberLineLabelPage.numberLinePreviewTab()
274
+ .then(($graphElement) => {
275
+ const graphWidth = $graphElement[0].clientWidth;
276
+ const originX = graphWidth / 2;
277
+ const xPixel = originX + x * (graphWidth / range);
278
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(0).find(`svg ellipse[cx*="${Math.floor(xPixel)}"]`)
279
+ .should('not.exist');
280
+ });
281
+ });
282
+ },
283
+
284
+ //Correct answer section
285
+ /**
286
+ * This function verifies correct plotted points on the number line on c tab
287
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
288
+ * @param {number} range - range of x coordinate
289
+ */
290
+ verifyCorrectResponseOnNumberLineCorrectAnswerSection: (label, range, coordinate) => {
291
+ numberLineLabelPage.numberLineCorrectAnswerSection()
292
+ .then(($graphElement) => {
293
+ const graphWidth = $graphElement[0].clientWidth;
294
+ const originX = graphWidth / 2;
295
+ const xPixel = originX + coordinate * (graphWidth / range);
296
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(1).find(`svg ellipse[cx*="${Math.floor(xPixel)}"][display="inline"]`)
297
+ .should('have.css', 'stroke', css.color.correctAnswer);
298
+ });
299
+ numberLineLabelPage.numberLineCorrectAnswerSection()
300
+ .parents('.ngie-jxgbox')
301
+ .within(() => {
302
+ numberLineLabelPage.draggableLabelsSpecifyCorrectAnswer()
303
+ .contains(label)
304
+ .should('have.class', 'icon-correct-tick')
305
+ .should('have.css', 'border', `1px solid ${css.color.correctAnswer}`)
306
+ .verifyPseudoClassBeforeProperty('color', css.color.correctAnswer);
307
+ });
308
+ },
309
+
310
+ /**
311
+ * This function verifies the label in container and is disabled
312
+ * @param {string} label in the container
313
+ */
314
+ verifyLabelIsDisabledForGradingView: (label) => {
315
+ numberLineLabelPage.draggableLabelsPreviewTab()
316
+ .contains(label)
317
+ .should('have.class', 'disable-label-tool');
318
+ },
319
+
320
+ verifyCorrectAnswerSectionNotExist: () => {
321
+ utilities.verifyElementVisibilityState(numberLineLabelPage.numberLineCorrectAnswerSection(), 'notExist');
322
+ }
323
+ }
324
+
325
+ const tests = {
326
+ ...autoScoredScoringPreviewTab.tests
327
+ }
328
+
329
+ export const numberLineLabelPage = {
330
+ ...selectors,
331
+ steps,
332
+ tests
333
+ }