itemengine-cypress-automation 1.0.193-packageUpdated-b3f3d0b.0 → 1.0.193
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.
- package/cypress/e2e/ILC/AudioPlayerNew/allSupportedFileTypes.js +3 -3
- package/cypress/e2e/ILC/AudioPlayerNew/audioOverviewAndTranscript.js +568 -0
- package/cypress/e2e/ILC/AudioPlayerNew/barAudioPlayerStyle.js +4 -4
- package/cypress/e2e/ILC/AudioPlayerNew/compactAudioPlayerStyle.js +5 -5
- package/cypress/e2e/ILC/AudioPlayerNew/customizePlayerLayoutSettings.js +2 -2
- package/cypress/e2e/ILC/AudioPlayerNew/headerSection.js +125 -0
- package/cypress/e2e/ILC/AudioPlayerNew/previewContents.smoke.js +5 -5
- package/cypress/e2e/ILC/AudioPlayerNew/standardAudioPlayerStyle.js +4 -4
- package/cypress/e2e/ILC/AudioPlayerNew/studentViewSettings.js +3 -3
- package/cypress/e2e/ILC/AudioPlayerNew/uploadAndAddAudioFile.js +19 -17
- package/cypress/e2e/ILC/ChartsBar/previewContentsForAllViews.smoke.js +7 -4
- package/cypress/e2e/ILC/ChartsLine/allOrNothingScoringForAllViews.smoke.js +366 -0
- package/cypress/e2e/ILC/ChartsLine/checkAnswerFunctionalityForAllViews.smoke.js +183 -0
- package/cypress/e2e/ILC/ChartsLine/gradingViewAndCorrectAnswerView.smoke.js +281 -0
- package/cypress/e2e/ILC/ChartsLine/previewContentsForAllViews.smoke.js +595 -0
- package/cypress/e2e/ILC/GridFill/allOrNothingBasicForAllViews.smoke.js +8 -8
- package/cypress/e2e/ILC/ImageHighlight/Scoring/allOrNothingWithAlternativePointsGreaterThanCorrectPoints.js +241 -0
- package/cypress/e2e/ILC/ImageHighlight/Scoring/allOrNothingWithCorrectPointsEqualToAlternativePoints.js +241 -0
- package/cypress/e2e/ILC/ImageHighlight/Scoring/allOrNothingWithCorrectPointsGreaterThanAlternatePoints.js +285 -0
- package/cypress/e2e/ILC/ImageHighlight/Scoring/manuallyAndNonScored.js +164 -0
- package/cypress/e2e/ILC/ImageHighlight/Scoring/partialDifferentWeightsAlternativePointsGreaterThanCorrectPoints.js +281 -0
- package/cypress/e2e/ILC/ImageHighlight/Scoring/partialDifferentWeightsScoring.js +467 -0
- package/cypress/e2e/ILC/ImageHighlight/Scoring/partialDifferentWeightsWithCorrectPointsEqualToAlternativePoints.js +250 -0
- package/cypress/e2e/ILC/ImageHighlight/Scoring/partialDifferentWeigtsCorrectPointsGreaterThanAlternativePoints.js +281 -0
- package/cypress/e2e/ILC/ImageHighlight/Scoring/partialEqualWeightsAlternativePointsGreaterThanCorrectPoints.js +260 -0
- package/cypress/e2e/ILC/ImageHighlight/Scoring/partialEqualWeightsScoring.js +184 -0
- package/cypress/e2e/ILC/ImageHighlight/Scoring/partialEqualWeightsWithCorrectPointsEqualToAlternativePoints.js +229 -0
- package/cypress/e2e/ILC/ImageHighlight/Scoring/partialEqualWeightsWithCorrectPointsGreaterThanAlternativePoints.js +261 -0
- package/cypress/e2e/ILC/chartsDotsPlot/allOrNothingForAllViews.smoke.js +409 -0
- package/cypress/e2e/ILC/chartsDotsPlot/checkAnswerFunctionalityForAllViews.smoke.js +199 -0
- package/cypress/e2e/ILC/chartsDotsPlot/gradingViewAndCorrectAnswerView.smoke.js +223 -0
- package/cypress/e2e/ILC/chartsDotsPlot/previewContentsForAllViews.smoke.js +402 -0
- package/cypress/pages/audioPlayerPage.js +229 -9
- package/cypress/pages/chartsBarPage.js +2 -70
- package/cypress/pages/chartsDotPlotPage.js +986 -3
- package/cypress/pages/chartsLinePage.js +368 -9
- package/cypress/pages/components/autoScoredScoringSectionMultiResponseType.js +0 -1
- package/cypress/pages/components/autoScoredSpecifyCorrectAnswerSection.js +3 -0
- package/cypress/pages/components/backgroundImageUploadComponent.js +1 -1
- package/cypress/pages/components/barAndLineChartComponent.js +27 -1
- package/cypress/pages/components/chartsCommonComponent.js +31 -2
- package/cypress/pages/components/createQuestionBasePage.js +1 -0
- package/cypress/pages/components/layoutSectionComponent.js +2 -2
- package/cypress/pages/components/singleMultipleSelectionModeComponent.js +5 -0
- package/cypress/pages/components/toolSettingsComponent.js +2 -2
- package/cypress/pages/feedbackScalePage.js +1 -1
- package/cypress/pages/gridFillPage.js +13 -6
- package/cypress/pages/imageHighlightPage.js +308 -2
- package/cypress/pages/numberLinePage.js +40 -16
- package/cypress/pages/videoResponsePage.js +350 -6
- package/package.json +1 -1
@@ -1,8 +1,991 @@
|
|
1
|
+
import utilities from "../support/helpers/utilities"
|
2
|
+
import { createQuestionBasePage, questionInstructionsComponent, resetPopupComponent, scoringSectionBaseEditTab, chartsCommonComponent, commonComponents, autoScoredStudentViewSettings, autoScoredScoringPreviewTab, layoutSectionComponent, autoScoredSpecifyCorrectAnswerSection, correctIncorrectAnswerLabelComponent } from "./components";
|
3
|
+
const css = Cypress.env('css');
|
4
|
+
|
1
5
|
const selectors = {
|
2
|
-
|
3
|
-
|
6
|
+
...questionInstructionsComponent,
|
7
|
+
...chartsCommonComponent,
|
8
|
+
...commonComponents,
|
9
|
+
...autoScoredStudentViewSettings,
|
10
|
+
...correctIncorrectAnswerLabelComponent,
|
11
|
+
|
12
|
+
dotPlotToggleButton: () => cy.get('[data-ngie-testid="dot-plot-toggle-button"]'),
|
13
|
+
minInputFieldSelectChartType: () => cy.get('input[aria-label="Min"]'),
|
14
|
+
maxInputFieldSelectChartType: () => cy.get('input[aria-label="Max"]'),
|
15
|
+
dotColumnSelectChartType: () => cy.get('.ngie-dot-plot-chart .ngie-chart-point'),
|
16
|
+
lockUnlockButtonSelectChartType: () => cy.get('.ngie-dot-plot-chart .lock-reset-icon-wrapper button'),
|
17
|
+
dotColumnLockIcon: () => cy.get('[class*="LockIconWrapper"]'),
|
18
|
+
tooltipWrapperSelectChartType: () => cy.get('.ngie-dot-plot-chart .charts-tooltip-wrapper'),
|
19
|
+
addButtonSelectChartType: () => cy.get('.ngie-dot-plot-chart .charts-tooltip-wrapper [aria-label*="plus"]'),
|
20
|
+
minusButtonSelectChartType: () => cy.get('.ngie-dot-plot-chart .charts-tooltip-wrapper [aria-label*="minus"]'),
|
21
|
+
dotIconSelectChartType: () => cy.get('.ngie-dot-plot-chart .dot-icon'),
|
22
|
+
controlOptionsWrapperSelectChartType: () => cy.get('.ngie-dot-plot-chart .charts-toolbar-wrapper'),
|
23
|
+
controlOptionsSelectChartType: (toolOptionAriaLabel = null) => {
|
24
|
+
if (toolOptionAriaLabel) {
|
25
|
+
return cy.get(`.ngie-dot-plot-chart .chart-controls button[aria-label*="${toolOptionAriaLabel}"]`)
|
26
|
+
} else {
|
27
|
+
return cy.get('.ngie-dot-plot-chart .chart-controls button')
|
28
|
+
}
|
29
|
+
},
|
30
|
+
//Specify correct answer
|
31
|
+
dotColumnSpecifyCorrectAnswer: () => cy.get('.ngie-accordion-detail .ngie-chart-point'),
|
32
|
+
addButtonSpecifyCorrectAnswer: () => cy.get('.ngie-accordion-detail .charts-tooltip-wrapper [aria-label*="plus"]'),
|
33
|
+
minusButtonSpecifyCorrectAnswer: () => cy.get('.ngie-accordion-detail .charts-tooltip-wrapper [aria-label*="minus"]'),
|
34
|
+
controlOptionsWrapperSpecifyCorrectAnswer: () => cy.get('.ngie-accordion-detail .charts-toolbar-wrapper'),
|
35
|
+
controlOptionsSpecifyCorrectAnswer: (toolOptionAriaLabel = null) => {
|
36
|
+
if (toolOptionAriaLabel) {
|
37
|
+
return cy.get(`.ngie-accordion-detail .chart-controls button[aria-label*="${toolOptionAriaLabel}"]`)
|
38
|
+
} else {
|
39
|
+
return cy.get('.ngie-accordion-detail .chart-controls button')
|
40
|
+
}
|
41
|
+
},
|
42
|
+
dotIconSpecifyCorrectAnswer: () => cy.get('.ngie-accordion-detail .dot-icon'),
|
43
|
+
tooltipWrapperSpecifyCorrectAnswer: () => cy.get('.ngie-accordion-detail .charts-tooltip-wrapper'),
|
44
|
+
|
45
|
+
//preview tab
|
46
|
+
dotColumnPreviewTab: () => cy.get('.ngie-chart-point:visible'),
|
47
|
+
tooltipWrapperPreviewTab: () => cy.get('[class*="question-preview-wrapper"] .charts-tooltip-wrapper'),
|
48
|
+
addButtonPreviewTab: () => cy.get('[class*="question-preview-wrapper"] .charts-tooltip-wrapper [aria-label*="plus"]'),
|
49
|
+
minusButtonPreviewTab: () => cy.get('[class*="question-preview-wrapper"] .charts-tooltip-wrapper [aria-label*="minus"]'),
|
50
|
+
dotIconPreviewTab: () => cy.get('.dot-icon:visible'),
|
51
|
+
controlOptionsWrapperPreviewTab: () => cy.get('[class*="question-preview-wrapper"] .charts-toolbar-wrapper:visible'),
|
52
|
+
controlOptionsPreviewTab: (toolOptionAriaLabel = null) => {
|
53
|
+
if (toolOptionAriaLabel) {
|
54
|
+
return cy.get(`[class*="question-preview-wrapper"] .chart-controls button[aria-label*="${toolOptionAriaLabel}"]:visible`)
|
55
|
+
} else {
|
56
|
+
return cy.get('[class*="question-preview-wrapper"] .chart-controls button')
|
57
|
+
}
|
58
|
+
},
|
59
|
+
dotColumnLockIconPreviewTab: () => cy.get('[class*="LockIconWrapper"]:visible'),
|
60
|
+
dotPlotChartPreviewTab: () => cy.get('[class*="question-preview-wrapper"] [class*="DotPlotChartstyles__ChartWrapper"]').eq(0),
|
61
|
+
numberLineAxisPreviewTab: () => cy.get('[class*="question-preview-wrapper"] .number-line-wrapper').eq(0),
|
62
|
+
labelsNumberLineAxisPreviewTab: () => cy.get('[class*="question-preview-wrapper"] [class*="DotPlotChartstyles__BottomWrapper"]').eq(0).find('.label-wrapper [class*="DotPlotChartstyles__Label"]'),
|
63
|
+
//Correct answer section
|
64
|
+
correctAnswersLabel: () => cy.get('[class*="CorrectAnswerHeader"]:visible'),
|
65
|
+
correctIcon: () => cy.get('.icon-correct'),
|
66
|
+
incorrectIcon: () => cy.get('.icon-incorrect'),
|
67
|
+
correctIncorrectAnswerTextWrapper: () => cy.get('[class*="AnswerStatusWrapper"]'),
|
68
|
+
dotPlotChartCorrectAnswerSection: () => cy.get('[class*="question-preview-wrapper"] [class*="DotPlotChartstyles__ChartWrapper"]').eq(1),
|
69
|
+
dotColumnCorrectAnswerSection: () => cy.get('.ngie-chart-point'),
|
70
|
+
dotIconCorrectAnswerSection: () => cy.get('.dot-icon'),
|
71
|
+
graphTitleCorrectAnswerSection: () => cy.get('.title-container'),
|
72
|
+
numberLineAxisCorrectAnswerSection: () => cy.get('[class*="question-preview-wrapper"] .number-line-wrapper').eq(0),
|
73
|
+
labelsNumberLineAxisCorrectAnswerSection: () => cy.get('[class*="question-preview-wrapper"] [class*="DotPlotChartstyles__BottomWrapper"]').eq(0).find('.label-wrapper [class*="DotPlotChartstyles__Label"]'),
|
74
|
+
}
|
75
|
+
|
76
|
+
const steps = {
|
77
|
+
...scoringSectionBaseEditTab.steps,
|
78
|
+
...chartsCommonComponent.steps,
|
79
|
+
...createQuestionBasePage.steps,
|
80
|
+
...questionInstructionsComponent.steps,
|
81
|
+
...resetPopupComponent.steps,
|
82
|
+
...autoScoredStudentViewSettings.steps,
|
83
|
+
...autoScoredScoringPreviewTab.steps,
|
84
|
+
...layoutSectionComponent.steps,
|
85
|
+
...autoScoredSpecifyCorrectAnswerSection.steps,
|
86
|
+
|
87
|
+
/**
|
88
|
+
* @param {string} element denotes element
|
89
|
+
* @param {string} text denotes tooltip text
|
90
|
+
* @description function is used to hover over element and verify inner text of its tooltip
|
91
|
+
*/
|
92
|
+
verifyTooltipInnerText: (element, text, index = null) => {
|
93
|
+
element()
|
94
|
+
.eq(index)
|
95
|
+
.trigger('mouseover', { force: true });
|
96
|
+
utilities.verifyInnerText(commonComponents.tooltipText().eq(1), text);
|
97
|
+
element()
|
98
|
+
.eq(index)
|
99
|
+
.trigger('mouseout', { force: true });
|
100
|
+
},
|
101
|
+
|
102
|
+
//select chart type
|
103
|
+
selectDotPlot: () => {
|
104
|
+
chartsDotPlotPage.dotPlotToggleButton()
|
105
|
+
.click();
|
106
|
+
},
|
107
|
+
|
108
|
+
/**
|
109
|
+
* Enters text into the minimum input field
|
110
|
+
* @param {string} value - The value to be entered into the input field.
|
111
|
+
*/
|
112
|
+
enterTextInMinInputField: (value) => {
|
113
|
+
chartsDotPlotPage.minInputFieldSelectChartType()
|
114
|
+
.clear()
|
115
|
+
.type(value)
|
116
|
+
.blur();
|
117
|
+
},
|
118
|
+
|
119
|
+
/**
|
120
|
+
* Verifies text into the minimum input field.
|
121
|
+
* @param {string} value - The value to be verified into the input field.
|
122
|
+
*/
|
123
|
+
verifyTextInMinInputField: (value) => {
|
124
|
+
chartsDotPlotPage.minInputFieldSelectChartType()
|
125
|
+
.should('have.value', value)
|
126
|
+
},
|
127
|
+
|
128
|
+
/**
|
129
|
+
* Enters text into the max input field.
|
130
|
+
* @param {string} value - The value to be entered into the input field.
|
131
|
+
*/
|
132
|
+
enterTextInMaxInputField: (value) => {
|
133
|
+
chartsDotPlotPage.maxInputFieldSelectChartType()
|
134
|
+
.clear()
|
135
|
+
.type(value)
|
136
|
+
.blur();
|
137
|
+
},
|
138
|
+
|
139
|
+
/**
|
140
|
+
* Verifies text into the max input field.
|
141
|
+
* @param {string} value - The value to be verified into the input field.
|
142
|
+
*/
|
143
|
+
verifyTextInMaxInputField: (value) => {
|
144
|
+
chartsDotPlotPage.maxInputFieldSelectChartType()
|
145
|
+
.should('have.value', value)
|
146
|
+
},
|
147
|
+
|
148
|
+
/**
|
149
|
+
* Selects a dot column in the chart type selection section based on the given point, minimum, and interval.
|
150
|
+
* @param {object} options - The options for selecting the dot column.
|
151
|
+
* @param {number} options.point - The point at which the dot column is located.
|
152
|
+
* @param {number} options.min - The minimum value of the number line axis.
|
153
|
+
* @param {number} options.interval - The interval value.
|
154
|
+
*/
|
155
|
+
selectDotColumnInSelectChartTypeSection: ({ point, min, interval }) => {
|
156
|
+
const index = Math.round((point - min) / interval);
|
157
|
+
chartsDotPlotPage.dotColumnSelectChartType()
|
158
|
+
.eq(index)
|
159
|
+
.click()
|
160
|
+
.should('have.class', 'selected');
|
161
|
+
chartsDotPlotPage.tooltipWrapperSelectChartType()
|
162
|
+
.should('exist');
|
163
|
+
},
|
164
|
+
|
165
|
+
/**
|
166
|
+
* Plot dots in a dot column in select chart type.
|
167
|
+
* @param {number} expectedDots - The expected number of dots to be plotted.
|
168
|
+
* @param {number} options.point - The point value.
|
169
|
+
* @param {number} options.min - The minimum value.
|
170
|
+
* @param {number} options.interval - The interval value.
|
171
|
+
* @param {number|null} [options.defaultDots=null] - The default number of dots. Defaults to null.
|
172
|
+
*/
|
173
|
+
plotDotsInDotColumnSelectChartTypeSection: (expectedDots, { point, min, interval, defaultDots = null }) => {
|
174
|
+
const index = Math.round((point - min) / interval);
|
175
|
+
steps.selectDotColumnInSelectChartTypeSection({ point, min, interval });
|
176
|
+
if (defaultDots === 0) {
|
177
|
+
steps.increaseDotCountInDotColumnSelectChartTypeSection(expectedDots);
|
178
|
+
} else {
|
179
|
+
const getCount = () => {
|
180
|
+
return chartsDotPlotPage.dotColumnSelectChartType()
|
181
|
+
.eq(index)
|
182
|
+
.find('.dot-icon')
|
183
|
+
.its('length')
|
184
|
+
.as('count')
|
185
|
+
.then(() => {
|
186
|
+
return cy.get('@count').then(count => count);
|
187
|
+
});
|
188
|
+
};
|
189
|
+
getCount().then(count => {
|
190
|
+
const difference = expectedDots - count;
|
191
|
+
const magnitude = Math.abs(difference);
|
192
|
+
if (difference > 0) {
|
193
|
+
steps.increaseDotCountInDotColumnSelectChartTypeSection(magnitude);
|
194
|
+
steps.verifyDotCountSelectChartTypeSection(expectedDots, { point, min, interval });
|
195
|
+
} else if (difference < 0) {
|
196
|
+
steps.decreaseDotCountInDotColumnSelectChartTypeSection(magnitude);
|
197
|
+
steps.verifyDotCountSelectChartTypeSection(expectedDots, { point, min, interval });
|
198
|
+
}
|
199
|
+
});
|
200
|
+
}
|
201
|
+
steps.unselectDotColumnInSelectChartTypeSection({ point, min, interval });
|
202
|
+
},
|
203
|
+
|
204
|
+
/**
|
205
|
+
* Adds dots
|
206
|
+
* @param {number} numberOfDots - The number of dots to add.
|
207
|
+
*/
|
208
|
+
increaseDotCountInDotColumnSelectChartTypeSection: (numberOfDots) => {
|
209
|
+
for (let i = 0; i < numberOfDots; i++) {
|
210
|
+
chartsDotPlotPage.addButtonSelectChartType()
|
211
|
+
.click();
|
212
|
+
}
|
213
|
+
},
|
214
|
+
|
215
|
+
|
216
|
+
/**
|
217
|
+
* Removes dots
|
218
|
+
* @param {number} numberOfDots - The number of dots to be removed
|
219
|
+
*/
|
220
|
+
decreaseDotCountInDotColumnSelectChartTypeSection: (numberOfDots) => {
|
221
|
+
for (let i = 0; i < numberOfDots; i++) {
|
222
|
+
chartsDotPlotPage.minusButtonSelectChartType()
|
223
|
+
.click();
|
224
|
+
}
|
225
|
+
},
|
226
|
+
|
227
|
+
/**
|
228
|
+
* Unselects a dot column in the chart type selection section based on the given point, minimum, and interval.
|
229
|
+
* @param {object} options - The options for selecting the dot column.
|
230
|
+
* @param {number} options.point - The point at which the dot column is located.
|
231
|
+
* @param {number} options.min - The minimum value of the number line axis.
|
232
|
+
* @param {number} options.interval - The interval value.
|
233
|
+
*/
|
234
|
+
unselectDotColumnInSelectChartTypeSection: ({ point, min, interval }) => {
|
235
|
+
const index = Math.round((point - min) / interval);
|
236
|
+
chartsDotPlotPage.controlOptionsWrapperSelectChartType()
|
237
|
+
.click();
|
238
|
+
chartsDotPlotPage.tooltipWrapperSelectChartType()
|
239
|
+
.should('not.exist');
|
240
|
+
chartsDotPlotPage.dotColumnSelectChartType()
|
241
|
+
.eq(index)
|
242
|
+
.should('not.have.class', 'selected');
|
243
|
+
},
|
244
|
+
|
245
|
+
/**
|
246
|
+
* Verifies the expected number of dots
|
247
|
+
* @param {number} expectedDotCount - The expected number of dots.
|
248
|
+
* @param {Object} options - Options object containing point, min, and interval values.
|
249
|
+
* @param {number} options.point - The point value.
|
250
|
+
* @param {number} options.min - The minimum value.
|
251
|
+
* @param {number} options.interval - The interval value.
|
252
|
+
*/
|
253
|
+
verifyDotCountSelectChartTypeSection: (expectedDotCount, { point, min, interval }) => {
|
254
|
+
const index = Math.round((point - min) / interval);
|
255
|
+
chartsDotPlotPage.dotColumnSelectChartType()
|
256
|
+
.eq(index)
|
257
|
+
.within(() => {
|
258
|
+
chartsDotPlotPage.dotIconSelectChartType()
|
259
|
+
.should('have.length', expectedDotCount);
|
260
|
+
});
|
261
|
+
},
|
262
|
+
|
263
|
+
/**
|
264
|
+
* Selects a control option
|
265
|
+
* @param {string} controlOption - The control option to select.
|
266
|
+
*/
|
267
|
+
selectControlOptionSelectChartTypeSection: (controlOption) => {
|
268
|
+
chartsDotPlotPage.controlOptionsSelectChartType(controlOption)
|
269
|
+
.click();
|
270
|
+
},
|
271
|
+
|
272
|
+
/**
|
273
|
+
* @description Lock the bar in select chart type section
|
274
|
+
* @param {number} index Index of the bar to be locked
|
275
|
+
*/
|
276
|
+
lockDotColumn: ({ point, min, interval }) => {
|
277
|
+
const index = Math.round((point - min) / interval);
|
278
|
+
steps.selectDotColumnInSelectChartTypeSection({ point, min, interval });
|
279
|
+
chartsDotPlotPage.lockUnlockButtonSelectChartType()
|
280
|
+
.click();
|
281
|
+
chartsDotPlotPage.lockUnlockButtonSelectChartType()
|
282
|
+
.should('have.attr', 'aria-label', 'locked bar');
|
283
|
+
steps.unselectDotColumnInSelectChartTypeSection({ point, min, interval });
|
284
|
+
utilities.getNthElement(chartsDotPlotPage.dotColumnSelectChartType(), index)
|
285
|
+
.within(() => {
|
286
|
+
utilities.verifyElementVisibilityState(chartsDotPlotPage.dotColumnLockIcon(), 'visible');
|
287
|
+
});
|
288
|
+
},
|
289
|
+
|
290
|
+
//specify correct answer
|
291
|
+
|
292
|
+
/**
|
293
|
+
* selects a dot column in the chart type selection section based on the given point, minimum, and interval.
|
294
|
+
* @param {object} options - The options for selecting the dot column.
|
295
|
+
* @param {number} options.point - The point at which the dot column is located.
|
296
|
+
* @param {number} options.min - The minimum value of the number line axis.
|
297
|
+
* @param {number} options.interval - The interval value.
|
298
|
+
*/
|
299
|
+
selectDotColumnInSpecifyCorrectAnswer: ({ point, min, interval }) => {
|
300
|
+
const index = Math.round((point - min) / interval);
|
301
|
+
chartsDotPlotPage.dotColumnSpecifyCorrectAnswer()
|
302
|
+
.eq(index)
|
303
|
+
.click()
|
304
|
+
.should('have.class', 'selected');
|
305
|
+
chartsDotPlotPage.tooltipWrapperSpecifyCorrectAnswer()
|
306
|
+
.should('exist');
|
307
|
+
},
|
308
|
+
|
309
|
+
/**
|
310
|
+
* Adds dots
|
311
|
+
* @param {number} numberOfDots - The number of dots to add.
|
312
|
+
*/
|
313
|
+
increaseDotCountInDotColumnSpecifyCorrectAnswer: (numberOfDots) => {
|
314
|
+
for (let i = 0; i < numberOfDots; i++) {
|
315
|
+
chartsDotPlotPage.addButtonSpecifyCorrectAnswer()
|
316
|
+
.click();
|
317
|
+
}
|
318
|
+
},
|
319
|
+
|
320
|
+
/**
|
321
|
+
* Removes dots
|
322
|
+
* @param {number} numberOfDots - The number of dots to be removed
|
323
|
+
*/
|
324
|
+
decreaseDotCountInDotColumnSpecifyCorrectAnswer: (numberOfDots) => {
|
325
|
+
for (let i = 0; i < numberOfDots; i++) {
|
326
|
+
chartsDotPlotPage.minusButtonSpecifyCorrectAnswer()
|
327
|
+
.click();
|
328
|
+
}
|
329
|
+
},
|
330
|
+
|
331
|
+
/**
|
332
|
+
* Unselects a dot column based on the given point, minimum, and interval.
|
333
|
+
* @param {object} options - The options for selecting the dot column.
|
334
|
+
* @param {number} options.point - The point at which the dot column is located.
|
335
|
+
* @param {number} options.min - The minimum value of the number line axis.
|
336
|
+
* @param {number} options.interval - The interval value.
|
337
|
+
*/
|
338
|
+
unselectDotColumnInSpecifyCorrectAnswer: ({ point, min, interval }) => {
|
339
|
+
const index = Math.round((point - min) / interval);
|
340
|
+
chartsDotPlotPage.controlOptionsWrapperSpecifyCorrectAnswer()
|
341
|
+
.click();
|
342
|
+
chartsDotPlotPage.tooltipWrapperSpecifyCorrectAnswer()
|
343
|
+
.should('not.exist');
|
344
|
+
chartsDotPlotPage.dotColumnSpecifyCorrectAnswer()
|
345
|
+
.eq(index)
|
346
|
+
.should('not.have.class', 'selected');
|
347
|
+
},
|
348
|
+
|
349
|
+
/**
|
350
|
+
* Selects a control option
|
351
|
+
* @param {string} controlOption - The control option to select.
|
352
|
+
*/
|
353
|
+
selectControlOptionSpecifyCorrectAnswer: (controlOption) => {
|
354
|
+
controlOptionsSpecifyCorrectAnswer(controlOption)
|
355
|
+
.click();
|
356
|
+
},
|
357
|
+
|
358
|
+
/**
|
359
|
+
* Verifies the expected number of dots
|
360
|
+
* @param {number} expectedDotCount - The expected number of dots.
|
361
|
+
* @param {Object} options - Options object containing point, min, and interval values.
|
362
|
+
* @param {number} options.point - The point value.
|
363
|
+
* @param {number} options.min - The minimum value.
|
364
|
+
* @param {number} options.interval - The interval value.
|
365
|
+
*/
|
366
|
+
verifyDotCountSpecifyCorrectAnswer: (expectedDotCount, { point, min, interval }) => {
|
367
|
+
const index = Math.round((point - min) / interval);
|
368
|
+
chartsDotPlotPage.dotColumnSpecifyCorrectAnswer()
|
369
|
+
.eq(index)
|
370
|
+
.within(() => {
|
371
|
+
chartsDotPlotPage.dotIconSpecifyCorrectAnswer()
|
372
|
+
.should('have.length', expectedDotCount);
|
373
|
+
});
|
374
|
+
},
|
375
|
+
|
376
|
+
/**
|
377
|
+
* Plot dots in a dot column in specify correct answer
|
378
|
+
* @param {number} expectedDots - The expected number of dots to be plotted.
|
379
|
+
* @param {number} options.point - The point value.
|
380
|
+
* @param {number} options.min - The minimum value.
|
381
|
+
* @param {number} options.interval - The interval value.
|
382
|
+
* @param {number|null} [options.defaultDots=null] - The default number of dots. Defaults to null.
|
383
|
+
*/
|
384
|
+
plotDotsInDotColumnSpecifyCorrectAnswer: (expectedDots, { point, min, interval, defaultDots = null }) => {
|
385
|
+
const index = Math.round((point - min) / interval);
|
386
|
+
steps.selectDotColumnInSpecifyCorrectAnswer({ point, min, interval });
|
387
|
+
if (defaultDots === 0) {
|
388
|
+
steps.increaseDotCountInDotColumnSpecifyCorrectAnswer(expectedDots);
|
389
|
+
} else {
|
390
|
+
const getCount = () => {
|
391
|
+
return chartsDotPlotPage.dotColumnSpecifyCorrectAnswer()
|
392
|
+
.eq(index)
|
393
|
+
.find('.dot-icon')
|
394
|
+
.its('length')
|
395
|
+
.as('count')
|
396
|
+
.then(() => {
|
397
|
+
return cy.get('@count').then(count => count);
|
398
|
+
});
|
399
|
+
};
|
400
|
+
getCount().then(count => {
|
401
|
+
const difference = expectedDots - count;
|
402
|
+
const magnitude = Math.abs(difference);
|
403
|
+
if (difference > 0) {
|
404
|
+
steps.increaseDotCountInDotColumnSpecifyCorrectAnswer(magnitude);
|
405
|
+
steps.verifyDotCountSpecifyCorrectAnswer(expectedDots, { point, min, interval });
|
406
|
+
} else if (difference < 0) {
|
407
|
+
steps.decreaseDotCountInDotColumnSpecifyCorrectAnswer(magnitude);
|
408
|
+
steps.verifyDotCountSpecifyCorrectAnswer(expectedDots, { point, min, interval });
|
409
|
+
}
|
410
|
+
});
|
411
|
+
}
|
412
|
+
steps.unselectDotColumnInSpecifyCorrectAnswer({ point, min, interval });
|
413
|
+
},
|
414
|
+
|
415
|
+
//preview tab
|
416
|
+
/**
|
417
|
+
* Unselects a dot column based on the given point, minimum, and interval.
|
418
|
+
* @param {object} options - The options for selecting the dot column.
|
419
|
+
* @param {number} options.point - The point at which the dot column is located.
|
420
|
+
* @param {number} options.min - The minimum value of the number line axis.
|
421
|
+
* @param {number} options.interval - The interval value.
|
422
|
+
*/
|
423
|
+
selectDotColumnInPreviewTab: ({ point, min, interval }) => {
|
424
|
+
const index = Math.round((point - min) / interval);
|
425
|
+
chartsDotPlotPage.dotColumnPreviewTab()
|
426
|
+
.eq(index)
|
427
|
+
.click();
|
428
|
+
},
|
429
|
+
|
430
|
+
/**
|
431
|
+
* Adds dots
|
432
|
+
* @param {number} numberOfDots - The number of dots to add.
|
433
|
+
*/
|
434
|
+
increaseDotCountInDotColumnPreviewTab: (numberOfDots) => {
|
435
|
+
for (let i = 0; i < numberOfDots; i++) {
|
436
|
+
chartsDotPlotPage.addButtonPreviewTab()
|
437
|
+
.click();
|
438
|
+
}
|
439
|
+
},
|
440
|
+
|
441
|
+
/**
|
442
|
+
* Adds dots using keyboard navigation
|
443
|
+
* @param {number} numberOfDots - The number of dots to subtract.
|
444
|
+
* @param {object} options - The options object containing point, min, and interval.
|
445
|
+
* @param {number} options.point - The point value.
|
446
|
+
* @param {number} options.min - The minimum value.
|
447
|
+
* @param {number} options.interval - The interval value.
|
448
|
+
*/
|
449
|
+
increaseDotInDotColumnUsingKeyboardPreviewTab: (numberOfDots, { point, min, interval }) => {
|
450
|
+
const index = Math.round((point - min) / interval);
|
451
|
+
steps.selectDotColumnInPreviewTab({ point, min, interval });
|
452
|
+
for (let i = 0; i < numberOfDots; i++) {
|
453
|
+
chartsDotPlotPage.dotColumnPreviewTab()
|
454
|
+
.eq(index)
|
455
|
+
.type('{upArrow}');
|
456
|
+
}
|
457
|
+
},
|
458
|
+
|
459
|
+
/**
|
460
|
+
* Removes dots
|
461
|
+
* @param {number} numberOfDots - The number of dots to be removed
|
462
|
+
*/
|
463
|
+
decreaseDotCountInDotColumnPreviewTab: (numberOfDots) => {
|
464
|
+
for (let i = 0; i < numberOfDots; i++) {
|
465
|
+
chartsDotPlotPage.minusButtonPreviewTab()
|
466
|
+
.click();
|
467
|
+
}
|
468
|
+
},
|
469
|
+
|
470
|
+
/**
|
471
|
+
* Removes 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
|
+
decreaseDotInDotColumnUsingKeyboardPreviewTab: (numberOfDots, { point, min, interval }) => {
|
479
|
+
const index = Math.round((point - min) / interval);
|
480
|
+
steps.selectDotColumnInPreviewTab({ point, min, interval });
|
481
|
+
for (let i = 0; i < numberOfDots; i++) {
|
482
|
+
chartsDotPlotPage.dotColumnPreviewTab()
|
483
|
+
.eq(index)
|
484
|
+
.type('{downArrow}');
|
485
|
+
}
|
486
|
+
},
|
487
|
+
|
488
|
+
/**
|
489
|
+
* Unselects a dot column in the chart type selection section based on the given point, minimum, and interval.
|
490
|
+
* @param {object} options - The options for selecting the dot column.
|
491
|
+
* @param {number} options.point - The point at which the dot column is located.
|
492
|
+
* @param {number} options.min - The minimum value of the number line axis.
|
493
|
+
* @param {number} options.interval - The interval value.
|
494
|
+
*/
|
495
|
+
unselectDotColumnInPreviewTab: ({ point, min, interval }) => {
|
496
|
+
const index = Math.round((point - min) / interval);
|
497
|
+
chartsDotPlotPage.controlOptionsWrapperPreviewTab()
|
498
|
+
.click();
|
499
|
+
chartsDotPlotPage.tooltipWrapperPreviewTab()
|
500
|
+
.should('not.exist');
|
501
|
+
chartsDotPlotPage.dotColumnPreviewTab()
|
502
|
+
.eq(index)
|
503
|
+
.should('not.have.class', 'selected');
|
504
|
+
},
|
505
|
+
|
506
|
+
/**
|
507
|
+
* Plot dots in a dot column in preview tab
|
508
|
+
* @param {number} expectedDots - The expected number of dots to be plotted.
|
509
|
+
* @param {number} options.point - The point value.
|
510
|
+
* @param {number} options.min - The minimum value.
|
511
|
+
* @param {number} options.interval - The interval value.
|
512
|
+
* @param {number|null} [options.defaultDots=null] - The default number of dots. Defaults to null.
|
513
|
+
*/
|
514
|
+
plotDotsInDotColumnPreviewTab: (expectedDots, { point, min, interval, defaultDots = null }) => {
|
515
|
+
const index = Math.round((point - min) / interval);
|
516
|
+
steps.selectDotColumnInPreviewTab({ point, min, interval });
|
517
|
+
if (defaultDots === 0) {
|
518
|
+
steps.increaseDotCountInDotColumnPreviewTab(expectedDots);
|
519
|
+
steps.verifyDotCountPreviewTab(expectedDots, { point, min, interval });
|
520
|
+
} else {
|
521
|
+
const getCount = () => {
|
522
|
+
return chartsDotPlotPage.dotColumnPreviewTab()
|
523
|
+
.eq(index)
|
524
|
+
.find('.dot-icon')
|
525
|
+
.its('length')
|
526
|
+
.as('count')
|
527
|
+
.then(() => {
|
528
|
+
return cy.get('@count').then(count => count);
|
529
|
+
});
|
530
|
+
};
|
531
|
+
getCount().then(count => {
|
532
|
+
const difference = expectedDots - count;
|
533
|
+
const magnitude = Math.abs(difference);
|
534
|
+
if (expectedDots === 0) {
|
535
|
+
steps.decreaseDotCountInDotColumnPreviewTab(count);
|
536
|
+
steps.verifyDotCountPreviewTab(expectedDots, { point, min, interval });
|
537
|
+
}
|
538
|
+
else if (difference > 0) {
|
539
|
+
steps.increaseDotCountInDotColumnPreviewTab(magnitude);
|
540
|
+
steps.verifyDotCountPreviewTab(expectedDots, { point, min, interval });
|
541
|
+
} else if (difference < 0) {
|
542
|
+
steps.decreaseDotCountInDotColumnPreviewTab(magnitude);
|
543
|
+
steps.verifyDotCountPreviewTab(expectedDots, { point, min, interval });
|
544
|
+
}
|
545
|
+
});
|
546
|
+
}
|
547
|
+
steps.unselectDotColumnInPreviewTab({ point, min, interval });
|
548
|
+
},
|
549
|
+
|
550
|
+
tooltipWrapperNotExistPreviewTab: () => {
|
551
|
+
chartsDotPlotPage.tooltipWrapperPreviewTab()
|
552
|
+
.should('not.exist');
|
553
|
+
},
|
554
|
+
|
555
|
+
/**
|
556
|
+
* Verifies the expected number of dots
|
557
|
+
* @param {number} expectedDotCount - The expected number of dots.
|
558
|
+
* @param {Object} options - Options object containing point, min, and interval values.
|
559
|
+
* @param {number} options.point - The point value.
|
560
|
+
* @param {number} options.min - The minimum value.
|
561
|
+
* @param {number} options.interval - The interval value.
|
562
|
+
*/
|
563
|
+
verifyDotCountPreviewTab: (expectedDotCount, { point, min, interval }) => {
|
564
|
+
const index = Math.round((point - min) / interval);
|
565
|
+
chartsDotPlotPage.dotColumnPreviewTab()
|
566
|
+
.eq(index)
|
567
|
+
.within(() => {
|
568
|
+
chartsDotPlotPage.dotIconPreviewTab()
|
569
|
+
.should('have.length', expectedDotCount);
|
570
|
+
});
|
571
|
+
},
|
572
|
+
|
573
|
+
/**
|
574
|
+
* Verifies that dots do not exist in the specified column
|
575
|
+
* @param {object} options - The options object containing point, min, and interval.
|
576
|
+
* @param {number} options.point - The point value.
|
577
|
+
* @param {number} options.min - The minimum value.
|
578
|
+
* @param {number} options.interval - The interval value.
|
579
|
+
*/
|
580
|
+
verifyDotNotExistPreviewTab: ({ point, min, interval }) => {
|
581
|
+
const index = Math.round((point - min) / interval);
|
582
|
+
chartsDotPlotPage.dotColumnPreviewTab()
|
583
|
+
.eq(index)
|
584
|
+
.within(() => {
|
585
|
+
chartsDotPlotPage.dotIconPreviewTab()
|
586
|
+
.should('not.exist');
|
587
|
+
});
|
588
|
+
},
|
589
|
+
|
590
|
+
/**
|
591
|
+
* Selects a control option
|
592
|
+
* @param {string} controlOption - The control option to select.
|
593
|
+
*/
|
594
|
+
selectControlOptionPreviewTab: (controlOption) => {
|
595
|
+
chartsDotPlotPage.controlOptionsPreviewTab(controlOption)
|
596
|
+
.click();
|
597
|
+
},
|
598
|
+
|
599
|
+
/**
|
600
|
+
* Verify the bar is locked in preview tab
|
601
|
+
* @param {number} index index of the bar
|
602
|
+
*/
|
603
|
+
verifyDotColumnIsLockedInPreviewTab: ({ point, min, interval }) => {
|
604
|
+
const index = Math.round((point - min) / interval);
|
605
|
+
utilities.getNthElement(chartsDotPlotPage.dotColumnPreviewTab(), index)
|
606
|
+
.within(() => {
|
607
|
+
utilities.verifyElementVisibilityState(chartsDotPlotPage.dotColumnLockIconPreviewTab(), 'visible');
|
608
|
+
});
|
609
|
+
utilities.getNthElement(chartsDotPlotPage.dotColumnPreviewTab(), index)
|
610
|
+
.should('have.css', 'background-color', css.color.lockedDotColumnBg);
|
611
|
+
},
|
612
|
+
|
613
|
+
/**
|
614
|
+
* Verify the bar is unlocked in preview tab
|
615
|
+
* @param {number} index index of the bar
|
616
|
+
*/
|
617
|
+
verifyDotColumnIsUnlockedInPreviewTab: ({ point, min, interval }) => {
|
618
|
+
const index = Math.round((point - min) / interval);
|
619
|
+
utilities.getNthElement(chartsDotPlotPage.dotColumnPreviewTab(), index)
|
620
|
+
.within(() => {
|
621
|
+
utilities.verifyElementVisibilityState(chartsDotPlotPage.dotColumnLockIconPreviewTab(), 'notExist');
|
622
|
+
});
|
623
|
+
},
|
624
|
+
|
625
|
+
/**
|
626
|
+
* Verifies that the correct dot column
|
627
|
+
* @param {object} options - The options object containing point, min, and interval.
|
628
|
+
* @param {number} options.point - The point value.
|
629
|
+
* @param {number} options.min - The minimum value.
|
630
|
+
* @param {number} options.interval - The interval value.
|
631
|
+
*/
|
632
|
+
verifyCorrectDotColumnPreviewTab: ({ point, min, interval, defaultDots = null }) => {
|
633
|
+
const index = Math.round((point - min) / interval);
|
634
|
+
chartsDotPlotPage.dotPlotChartPreviewTab()
|
635
|
+
.within(() => {
|
636
|
+
chartsDotPlotPage.dotColumnPreviewTab()
|
637
|
+
.eq(index)
|
638
|
+
.should('have.class', 'correct-bar-indicator')
|
639
|
+
.should('have.css', 'background-color', css.color.correctAnswerLabelBg)
|
640
|
+
.find('.icon-correct')
|
641
|
+
.should('exist');
|
642
|
+
});
|
643
|
+
if (defaultDots === null) {
|
644
|
+
steps.verifyCorrectDotPreviewTab({ point, min, interval });
|
645
|
+
}
|
646
|
+
},
|
647
|
+
|
648
|
+
/**
|
649
|
+
* Verifies that the incorrect dot column
|
650
|
+
* @param {object} options - The options object containing point, min, and interval.
|
651
|
+
* @param {number} options.point - The point value.
|
652
|
+
* @param {number} options.min - The minimum value.
|
653
|
+
* @param {number} options.interval - The interval value.
|
654
|
+
*/
|
655
|
+
verifyIncorrectDotColumnPreviewTab: ({ point, min, interval, defaultDots = null }) => {
|
656
|
+
const index = Math.round((point - min) / interval);
|
657
|
+
chartsDotPlotPage.dotPlotChartPreviewTab()
|
658
|
+
.within(() => {
|
659
|
+
chartsDotPlotPage.dotColumnPreviewTab()
|
660
|
+
.eq(index)
|
661
|
+
.should('have.class', 'inCorrect-bar-indicator')
|
662
|
+
.should('have.css', 'background-color', css.color.incorrectAnswerLabelBg)
|
663
|
+
.find('.icon-incorrect')
|
664
|
+
.should('exist');
|
665
|
+
});
|
666
|
+
if (defaultDots === null) {
|
667
|
+
steps.verifyIncorrectDotPreviewTab({ point, min, interval });
|
668
|
+
}
|
669
|
+
},
|
670
|
+
|
671
|
+
/**
|
672
|
+
* Verifies that the default dot column
|
673
|
+
* @param {object} options - The options object containing point, min, and interval.
|
674
|
+
* @param {number} options.point - The point value.
|
675
|
+
* @param {number} options.min - The minimum value.
|
676
|
+
* @param {number} options.interval - The interval value.
|
677
|
+
*/
|
678
|
+
verifyLockedDotColumnPreviewTab: ({ point, min, interval }) => {
|
679
|
+
const index = Math.round((point - min) / interval);
|
680
|
+
chartsDotPlotPage.dotPlotChartPreviewTab()
|
681
|
+
.within(() => {
|
682
|
+
chartsDotPlotPage.dotColumnPreviewTab()
|
683
|
+
.eq(index)
|
684
|
+
.should('not.have.class', 'correct-bar-indicator')
|
685
|
+
.and('not.have.class', 'inCorrect-bar-indicator')
|
686
|
+
.and('not.have.css', 'background-color', css.color.correctAnswerLabelBg)
|
687
|
+
.and('not.have.css', 'background-color', css.color.correctAnswerLabelBg)
|
688
|
+
});
|
689
|
+
steps.verifyDotColumnIsLockedInPreviewTab({ point, min, interval });
|
690
|
+
steps.verifyDefaultDotPreviewTab({ point, min, interval });
|
691
|
+
},
|
692
|
+
|
693
|
+
/**
|
694
|
+
* Verifies that the correct dot exists in the specified column
|
695
|
+
* @param {object} options - The options object containing point, min, and interval.
|
696
|
+
* @param {number} options.point - The point value.
|
697
|
+
* @param {number} options.min - The minimum value.
|
698
|
+
* @param {number} options.interval - The interval value.
|
699
|
+
*/
|
700
|
+
verifyCorrectDotPreviewTab: ({ point, min, interval }) => {
|
701
|
+
const index = Math.round((point - min) / interval);
|
702
|
+
chartsDotPlotPage.dotPlotChartPreviewTab()
|
703
|
+
.within(() => {
|
704
|
+
chartsDotPlotPage.dotColumnPreviewTab()
|
705
|
+
.eq(index)
|
706
|
+
.within(() => {
|
707
|
+
chartsDotPlotPage.dotIconPreviewTab()
|
708
|
+
.each((el) => {
|
709
|
+
cy.wrap(el)
|
710
|
+
.should('have.css', 'background-color', css.color.correctAnswer)
|
711
|
+
});
|
712
|
+
});
|
713
|
+
});
|
714
|
+
},
|
715
|
+
|
716
|
+
/**
|
717
|
+
* Verifies that the incorrect dot exists in the specified column
|
718
|
+
* @param {object} options - The options object containing point, min, and interval.
|
719
|
+
* @param {number} options.point - The point value.
|
720
|
+
* @param {number} options.min - The minimum value.
|
721
|
+
* @param {number} options.interval - The interval value.
|
722
|
+
*/
|
723
|
+
verifyIncorrectDotPreviewTab: ({ point, min, interval }) => {
|
724
|
+
const index = Math.round((point - min) / interval);
|
725
|
+
chartsDotPlotPage.dotPlotChartPreviewTab()
|
726
|
+
.within(() => {
|
727
|
+
chartsDotPlotPage.dotColumnPreviewTab()
|
728
|
+
.eq(index)
|
729
|
+
.within(() => {
|
730
|
+
chartsDotPlotPage.dotIconPreviewTab()
|
731
|
+
.each((el) => {
|
732
|
+
cy.wrap(el)
|
733
|
+
.should('have.css', 'background-color', css.color.incorrectAnswer)
|
734
|
+
});
|
735
|
+
});
|
736
|
+
});
|
737
|
+
},
|
738
|
+
|
739
|
+
/**
|
740
|
+
* Verifies that the default dot exists in the specified column
|
741
|
+
* @param {object} options - The options object containing point, min, and interval.
|
742
|
+
* @param {number} options.point - The point value.
|
743
|
+
* @param {number} options.min - The minimum value.
|
744
|
+
* @param {number} options.interval - The interval value.
|
745
|
+
*/
|
746
|
+
verifyDefaultDotPreviewTab: ({ point, min, interval }) => {
|
747
|
+
const index = Math.round((point - min) / interval);
|
748
|
+
chartsDotPlotPage.dotPlotChartPreviewTab()
|
749
|
+
.within(() => {
|
750
|
+
chartsDotPlotPage.dotColumnPreviewTab()
|
751
|
+
.eq(index)
|
752
|
+
.within(() => {
|
753
|
+
chartsDotPlotPage.dotIconPreviewTab()
|
754
|
+
.each((el) => {
|
755
|
+
cy.wrap(el)
|
756
|
+
.should('have.css', 'background-color', css.color.activeButtons)
|
757
|
+
});
|
758
|
+
});
|
759
|
+
});
|
760
|
+
},
|
761
|
+
|
762
|
+
/**
|
763
|
+
* Verifies the number of divisions on the number line axis in the preview tab.
|
764
|
+
* @param {object} options - The options object containing min, max, and interval values.
|
765
|
+
* @param {number} options.min - The minimum value.
|
766
|
+
* @param {number} options.max - The maximum value.
|
767
|
+
* @param {number} options.interval - The interval value.
|
768
|
+
*/
|
769
|
+
verifyDivisionsOnNumberLineAxisPreviewTab: ({ min, max, interval }) => {
|
770
|
+
const expectedDivisions = Math.round((max - min) / interval);
|
771
|
+
chartsDotPlotPage.numberLineAxisPreviewTab()
|
772
|
+
.find('.number-line')
|
773
|
+
.its('length')
|
774
|
+
.then((len) => {
|
775
|
+
expect(len).to.equal(expectedDivisions);
|
776
|
+
});
|
777
|
+
},
|
778
|
+
|
779
|
+
/**
|
780
|
+
* Verifies the labels on the number line axis in the preview tab.
|
781
|
+
* @param {number} min - The minimum value.
|
782
|
+
* @param {number} max - The maximum value.
|
783
|
+
*/
|
784
|
+
verifyLabelsOnNumberLineAxisPreviewTab: (min, max, annotateEvery) => {
|
785
|
+
let expectedLabelsIndex = [];
|
786
|
+
chartsDotPlotPage.labelsNumberLineAxisPreviewTab()
|
787
|
+
.each((value, index) => {
|
788
|
+
if (index % annotateEvery === 0) {
|
789
|
+
expectedLabelsIndex.push(index.toString());
|
790
|
+
}
|
791
|
+
for (var i = min; i < max; i++) {
|
792
|
+
chartsDotPlotPage.labelsNumberLineAxisPreviewTab()
|
793
|
+
.eq(expectedLabelsIndex[i - 1])
|
794
|
+
.should('have.text', i)
|
795
|
+
}
|
796
|
+
});
|
797
|
+
},
|
798
|
+
|
799
|
+
//correct answer section
|
800
|
+
/**
|
801
|
+
* @param {("correct" | "incorrect")} answerStatus - The status of the answer.
|
802
|
+
* @description Verifies the visibility and content of the correct/incorrect answer label block.
|
803
|
+
* If the answer is correct, it also verifies the visibility of the correct icon;
|
804
|
+
* otherwise, it verifies the visibility of the incorrect icon.
|
805
|
+
*/
|
806
|
+
verifyCorrectIncorrectAnswerLabel: (answerStatus) => {
|
807
|
+
utilities.verifyInnerText(chartsDotPlotPage.correctIncorrectAnswerTextWrapper(), `Your answer is${answerStatus}`)
|
808
|
+
chartsDotPlotPage.correctIncorrectAnswerTextWrapper()
|
809
|
+
.within(() => {
|
810
|
+
if (answerStatus === 'correct') {
|
811
|
+
utilities.verifyElementVisibilityState(chartsDotPlotPage.correctIcon(), 'visible');
|
812
|
+
} else {
|
813
|
+
utilities.verifyElementVisibilityState(chartsDotPlotPage.incorrectIcon(), 'visible');
|
814
|
+
}
|
815
|
+
});
|
816
|
+
},
|
817
|
+
|
818
|
+
verifyCorrectAnswerSectionNotExists: () => {
|
819
|
+
utilities.verifyElementVisibilityState(chartsDotPlotPage.dotPlotChartCorrectAnswerSection(), 'notExist');
|
820
|
+
},
|
821
|
+
|
822
|
+
/**
|
823
|
+
* Verifies that the correct dot column
|
824
|
+
* @param {object} options - The options object containing point, min, and interval.
|
825
|
+
* @param {number} options.point - The point value.
|
826
|
+
* @param {number} options.min - The minimum value.
|
827
|
+
* @param {number} options.interval - The interval value.
|
828
|
+
*/
|
829
|
+
verifyCorrectDotColumnCorrectAnswerSection: ({ point, min, interval, defaultDots = null }) => {
|
830
|
+
const index = Math.round((point - min) / interval);
|
831
|
+
chartsDotPlotPage.dotPlotChartCorrectAnswerSection()
|
832
|
+
.within(() => {
|
833
|
+
chartsDotPlotPage.dotColumnCorrectAnswerSection()
|
834
|
+
.eq(index)
|
835
|
+
.should('have.class', 'correct-bar-indicator')
|
836
|
+
.should('have.css', 'background-color', css.color.correctAnswerLabelBg)
|
837
|
+
.find('.icon-correct')
|
838
|
+
.should('exist');
|
839
|
+
});
|
840
|
+
if (defaultDots === null) {
|
841
|
+
steps.verifyCorrectDotCorrectAnswerSection({ point, min, interval });
|
842
|
+
}
|
843
|
+
},
|
844
|
+
|
845
|
+
/**
|
846
|
+
* Verifies that the correct dot exists in the specified column
|
847
|
+
* @param {object} options - The options object containing point, min, and interval.
|
848
|
+
* @param {number} options.point - The point value.
|
849
|
+
* @param {number} options.min - The minimum value.
|
850
|
+
* @param {number} options.interval - The interval value.
|
851
|
+
*/
|
852
|
+
verifyCorrectDotCorrectAnswerSection: ({ point, min, interval }) => {
|
853
|
+
const index = Math.round((point - min) / interval);
|
854
|
+
chartsDotPlotPage.dotPlotChartCorrectAnswerSection()
|
855
|
+
.within(() => {
|
856
|
+
chartsDotPlotPage.dotColumnCorrectAnswerSection()
|
857
|
+
.eq(index)
|
858
|
+
.within(() => {
|
859
|
+
chartsDotPlotPage.dotIconCorrectAnswerSection()
|
860
|
+
.each((el) => {
|
861
|
+
cy.wrap(el)
|
862
|
+
.should('have.css', 'background-color', css.color.correctAnswer)
|
863
|
+
});
|
864
|
+
});
|
865
|
+
});
|
866
|
+
},
|
867
|
+
|
868
|
+
/**
|
869
|
+
* Verifies that the default dot exists in the specified column
|
870
|
+
* @param {object} options - The options object containing point, min, and interval.
|
871
|
+
* @param {number} options.point - The point value.
|
872
|
+
* @param {number} options.min - The minimum value.
|
873
|
+
* @param {number} options.interval - The interval value.
|
874
|
+
*/
|
875
|
+
verifyDefaultDotCorrectAnswerSection: ({ point, min, interval }) => {
|
876
|
+
const index = Math.round((point - min) / interval);
|
877
|
+
chartsDotPlotPage.dotPlotChartCorrectAnswerSection()
|
878
|
+
.within(() => {
|
879
|
+
chartsDotPlotPage.dotColumnCorrectAnswerSection()
|
880
|
+
.eq(index)
|
881
|
+
.within(() => {
|
882
|
+
chartsDotPlotPage.dotIconCorrectAnswerSection()
|
883
|
+
.each((el) => {
|
884
|
+
cy.wrap(el)
|
885
|
+
.should('have.css', 'background-color', css.color.activeButtons)
|
886
|
+
});
|
887
|
+
});
|
888
|
+
});
|
889
|
+
},
|
890
|
+
|
891
|
+
/**
|
892
|
+
* Verify the bar is locked in preview tab
|
893
|
+
* @param {number} index index of the bar
|
894
|
+
*/
|
895
|
+
verifyDotColumnIsLockedInCorrectAnswerSection: ({ point, min, interval }) => {
|
896
|
+
const index = Math.round((point - min) / interval);
|
897
|
+
chartsDotPlotPage.dotPlotChartCorrectAnswerSection()
|
898
|
+
.within(() => {
|
899
|
+
utilities.getNthElement(chartsDotPlotPage.dotColumnCorrectAnswerSection(), index)
|
900
|
+
.find('[class*="LockIconWrapper"]')
|
901
|
+
.should('exist');
|
902
|
+
});
|
903
|
+
},
|
904
|
+
|
905
|
+
/**
|
906
|
+
* Verifies the expected number of dots
|
907
|
+
* @param {number} expectedDotCount - The expected number of dots.
|
908
|
+
* @param {Object} options - Options object containing point, min, and interval values.
|
909
|
+
* @param {number} options.point - The point value.
|
910
|
+
* @param {number} options.min - The minimum value.
|
911
|
+
* @param {number} options.interval - The interval value.
|
912
|
+
*/
|
913
|
+
verifyDotCountCorrectAnswerSection: (expectedDotCount, { point, min, interval }) => {
|
914
|
+
const index = Math.round((point - min) / interval);
|
915
|
+
chartsDotPlotPage.dotColumnCorrectAnswerSection()
|
916
|
+
.eq(index)
|
917
|
+
.within(() => {
|
918
|
+
chartsDotPlotPage.dotIconCorrectAnswerSection()
|
919
|
+
.should('have.length', expectedDotCount);
|
920
|
+
});
|
921
|
+
},
|
922
|
+
|
923
|
+
/**
|
924
|
+
* Verifies the number of divisions on the number line axis in the preview tab.
|
925
|
+
* @param {object} options - The options object containing min, max, and interval values.
|
926
|
+
* @param {number} options.min - The minimum value.
|
927
|
+
* @param {number} options.max - The maximum value.
|
928
|
+
* @param {number} options.interval - The interval value.
|
929
|
+
*/
|
930
|
+
verifyDivisionsOnNumberLineAxisCorrectAnswerSection: ({ min, max, interval }) => {
|
931
|
+
const expectedDivisions = Math.round((max - min) / interval);
|
932
|
+
chartsDotPlotPage.numberLineAxisCorrectAnswerSection()
|
933
|
+
.find('.number-line')
|
934
|
+
.its('length')
|
935
|
+
.then((len) => {
|
936
|
+
expect(len).to.equal(expectedDivisions);
|
937
|
+
});
|
938
|
+
},
|
939
|
+
|
940
|
+
/**
|
941
|
+
* Verifies the labels on the number line axis
|
942
|
+
* @param {number} min - The minimum value.
|
943
|
+
* @param {number} max - The maximum value.
|
944
|
+
*/
|
945
|
+
verifyLabelsOnNumberLineAxisCorrectAnswerSection: (min, max, annotateEvery) => {
|
946
|
+
let expectedLabelsIndex = [];
|
947
|
+
chartsDotPlotPage.labelsNumberLineAxisCorrectAnswerSection()
|
948
|
+
.each((value, index) => {
|
949
|
+
if (index % annotateEvery === 0) {
|
950
|
+
expectedLabelsIndex.push(index.toString());
|
951
|
+
}
|
952
|
+
for (var i = min; i < max; i++) {
|
953
|
+
chartsDotPlotPage.labelsNumberLineAxisCorrectAnswerSection()
|
954
|
+
.eq(expectedLabelsIndex[i - 1])
|
955
|
+
.should('have.text', i)
|
956
|
+
}
|
957
|
+
});
|
958
|
+
},
|
959
|
+
|
960
|
+
/**
|
961
|
+
* Verifies that the default dot exists in the specified column
|
962
|
+
* @param {object} options - The options object containing point, min, and interval.
|
963
|
+
* @param {number} options.point - The point value.
|
964
|
+
* @param {number} options.min - The minimum value.
|
965
|
+
* @param {number} options.interval - The interval value.
|
966
|
+
*/
|
967
|
+
verifyLockedDotColumnCorrectAnswerSection: ({ point, min, interval }) => {
|
968
|
+
const index = Math.round((point - min) / interval);
|
969
|
+
chartsDotPlotPage.dotPlotChartCorrectAnswerSection()
|
970
|
+
.within(() => {
|
971
|
+
chartsDotPlotPage.dotColumnCorrectAnswerSection()
|
972
|
+
.eq(index)
|
973
|
+
.should('not.have.class', 'correct-bar-indicator')
|
974
|
+
.and('not.have.class', 'inCorrect-bar-indicator')
|
975
|
+
.and('not.have.css', 'background-color', css.color.correctAnswerLabelBg)
|
976
|
+
.and('not.have.css', 'background-color', css.color.correctAnswerLabelBg)
|
977
|
+
});
|
978
|
+
steps.verifyDotColumnIsLockedInCorrectAnswerSection({ point, min, interval });
|
979
|
+
steps.verifyDefaultDotCorrectAnswerSection({ point, min, interval });
|
980
|
+
},
|
981
|
+
}
|
982
|
+
|
983
|
+
const tests = {
|
984
|
+
...autoScoredScoringPreviewTab.tests
|
4
985
|
}
|
5
986
|
|
6
987
|
export const chartsDotPlotPage = {
|
7
|
-
...selectors
|
988
|
+
...selectors,
|
989
|
+
steps,
|
990
|
+
tests
|
8
991
|
}
|