itemengine-cypress-automation 1.0.165-migrationScripts-e27d6f2.0 → 1.0.166

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/cypress/e2e/ILC/BrainingCampManipulative/additionalSettings.js +83 -0
  2. package/cypress/e2e/ILC/BrainingCampManipulative/editTabBasicSection.js +200 -0
  3. package/cypress/e2e/ILC/BrainingCampManipulative/editTabScoringSection.js +56 -0
  4. package/cypress/e2e/ILC/BrainingCampManipulative/gradingViewAndCorrectAnswerViewContents.smoke.js +95 -0
  5. package/cypress/e2e/ILC/BrainingCampManipulative/headerSection.js +71 -0
  6. package/cypress/e2e/ILC/BrainingCampManipulative/previewTabContent.smoke.js +72 -0
  7. package/cypress/e2e/ILC/BrainingCampManipulative/toolSettings.js +71 -0
  8. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/allOrNothingBasicForAllViews.smoke.js +2 -2
  9. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/clickAndDrop.js +22 -11
  10. package/cypress/e2e/ILC/EssayResponse/essayResponseAdditionalSettings.js +432 -0
  11. package/cypress/e2e/ILC/EssayResponse/essayResponseAdditionalSettingsBasic.js +134 -0
  12. package/cypress/e2e/ILC/FeedbackScaleNew/feedbackScaleStylePreviewTab.js +161 -0
  13. package/cypress/e2e/ILC/FeedbackScaleNew/numbersFeedbackScaleStyle.js +308 -0
  14. package/cypress/e2e/ILC/FeedbackScaleNew/previewContentsForAllViews.smoke.js +216 -0
  15. package/cypress/e2e/ILC/FeedbackScaleNew/starsHeartsFeedbackScaleStyle.js +336 -0
  16. package/cypress/e2e/ILC/FeedbackScaleNew/textFeedbackScaleStyle.js +570 -0
  17. package/cypress/e2e/ILC/FeedbackScaleNew/thumbsFeedbackScaleStyle.js +214 -0
  18. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropAdditionalSettings.js +356 -0
  19. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropAdditionalSettingsResponseAccordion.js +299 -0
  20. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/clickAndDrop.js +18 -7
  21. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/clickAndDrop.js +11 -6
  22. package/cypress/e2e/ILC/Graphing/Scoring/allOrNothingWithCorrectPointsEqualToAlternatePoints.js +355 -0
  23. package/cypress/e2e/ILC/Graphing/previewContentsForAllViews.smoke.js +0 -1
  24. package/cypress/e2e/ILC/Graphing/toolsControlsAndBackgroundSection.js +2 -36
  25. package/cypress/e2e/ILC/GridFill/allOrNothingBasicForAllViews.smoke.js +22 -34
  26. package/cypress/e2e/ILC/GridFill/checkAnswerFunctionalityForAllViews.smoke.js +8 -24
  27. package/cypress/e2e/ILC/GridFill/previewContentsForAllViews.smoke.js +5 -25
  28. package/cypress/e2e/ILC/GridFill/scoring/allOrNothingAlternativePointsGreaterThanCorrectPoints.js +68 -114
  29. package/cypress/e2e/ILC/GridFill/scoring/allOrNothingCorrectPointsEqualToAlternativePoints.js +67 -111
  30. package/cypress/e2e/ILC/GridFill/scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +71 -123
  31. package/cypress/e2e/ILC/GridFill/scoring/allOrNothingScoringCellShadeCount.js +41 -63
  32. package/cypress/e2e/ILC/GridFill/scoring/manuallyAndNonScored.js +21 -25
  33. package/cypress/e2e/ILC/GridFill/scoring/partialEqualWeightsBasic.js +50 -85
  34. package/cypress/e2e/ILC/GridFill/scoring/partialEqualWeightsWithAlternativePointsGreaterThanCorrectPoints.js +68 -115
  35. package/cypress/e2e/ILC/GridFill/scoring/partialEqualWeightsWithCorrectPointsEqualToAlternativePoints.js +54 -98
  36. package/cypress/e2e/ILC/GridFill/scoring/partialEqualWeightsWithCorrectPointsGreaterThanAlternativePoints.js +72 -120
  37. package/cypress/e2e/ILC/GridFill/studentViewSettingsSection.js +3 -3
  38. package/cypress/e2e/ILC/Matching/maximumCapacityPerDropzoneSection.js +309 -0
  39. package/cypress/e2e/ILC/Matching/specifyCorrectAnswerSection.js +1 -1
  40. package/cypress/e2e/ILC/Matching/toolSettings.js +72 -0
  41. package/cypress/e2e/ILC/MultipleSelectionGridNew/editTabBasicSection.js +1033 -0
  42. package/cypress/e2e/ILC/MultipleSelectionGridNew/test.js +28 -0
  43. package/cypress/e2e/ILC/NumberLine/Scoring/allOrNothingWithAlternatePointsGreaterThanCorrectPoints.js +236 -0
  44. package/cypress/e2e/ILC/NumberLine/Scoring/allOrNothingWithCorrectPointsEqualToAlternatePoints.js +239 -0
  45. package/cypress/e2e/ILC/NumberLine/Scoring/allOrNothingWithCorrectPointsGreaterThanAlternativePoints.js +278 -0
  46. package/cypress/e2e/ILC/NumberLine/Scoring/manualAndNonScoredScoring.js +178 -0
  47. package/cypress/e2e/ILC/NumberLine/Scoring/partialEqualWeightsBasic.js +407 -0
  48. package/cypress/e2e/ILC/NumberLine/Scoring/partialEqualWeightsWithAlternatePointsGreaterThanCorrectPoints.js +273 -0
  49. package/cypress/e2e/ILC/NumberLine/Scoring/partialEqualWeightsWithCorrectPointsGreaterThanAlternatePoints.js +278 -0
  50. package/cypress/e2e/ILC/NumberLine/Scoring/partialEqualWeigtsWithCorrectPointsEqualToAlternatePoints.js +228 -0
  51. package/cypress/e2e/ILC/NumberLine/additionalSettings.js +120 -0
  52. package/cypress/e2e/ILC/NumberLine/allOrNothingScoringForAllViews.smoke.js +659 -0
  53. package/cypress/e2e/ILC/NumberLine/checkAnswerFunctionalityForAllViews.smoke.js +149 -0
  54. package/cypress/e2e/ILC/NumberLine/editTabScoringSection.js +151 -0
  55. package/cypress/e2e/ILC/NumberLine/gradingViewAndCorrectAnswerView.smoke.js +171 -0
  56. package/cypress/e2e/ILC/NumberLine/headerSection.js +76 -0
  57. package/cypress/e2e/ILC/NumberLine/minimumScoringPenaltyPointsAndRoundingDropdown.js +54 -0
  58. package/cypress/e2e/ILC/NumberLine/previewTabContentsForAllViews.smoke.js +200 -0
  59. package/cypress/e2e/ILC/NumberLine/specifyCorrectAnswerSection.js +67 -0
  60. package/cypress/e2e/ILC/NumberLine/studentViewSettings.js +135 -0
  61. package/cypress/e2e/ILC/NumberLine/toolSettings.js +73 -0
  62. package/cypress/e2e/ILC/NumberLine/toolsAndControls.js +372 -0
  63. package/cypress/e2e/ILC/SingleSelectionGridNew/editTabBasicSection.js +1014 -0
  64. package/cypress/e2e/ILC/TextSelection/Scoring/allOrNothingAlternatePointsMoreThanCorrectPoints.js +235 -0
  65. package/cypress/e2e/ILC/TextSelection/Scoring/allOrNothingCorrectPointsEqualToAlternatePoints.js +235 -0
  66. package/cypress/e2e/ILC/TextSelection/Scoring/allOrNothingCorrectPointsMoreThanAlternatePoints.js +235 -0
  67. package/cypress/e2e/ILC/TextSelection/Scoring/partialDifferentWeightsBasic.js +457 -0
  68. package/cypress/e2e/ILC/TextSelection/Scoring/partialDifferentWeightsWithAlternativePointsGreaterThanCorrectPoints.js +342 -0
  69. package/cypress/e2e/ILC/TextSelection/Scoring/partialDifferentWeightsWithCorrectPointsEqualToAlternativePoints.js +342 -0
  70. package/cypress/e2e/ILC/TextSelection/Scoring/partialDifferentWeightsWithCorrectPointsGreaterThanAlternativePoints.js +342 -0
  71. package/cypress/e2e/ILC/TextSelection/Scoring/partialEqualWeightsBasic.js +155 -0
  72. package/cypress/e2e/ILC/TextSelection/Scoring/partialEqualWeightsWithAlternativePointsGreaterThanCorrectPoints.js +314 -0
  73. package/cypress/e2e/ILC/TextSelection/Scoring/partialEqualWeightsWithCorrectPointsEqualToAlternativePoints.js +275 -0
  74. package/cypress/e2e/ILC/TextSelection/Scoring/partialEqualWeightsWithCorrectPointsGreaterThanAlternativePoints.js +314 -0
  75. package/cypress/e2e/ILC/TextSelection/allOrNothingScoringForAllViews.smoke.js +290 -0
  76. package/cypress/e2e/ILC/TextSelection/checkAnswerFunctionalityForAllViews.smoke.js +142 -0
  77. package/cypress/e2e/ILC/TextSelection/previewContentsForAllViews.js +137 -0
  78. package/cypress/e2e/ILC/ToolSettings/toolSettingsContent.js +4 -4
  79. package/cypress/fixtures/theme/ilc.json +14 -26
  80. package/cypress/pages/brainingCampManipulativePage.js +122 -0
  81. package/cypress/pages/components/autoScoredScoringSectionMultiResponseType.js +1 -1
  82. package/cypress/pages/components/autoScoredSpecifyCorrectAnswerSection.js +3 -0
  83. package/cypress/pages/components/autoScoredStudentViewSettings.js +1 -1
  84. package/cypress/pages/components/colorPopupComponent.js +2 -2
  85. package/cypress/pages/components/defaultToolDropdown.js +77 -0
  86. package/cypress/pages/components/gridQuestionCommonComponent.js +629 -2
  87. package/cypress/pages/components/index.js +3 -0
  88. package/cypress/pages/components/maximumCapacityPerDropzoneComponent.js +1 -1
  89. package/cypress/pages/components/measuringToolComponent.js +2 -2
  90. package/cypress/pages/components/resetPopupComponent.js +74 -0
  91. package/cypress/pages/components/scoringSectionBaseEditTab.js +1 -1
  92. package/cypress/pages/components/setPointsPopupBase.js +6 -4
  93. package/cypress/pages/components/specifyRowsAndColumnsComponent.js +60 -3
  94. package/cypress/pages/components/toolSettingsComponent.js +80 -12
  95. package/cypress/pages/components/toolsAndControlsComponent.js +69 -0
  96. package/cypress/pages/dragAndDropIntoCategoriesPage.js +0 -8
  97. package/cypress/pages/feedbackScalePage copy.js +716 -0
  98. package/cypress/pages/feedbackScalePage.js +591 -449
  99. package/cypress/pages/fillInTheGapsOverImageDragAndDropPage.js +3 -1
  100. package/cypress/pages/graphingPage.js +9 -145
  101. package/cypress/pages/gridFillPage.js +135 -120
  102. package/cypress/pages/highlightPage.js +0 -394
  103. package/cypress/pages/index.js +5 -2
  104. package/cypress/pages/matchingPage.js +78 -20
  105. package/cypress/pages/multipleSelectionGridPage.js +88 -1
  106. package/cypress/pages/numberLinePage.js +723 -0
  107. package/cypress/pages/singleSelectionGridPage.js +86 -0
  108. package/cypress/pages/textSelectionPage.js +582 -0
  109. package/package.json +2 -2
@@ -0,0 +1,723 @@
1
+ import utilities from '../support/helpers/utilities';
2
+ import { createQuestionBasePage, toolsAndControlsComponent, questionInstructionsComponent, resetPopupComponent, scoringSectionBaseEditTab, autoScoredScoringPreviewTab, autoScoredSpecifyCorrectAnswerSection, commonComponents, autoScoredScoringSectionMultiResponseType, toolSettingsComponent, additionalSettingsPanel, additionalSettingsAccessibilitySectionComponent, autoScoredStudentViewSettings, randomizeOptionsComponent, studentViewSettingsLabelComponent, defaultToolDropdown } from './components';
3
+ const css = Cypress.env('css');
4
+
5
+ const selectors = {
6
+ ...toolsAndControlsComponent,
7
+ ...questionInstructionsComponent,
8
+ ...resetPopupComponent,
9
+ ...additionalSettingsPanel,
10
+ ...autoScoredStudentViewSettings,
11
+ ...autoScoredScoringPreviewTab,
12
+ ...randomizeOptionsComponent,
13
+ ...commonComponents,
14
+ ...defaultToolDropdown,
15
+ ...autoScoredScoringSectionMultiResponseType,
16
+
17
+ //Specify correct answer
18
+ numberLineSpecifyCorrectAnswer: () => cy.get('.ngie-accordion .ngie-jxgbox svg'),
19
+ numberLineToolOptionSpecifyCorrectAnswer: (toolOptionAriaLabel = null) => {
20
+ if (toolOptionAriaLabel) {
21
+ return cy.get(`.graph-tools-wrapper .single-select-toggle-group-double button[aria-label*="${toolOptionAriaLabel}"]`).eq(0)
22
+ } else {
23
+ return cy.get('.graph-tools-wrapper .single-select-toggle-group-double button')
24
+ }
25
+ },
26
+ numberLineControlOptionSpecifyCorrectAnswer: (toolOptionAriaLabel = null) => {
27
+ if (toolOptionAriaLabel) {
28
+ return cy.get(`[class*="GraphingToolsstyles__ControlsWrapper"] button[aria-label*="${toolOptionAriaLabel}"]`)
29
+ } else {
30
+ return cy.get('[class*="GraphingToolsstyles__ControlsWrapper"] button')
31
+ }
32
+ },
33
+ numberLineTitleSpecifyCorrectAnswerSection: () => cy.get('.correct-answer-accordion [class*="LineGraphstyles__TitleText"]'),
34
+ plotNumberLineToggleButton: () => cy.get('[data-ngie-testid="plot-number-line-tab"]'),
35
+ partialEqualWeightsPointsPerResponseScore: () => cy.get('.alternate-points-points-per-value-span'),
36
+
37
+ //Preview Tab
38
+ numberLinePreviewTab: () => cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox svg').eq(0),
39
+ numberLinePointPreviewTab: () => cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(0).find('svg ellipse[tabindex="0"]'),
40
+ numberLineSegmentPreviewTab: () => cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(0).find('[stroke-linecap="butt"]'),
41
+ numberLineToolOptionPreviewTab: (toolOptionAriaLabel = null) => {
42
+ if (toolOptionAriaLabel) {
43
+ return cy.get(`[class*="question-preview-wrapper"] .graph-tools-wrapper .single-select-toggle-group-double button[aria-label*="${toolOptionAriaLabel}"]`).eq(0)
44
+ } else {
45
+ return cy.get('[class*="question-preview-wrapper"] .graph-tools-wrapper .single-select-toggle-group-double button')
46
+ }
47
+ },
48
+ numberLineControlOptionPreviewTab: (toolOptionAriaLabel = null) => {
49
+ if (toolOptionAriaLabel) {
50
+ return cy.get(`[class*="question-preview-wrapper"] [class*="ControlsWrapper"] button[aria-label*="${toolOptionAriaLabel}"]`)
51
+ } else {
52
+ return cy.get('[class*="question-preview-wrapper"] [class*="ControlsWrapper"] button')
53
+ }
54
+ },
55
+ numberLineTitlePreviewTab: () => cy.get('.edit-question-preview-wrapper [class*="LineGraphstyles__TitleText"]'),
56
+
57
+ //Correct answer section
58
+ correctAnswersLabel: () => cy.get('[class*="AnswerLabel"]'),
59
+ correctIcon: () => cy.get('[data-icon="CorrectAnswer"]'),
60
+ incorrectIcon: () => cy.get('[data-icon="Incorrect"]'),
61
+ numberLineCorrectAnswerSection: () => cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox svg:visible').eq(1),
62
+ numberLinePointCorrectAnswerSection: () => cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(1).find('svg ellipse[tabindex="0"]'),
63
+ correctIncorrectAnswerTextWrapper: () => cy.get('[class*="CorrectIncorrectWrapper"]'),
64
+ numberLineTitleCorrectAnswerSection: () => cy.get('[class*="LineGraphstyles__TitleText"]').last()
65
+ }
66
+
67
+ const steps = {
68
+ ...createQuestionBasePage.steps,
69
+ ...toolsAndControlsComponent.steps,
70
+ ...questionInstructionsComponent.steps,
71
+ ...resetPopupComponent.steps,
72
+ ...scoringSectionBaseEditTab.steps,
73
+ ...additionalSettingsPanel.steps,
74
+ ...autoScoredStudentViewSettings.steps,
75
+ ...autoScoredScoringPreviewTab.steps,
76
+ ...autoScoredSpecifyCorrectAnswerSection.steps,
77
+ ...commonComponents.steps,
78
+ ...autoScoredScoringSectionMultiResponseType.steps,
79
+ ...defaultToolDropdown.steps,
80
+
81
+ /**
82
+ * @description This function selects the tool option from graph
83
+ * @param {string} toolOption aria label of the tool option to be selected
84
+ */
85
+ selectNumberLineToolOptionSpecifyCorrectAnswer: (toolOption) => {
86
+ numberLinePage.numberLineToolOptionSpecifyCorrectAnswer(toolOption)
87
+ .click();
88
+ },
89
+
90
+ /**
91
+ * @description This function selects the control option from graph
92
+ * @param {string} controlOption aria label of the control option to be selected
93
+ */
94
+ selectNumberLineControlOptionSpecifyCorrectAnswerSection: (controlOption) => {
95
+ numberLinePage.numberLineControlOptionSpecifyCorrectAnswer(controlOption)
96
+ .click();
97
+ },
98
+
99
+ /**
100
+ * This function plots points on the number line on Edit tab
101
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
102
+ * @param {number} coordinates[].x - x coordinate to be plotted on the graph
103
+ * @param {number} coordinates[].xRange - range of x coordinate
104
+ */
105
+ plotPointOnNumberLineSpecifyCorrectAnswer: (coordinates) => {
106
+ coordinates.forEach(({ x, xRange }) => {
107
+ numberLinePage.numberLineSpecifyCorrectAnswer()
108
+ .then(($graphElement) => {
109
+ const graphWidth = $graphElement[0].clientWidth;
110
+ const graphHeight = $graphElement[0].clientHeight;
111
+ const originX = graphWidth / 2;
112
+ const originY = graphHeight / 2;
113
+ const xPixel = originX + x * (graphWidth / xRange);
114
+ numberLinePage.numberLineSpecifyCorrectAnswer()
115
+ .click(xPixel, originY, { force: true });
116
+ });
117
+ });
118
+ },
119
+
120
+ /**
121
+ * This function verifies plotted points on the number line on Edit tab
122
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
123
+ * @param {number} coordinates[].x - x coordinate to be plotted on the graph
124
+ * @param {number} coordinates[].xRange - range of x coordinate
125
+ */
126
+ verifyPointsPlottedOnNumberLineSpecifyCorrectAnswer: (coordinates) => {
127
+ coordinates.forEach(({ x, xRange }) => {
128
+ numberLinePage.numberLineSpecifyCorrectAnswer()
129
+ .then(($graphElement) => {
130
+ const graphWidth = $graphElement[0].clientWidth;
131
+ const graphHeight = $graphElement[0].clientHeight;
132
+ const originX = graphWidth / 2;
133
+ const originY = graphHeight / 2;
134
+ const xPixel = originX + x * (graphWidth / xRange);
135
+ cy.get(`.ngie-accordion .ngie-jxgbox svg ellipse[cx*="${Math.floor(xPixel)}"][cy*="${Math.floor(originY)}"][tabindex="0"]`)
136
+ .should('exist');
137
+ });
138
+ });
139
+ },
140
+
141
+ /**
142
+ * This verifies line segment on the number line on Edit tab
143
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
144
+ * @param {number} coordinates[].x1 - x coordinate to be plotted on the graph
145
+ * @param {number} coordinates[].x1Range - range of x coordinate
146
+ * @param {number} coordinates[].x2 - x coordinate to be plotted on the graph
147
+ * @param {number} coordinates[].x2Range - range of x coordinate
148
+ */
149
+ verifyLineSegmentOnNumberLineSpecifyCorrectAnswer: (coordinates) => {
150
+ coordinates.forEach(({ x1, x1Range, x2, x2Range }) => {
151
+ numberLinePage.numberLineSpecifyCorrectAnswer()
152
+ .then(($graphElement) => {
153
+ const graphWidth = $graphElement[0].clientWidth;
154
+ const graphHeight = $graphElement[0].clientHeight;
155
+ const originX = graphWidth / 2;
156
+ const originY = graphHeight / 2;
157
+ const x1Pixel = originX + x1 * (graphWidth / x1Range);
158
+ const x2Pixel = originX + x2 * (graphWidth / x2Range);
159
+ cy.get(`.ngie-accordion .ngie-jxgbox svg [stroke-linecap="butt"][x1*="${Math.floor(x1Pixel)}"][y1*="${Math.floor(originY)}"][x2*="${Math.floor(x2Pixel)}"][y2*="${Math.floor(originY)}"]`)
160
+ .should('be.visible');
161
+ });
162
+ });
163
+ },
164
+
165
+ /**
166
+ * This function verifies plotted points not exist on the number line on Edit tab
167
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
168
+ * @param {number} coordinates[].x - x coordinate to be plotted on the graph
169
+ * @param {number} coordinates[].xRange - range of x coordinate
170
+ */
171
+ verifyPointsPlottedOnNumberLineNotExistSpecifyCorrectAnswer: (coordinates) => {
172
+ coordinates.forEach(({ x, xRange }) => {
173
+ numberLinePage.numberLineSpecifyCorrectAnswer()
174
+ .then(($graphElement) => {
175
+ const graphWidth = $graphElement[0].clientWidth;
176
+ const graphHeight = $graphElement[0].clientHeight;
177
+ const originX = graphWidth / 2;
178
+ const originY = graphHeight / 2;
179
+ const xPixel = originX + x * (graphWidth / xRange);
180
+ cy.get(`.ngie-accordion .ngie-jxgbox svg ellipse[cx*="${Math.floor(xPixel)}"][cy*="${Math.floor(originY)}"][tabindex="0"]`)
181
+ .should('not.exist');
182
+ });
183
+ });
184
+ },
185
+
186
+ verifyPointsPerResponseLabel: () => {
187
+ utilities.verifyInnerText(autoScoredScoringSectionMultiResponseType.pointsPerResponseLabel(), 'Points per response:\n-');
188
+ utilities.verifyElementVisibilityState(autoScoredScoringSectionMultiResponseType.pointsPerResponseLabel(), 'visible');
189
+ },
190
+
191
+ /**
192
+ * @param {number} optionIndex - The index of the option to verify the partial equal weights points per response score.
193
+ * @param {number} points - The expected points value to be verified.
194
+ * @description Verifies the partial equal weights points per response score for a specific option in the specify correct answer section for a multi-response type question.
195
+ */
196
+ verifyPartialEqualWeightsPointsPerResponseScore: (points) => {
197
+ utilities.verifyInnerText(numberLinePage.partialEqualWeightsPointsPerResponseScore(), `${points}`);
198
+ },
199
+
200
+ /**
201
+ * This function plots points on the number line on preview tab
202
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
203
+ * @param {number} coordinates[].x - x coordinate to be plotted on the graph
204
+ * @param {number} coordinates[].xRange - range of x coordinate
205
+ */
206
+ plotPointOnNumberLinePreviewTab: (coordinates) => {
207
+ coordinates.forEach(({ x, xRange }) => {
208
+ numberLinePage.numberLinePreviewTab()
209
+ .then(($graphElement) => {
210
+ const graphWidth = $graphElement[0].clientWidth;
211
+ const graphHeight = $graphElement[0].clientHeight;
212
+ const originX = graphWidth / 2;
213
+ const originY = graphHeight / 2;
214
+ const xPixel = originX + x * (graphWidth / xRange);
215
+ numberLinePage.numberLinePreviewTab()
216
+ .click(xPixel, originY, { force: true });
217
+ });
218
+ });
219
+ },
220
+
221
+ /**
222
+ * This verifies plotted points on the number line on preview tab
223
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
224
+ * @param {number} coordinates[].x - x coordinate to be plotted on the graph
225
+ * @param {number} coordinates[].xRange - range of x coordinate
226
+ */
227
+ verifyPointsPlottedOnNumberLinePreviewTab: (coordinates) => {
228
+ coordinates.forEach(({ x, xRange }) => {
229
+ numberLinePage.numberLinePreviewTab()
230
+ .then(($graphElement) => {
231
+ const graphWidth = $graphElement[0].clientWidth;
232
+ const graphHeight = $graphElement[0].clientHeight;
233
+ const originX = graphWidth / 2;
234
+ const originY = graphHeight / 2;
235
+ const xPixel = originX + x * (graphWidth / xRange);
236
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(0).find(`svg ellipse[cx*="${Math.floor(xPixel)}"][cy*="${Math.floor(originY)}"][tabindex="0"]`)
237
+ .should('exist');
238
+ });
239
+ });
240
+ },
241
+
242
+ /**
243
+ * This function verifies points not exist on the number line on preview tab
244
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
245
+ * @param {number} coordinates[].x - x coordinate to be plotted on the graph
246
+ * @param {number} coordinates[].xRange - range of x coordinate
247
+ */
248
+ verifyPointsNotExistOnNumberLinePreviewTab: (coordinates) => {
249
+ coordinates.forEach(({ x, xRange }) => {
250
+ numberLinePage.numberLinePreviewTab()
251
+ .then(($graphElement) => {
252
+ const graphWidth = $graphElement[0].clientWidth;
253
+ const graphHeight = $graphElement[0].clientHeight;
254
+ const originX = graphWidth / 2;
255
+ const originY = graphHeight / 2;
256
+ const xPixel = originX + x * (graphWidth / xRange);
257
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(0).find(`svg ellipse[cx*="${Math.floor(xPixel)}"][cy*="${Math.floor(originY)}"][tabindex="0"]`)
258
+ .should('not.exist');
259
+ });
260
+ });
261
+ },
262
+
263
+ /**
264
+ * This function verifies correct points on the number line on Edit tab
265
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
266
+ * @param {number} coordinates[].x - x coordinate to be plotted on the graph
267
+ * @param {number} coordinates[].xRange - range of x coordinate
268
+ */
269
+ verifyCorrectPointsOnNumberLinePreviewTab: (coordinates) => {
270
+ coordinates.forEach(({ x, xRange }) => {
271
+ numberLinePage.numberLinePreviewTab()
272
+ .then(($graphElement) => {
273
+ const graphWidth = $graphElement[0].clientWidth;
274
+ const graphHeight = $graphElement[0].clientHeight;
275
+ const originX = graphWidth / 2;
276
+ const originY = graphHeight / 2;
277
+ const xPixel = originX + x * (graphWidth / xRange);
278
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(0).find(`svg ellipse[cx*="${Math.floor(xPixel)}"][cy*="${Math.floor(originY)}"][tabindex="0"]`)
279
+ .should('have.css', 'stroke', css.color.correctAnswer);
280
+ });
281
+ });
282
+ },
283
+
284
+ /**
285
+ * This function verifies incorrect points on the number line on preview tab
286
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
287
+ * @param {number} coordinates[].x - x coordinate to be plotted on the graph
288
+ * @param {number} coordinates[].xRange - range of x coordinate
289
+ */
290
+ verifyIncorrectPointsOnNumberLinePreviewTab: (coordinates) => {
291
+ coordinates.forEach(({ x, xRange }) => {
292
+ numberLinePage.numberLinePreviewTab()
293
+ .then(($graphElement) => {
294
+ const graphWidth = $graphElement[0].clientWidth;
295
+ const graphHeight = $graphElement[0].clientHeight;
296
+ const originX = graphWidth / 2;
297
+ const originY = graphHeight / 2;
298
+ const xPixel = originX + x * (graphWidth / xRange);
299
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(0).find(`svg ellipse[cx*="${Math.floor(xPixel)}"][cy*="${Math.floor(originY)}"][tabindex="0"]`)
300
+ .should('have.css', 'stroke', css.color.incorrectAnswer);
301
+ });
302
+ });
303
+ },
304
+
305
+ /**
306
+ * This function plots points on the number line on Edit tab
307
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
308
+ * @param {number} coordinates[].x1 - x coordinate to be plotted on the graph
309
+ * @param {number} coordinates[].x1Range - range of x coordinate
310
+ * @param {number} coordinates[].x2 - x coordinate to be plotted on the graph
311
+ * @param {number} coordinates[].x2Range - range of x coordinate
312
+ */
313
+ verifyLineSegmentOnNumberLinePreviewTab: (coordinates) => {
314
+ coordinates.forEach(({ x1, x1Range, x2, x2Range }) => {
315
+ numberLinePage.numberLinePreviewTab()
316
+ .then(($graphElement) => {
317
+ const graphWidth = $graphElement[0].clientWidth;
318
+ const graphHeight = $graphElement[0].clientHeight;
319
+ const originX = graphWidth / 2;
320
+ const originY = graphHeight / 2;
321
+ const x1Pixel = originX + x1 * (graphWidth / x1Range);
322
+ const x2Pixel = originX + x2 * (graphWidth / x2Range);
323
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(0).find(`[stroke-linecap="butt"][x1*="${Math.floor(x1Pixel)}"][y1*="${Math.floor(originY)}"][x2*="${Math.floor(x2Pixel)}"][y2*="${Math.floor(originY)}"]`)
324
+ .should('be.visible');
325
+ });
326
+ });
327
+ },
328
+
329
+
330
+ /**
331
+ * This function verifies correct points on the number line on Edit tab
332
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
333
+ * @param {number} coordinates[].x1 - x coordinate to be plotted on the graph
334
+ * @param {number} coordinates[].x1Range - range of x coordinate
335
+ * @param {number} coordinates[].x2 - x coordinate to be plotted on the graph
336
+ * @param {number} coordinates[].x2Range - range of x coordinate
337
+ */
338
+ verifyCorrectLineSegmentOnNumberLinePreviewTab: (coordinates) => {
339
+ coordinates.forEach(({ x1, x1Range, x2, x2Range }) => {
340
+ numberLinePage.numberLinePreviewTab()
341
+ .then(($graphElement) => {
342
+ const graphWidth = $graphElement[0].clientWidth;
343
+ const graphHeight = $graphElement[0].clientHeight;
344
+ const originX = graphWidth / 2;
345
+ const originY = graphHeight / 2;
346
+ const x1Pixel = originX + x1 * (graphWidth / x1Range);
347
+ const x2Pixel = originX + x2 * (graphWidth / x2Range);
348
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(0).find(`[stroke-linecap="butt"][x1*="${Math.floor(x1Pixel)}"][y1*="${Math.floor(originY)}"][x2*="${Math.floor(x2Pixel)}"][y2*="${Math.floor(originY)}"]`)
349
+ .should('have.css', 'stroke', css.color.correctAnswer);
350
+ });
351
+ });
352
+ },
353
+
354
+ /**
355
+ * This function verifies incorrect points on the number line on Edit tab
356
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
357
+ * @param {number} coordinates[].x1 - x coordinate to be plotted on the graph
358
+ * @param {number} coordinates[].x1Range - range of x coordinate
359
+ * @param {number} coordinates[].x2 - x coordinate to be plotted on the graph
360
+ * @param {number} coordinates[].x2Range - range of x coordinate
361
+ */
362
+ verifyIncorrectLineSegmentOnNumberLinePreviewTab: (coordinates) => {
363
+ coordinates.forEach(({ x1, x1Range, x2, x2Range }) => {
364
+ numberLinePage.numberLinePreviewTab()
365
+ .then(($graphElement) => {
366
+ const graphWidth = $graphElement[0].clientWidth;
367
+ const graphHeight = $graphElement[0].clientHeight;
368
+ const originX = graphWidth / 2;
369
+ const originY = graphHeight / 2;
370
+ const x1Pixel = originX + x1 * (graphWidth / x1Range);
371
+ const x2Pixel = originX + x2 * (graphWidth / x2Range);
372
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(0).find(`[stroke-linecap="butt"][x1*="${Math.floor(x1Pixel)}"][y1*="${Math.floor(originY)}"][x2*="${Math.floor(x2Pixel)}"][y2*="${Math.floor(originY)}"]`)
373
+ .should('have.css', 'stroke', css.color.incorrectAnswer);
374
+ });
375
+ });
376
+ },
377
+
378
+ /**
379
+ * This function verifies points does not exist on the number line on Edit tab
380
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
381
+ * @param {number} coordinates[].x1 - x coordinate to be plotted on the graph
382
+ * @param {number} coordinates[].x1Range - range of x coordinate
383
+ * @param {number} coordinates[].x2 - x coordinate to be plotted on the graph
384
+ * @param {number} coordinates[].x2Range - range of x coordinate
385
+ */
386
+ verifyLineSegmentOnNumberLineNotExistPreviewTab: (coordinates) => {
387
+ coordinates.forEach(({ x1, x1Range, x2, x2Range }) => {
388
+ numberLinePage.numberLinePreviewTab()
389
+ .then(($graphElement) => {
390
+ const graphWidth = $graphElement[0].clientWidth;
391
+ const graphHeight = $graphElement[0].clientHeight;
392
+ const originX = graphWidth / 2;
393
+ const originY = graphHeight / 2;
394
+ const x1Pixel = originX + x1 * (graphWidth / x1Range);
395
+ const x2Pixel = originX + x2 * (graphWidth / x2Range);
396
+ cy.get(`[class*="PreviewTabstyles__ContentWrapper"] .ngie-jxgbox svg [stroke-linecap="butt"][x1*="${Math.floor(x1Pixel)}"][y1*="${Math.floor(originY)}"][x2*="${Math.floor(x2Pixel)}"][y2*="${Math.floor(originY)}"]`)
397
+ .should('not.exist');
398
+ });
399
+ });
400
+ },
401
+
402
+ /**
403
+ * @description This function selects the tool option from graph
404
+ * @param {string} toolOption aria label of the tool option to be selected
405
+ */
406
+ selectNumberLineToolOptionPreviewTab: (toolOption) => {
407
+ numberLinePage.numberLineToolOptionPreviewTab(toolOption)
408
+ .click();
409
+ },
410
+
411
+ /**
412
+ * @description This function verifies the tool option is in selected state
413
+ * @param {string} toolOption aria label of the tool option to be verified selected
414
+ */
415
+ verifyToolOptionSelectedPreviewTab: (toolOptionAriaLabel) => {
416
+ numberLinePage.numberLineToolOptionPreviewTab(toolOptionAriaLabel)
417
+ .should('have.class', 'single-select-toggle-button-selected');
418
+ },
419
+
420
+ /**
421
+ * @description This function verifies the tool option is not in selected state
422
+ * @param {string} toolOption aria label of the tool option to be verified not selected
423
+ */
424
+ verifyToolOptionNotSelectedPreviewTab: (toolOptionAriaLabelArray) => {
425
+ toolOptionAriaLabelArray.forEach((toolOptionAriaLabel) => {
426
+ numberLinePage.numberLineToolOptionPreviewTab(toolOptionAriaLabel)
427
+ .should('not.have.class', 'single-select-toggle-button-selected');
428
+ });
429
+ },
430
+
431
+ /**
432
+ * @description This function selects the control option from graph
433
+ * @param {string} controlOption aria label of the control option to be selected
434
+ */
435
+ selectNumberLineControlOptionPreviewTab: (controlOption) => {
436
+ numberLinePage.numberLineControlOptionPreviewTab(controlOption)
437
+ .click();
438
+ },
439
+
440
+ /**
441
+ * @description This function verifies the tool option is in selected state
442
+ * @param {string} toolOption aria label of the tool option to be verified selected
443
+ */
444
+ verifyToolOptionSelectedSpecifyCorrectAnswerSection: (toolOptionAriaLabel) => {
445
+ numberLinePage.numberLineToolOptionSpecifyCorrectAnswer(toolOptionAriaLabel)
446
+ .eq(0)
447
+ .should('have.class', 'single-select-toggle-button-selected');
448
+ },
449
+
450
+ /**
451
+ * @description This function verifies the tool option is not in selected state
452
+ * @param {string} toolOption aria label of the tool option to be verified not selected
453
+ */
454
+ verifyToolOptionNotSelectedSpecifyCorrectAnswerSection: (toolOptionAriaLabelArray) => {
455
+ toolOptionAriaLabelArray.forEach((toolOptionAriaLabel) => {
456
+ numberLinePage.numberLineToolOptionSpecifyCorrectAnswer(toolOptionAriaLabel)
457
+ .should('not.have.class', 'single-select-toggle-button-selected');
458
+ });
459
+ },
460
+ //Correct answer section
461
+
462
+ /**
463
+ * This function verifies plotted points on the number line on c tab
464
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
465
+ * @param {number} coordinates[].x - x coordinate to be plotted on the graph
466
+ * @param {number} coordinates[].xRange - range of x coordinate
467
+ */
468
+ verifyPointsPlottedOnNumberLineCorrectAnswerSection: (coordinates) => {
469
+ coordinates.forEach(({ x, xRange }) => {
470
+ numberLinePage.numberLineCorrectAnswerSection()
471
+ .then(($graphElement) => {
472
+ const graphWidth = $graphElement[0].clientWidth;
473
+ const graphHeight = $graphElement[0].clientHeight;
474
+ const originX = graphWidth / 2;
475
+ const originY = graphHeight / 2;
476
+ const xPixel = originX + x * (graphWidth / xRange);
477
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(1).find(`svg ellipse[cx*="${Math.floor(xPixel)}"][cy*="${Math.floor(originY)}"][pointer-events="visiblePainted"]`)
478
+ .should('exist');
479
+ });
480
+ });
481
+ },
482
+
483
+ /**
484
+ * This function verifies correct plotted points on the number line on c tab
485
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
486
+ * @param {number} coordinates[].x - x coordinate to be plotted on the graph
487
+ * @param {number} coordinates[].xRange - range of x coordinate
488
+ */
489
+ verifyCorrectPointsOnNumberLineCorrectAnswerSection: (coordinates) => {
490
+ coordinates.forEach(({ x, xRange }) => {
491
+ numberLinePage.numberLineCorrectAnswerSection()
492
+ .then(($graphElement) => {
493
+ const graphWidth = $graphElement[0].clientWidth;
494
+ const graphHeight = $graphElement[0].clientHeight;
495
+ const originX = graphWidth / 2;
496
+ const originY = graphHeight / 2;
497
+ const xPixel = originX + x * (graphWidth / xRange);
498
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(1).find(`svg ellipse[cx*="${Math.floor(xPixel)}"][cy*="${Math.floor(originY)}"][pointer-events="visiblePainted"]`)
499
+ .should('have.css', 'stroke', css.color.correctAnswer);
500
+ });
501
+ });
502
+ },
503
+
504
+
505
+ /**
506
+ * This function verifies incorrect plotted points on the number line on c tab
507
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
508
+ * @param {number} coordinates[].x - x coordinate to be plotted on the graph
509
+ * @param {number} coordinates[].xRange - range of x coordinate
510
+ */
511
+ verifyIncorrectPointsOnNumberLineCorrectAnswerSection: (coordinates) => {
512
+ coordinates.forEach(({ x, xRange }) => {
513
+ numberLinePage.numberLineCorrectAnswerSection()
514
+ .then(($graphElement) => {
515
+ const graphWidth = $graphElement[0].clientWidth;
516
+ const graphHeight = $graphElement[0].clientHeight;
517
+ const originX = graphWidth / 2;
518
+ const originY = graphHeight / 2;
519
+ const xPixel = originX + x * (graphWidth / xRange);
520
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(1).find(`svg ellipse[cx*="${Math.floor(xPixel)}"][cy*="${Math.floor(originY)}"][pointer-events="visiblePainted"]`)
521
+ .should('have.css', 'stroke', css.color.incorrectAnswer);
522
+ });
523
+ });
524
+ },
525
+
526
+ /**
527
+ * This function verifies line plotted points on the number line on c tab
528
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
529
+ * @param {number} coordinates[].x1 - x coordinate to be plotted on the graph
530
+ * @param {number} coordinates[].x1Range - range of x coordinate
531
+ * @param {number} coordinates[].x2 - x coordinate to be plotted on the graph
532
+ * @param {number} coordinates[].x2Range - range of x coordinate
533
+ */
534
+ verifyLineSegmentOnNumberLineCorrectAnswerSection: (coordinates) => {
535
+ coordinates.forEach(({ x1, x1Range, x2, x2Range }) => {
536
+ numberLinePage.numberLineCorrectAnswerSection()
537
+ .then(($graphElement) => {
538
+ const graphWidth = $graphElement[0].clientWidth;
539
+ const graphHeight = $graphElement[0].clientHeight;
540
+ const originX = graphWidth / 2;
541
+ const originY = graphHeight / 2;
542
+ const x1Pixel = originX + x1 * (graphWidth / x1Range);
543
+ const x2Pixel = originX + x2 * (graphWidth / x2Range);
544
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(1).find(`[stroke-linecap="butt"][x1*="${Math.floor(x1Pixel)}"][y1*="${Math.floor(originY)}"][x2*="${Math.floor(x2Pixel)}"][y2*="${Math.floor(originY)}"]`)
545
+ .should('be.visible');
546
+ });
547
+ });
548
+ },
549
+
550
+ /**
551
+ * This function verifies correct plotted points on the number line on c tab
552
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
553
+ * @param {number} coordinates[].x1 - x coordinate to be plotted on the graph
554
+ * @param {number} coordinates[].x1Range - range of x coordinate
555
+ * @param {number} coordinates[].x2 - x coordinate to be plotted on the graph
556
+ * @param {number} coordinates[].x2Range - range of x coordinate
557
+ */
558
+ verifyCorrectLineSegmentOnNumberLineCorrectAnswerSection: (coordinates) => {
559
+ coordinates.forEach(({ x1, x1Range, x2, x2Range }) => {
560
+ numberLinePage.numberLineCorrectAnswerSection()
561
+ .then(($graphElement) => {
562
+ const graphWidth = $graphElement[0].clientWidth;
563
+ const graphHeight = $graphElement[0].clientHeight;
564
+ const originX = graphWidth / 2;
565
+ const originY = graphHeight / 2;
566
+ const x1Pixel = originX + x1 * (graphWidth / x1Range);
567
+ const x2Pixel = originX + x2 * (graphWidth / x2Range);
568
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(1).find(`[stroke-linecap="butt"][x1*="${Math.floor(x1Pixel)}"][y1*="${Math.floor(originY)}"][x2*="${Math.floor(x2Pixel)}"][y2*="${Math.floor(originY)}"]`)
569
+ .should('have.css', 'stroke', css.color.correctAnswer);
570
+ });
571
+ });
572
+ },
573
+
574
+ /**
575
+ * This function verifies incorrect plotted points on the number line on c tab
576
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
577
+ * @param {number} coordinates[].x1 - x coordinate to be plotted on the graph
578
+ * @param {number} coordinates[].x1Range - range of x coordinate
579
+ * @param {number} coordinates[].x2 - x coordinate to be plotted on the graph
580
+ * @param {number} coordinates[].x2Range - range of x coordinate
581
+ */
582
+ verifyIncorrectLineSegmentOnNumberLineCorrectAnswerSection: (coordinates) => {
583
+ coordinates.forEach(({ x1, x1Range, x2, x2Range }) => {
584
+ numberLinePage.numberLineCorrectAnswerSection()
585
+ .then(($graphElement) => {
586
+ const graphWidth = $graphElement[0].clientWidth;
587
+ const graphHeight = $graphElement[0].clientHeight;
588
+ const originX = graphWidth / 2;
589
+ const originY = graphHeight / 2;
590
+ const x1Pixel = originX + x1 * (graphWidth / x1Range);
591
+ const x2Pixel = originX + x2 * (graphWidth / x2Range);
592
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(1).find(`[stroke-linecap="butt"][x1*="${Math.floor(x1Pixel)}"][y1*="${Math.floor(originY)}"][x2*="${Math.floor(x2Pixel)}"][y2*="${Math.floor(originY)}"]`)
593
+ .should('have.css', 'stroke', css.color.incorrectAnswer);
594
+ });
595
+ });
596
+ },
597
+
598
+ /**
599
+ * This function verifies plotted points not exist on the number line on c tab
600
+ * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
601
+ * @param {number} coordinates[].x1 - x coordinate to be plotted on the graph
602
+ * @param {number} coordinates[].x1Range - range of x coordinate
603
+ * @param {number} coordinates[].x2 - x coordinate to be plotted on the graph
604
+ * @param {number} coordinates[].x2Range - range of x coordinate
605
+ */
606
+ verifyLineSegmentOnNumberLineNotExistCorrectAnswerSection: (coordinates) => {
607
+ coordinates.forEach(({ x1, x1Range, x2, x2Range }) => {
608
+ numberLinePage.numberLineCorrectAnswerSection()
609
+ .then(($graphElement) => {
610
+ const graphWidth = $graphElement[0].clientWidth;
611
+ const graphHeight = $graphElement[0].clientHeight;
612
+ const originX = graphWidth / 2;
613
+ const originY = graphHeight / 2;
614
+ const x1Pixel = originX + x1 * (graphWidth / x1Range);
615
+ const x2Pixel = originX + x2 * (graphWidth / x2Range);
616
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(1).find(`svg [stroke-linecap="butt"][x1*="${Math.floor(x1Pixel)}"][y1*="${Math.floor(originY)}"][x2*="${Math.floor(x2Pixel)}"][y2*="${Math.floor(originY)}"]`)
617
+ .should('not.exist');
618
+ });
619
+ });
620
+ },
621
+
622
+ verifyPlotNumberLineSelected: () => {
623
+ numberLinePage.plotNumberLineToggleButton()
624
+ .should('have.attr', 'aria-selected', 'true');
625
+ },
626
+
627
+ verifyCorrectAnswerSectionNotExist: () => {
628
+ utilities.verifyElementVisibilityState(numberLinePage.numberLineCorrectAnswerSection(), 'notExist');
629
+ },
630
+
631
+ /**
632
+ * @param {("correct" | "incorrect")} answerStatus - The status of the answer.
633
+ * @description Verifies the visibility and content of the correct/incorrect answer label block.
634
+ * If the answer is correct, it also verifies the visibility of the correct icon;
635
+ * otherwise, it verifies the visibility of the incorrect icon.
636
+ */
637
+ verifyCorrectIncorrectAnswerLabel: (answerStatus) => {
638
+ utilities.verifyInnerText(numberLinePage.correctIncorrectAnswerTextWrapper(), `Your answer is\n${answerStatus}`)
639
+ numberLinePage.correctIncorrectAnswerTextWrapper()
640
+ .within(() => {
641
+ if (answerStatus === 'correct') {
642
+ utilities.verifyElementVisibilityState(numberLinePage.correctIcon(), 'visible');
643
+ } else {
644
+ utilities.verifyElementVisibilityState(numberLinePage.incorrectIcon(), 'visible');
645
+ }
646
+ });
647
+ }
648
+ }
649
+
650
+ const tests = {
651
+ ...resetPopupComponent.tests,
652
+ ...toolSettingsComponent.tests,
653
+ ...additionalSettingsAccessibilitySectionComponent.tests,
654
+ ...additionalSettingsPanel.tests,
655
+ ...studentViewSettingsLabelComponent.tests,
656
+ ...autoScoredStudentViewSettings.tests,
657
+ ...autoScoredSpecifyCorrectAnswerSection.tests,
658
+ ...createQuestionBasePage.tests,
659
+ ...commonComponents.tests,
660
+ ...autoScoredScoringPreviewTab.tests,
661
+ ...defaultToolDropdown.tests,
662
+ ...scoringSectionBaseEditTab.tests,
663
+ ...autoScoredScoringSectionMultiResponseType.tests,
664
+
665
+ verifyContentsOfSpecifyCorrectAnswerSection: () => {
666
+ it('When user selects a scoring type then in the \'Correct\' accordion, all the contents should be displayed', () => {
667
+ utilities.verifyElementVisibilityState(numberLinePage.numberLineSpecifyCorrectAnswer(), 'visible');
668
+ utilities.verifyElementVisibilityState(numberLinePage.numberLineToolOptionSpecifyCorrectAnswer(), 'visible');
669
+ utilities.verifyElementVisibilityState(numberLinePage.numberLineControlOptionSpecifyCorrectAnswer(), 'visible');
670
+ utilities.verifyElementVisibilityState(numberLinePage.numberLineTitleSpecifyCorrectAnswerSection(), 'exist');
671
+ });
672
+ },
673
+
674
+ /**
675
+ * Verifies the contents and functionality of the 'Specify correct answer' accordion for multiple selection questions.
676
+ * @param {{'Correct' | 'Alternative'}} accordionName - The name of the accordion to be used in the validation.
677
+ * @example - verifySpecifyCorrectAnswerAccordionContentsAndFunctionality('Correct');
678
+ */
679
+ verifySpecifyCorrectAnswerAccordionContentsAndFunctionality: (accordionName) => {
680
+ it(`The user should be able to plot points on number line in the specify correct answer section ${accordionName} accordion`, () => {
681
+ numberLinePage.steps.plotPointOnNumberLineSpecifyCorrectAnswer([{ x: 0, xRange: 20 }, { x: 1, xRange: 20 }]);
682
+ numberLinePage.steps.verifyPointsPlottedOnNumberLineSpecifyCorrectAnswer([{ x: 0, xRange: 20 }, { x: 1, xRange: 20 }]);
683
+ });
684
+
685
+ it(`When the user resets the number line in the ${accordionName} accordion, \'Error: Please set a correct answer.\' error message should be thrown along with an error icon on the \'${accordionName}\' accordion`, () => {
686
+ numberLinePage.steps.selectNumberLineControlOptionSpecifyCorrectAnswerSection('Reset');
687
+ numberLinePage.steps.confirmReset();
688
+ utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'visible');
689
+ utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: Please set a correct answer.');
690
+ if (accordionName == 'Correct') {
691
+ autoScoredSpecifyCorrectAnswerSection.correctAnswerAccordion()
692
+ .within(() => {
693
+ utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.specifyCorrectAnswerErrorIcon(), 'visible');
694
+ });
695
+ } else {
696
+ autoScoredSpecifyCorrectAnswerSection.alternativeAnswerAccordion()
697
+ .within(() => {
698
+ utilities.verifyElementVisibilityState(autoScoredSpecifyCorrectAnswerSection.specifyCorrectAnswerErrorIcon(), 'visible');
699
+ });
700
+ };
701
+ });
702
+
703
+ autoScoredSpecifyCorrectAnswerSection.tests.verifyAutoScoredCorrectAnswerErrorMessageCSSAndA11y();
704
+
705
+ it('When the user plots on the number line then the error message should disappear', () => {
706
+ numberLinePage.steps.plotPointOnNumberLineSpecifyCorrectAnswer([{ x: 0, xRange: 20 }, { x: 1, xRange: 20 }]);
707
+ numberLinePage.steps.verifyPointsPlottedOnNumberLineSpecifyCorrectAnswer([{ x: 0, xRange: 20 }, { x: 1, xRange: 20 }]);
708
+ });
709
+
710
+ autoScoredSpecifyCorrectAnswerSection.tests.verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty(accordionName);
711
+
712
+ it('Accessibility of \'Correct\' accordion contents', { tags: 'a11y' }, () => {
713
+ cy.checkAccessibility(numberLinePage.numberLineSpecifyCorrectAnswer());
714
+ });
715
+ }
716
+
717
+ }
718
+
719
+ export const numberLinePage = {
720
+ ...selectors,
721
+ steps,
722
+ tests
723
+ }