itemengine-cypress-automation 1.0.193-packageUpdated-7f1e306.0 → 1.0.193-packageUpdated-0af2e49.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. package/cypress/e2e/ILC/AudioPlayerNew/allSupportedFileTypes.js +3 -3
  2. package/cypress/e2e/ILC/AudioPlayerNew/audioOverviewAndTranscript.js +568 -0
  3. package/cypress/e2e/ILC/AudioPlayerNew/barAudioPlayerStyle.js +4 -4
  4. package/cypress/e2e/ILC/AudioPlayerNew/compactAudioPlayerStyle.js +5 -5
  5. package/cypress/e2e/ILC/AudioPlayerNew/customizePlayerLayoutSettings.js +2 -2
  6. package/cypress/e2e/ILC/AudioPlayerNew/headerSection.js +125 -0
  7. package/cypress/e2e/ILC/AudioPlayerNew/previewContents.smoke.js +5 -5
  8. package/cypress/e2e/ILC/AudioPlayerNew/standardAudioPlayerStyle.js +4 -4
  9. package/cypress/e2e/ILC/AudioPlayerNew/studentViewSettings.js +3 -3
  10. package/cypress/e2e/ILC/AudioPlayerNew/uploadAndAddAudioFile.js +19 -17
  11. package/cypress/e2e/ILC/ChartsBar/previewContentsForAllViews.smoke.js +7 -4
  12. package/cypress/e2e/ILC/ChartsLine/allOrNothingScoringForAllViews.smoke.js +366 -0
  13. package/cypress/e2e/ILC/ChartsLine/checkAnswerFunctionalityForAllViews.smoke.js +183 -0
  14. package/cypress/e2e/ILC/ChartsLine/gradingViewAndCorrectAnswerView.smoke.js +281 -0
  15. package/cypress/e2e/ILC/ChartsLine/previewContentsForAllViews.smoke.js +595 -0
  16. package/cypress/e2e/ILC/GridFill/allOrNothingBasicForAllViews.smoke.js +8 -8
  17. package/cypress/e2e/ILC/ImageHighlight/Scoring/allOrNothingWithAlternativePointsGreaterThanCorrectPoints.js +241 -0
  18. package/cypress/e2e/ILC/ImageHighlight/Scoring/allOrNothingWithCorrectPointsEqualToAlternativePoints.js +241 -0
  19. package/cypress/e2e/ILC/ImageHighlight/Scoring/allOrNothingWithCorrectPointsGreaterThanAlternatePoints.js +285 -0
  20. package/cypress/e2e/ILC/ImageHighlight/Scoring/manuallyAndNonScored.js +164 -0
  21. package/cypress/e2e/ILC/ImageHighlight/Scoring/partialDifferentWeightsAlternativePointsGreaterThanCorrectPoints.js +281 -0
  22. package/cypress/e2e/ILC/ImageHighlight/Scoring/partialDifferentWeightsScoring.js +467 -0
  23. package/cypress/e2e/ILC/ImageHighlight/Scoring/partialDifferentWeightsWithCorrectPointsEqualToAlternativePoints.js +250 -0
  24. package/cypress/e2e/ILC/ImageHighlight/Scoring/partialDifferentWeigtsCorrectPointsGreaterThanAlternativePoints.js +281 -0
  25. package/cypress/e2e/ILC/ImageHighlight/Scoring/partialEqualWeightsAlternativePointsGreaterThanCorrectPoints.js +260 -0
  26. package/cypress/e2e/ILC/ImageHighlight/Scoring/partialEqualWeightsScoring.js +184 -0
  27. package/cypress/e2e/ILC/ImageHighlight/Scoring/partialEqualWeightsWithCorrectPointsEqualToAlternativePoints.js +229 -0
  28. package/cypress/e2e/ILC/ImageHighlight/Scoring/partialEqualWeightsWithCorrectPointsGreaterThanAlternativePoints.js +261 -0
  29. package/cypress/e2e/ILC/chartsDotsPlot/allOrNothingForAllViews.smoke.js +409 -0
  30. package/cypress/e2e/ILC/chartsDotsPlot/checkAnswerFunctionalityForAllViews.smoke.js +199 -0
  31. package/cypress/e2e/ILC/chartsDotsPlot/gradingViewAndCorrectAnswerView.smoke.js +223 -0
  32. package/cypress/e2e/ILC/chartsDotsPlot/previewContentsForAllViews.smoke.js +402 -0
  33. package/cypress/pages/audioPlayerPage.js +229 -9
  34. package/cypress/pages/chartsBarPage.js +2 -70
  35. package/cypress/pages/chartsDotPlotPage.js +986 -3
  36. package/cypress/pages/chartsLinePage.js +368 -9
  37. package/cypress/pages/components/autoScoredScoringSectionMultiResponseType.js +0 -1
  38. package/cypress/pages/components/autoScoredSpecifyCorrectAnswerSection.js +3 -0
  39. package/cypress/pages/components/backgroundImageUploadComponent.js +1 -1
  40. package/cypress/pages/components/barAndLineChartComponent.js +27 -1
  41. package/cypress/pages/components/chartsCommonComponent.js +31 -2
  42. package/cypress/pages/components/createQuestionBasePage.js +1 -0
  43. package/cypress/pages/components/layoutSectionComponent.js +2 -2
  44. package/cypress/pages/components/singleMultipleSelectionModeComponent.js +5 -0
  45. package/cypress/pages/components/toolSettingsComponent.js +2 -2
  46. package/cypress/pages/feedbackScalePage.js +1 -1
  47. package/cypress/pages/gridFillPage.js +13 -6
  48. package/cypress/pages/imageHighlightPage.js +308 -2
  49. package/cypress/pages/numberLinePage.js +40 -16
  50. package/cypress/pages/textEntryMathPage.js +1 -1
  51. package/cypress/pages/videoResponsePage.js +350 -6
  52. package/package.json +1 -1
  53. package/cypress/e2e/ILC/ChartsBar/allOrNothingScoringForAllViews.smoke.js +0 -366
@@ -0,0 +1,595 @@
1
+ import { chartsLinePage, itemPreviewPage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ import utilities from "../../../support/helpers/utilities";
4
+ const css = Cypress.env('css');
5
+
6
+ const previewContentViews = ['Question preview'];
7
+ const views = utilities.getViews(previewContentViews);
8
+ var itemReferenceID = "";
9
+
10
+ describe('Create item page: Charts - Line - Preview contents in all views', () => {
11
+ before(() => {
12
+ cy.loginAs('admin');
13
+ });
14
+
15
+ views.forEach((view) => {
16
+ describe(`Preview tab contents - Edit line graphs, graph labels, locked graph ${view}`, { tags: 'smoke' }, () => {
17
+ abortEarlySetup();
18
+ before(() => {
19
+ switch (view) {
20
+ case 'Question preview':
21
+ chartsLinePage.steps.navigateToCreateQuestion('charts');
22
+ cy.barsPreLoaderWait();
23
+ chartsLinePage.steps.addTextInQuestionInstructionsInputField('Set the points on the chart for the profits of the years');
24
+ chartsLinePage.steps.selectLineButton();
25
+ chartsLinePage.steps.selectAddBarOrPointToolbarOption();
26
+ chartsLinePage.steps.addBarOrPointInChartInSelectChartTypeSection();
27
+ chartsLinePage.steps.setGraphTitle('Graph of profits');
28
+ chartsLinePage.steps.setYAxisLabel('Profit');
29
+ chartsLinePage.steps.setXAxisLabel('Year');
30
+ chartsLinePage.steps.setMaxYValue(20);
31
+ chartsLinePage.steps.setPointValueInSelectChartTypeSection({ pointIndex: 0, value: 1, range: 20 });
32
+ chartsLinePage.steps.setPointValueInSelectChartTypeSection({ pointIndex: 1, value: 2, range: 20 });
33
+ chartsLinePage.steps.setPointValueInSelectChartTypeSection({ pointIndex: 2, value: 3, range: 20 });
34
+ chartsLinePage.steps.setPointValueInSelectChartTypeSection({ pointIndex: 3, value: 4, range: 20 });
35
+ chartsLinePage.steps.lockPoint(1);
36
+ chartsLinePage.steps.allotPoints(10);
37
+ chartsLinePage.steps.setPointValueInSpecifyCorrectAnswerSection({ pointIndex: 0, value: 2, range: 20 });
38
+ chartsLinePage.steps.setPointValueInSpecifyCorrectAnswerSection({ pointIndex: 2, value: 5, range: 20 });
39
+ chartsLinePage.steps.setPointValueInSpecifyCorrectAnswerSection({ pointIndex: 3, value: 1, range: 20 });
40
+ chartsLinePage.steps.addBarOrPointInChartInSpecifyCorrectAnswerSection();
41
+ chartsLinePage.steps.setPointValueInSpecifyCorrectAnswerSection({ pointIndex: 4, value: 8, range: 20 });
42
+ chartsLinePage.steps.switchToPreviewTab();
43
+ break;
44
+ case 'Item view':
45
+ cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
46
+ break;
47
+ case 'Item preview':
48
+ cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
49
+ chartsLinePage.steps.switchToPreviewTab();
50
+ break;
51
+ case 'Student view':
52
+ cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
53
+ break;
54
+ default:
55
+ throw new Error('Invalid view');
56
+ }
57
+ });
58
+
59
+ after(() => {
60
+ if (view === 'Question preview') {
61
+ chartsLinePage.steps.clickOnSaveQuestionButton();
62
+ utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
63
+ itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
64
+ }
65
+ });
66
+
67
+ it('Question instructions should be visible', () => {
68
+ utilities.verifyInnerText(chartsLinePage.questionInstructionsText(), 'Set the points on the chart for the profits of the years');
69
+ utilities.verifyElementVisibilityState(chartsLinePage.questionInstructionsText(), 'visible');
70
+ });
71
+
72
+ it('The toolbar options - Add point, Undo, Redo and Reset should be displayed in the preview tab and only Add point button should be enabled', () => {
73
+ utilities.verifyElementVisibilityState(chartsLinePage.previewTabToolsAddBarOrPointButton(), 'visible');
74
+ utilities.verifyElementNotDisabled(chartsLinePage.previewTabToolsAddBarOrPointButton());
75
+ utilities.verifyElementVisibilityState(chartsLinePage.previewTabToolsUndoButton(), 'visible');
76
+ utilities.verifyElementDisabled(chartsLinePage.previewTabToolsUndoButton());
77
+ utilities.verifyElementVisibilityState(chartsLinePage.previewTabToolsRedoButton(), 'visible');
78
+ utilities.verifyElementDisabled(chartsLinePage.previewTabToolsRedoButton());
79
+ utilities.verifyElementVisibilityState(chartsLinePage.previewTabToolsResetButton(), 'visible');
80
+ utilities.verifyElementDisabled(chartsLinePage.previewTabToolsResetButton());
81
+ });
82
+
83
+ it('The graph title, Y axis label, X axis label and point labels should be displayed', () => {
84
+ utilities.verifyInnerText(chartsLinePage.previewTabGraphTitle(), 'Graph of profits');
85
+ utilities.verifyElementVisibilityState(chartsLinePage.previewTabGraphTitle(), 'visible');
86
+ utilities.verifyInnerText(chartsLinePage.previewTabYAxisLabelButton(), 'Profit');
87
+ utilities.verifyElementVisibilityState(chartsLinePage.previewTabYAxisLabelButton(), 'visible');
88
+ utilities.verifyInnerText(chartsLinePage.previewTabXAxisLabelButton(), 'Year');
89
+ utilities.verifyElementVisibilityState(chartsLinePage.previewTabXAxisLabelButton(), 'visible');
90
+ utilities.verifyInnerText(utilities.getNthElement(chartsLinePage.previewTabPointLabel(), 0), 'Bar 1');
91
+ utilities.verifyInnerText(utilities.getNthElement(chartsLinePage.previewTabPointLabel(), 1), 'Bar 2');
92
+ utilities.verifyInnerText(utilities.getNthElement(chartsLinePage.previewTabPointLabel(), 2), 'Bar 3');
93
+ utilities.verifyInnerText(utilities.getNthElement(chartsLinePage.previewTabPointLabel(), 3), '1');
94
+ });
95
+
96
+ it('The graph max value should be as set in the Max Y input field and it should affect the chart division', () => {
97
+ utilities.verifyTextContent(utilities.getNthElement(chartsLinePage.previewTabYAxisCoordinate(), 0), 20);
98
+ utilities.verifyElementCount(chartsLinePage.previewTabChartRowHeaderContainer(), 21);
99
+ });
100
+
101
+ it('User should be able to edit the Y axis and X axis labels in preview tab', () => {
102
+ chartsLinePage.steps.editYAxisLabelInPreviewTab('Edited Y axis label');
103
+ utilities.verifyInnerText(chartsLinePage.previewTabYAxisLabelButton(), 'Edited Y axis label');
104
+ chartsLinePage.steps.editXAxisLabelInPreviewTab('Edited X axis label');
105
+ utilities.verifyInnerText(chartsLinePage.previewTabXAxisLabelButton(), 'Edited X axis label');
106
+ });
107
+
108
+ it('The charts and graphs should be visible as set by the user in select chart type section', () => {
109
+ chartsLinePage.steps.verifyPointValueInPreviewTab({ pointIndex: 0, value: 1, range: 20 });
110
+ chartsLinePage.steps.verifyPointValueInPreviewTab({ pointIndex: 1, value: 2, range: 20 });
111
+ chartsLinePage.steps.verifyPointValueInPreviewTab({ pointIndex: 2, value: 3, range: 20 });
112
+ chartsLinePage.steps.verifyPointValueInPreviewTab({ pointIndex: 3, value: 4, range: 20 });
113
+ });
114
+
115
+ it('The locked point should be displayed in the locked state in preview tab and it should not have a drag handle', () => {
116
+ chartsLinePage.steps.verifyPointIsLockedInPreviewTab(1);
117
+ });
118
+
119
+ it('User should not be able to edit the locked point height', () => {
120
+ chartsLinePage.steps.verifyLockedPointIsUneditableInPreviewTab(1);
121
+ });
122
+
123
+ it('User should be able to increase the point height in preview tab', () => {
124
+ chartsLinePage.steps.setPointValueInPreviewTab({ pointIndex: 0, value: 20, range: 20 });
125
+ });
126
+
127
+ it('User should be able to decrease the height of the point in preview tab', () => {
128
+ chartsLinePage.steps.setPointValueInPreviewTab({ pointIndex: 2, value: 0, range: 20 });
129
+ });
130
+
131
+ it('When point is at the topmost value and the user still tries to increase its value, then the point value should not increase', () => {
132
+ chartsLinePage.steps.keyBoardUpPointInPreviewTab(0);
133
+ chartsLinePage.steps.keyBoardUpPointInPreviewTab(0);
134
+ chartsLinePage.steps.verifyPointValueInPreviewTab({ pointIndex: 0, value: 20, range: 20 });
135
+ });
136
+
137
+ it('When point is at the bottommost value and the user still tries to decrease its value, then the point value should not decrease', () => {
138
+ chartsLinePage.steps.keyBoardDownPointInPreviewTab(2);
139
+ chartsLinePage.steps.keyBoardDownPointInPreviewTab(2);
140
+ chartsLinePage.steps.verifyPointValueInPreviewTab({ pointIndex: 2, value: 0, range: 20 });
141
+ });
142
+
143
+ chartsLinePage.tests.verifyPointTooltipContentsCSSAndA11yInPreviewTab('0', 'Bar 1');
144
+
145
+ it('User should be able to edit the point label', () => {
146
+ chartsLinePage.steps.editPointLabelInPreviewTab(0, '2000');
147
+ });
148
+
149
+ it('CSS of preview tab contents', { tags: 'css' }, () => {
150
+ utilities.verifyCSS(chartsLinePage.previewTabToolsAddBarOrPointButton(), {
151
+ 'background-color': css.color.activeButtons
152
+ });
153
+ utilities.verifyCSS(chartsLinePage.previewTabGraphTitle(), {
154
+ 'color': css.color.text,
155
+ 'font-size': css.fontSize.default,
156
+ 'font-weight': css.fontWeight.bold
157
+ });
158
+ utilities.verifyCSS(chartsLinePage.previewTabYAxisLabelButton(), {
159
+ 'color': css.color.activeButtons,
160
+ 'font-size': css.fontSize.default,
161
+ 'font-weight': css.fontWeight.bold
162
+ });
163
+ utilities.verifyCSS(chartsLinePage.previewTabXAxisLabelButton(), {
164
+ 'color': css.color.activeButtons,
165
+ 'font-size': css.fontSize.default,
166
+ 'font-weight': css.fontWeight.bold
167
+ });
168
+ utilities.verifyCSS(chartsLinePage.previewTabPointLabel(), {
169
+ 'color': css.color.text,
170
+ 'font-size': css.fontSize.default,
171
+ 'font-weight': css.fontWeight.semibold
172
+ });
173
+ utilities.verifyCSS(chartsLinePage.previewTabYAxisCoordinate(), {
174
+ 'color': css.color.text,
175
+ 'font-size': css.fontSize.normal,
176
+ 'font-weight': css.fontWeight.semibold
177
+ });
178
+ utilities.verifyCSS(chartsLinePage.previewTabPoint().eq(0), {
179
+ 'background-color': css.color.lineChartDragIcon
180
+ });
181
+ utilities.verifyCSS(chartsLinePage.previewTabConnectorLine().eq(0), {
182
+ 'background-color': css.color.lineChartConnectorLine
183
+ });
184
+ utilities.verifyCSS(chartsLinePage.pointLockIcon(), {
185
+ 'background-color': css.color.defaultBackground,
186
+ });
187
+ });
188
+
189
+ it('Accessibility of preview tab contents', { tags: 'a11y' }, () => {
190
+ cy.checkAccessibility(chartsLinePage.previewTabGraphTitle().parents('[class*="ChartsPreviewstyles__PreviewWrapper"]'));
191
+ });
192
+ });
193
+ });
194
+
195
+ views.forEach((view) => {
196
+ describe(`Preview tab contents - Add and delete point ${view}`, { tags: 'smoke' }, () => {
197
+ abortEarlySetup();
198
+ before(() => {
199
+ switch (view) {
200
+ case 'Question preview':
201
+ chartsLinePage.steps.navigateToCreateQuestion('charts');
202
+ cy.barsPreLoaderWait();
203
+ chartsLinePage.steps.addTextInQuestionInstructionsInputField('Set the point on the chart for the profits of the years');
204
+ chartsLinePage.steps.selectLineButton();
205
+ chartsLinePage.steps.selectAddBarOrPointToolbarOption();
206
+ chartsLinePage.steps.setPointValueInSelectChartTypeSection({ pointIndex: 0, value: 1, range: 10 });
207
+ chartsLinePage.steps.setPointValueInSelectChartTypeSection({ pointIndex: 1, value: 2, range: 10 });
208
+ chartsLinePage.steps.setPointValueInSelectChartTypeSection({ pointIndex: 2, value: 3, range: 10 });
209
+ chartsLinePage.steps.allotPoints(10);
210
+ chartsLinePage.steps.setPointValueInSpecifyCorrectAnswerSection({ pointIndex: 0, value: 2, range: 10 });
211
+ chartsLinePage.steps.setPointValueInSpecifyCorrectAnswerSection({ pointIndex: 1, value: 4, range: 10 });
212
+ chartsLinePage.steps.setPointValueInSpecifyCorrectAnswerSection({ pointIndex: 2, value: 5, range: 10 });
213
+ chartsLinePage.steps.switchToPreviewTab();
214
+ break;
215
+ case 'Item view':
216
+ cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
217
+ break;
218
+ case 'Item preview':
219
+ cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
220
+ chartsLinePage.steps.switchToPreviewTab();
221
+ break;
222
+ case 'Student view':
223
+ cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
224
+ break;
225
+ default:
226
+ throw new Error('Invalid view');
227
+ }
228
+ });
229
+
230
+ after(() => {
231
+ if (view === 'Question preview') {
232
+ chartsLinePage.steps.clickOnSaveQuestionButton();
233
+ utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
234
+ itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
235
+ }
236
+ });
237
+
238
+ it('When user hovers on the enabled add point button, then tooltip \'Add point\' should be displayed', () => {
239
+ chartsLinePage.previewTabToolsAddBarOrPointButton()
240
+ .verifyTooltip('Add point');
241
+ });
242
+
243
+ it('CSS of the tooltip text', { tags: 'css' }, () => {
244
+ utilities.hoverOverElement(chartsLinePage.previewTabToolsAddBarOrPointButton());
245
+ utilities.verifyCSS(chartsLinePage.tooltipText(), {
246
+ 'color': css.color.whiteText,
247
+ 'font-size': css.fontSize.small,
248
+ 'font-weight': css.fontWeight.regular,
249
+ 'background-color': css.color.tooltipBg
250
+ });
251
+ utilities.hoverAwayFromElement();
252
+ });
253
+
254
+ it('Accessibility of the tooltip text', { tags: 'a11y' }, () => {
255
+ utilities.hoverOverElement(chartsLinePage.previewTabToolsAddBarOrPointButton());
256
+ utilities.verifyElementVisibilityState(chartsLinePage.tooltipText(), 'visible');
257
+ cy.checkAccessibility(chartsLinePage.tooltipText().parents('[role="tooltip"]'));
258
+ utilities.hoverAwayFromElement();
259
+ utilities.verifyElementVisibilityState(chartsLinePage.tooltipText(), 'notExist');
260
+ });
261
+
262
+ it('User should be able to add a point in chart and the added point should be displayed at 0 height with the label \'4\'', () => {
263
+ chartsLinePage.steps.addBarOrPointInChartInPreviewTab();
264
+ utilities.verifyElementCount(chartsLinePage.previewTabPoint(), 4);
265
+ chartsLinePage.steps.verifyPointValueInPreviewTab({ pointIndex: 3, value: 0, range: 20 });
266
+ utilities.verifyInnerText(utilities.getNthElement(chartsLinePage.previewTabPointLabel(), 3), '1');
267
+ });
268
+
269
+ it('CSS of newly added point in preview tab', { tags: 'css' }, () => {
270
+ utilities.verifyCSS(chartsLinePage.previewTabPoint().eq(4).find('.line-chart-drag-icon'), {
271
+ 'background-color': css.color.lineChartDragIcon
272
+ });
273
+ });
274
+
275
+ it('Accessibility of newly added point in preview tab', { tags: 'a11y' }, () => {
276
+ cy.checkAccessibility(chartsLinePage.previewTabGraphTitle().parents('[class*="ChartsPreviewstyles__PreviewWrapper"]'));
277
+ });
278
+
279
+ it('When user deletes a point, then that point should be deleted and the add point button should be enabled again', () => {
280
+ chartsLinePage.steps.deletePointInPreviewTab(3);
281
+ utilities.verifyElementCount(chartsLinePage.previewTabPoint(), 3);
282
+ utilities.verifyElementVisibilityState(utilities.getNthElement(chartsLinePage.previewTabPointLabel(), 4), 'notExist');
283
+ });
284
+ });
285
+ });
286
+
287
+ views.forEach((view) => {
288
+ describe(`Preview tab contents - Undo, Redo and Reset buttons ${view}`, { tags: 'smoke' }, () => {
289
+ abortEarlySetup();
290
+ before(() => {
291
+ switch (view) {
292
+ case 'Question preview':
293
+ chartsLinePage.steps.navigateToCreateQuestion('charts');
294
+ cy.barsPreLoaderWait();
295
+ chartsLinePage.steps.addTextInQuestionInstructionsInputField('Set the point on the chart for the profits of the years');
296
+ chartsLinePage.steps.selectLineButton();
297
+ chartsLinePage.steps.selectAddBarOrPointToolbarOption();
298
+ chartsLinePage.steps.addBarOrPointInChartInSelectChartTypeSection();
299
+ chartsLinePage.steps.setPointValueInSelectChartTypeSection({ pointIndex: 0, value: 1, range: 10 });
300
+ chartsLinePage.steps.setPointValueInSelectChartTypeSection({ pointIndex: 1, value: 2, range: 10 });
301
+ chartsLinePage.steps.setPointValueInSelectChartTypeSection({ pointIndex: 2, value: 3, range: 10 });
302
+ chartsLinePage.steps.setPointValueInSelectChartTypeSection({ pointIndex: 3, value: 4, range: 10 });
303
+ chartsLinePage.steps.allotPoints(10);
304
+ chartsLinePage.steps.setPointValueInSpecifyCorrectAnswerSection({ pointIndex: 0, value: 2, range: 10 });
305
+ chartsLinePage.steps.setPointValueInSpecifyCorrectAnswerSection({ pointIndex: 1, value: 4, range: 10 });
306
+ chartsLinePage.steps.setPointValueInSpecifyCorrectAnswerSection({ pointIndex: 2, value: 5, range: 10 });
307
+ chartsLinePage.steps.setPointValueInSpecifyCorrectAnswerSection({ pointIndex: 3, value: 1, range: 10 });
308
+ chartsLinePage.steps.switchToPreviewTab();
309
+ break;
310
+ case 'Item view':
311
+ cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
312
+ break;
313
+ case 'Item preview':
314
+ cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
315
+ chartsLinePage.steps.switchToPreviewTab();
316
+ break;
317
+ case 'Student view':
318
+ cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
319
+ break;
320
+ default:
321
+ throw new Error('Invalid view');
322
+ }
323
+ });
324
+
325
+ after(() => {
326
+ if (view === 'Question preview') {
327
+ chartsLinePage.steps.clickOnSaveQuestionButton();
328
+ utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
329
+ itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
330
+ }
331
+ });
332
+
333
+ //Point labels
334
+ it('When user updates a point label, then the undo and reset button should be displayed in enabled state', () => {
335
+ chartsLinePage.steps.editPointLabelInPreviewTab(0, 'Edited point 1');
336
+ utilities.verifyElementNotDisabled(chartsLinePage.previewTabToolsUndoButton());
337
+ utilities.verifyElementNotDisabled(chartsLinePage.previewTabToolsResetButton());
338
+ });
339
+
340
+ it('When user hovers on the enabled undo and reset button, then tooltips \'Undo\' and \'Reset\' should be displayed', () => {
341
+ chartsLinePage.previewTabToolsUndoButton()
342
+ .verifyTooltip('Undo');
343
+ chartsLinePage.previewTabToolsResetButton()
344
+ .verifyTooltip('Reset');
345
+ });
346
+
347
+ it('CSS of the tooltip text', { tags: 'css' }, () => {
348
+ utilities.triggerMouseover(chartsLinePage.previewTabToolsUndoButton());
349
+ utilities.verifyCSS(chartsLinePage.tooltipText(), {
350
+ 'color': css.color.whiteText,
351
+ 'font-size': css.fontSize.small,
352
+ 'font-weight': css.fontWeight.regular,
353
+ 'background-color': css.color.tooltipBg
354
+ });
355
+ utilities.triggerMouseout(chartsLinePage.previewTabToolsUndoButton());
356
+ utilities.triggerMouseover(chartsLinePage.previewTabToolsResetButton());
357
+ utilities.verifyCSS(chartsLinePage.tooltipText(), {
358
+ 'color': css.color.whiteText,
359
+ 'font-size': css.fontSize.small,
360
+ 'font-weight': css.fontWeight.regular,
361
+ 'background-color': css.color.tooltipBg
362
+ });
363
+ utilities.triggerMouseout(chartsLinePage.previewTabToolsResetButton());
364
+ });
365
+
366
+ it('Accessibility of the tooltip text', { tags: 'a11y' }, () => {
367
+ utilities.triggerMouseover(chartsLinePage.previewTabToolsUndoButton());
368
+ utilities.verifyElementVisibilityState(chartsLinePage.tooltipText(), 'visible');
369
+ cy.checkAccessibility(chartsLinePage.tooltipText().parents('[role="tooltip"]'));
370
+ utilities.triggerMouseout(chartsLinePage.previewTabToolsUndoButton());
371
+ utilities.verifyElementVisibilityState(chartsLinePage.tooltipText(), 'notExist');
372
+ utilities.triggerMouseover(chartsLinePage.previewTabToolsResetButton());
373
+ utilities.verifyElementVisibilityState(chartsLinePage.tooltipText(), 'visible');
374
+ cy.checkAccessibility(chartsLinePage.tooltipText().parents('[role="tooltip"]'));
375
+ utilities.triggerMouseout(chartsLinePage.previewTabToolsResetButton());
376
+ utilities.verifyElementVisibilityState(chartsLinePage.tooltipText(), 'notExist');
377
+ });
378
+
379
+ it('When user clicks on a undo button, then the previously performed action should be reverted', () => {
380
+ chartsLinePage.steps.clickOnUndoButtonPreviewTab();
381
+ utilities.verifyInnerText(utilities.getNthElement(chartsLinePage.previewTabPointLabel(), 0), 'Bar 1');
382
+ });
383
+
384
+ it('When user has clicked on undo button, then the redo button should be enabled', () => {
385
+ utilities.verifyElementNotDisabled(chartsLinePage.previewTabToolsRedoButton());
386
+ });
387
+
388
+ it('When user hovers on the enabled redo button, then tooltip \'Redo\' should be displayed', () => {
389
+ chartsLinePage.previewTabToolsRedoButton()
390
+ .verifyTooltip('Redo');
391
+ });
392
+
393
+ it('CSS of the tooltip text', { tags: 'css' }, () => {
394
+ utilities.triggerMouseover(chartsLinePage.previewTabToolsRedoButton());
395
+ utilities.verifyCSS(chartsLinePage.tooltipText(), {
396
+ 'color': css.color.whiteText,
397
+ 'font-size': css.fontSize.small,
398
+ 'font-weight': css.fontWeight.regular,
399
+ 'background-color': css.color.tooltipBg
400
+ });
401
+ utilities.triggerMouseout(chartsLinePage.previewTabToolsRedoButton());
402
+ });
403
+
404
+ it('Accessibility of the tooltip text', { tags: 'a11y' }, () => {
405
+ utilities.triggerMouseover(chartsLinePage.previewTabToolsRedoButton());
406
+ utilities.verifyElementVisibilityState(chartsLinePage.tooltipText(), 'visible');
407
+ cy.checkAccessibility(chartsLinePage.tooltipText().parents('[role="tooltip"]'));
408
+ utilities.triggerMouseout(chartsLinePage.previewTabToolsRedoButton());
409
+ utilities.verifyElementVisibilityState(chartsLinePage.tooltipText(), 'notExist');
410
+ });
411
+
412
+ it('When the user clicks on redo button, then the last reverted action should be performed again and the button should be disabled and undo button should be enabled', () => {
413
+ chartsLinePage.steps.clickOnRedoButtonPreviewTab();
414
+ utilities.verifyInnerText(utilities.getNthElement(chartsLinePage.previewTabPointLabel(), 0), 'Edited point 1');
415
+ utilities.verifyElementDisabled(chartsLinePage.previewTabToolsRedoButton());
416
+ utilities.verifyElementNotDisabled(chartsLinePage.previewTabToolsUndoButton());
417
+ });
418
+
419
+ it('When user performs more than 1 actions and then clicks on undo button, then undo button should be enabled' ,() => {
420
+ cy.log('Pre-step: Reset the chart');
421
+ chartsLinePage.steps.clickOnResetButtonPreviewTab();
422
+ chartsLinePage.steps.confirmReset();
423
+ chartsLinePage.steps.editPointLabelInPreviewTab(0, 'Edited point 1');
424
+ chartsLinePage.steps.editPointLabelInPreviewTab(1, 'Edited point 2');
425
+ chartsLinePage.steps.clickOnUndoButtonPreviewTab();
426
+ utilities.verifyElementNotDisabled(chartsLinePage.previewTabToolsUndoButton());
427
+ });
428
+
429
+ it('When the user clicks on undo button until the graph reaches its initial state, then the undo button should be disabled', () => {
430
+ chartsLinePage.steps.clickOnUndoButtonPreviewTab();
431
+ utilities.verifyElementDisabled(chartsLinePage.previewTabToolsUndoButton());
432
+ });
433
+
434
+ //Point value/height
435
+ it('When user updates a point value and clicks on undo button, then the previously performed action should be reverted', () => {
436
+ cy.log('Pre-step: Reset the chart');
437
+ chartsLinePage.steps.clickOnResetButtonPreviewTab();
438
+ chartsLinePage.steps.confirmReset();
439
+ chartsLinePage.steps.setPointValueInPreviewTab({ pointIndex: 0, value: 4, range: 10 });
440
+ chartsLinePage.steps.clickOnUndoButtonPreviewTab();
441
+ chartsLinePage.steps.verifyPointValueInPreviewTab({ pointIndex: 0, value: 3, range: 10 });
442
+ });
443
+
444
+ it('When user has clicked on undo button, then the redo button should be enabled', () => {
445
+ utilities.verifyElementNotDisabled(chartsLinePage.previewTabToolsRedoButton());
446
+ });
447
+
448
+ it('When the user clicks on redo button, then the last reverted action should be performed again and the button should be disabled and undo button should be enabled', () => {
449
+ chartsLinePage.steps.clickOnRedoButtonPreviewTab();
450
+ chartsLinePage.steps.verifyPointValueInPreviewTab({ pointIndex: 0, value: 4, range: 10 });
451
+ utilities.verifyElementDisabled(chartsLinePage.previewTabToolsRedoButton());
452
+ utilities.verifyElementNotDisabled(chartsLinePage.previewTabToolsUndoButton());
453
+ });
454
+
455
+ it('When user performs more than 1 actions and then clicks on undo button, then undo button should be enabled' ,() => {
456
+ cy.log('Reset the chart');
457
+ chartsLinePage.steps.clickOnResetButtonPreviewTab();
458
+ chartsLinePage.steps.confirmReset();
459
+ chartsLinePage.steps.setPointValueInPreviewTab({ pointIndex: 0, value: 3, range: 10 });
460
+ chartsLinePage.steps.clickOnUndoButtonPreviewTab();
461
+ utilities.verifyElementNotDisabled(chartsLinePage.previewTabToolsUndoButton());
462
+ });
463
+
464
+ it('When the user clicks on undo button until the graph reaches its initial state, then the undo button should be disabled', () => {
465
+ chartsLinePage.steps.clickOnUndoButtonPreviewTab();
466
+ utilities.verifyElementDisabled(chartsLinePage.previewTabToolsUndoButton());
467
+ });
468
+
469
+ //Add point
470
+ it('When user adds a point and and clicks on undo button, then the previously performed action should be reverted', () => {
471
+ cy.log('Pre-step: Reset the chart');
472
+ chartsLinePage.steps.clickOnResetButtonPreviewTab();
473
+ chartsLinePage.steps.confirmReset();
474
+ chartsLinePage.steps.addBarOrPointInChartInPreviewTab();
475
+ chartsLinePage.steps.clickOnUndoButtonPreviewTab();
476
+ utilities.verifyElementCount(chartsLinePage.previewTabPoint(), 4);
477
+ });
478
+
479
+ it('When user has clicked on undo button, then the redo button should be enabled', () => {
480
+ utilities.verifyElementNotDisabled(chartsLinePage.previewTabToolsRedoButton());
481
+ });
482
+
483
+ it('When the user clicks on redo button, then the last reverted action should be performed again and the button should be disabled and undo button should be enabled', () => {
484
+ chartsLinePage.steps.clickOnRedoButtonPreviewTab();
485
+ utilities.verifyElementCount(chartsLinePage.previewTabPoint(), 5);
486
+ utilities.verifyElementDisabled(chartsLinePage.previewTabToolsRedoButton());
487
+ utilities.verifyElementNotDisabled(chartsLinePage.previewTabToolsUndoButton());
488
+ });
489
+
490
+ it('When user performs more than 1 actions and then clicks on undo button, then undo button should be enabled' ,() => {
491
+ cy.log('Reset the chart');
492
+ chartsLinePage.steps.clickOnResetButtonPreviewTab();
493
+ chartsLinePage.steps.confirmReset();
494
+ chartsLinePage.steps.addBarOrPointInChartInPreviewTab();
495
+ chartsLinePage.steps.addBarOrPointInChartInPreviewTab();
496
+ chartsLinePage.steps.clickOnUndoButtonPreviewTab();
497
+ utilities.verifyElementNotDisabled(chartsLinePage.previewTabToolsUndoButton());
498
+ });
499
+
500
+ it('When the user clicks on undo button until the graph reaches its initial state, then the undo button should be disabled', () => {
501
+ chartsLinePage.steps.clickOnUndoButtonPreviewTab();
502
+ utilities.verifyElementDisabled(chartsLinePage.previewTabToolsUndoButton());
503
+ });
504
+
505
+ //Delete point
506
+ it('When user deletes a point and clicks on a undo button, then the previously performed action should be reverted', () => {
507
+ cy.log('Pre-step: Reset the chart');
508
+ chartsLinePage.steps.clickOnResetButtonPreviewTab();
509
+ chartsLinePage.steps.confirmReset();
510
+ chartsLinePage.steps.deletePointInPreviewTab(0);
511
+ chartsLinePage.steps.clickOnUndoButtonPreviewTab();
512
+ utilities.verifyElementCount(chartsLinePage.previewTabPoint(), 4);
513
+ });
514
+
515
+ it('When user has clicked on undo button, then the redo button should be enabled', () => {
516
+ utilities.verifyElementNotDisabled(chartsLinePage.previewTabToolsRedoButton());
517
+ });
518
+
519
+ it('When the user clicks on redo button, then the last reverted action should be performed again and the button should be disabled and undo button should be enabled', () => {
520
+ chartsLinePage.steps.clickOnRedoButtonPreviewTab();
521
+ utilities.verifyElementCount(chartsLinePage.previewTabPoint(), 3);
522
+ utilities.verifyElementDisabled(chartsLinePage.previewTabToolsRedoButton());
523
+ utilities.verifyElementNotDisabled(chartsLinePage.previewTabToolsUndoButton());
524
+ });
525
+
526
+ it('When user performs more than 1 actions and then clicks on undo button, then undo button should be enabled' ,() => {
527
+ cy.log('Reset the chart');
528
+ chartsLinePage.steps.clickOnResetButtonPreviewTab();
529
+ chartsLinePage.steps.confirmReset();
530
+ chartsLinePage.steps.deletePointInPreviewTab(0);
531
+ chartsLinePage.steps.deletePointInPreviewTab(0);
532
+ chartsLinePage.steps.clickOnUndoButtonPreviewTab();
533
+ utilities.verifyElementNotDisabled(chartsLinePage.previewTabToolsUndoButton());
534
+ });
535
+
536
+ it('When the user clicks on undo button until the graph reaches its initial state, then the undo button should be disabled', () => {
537
+ chartsLinePage.steps.clickOnUndoButtonPreviewTab();
538
+ utilities.verifyElementDisabled(chartsLinePage.previewTabToolsUndoButton());
539
+ });
540
+
541
+ //Reset button
542
+ it('When the user clicks on Reset button then reset popup should be displayed', () => {
543
+ cy.log('Pre-step: Editing the graph');
544
+ chartsLinePage.steps.setPointValueInPreviewTab({ pointIndex: 0, value: 10, range: 10 });
545
+ chartsLinePage.steps.setPointValueInPreviewTab({ pointIndex: 1, value: 2, range: 10 });
546
+ chartsLinePage.steps.setPointValueInPreviewTab({ pointIndex: 2, value: 0, range: 10 });
547
+ chartsLinePage.steps.setPointValueInPreviewTab({ pointIndex: 3, value: 6, range: 10 });
548
+ chartsLinePage.steps.clickOnResetButtonPreviewTab();
549
+ utilities.verifyElementVisibilityState(chartsLinePage.dialogBox(), 'visible');
550
+ });
551
+
552
+ chartsLinePage.tests.verifyResetPopupContentWithCSSAndA11y('chart');
553
+
554
+ it('When user clicks on cancel button in reset popup, then reset popup should close and chart should not be reset', () => {
555
+ chartsLinePage.steps.cancelReset();
556
+ chartsLinePage.steps.verifyPointValueInPreviewTab({ pointIndex: 0, value: 10, range: 10 });
557
+ chartsLinePage.steps.verifyPointValueInPreviewTab({ pointIndex: 1, value: 2, range: 10 });
558
+ chartsLinePage.steps.verifyPointValueInPreviewTab({ pointIndex: 2, value: 0, range: 10 });
559
+ chartsLinePage.steps.verifyPointValueInPreviewTab({ pointIndex: 3, value: 6, range: 10 });
560
+ });
561
+
562
+ it('When the user clicks on Reset button and confirms reset, then all the chart actions should be reverted and chart should be reverted to default state', () => {
563
+ chartsLinePage.steps.clickOnResetButtonPreviewTab();
564
+ chartsLinePage.steps.confirmReset();
565
+ utilities.verifyElementNotDisabled(chartsLinePage.previewTabToolsAddBarOrPointButton());
566
+ utilities.verifyElementVisibilityState(chartsLinePage.previewTabToolsUndoButton(), 'visible');
567
+ utilities.verifyElementDisabled(chartsLinePage.previewTabToolsUndoButton());
568
+ utilities.verifyElementVisibilityState(chartsLinePage.previewTabToolsRedoButton(), 'visible');
569
+ utilities.verifyElementDisabled(chartsLinePage.previewTabToolsRedoButton());
570
+ utilities.verifyElementVisibilityState(chartsLinePage.previewTabToolsResetButton(), 'visible');
571
+ utilities.verifyElementDisabled(chartsLinePage.previewTabToolsResetButton());
572
+ utilities.verifyInnerText(utilities.getNthElement(chartsLinePage.previewTabPointLabel(), 0), 'Bar 1');
573
+ utilities.verifyInnerText(utilities.getNthElement(chartsLinePage.previewTabPointLabel(), 1), 'Bar 2');
574
+ utilities.verifyInnerText(utilities.getNthElement(chartsLinePage.previewTabPointLabel(), 2), 'Bar 3');
575
+ utilities.verifyInnerText(utilities.getNthElement(chartsLinePage.previewTabPointLabel(), 3), '1');
576
+ chartsLinePage.steps.verifyPointValueInPreviewTab({ pointIndex: 0, value: 1, range: 10 });
577
+ chartsLinePage.steps.verifyPointValueInPreviewTab({ pointIndex: 1, value: 2, range: 10 });
578
+ chartsLinePage.steps.verifyPointValueInPreviewTab({ pointIndex: 2, value: 3, range: 10 });
579
+ chartsLinePage.steps.verifyPointValueInPreviewTab({ pointIndex: 3, value: 4, range: 10 });
580
+ });
581
+
582
+ it('CSS of preview tab contents', { tags: 'css' }, () => {
583
+ utilities.verifyCSS(chartsLinePage.previewTabToolsUndoButton().find('svg'), {
584
+ 'fill': css.color.secondaryBtnDisabled
585
+ });
586
+ utilities.verifyCSS(chartsLinePage.previewTabToolsRedoButton().find('svg'), {
587
+ 'fill': css.color.secondaryBtnDisabled
588
+ });
589
+ utilities.verifyCSS(chartsLinePage.previewTabToolsUndoButton().find('svg'), {
590
+ 'fill': css.color.secondaryBtnDisabled
591
+ });
592
+ });
593
+ });
594
+ });
595
+ });