itemengine-cypress-automation 1.0.128 → 1.0.130

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. package/cypress/e2e/ILC/ContentBlocks/editTabBasics.js +210 -0
  2. package/cypress/e2e/ILC/ContentBlocks/previewContents.smoke.js +91 -0
  3. package/cypress/e2e/ILC/ContentBlocks/styleAndLayoutCustomizationSection.js +392 -0
  4. package/cypress/e2e/ILC/DrawingResponse/drawingResponseAdditionalSettings.js +1 -1
  5. package/cypress/e2e/ILC/DrawingResponse/drawingResponseBackground.js +1 -1
  6. package/cypress/e2e/ILC/DrawingResponse/drawingResponseCustomizeAdditionalOptions.js +2 -1
  7. package/cypress/e2e/ILC/DrawingResponse/drawingResponseGradingViewAndCorrectAnswerViewContents.smoke.js +2 -1
  8. package/cypress/e2e/ILC/EssayResponse/essayResponseSpecialCharacters.js +1 -0
  9. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/allOrNothingGroupedScoring.js +152 -0
  10. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/allOrNothingWithAlternativePointsGreaterThanCorrectPoints.js +196 -0
  11. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/allOrNothingWithCorrectPointsEqualToAlternativePoints.js +195 -0
  12. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/allOrNothingWithCorrectPointsGreaterThanAlternativePoints.js +288 -0
  13. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/manuallyAndNonScored.js +141 -0
  14. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialDifferentWeightsAlternativePointsGreaterThanCorrectPoints.js +245 -0
  15. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialDifferentWeightsBasic.js +413 -0
  16. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialDifferentWeightsWithCorrectPointsEqualToAlternativePoints.js +218 -0
  17. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialDifferentWeightsWithCorrectPointsGreaterThanAlternativePoints.js +245 -0
  18. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialEqualWeightsBasic.js +163 -0
  19. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialEqualWeightsWithAlternativePointsGreaterThanCorrectPoints.js +224 -0
  20. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialEqualWeightsWithCorrectPointsEqualToAlternativePoints.js +196 -0
  21. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialEqualWeightsWithCorrectPointsGreaterThanAlternativePoints.js +224 -0
  22. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/responseLevelAlternateAnswerBasicScoring.js +83 -0
  23. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/clickAndDrop.js +653 -0
  24. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/draggableOptions.js +180 -0
  25. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/editTabScoringSection.js +229 -0
  26. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/specifyCorrectAnswerSection.js +90 -0
  27. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/switchingCasesBetweenOptionsLayout.js +50 -0
  28. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/allOrNothingAlternativePointsGreaterThanCorrectPoints.js +204 -0
  29. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/allOrNothingCorrectPointsEqualToAlternativePoints.js +204 -0
  30. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +298 -0
  31. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/allOrNothingPenaltyScoring.js +63 -0
  32. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/manuallyAndNonScored.js +111 -0
  33. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialDifferentWeightsAlternativePointsGreaterThanCorrectPoints.js +231 -0
  34. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialDifferentWeightsBasic.js +90 -0
  35. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialDifferentWeightsMinimumAndPenaltyScoring.js +300 -0
  36. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialDifferentWeightsWithCorrectPointsEqualToAlternativePoints.js +232 -0
  37. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialDifferentWeightsWithCorrectPointsGreaterThanAlternativePoints.js +231 -0
  38. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialEqualWeightsBasic.js +138 -0
  39. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialEqualWeightsWithAlternativePointsGreaterThanCorrectPoints.js +213 -0
  40. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialEqualWeightsWithCorrectPointsEqualToAlternativePoints.js +186 -0
  41. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialEqualWeightsWithCorrectPointsGreaterThanAlternativePoints.js +214 -0
  42. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/dropdownAndDropdownMenuSection.js +161 -0
  43. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/dropdownOptionsSection.js +328 -0
  44. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/editTabBasicSection.js +144 -0
  45. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/editTabScoringSection.js +250 -0
  46. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/headerSection.js +75 -0
  47. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/minimumScoringPenaltyPointsAndRoundingDropdown.js +194 -0
  48. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/specifyCorrectAnswerSection.js +74 -0
  49. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/studentViewSettings.js +188 -0
  50. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/clickAndDrop.js +8 -8
  51. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/editTabScoring.js +0 -1
  52. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/specifyCorrectAnswerSection.js +4 -2
  53. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/editTabScoringSection.js +1 -52
  54. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/responseAnswersAndAcceptedStudentInput.js +3 -211
  55. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/setLimitSection.js +39 -3
  56. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/specialCharactersSection.js +1 -8
  57. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/specifyCorrectAnswerSection.js +3 -1
  58. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/studentViewSettings.js +2 -50
  59. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/conditionalCheckboxScoring.js +325 -0
  60. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsBasic.js +1 -146
  61. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsMinimumAndPenaltyScoring.js +300 -0
  62. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/responseLevelAlternateAnswersBasicScoring.js +78 -0
  63. package/cypress/e2e/ILC/FillInTheGapsTextNew/editTabScoringSection.js +265 -0
  64. package/cypress/e2e/ILC/FillInTheGapsTextNew/headerSection.js +75 -0
  65. package/cypress/e2e/ILC/FillInTheGapsTextNew/minimumScoringPenaltyPointsAndRoundingDropdown.js +194 -0
  66. package/cypress/e2e/ILC/FillInTheGapsTextNew/responseAnswersAndAcceptedStudentInput.js +56 -0
  67. package/cypress/e2e/ILC/FillInTheGapsTextNew/setLimitSection.js +40 -2
  68. package/cypress/e2e/ILC/FillInTheGapsTextNew/specialCharactersSection.js +249 -0
  69. package/cypress/e2e/ILC/FillInTheGapsTextNew/specifyCorrectAnswerSection.js +64 -0
  70. package/cypress/e2e/ILC/FillInTheGapsTextNew/studentViewSettings.js +128 -0
  71. package/cypress/e2e/ILC/Graphing/allOrNothingForAllViews.smoke.js +889 -0
  72. package/cypress/e2e/ILC/Graphing/checkAnswerFunctionalityForAllViews.smoke.js +168 -0
  73. package/cypress/e2e/ILC/Graphing/gradingViewAndCorrectAnswerView.smoke.js +203 -0
  74. package/cypress/e2e/ILC/Graphing/previewContentsForAllViews.smoke.js +222 -0
  75. package/cypress/e2e/ILC/SimpleCalculator/calculatorFunctionality.js +349 -0
  76. package/cypress/e2e/ILC/SimpleCalculator/previewContents.smoke.js +132 -0
  77. package/cypress/e2e/ILC/UploadResponse/previewContentsForAllViews.smoke.js +35 -7
  78. package/cypress/e2e/ILC/UploadResponse/studentViewSettingsSection.js +213 -0
  79. package/cypress/e2e/ILC/UploadResponse/uploadResponseAdditionalSettings.js +41 -0
  80. package/cypress/e2e/ILC/UploadResponse/uploadResponseEditTabBasicSections.js +377 -0
  81. package/cypress/e2e/ILC/UploadResponse/uploadResponsePreview.js +161 -0
  82. package/cypress/e2e/ILC/UploadResponse/uplodResponsePreviewUploadedFileProperties.js +250 -0
  83. package/cypress/e2e/migration/migration.js +4 -41
  84. package/cypress/e2e/migration/migration10.js +6 -43
  85. package/cypress/e2e/migration/migration2.js +6 -43
  86. package/cypress/e2e/migration/migration3.js +6 -43
  87. package/cypress/e2e/migration/migration4.js +6 -43
  88. package/cypress/e2e/migration/migration5.js +6 -43
  89. package/cypress/e2e/migration/migration6.js +6 -43
  90. package/cypress/e2e/migration/migration7.js +6 -43
  91. package/cypress/e2e/migration/migration8.js +6 -43
  92. package/cypress/e2e/migration/migration9.js +6 -43
  93. package/cypress/fixtures/drawingToolbarOptionsAdditionalOptionsAndSpecialAndMathCharacters.js +2 -2
  94. package/cypress/fixtures/theme/ilc.json +6 -1
  95. package/cypress/fixtures/uploadResponseFileType.js +5 -0
  96. package/cypress/pages/components/autoScoredSpecifyCorrectAnswerSection.js +13 -13
  97. package/cypress/pages/components/customizeSpecialCharacterComponent.js +24 -6
  98. package/cypress/pages/components/draggableOptionContainer.js +1 -0
  99. package/cypress/pages/components/fillInTheGapsDragAndDropCommonComponents.js +42 -4
  100. package/cypress/pages/components/fillInTheGapsDropdownCommonComponent.js +149 -5
  101. package/cypress/pages/components/fillInTheGapsTextCommonComponent.js +954 -77
  102. package/cypress/pages/components/questionInputFieldComponent.js +1 -1
  103. package/cypress/pages/components/questionInstructionsComponent.js +2 -1
  104. package/cypress/pages/contentBlocksPage.js +515 -0
  105. package/cypress/pages/drawingResponsePage.js +2 -2
  106. package/cypress/pages/fillInTheGapsDragAndDropPage.js +359 -3
  107. package/cypress/pages/fillInTheGapsDropdownPage.js +21 -1
  108. package/cypress/pages/fillInTheGapsOverImageDragAndDropPage.js +5 -57
  109. package/cypress/pages/fillInTheGapsOverImageDropdownPage.js +3 -24
  110. package/cypress/pages/fillInTheGapsOverImageTextPage.js +1 -435
  111. package/cypress/pages/fillInTheGapsTextPage.js +9 -2
  112. package/cypress/pages/graphingPage.js +484 -0
  113. package/cypress/pages/index.js +4 -1
  114. package/cypress/pages/simpleCalculatorPage.js +310 -0
  115. package/cypress/pages/uploadResponsePage.js +260 -92
  116. package/cypress/support/commands.js +33 -1
  117. package/package.json +1 -1
  118. package/cypress/e2e/ILC/Passage/multipageContentEditTab.js +0 -242
  119. package/cypress/e2e/ILC/Passage/passageAdditionalSettings.js +0 -99
  120. package/cypress/e2e/ILC/Passage/passageEditTab.js +0 -241
  121. package/cypress/e2e/ILC/Passage/passageHeaderSection.js +0 -73
  122. package/cypress/e2e/ILC/Passage/passagePreviewTab.js +0 -246
@@ -0,0 +1,168 @@
1
+ import { graphingPage, itemPreviewPage, studentViewPage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ import utilities from "../../../support/helpers/utilities";
4
+ var itemReferenceID = "";
5
+ const checkAnswerViews = ['Question preview', 'Item preview', 'Student view'];
6
+ const unselectedToolOption = ['Circle', 'Parabola', 'Sine', 'Polygon'];
7
+ const views = utilities.getViews(checkAnswerViews);
8
+
9
+ describe('Create item page - Graphing - Check answer functionality', () => {
10
+ before(() => {
11
+ cy.loginAs('admin');
12
+ });
13
+
14
+ views.forEach((view) => {
15
+ //Note: Remove after https://redmine.zeuslearning.com/issues/549542 is fixed
16
+ const checkAnswer = (view) => {
17
+ switch (view) {
18
+ case 'Question preview':
19
+ case 'Item preview':
20
+ graphingPage.steps.checkAnswer();
21
+ break;
22
+ case 'Student view':
23
+ studentViewPage.steps.checkAnswer();
24
+ break;
25
+ default:
26
+ throw new Error(`Unsupported page identifier: ${view}`);
27
+ }
28
+ };
29
+
30
+ //Failing due to https://redmine.zeuslearning.com/issues/563789
31
+ describe(`${view} - Check answer functionality`, { tags: 'smoke' }, () => {
32
+ abortEarlySetup();
33
+ before(() => {
34
+ switch (view) {
35
+ case 'Question preview':
36
+ graphingPage.steps.navigateToCreateQuestion('Graphing');
37
+ cy.barsPreLoaderWait();
38
+ graphingPage.steps.addTextInQuestionInstructionsInputField('Plot the graph');
39
+ graphingPage.steps.selectToolOptions(unselectedToolOption);
40
+ graphingPage.steps.checkSnapToGridCheckbox();
41
+ graphingPage.steps.checkPatternBackground();
42
+ graphingPage.steps.selectGraphToolOptionEditTab('Line');
43
+ graphingPage.steps.plotPointsOnGraphEditTab([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
44
+ graphingPage.steps.verifyPointsPlottedOnEditTabGraph([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
45
+ graphingPage.steps.selectGraphToolOptionEditTab('Circle');
46
+ graphingPage.steps.plotPointsOnGraphEditTab([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
47
+ graphingPage.steps.verifyPointsPlottedOnEditTabGraph([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
48
+ graphingPage.steps.selectGraphToolOptionSpecifyCorrectAnswer('Polygon');
49
+ graphingPage.steps.plotPointsOnGraphSpecifyCorrectAnswerSection([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
50
+ graphingPage.steps.verifyPointsPlottedOnSpecifyCorrectAnswerSection([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
51
+ graphingPage.steps.selectGraphToolOptionSpecifyCorrectAnswer('Vector');
52
+ graphingPage.steps.plotPointsOnGraphSpecifyCorrectAnswerSection([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
53
+ graphingPage.steps.verifyPointsPlottedOnSpecifyCorrectAnswerSection([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
54
+ graphingPage.steps.allotPoints(20);
55
+ graphingPage.steps.checkAllowStudentToCheckAnswerCheckbox();
56
+ graphingPage.steps.switchToPreviewTab();
57
+ break;
58
+ case 'Item preview':
59
+ cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
60
+ itemPreviewPage.steps.switchToPreviewTab();
61
+ break;
62
+ case 'Student view':
63
+ cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
64
+ break;
65
+ }
66
+ });
67
+
68
+ beforeEach(() => {
69
+ switch (view) {
70
+ case 'Question preview':
71
+ graphingPage.steps.verifyCorrectAnswerSectionNotExist();
72
+ graphingPage.steps.resetQuestionPreview();
73
+ break;
74
+ case 'Item preview':
75
+ graphingPage.steps.verifyCorrectAnswerSectionNotExist();
76
+ itemPreviewPage.steps.resetQuestionPreview();
77
+ break;
78
+ case 'Student view':
79
+ cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
80
+ break;
81
+ }
82
+ });
83
+
84
+ if (view === 'Question preview') {
85
+ after(() => {
86
+ graphingPage.steps.clickOnSaveQuestionButton();
87
+ utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
88
+ itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
89
+ });
90
+ };
91
+
92
+ it('When the user selects \'Grading\' view without attempting the question, the correct answer should be displayed in the correct answer section graph', () => {
93
+ checkAnswer(view);
94
+ //Preview tab
95
+ utilities.verifyElementCount(graphingPage.graphCirclePreviewTab(), 1);
96
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
97
+ utilities.verifyElementCount(graphingPage.graphLinePreviewTab(), 1);
98
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
99
+ graphingPage.steps.verifyCorrectAnswerSectionNotExist();
100
+ });
101
+
102
+ it('When the user attempts the question incorrectly then the user should be awarded with 0 points and on switching to grading view \'Your answer is incorrect\' should be displayed and the attempted graph should be displayed incorrect', () => {
103
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Circle');
104
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: -2, xRange: 20, y: 1, yRange: 20 }, { x: -4, xRange: 20, y: 1, yRange: 20 }]);
105
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: -2, xRange: 20, y: 1, yRange: 20 }, { x: -4, xRange: 20, y: 1, yRange: 20 }]);
106
+ checkAnswer(view);
107
+
108
+ //Preview tab
109
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
110
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: -2, xRange: 20, y: 1, yRange: 20 }, { x: -4, xRange: 20, y: 1, yRange: 20 }]);
111
+ utilities.verifyElementCount(graphingPage.graphLinePreviewTab(), 1);
112
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
113
+ graphingPage.steps.verifyIncorrectPointsPlottedOnGraphPreviewTab([{ x: -2, xRange: 20, y: 1, yRange: 20 }, { x: -4, xRange: 20, y: 1, yRange: 20 }]);
114
+ graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect')
115
+ graphingPage.steps.verifyCorrectAnswerSectionNotExist();
116
+ });
117
+
118
+ it('When the user attempts the question partially correct then the user should be awarded with 0 points and on switching to grading view \'Your answer is incorrect\' should be displayed and the attempted graph should be displayed correct', () => {
119
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Vector');
120
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
121
+ checkAnswer(view);
122
+
123
+ //Preview tab
124
+ utilities.verifyElementCount(graphingPage.graphCirclePreviewTab(), 1);
125
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
126
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
127
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
128
+ graphingPage.steps.verifyCorrectPointsPlottedOnGraphPreviewTab([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
129
+ graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect')
130
+ graphingPage.steps.verifyCorrectAnswerSectionNotExist();
131
+ });
132
+
133
+ it('When the user attempts the question partially correct with an incorrect response then the user should be awarded with 0 points and on switching to grading view \'Your answer is incorrect\' should be displayed and the attempted graph should be displayed correct for the correct response', () => {
134
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Polygon');
135
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: -3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: -4, yRange: 20 }, { x: -3, xRange: 20, y: 4, yRange: 20 }]);
136
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Polygon');
137
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
138
+ checkAnswer(view);
139
+
140
+ //Preview tab
141
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
142
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
143
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: -3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: -4, yRange: 20 }, { x: -3, xRange: 20, y: 4, yRange: 20 }]);
144
+ graphingPage.steps.verifyCorrectPointsPlottedOnGraphPreviewTab([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
145
+ graphingPage.steps.verifyIncorrectPointsPlottedOnGraphPreviewTab([{ x: -3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: -4, yRange: 20 }, { x: -3, xRange: 20, y: 4, yRange: 20 }]);
146
+ graphingPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect')
147
+ graphingPage.steps.verifyCorrectAnswerSectionNotExist();
148
+ });
149
+
150
+ it('When the user attempts the question correctly then the user should be awarded with full points and on switching to grading view \'Your answer is correct\' should be displayed and the attempted graph should be displayed correct', () => {
151
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Polygon');
152
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
153
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Vector');
154
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
155
+ checkAnswer(view);
156
+
157
+ //Preview tab
158
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
159
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
160
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
161
+ graphingPage.steps.verifyCorrectPointsPlottedOnGraphPreviewTab([{ x: 6, xRange: 20, y: 0, yRange: 20 }, { x: 6, xRange: 20, y: 5, yRange: 20 }]);
162
+ graphingPage.steps.verifyCorrectPointsPlottedOnGraphPreviewTab([{ x: -6, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 7, yRange: 20 }, { x: -4, xRange: 20, y: 9, yRange: 20 }, { x: -6, xRange: 20, y: 9, yRange: 20 }]);
163
+ graphingPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
164
+ graphingPage.steps.verifyCorrectAnswerSectionNotExist();
165
+ });
166
+ });
167
+ });
168
+ });
@@ -0,0 +1,203 @@
1
+ import { graphingPage, correctAnswerViewPage, itemPreviewPage, studentViewPage } from "../../../pages";
2
+ import { gradingViewPage } from "../../../pages";
3
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
4
+ import utilities from "../../../support/helpers/utilities";
5
+ let gradingAndCorrectAnsView = ['Grading view', 'Correct answer view']
6
+ const views = utilities.getViews(gradingAndCorrectAnsView);
7
+ var itemReferenceID = "";
8
+ const css = Cypress.env('css');
9
+
10
+ const unselectedToolOption = ['Circle', 'Parabola', 'Sine', 'Polygon'];
11
+
12
+ describe('Create item page - Graphing: Grading view, Correct answer view contents', () => {
13
+ before(() => {
14
+ cy.loginAs('admin');
15
+ });
16
+
17
+ if (views.includes('Grading view')) {
18
+ describe('Grading view contents', { tags: 'smoke' }, () => {
19
+ abortEarlySetup();
20
+ before(() => {
21
+ graphingPage.steps.navigateToCreateQuestion('Graphing');
22
+ cy.barsPreLoaderWait();
23
+ graphingPage.steps.addTextInQuestionInstructionsInputField('Plot the graph');
24
+ graphingPage.steps.allotPoints(10);
25
+ graphingPage.steps.selectToolOptions(unselectedToolOption);
26
+ graphingPage.steps.checkPatternBackground();
27
+ graphingPage.steps.checkSnapToGridCheckbox();
28
+ graphingPage.steps.selectGraphToolOptionEditTab('Line');
29
+ graphingPage.steps.plotPointsOnGraphEditTab([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
30
+ graphingPage.steps.verifyPointsPlottedOnEditTabGraph([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
31
+ graphingPage.steps.selectGraphToolOptionEditTab('Circle');
32
+ graphingPage.steps.plotPointsOnGraphEditTab([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
33
+ graphingPage.steps.verifyPointsPlottedOnEditTabGraph([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
34
+ graphingPage.steps.selectGraphToolOptionSpecifyCorrectAnswer('Polygon');
35
+ graphingPage.steps.plotPointsOnGraphSpecifyCorrectAnswerSection([{ x: -3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: -4, yRange: 20 }, { x: -3, xRange: 20, y: 4, yRange: 20 }]);
36
+ graphingPage.steps.verifyPointsPlottedOnSpecifyCorrectAnswerSection([{ x: -3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: -4, yRange: 20 }, { x: -3, xRange: 20, y: 4, yRange: 20 }]);
37
+ graphingPage.steps.clickOnSaveQuestionButton();
38
+ utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
39
+ //Global variable issue, not working inside before
40
+ itemPreviewPage.referenceID()
41
+ .invoke('text')
42
+ .then(($refID) => {
43
+ itemReferenceID = $refID;
44
+ cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
45
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Sine');
46
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: 0, xRange: 20, y: 7, yRange: 20 }, { x: 1, xRange: 20, y: 8, yRange: 20 }]);
47
+ utilities.verifyElementCount(graphingPage.graphSineAndParabolaPreviewTab(), 1);
48
+ studentViewPage.steps.submitResponse();
49
+ studentViewPage.steps.clickOnGoToGradingViewButton();
50
+ });
51
+ });
52
+
53
+ it('Question instructions should be visible', () => {
54
+ utilities.verifyInnerText(graphingPage.questionInstructionsText(), 'Plot the graph');
55
+ utilities.verifyElementVisibilityState(graphingPage.questionInstructionsText(), 'visible');
56
+ });
57
+
58
+ it('Tool and control options should not be displayed', () => {
59
+ utilities.verifyElementVisibilityState(graphingPage.graphToolOptionPreviewTab(), 'notExist');
60
+ utilities.verifyElementVisibilityState(graphingPage.graphControlOptionPreviewTab(), 'notExist');
61
+ });
62
+
63
+ it('The graph plotted by the author in the edit tab should be displayed in the grading view', () => {
64
+ utilities.verifyElementVisibilityState(graphingPage.gradingViewQuestionSineWave(), 'visible');
65
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 0, xRange: 20, y: 7, yRange: 20 }, { x: 1, xRange: 20, y: 8, yRange: 20 }]);
66
+ utilities.verifyElementVisibilityState(graphingPage.gradingViewQuestionCircle(), 'visible');
67
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
68
+ utilities.verifyElementVisibilityState(graphingPage.gradingViewQuestionLine(), 'visible');
69
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
70
+ });
71
+
72
+ it('Correct answer label should be displayed', () => {
73
+ utilities.verifyInnerText(graphingPage.correctAnswerLabel(), 'Correct answer');
74
+ utilities.verifyElementVisibilityState(graphingPage.correctAnswerLabel(), 'visible');
75
+ });
76
+
77
+ it('Correct answer along with graph plotted by the author in the edit tab should be displayed in the correct answer section', () => {
78
+ utilities.verifyElementVisibilityState(graphingPage.graphPolygonCorrectAnswerSection(), 'visible');
79
+ graphingPage.steps.verifyPointsPlottedOnCorrectAnswerSection([{ x: -3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: -4, yRange: 20 }, { x: -3, xRange: 20, y: 4, yRange: 20 }]);
80
+ utilities.verifyElementVisibilityState(graphingPage.graphCircleCorrectAnswerSection(), 'visible');
81
+ graphingPage.steps.verifyPointsPlottedOnCorrectAnswerSection([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
82
+ utilities.verifyElementVisibilityState(graphingPage.graphLineCorrectAnswerSection(), 'visible');
83
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
84
+ utilities.verifyElementVisibilityState(graphingPage.graphSineWaveCorrectAnswerSection(), 'notExist');
85
+ });
86
+
87
+ it('Points and the total score should be displayed', () => {
88
+ gradingViewPage.steps.verifyGradingViewScore(0, 10);
89
+ });
90
+
91
+ it('CSS of grading view', { tags: 'css' }, () => {
92
+ utilities.verifyCSS(graphingPage.gradingViewQuestionSineWave(), {
93
+ 'fill': css.color.incorrectAnswer,
94
+ 'fill-opacity': '0',
95
+ 'stroke-width': '1px'
96
+ });
97
+ utilities.verifyCSS(graphingPage.gradingViewQuestionCircle(), {
98
+ 'fill': css.color.secondaryBtnDisabled,
99
+ 'fill-opacity': '0',
100
+ 'stroke-width': '2px'
101
+ });
102
+ utilities.verifyCSS(graphingPage.gradingViewQuestionLine(), {
103
+ 'fill': css.color.secondaryBtnDisabled,
104
+ 'fill-opacity': '1',
105
+ 'stroke-width': '2px'
106
+ });
107
+ utilities.verifyCSS(graphingPage.graphPolygonCorrectAnswerSection(), {
108
+ 'fill': css.color.correctAnswer,
109
+ 'fill-opacity': '0.3',
110
+ 'stroke-width': '1px'
111
+ });
112
+ utilities.verifyCSS(graphingPage.graphCircleCorrectAnswerSection(), {
113
+ 'fill': css.color.secondaryBtnDisabled,
114
+ 'fill-opacity': '0',
115
+ 'stroke-width': '2px'
116
+ });
117
+ utilities.verifyCSS(graphingPage.graphLineCorrectAnswerSection(), {
118
+ 'fill': css.color.secondaryBtnDisabled,
119
+ 'fill-opacity': '1',
120
+ 'stroke-width': '2px'
121
+ });
122
+ });
123
+
124
+ it('Accessibility of grading view', { tags: 'a11y' }, () => {
125
+ cy.checkAccessibility(graphingPage.graphPreviewTab());
126
+ });
127
+ });
128
+ }
129
+
130
+ if (views.includes('Correct answer view')) {
131
+ describe('Correct answer view contents', { tags: 'smoke' }, () => {
132
+ abortEarlySetup();
133
+ before(() => {
134
+ graphingPage.steps.navigateToCreateQuestion('Graphing');
135
+ graphingPage.steps.addTextInQuestionInstructionsInputField('Plot the graph');
136
+ graphingPage.steps.allotPoints(10);
137
+ graphingPage.steps.selectToolOptions(unselectedToolOption);
138
+ graphingPage.steps.checkPatternBackground();
139
+ graphingPage.steps.checkSnapToGridCheckbox();
140
+ graphingPage.steps.selectGraphToolOptionEditTab('Line');
141
+ graphingPage.steps.plotPointsOnGraphEditTab([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
142
+ graphingPage.steps.selectGraphToolOptionEditTab('Circle');
143
+ graphingPage.steps.plotPointsOnGraphEditTab([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
144
+ graphingPage.steps.selectGraphToolOptionSpecifyCorrectAnswer('Polygon');
145
+ graphingPage.steps.plotPointsOnGraphSpecifyCorrectAnswerSection([{ x: -3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: -4, yRange: 20 }, { x: -3, xRange: 20, y: 4, yRange: 20 }]);
146
+ graphingPage.steps.clickOnSaveQuestionButton();
147
+ utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
148
+ //Global variable issue, not working inside before
149
+ itemPreviewPage.referenceID()
150
+ .invoke('text')
151
+ .then(($refID) => {
152
+ itemReferenceID = $refID
153
+ cy.visit(`/item-engine/demo/render-item/correct-answer-view/${utilities.base64Encoding(itemReferenceID)}`);
154
+ });
155
+ });
156
+
157
+ it('Question instructions should be visible', () => {
158
+ utilities.verifyInnerText(graphingPage.questionInstructionsText(), 'Plot the graph');
159
+ utilities.verifyElementVisibilityState(graphingPage.questionInstructionsText(), 'visible');
160
+ });
161
+
162
+ it('Tool and control options should not be displayed', () => {
163
+ utilities.verifyElementVisibilityState(graphingPage.graphToolOptionPreviewTab(), 'notExist');
164
+ utilities.verifyElementVisibilityState(graphingPage.graphControlOptionPreviewTab(), 'notExist');
165
+ });
166
+
167
+ it('The graph plotted by the author along with the correct answer should be displayed in the correct answer view', () => {
168
+ utilities.verifyElementVisibilityState(graphingPage.graphLine(), 'visible');
169
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }])
170
+ utilities.verifyElementVisibilityState(graphingPage.graphPolygon(), 'visible');
171
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: -3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: -4, yRange: 20 }, { x: -3, xRange: 20, y: 4, yRange: 20 }])
172
+ utilities.verifyElementVisibilityState(graphingPage.graphCircle(), 'visible');
173
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }])
174
+ });
175
+
176
+ it('The points alloted to the question should be displayed', () => {
177
+ correctAnswerViewPage.steps.verifyAvailablePoints(10);
178
+ });
179
+
180
+ it('CSS of correct answer section', { tags: 'css' }, () => {
181
+ utilities.verifyCSS(graphingPage.graphPolygon(), {
182
+ 'fill': css.color.correctAnswer,
183
+ 'fill-opacity': '0.3',
184
+ 'stroke-width': '1px'
185
+ });
186
+ utilities.verifyCSS(graphingPage.graphCircle(), {
187
+ 'fill': css.color.secondaryBtnDisabled,
188
+ 'fill-opacity': '0',
189
+ 'stroke-width': '2px'
190
+ });
191
+ utilities.verifyCSS(graphingPage.graphLine(), {
192
+ 'fill': css.color.secondaryBtnDisabled,
193
+ 'fill-opacity': '1',
194
+ 'stroke-width': '2px'
195
+ });
196
+ });
197
+
198
+ it('Accessibility of correct answer section', { tags: 'a11y' }, () => {
199
+ cy.checkAccessibility(graphingPage.graphPreviewTab());
200
+ });
201
+ });
202
+ }
203
+ });
@@ -0,0 +1,222 @@
1
+ import { graphingPage, itemPreviewPage, studentViewPage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ import utilities from "../../../support/helpers/utilities";
4
+ const previewContentViews = ['Question preview', 'Item view', 'Item preview', 'Student view'];
5
+ const views = utilities.getViews(previewContentViews);
6
+ var itemReferenceID = "";
7
+ const css = Cypress.env('css');
8
+ const unselectedToolOption = ['Circle', 'Parabola', 'Sine', 'Polygon'];
9
+ const selectedToolOption = ['Point', 'Line', 'Label', 'Ray', 'Segment', 'Vector'];
10
+ const controlOptions = ['Move', 'Undo', 'Redo', 'Reset'];
11
+ const toolOptions = [...selectedToolOption, ...unselectedToolOption];
12
+
13
+ describe('Create item page - Graphing - Preview contents in all views', () => {
14
+ before(() => {
15
+ cy.loginAs('admin');
16
+ graphingPage.steps.navigateToCreateQuestion('Graphing');
17
+ });
18
+
19
+ views.forEach((view) => {
20
+ describe(`Preview tab contents - ${view}`, { tags: 'smoke' }, () => {
21
+ abortEarlySetup();
22
+ before(() => {
23
+ switch (view) {
24
+ case 'Question preview':
25
+ graphingPage.steps.navigateToCreateQuestion('Graphing');
26
+ cy.barsPreLoaderWait();
27
+ graphingPage.steps.addTextInQuestionInstructionsInputField('Plot the graph');
28
+ graphingPage.steps.allotPoints(10);
29
+ graphingPage.steps.selectToolOptions(unselectedToolOption);
30
+ graphingPage.steps.checkPatternBackground();
31
+ graphingPage.steps.checkSnapToGridCheckbox();
32
+ graphingPage.steps.selectGraphToolOptionEditTab('Line');
33
+ graphingPage.steps.plotPointsOnGraphEditTab([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
34
+ graphingPage.steps.verifyPointsPlottedOnEditTabGraph([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
35
+ graphingPage.steps.selectGraphToolOptionEditTab('Circle');
36
+ graphingPage.steps.plotPointsOnGraphEditTab([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
37
+ graphingPage.steps.verifyPointsPlottedOnEditTabGraph([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
38
+ graphingPage.steps.selectGraphToolOptionSpecifyCorrectAnswer('Polygon');
39
+ graphingPage.steps.plotPointsOnGraphSpecifyCorrectAnswerSection([{ x: -3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: -4, yRange: 20 }, { x: -3, xRange: 20, y: 4, yRange: 20 }]);
40
+ graphingPage.steps.verifyPointsPlottedOnSpecifyCorrectAnswerSection([{ x: -3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: -4, yRange: 20 }, { x: -3, xRange: 20, y: 4, yRange: 20 }]);
41
+ graphingPage.steps.switchToPreviewTab();
42
+ break;
43
+ case 'Item view':
44
+ cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
45
+ break;
46
+ case 'Item preview':
47
+ cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
48
+ graphingPage.steps.switchToPreviewTab();
49
+ break;
50
+ case 'Student view':
51
+ cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
52
+ break;
53
+ default:
54
+ throw new Error('Invalid view');
55
+ }
56
+ });
57
+
58
+ after(() => {
59
+ if (view === 'Question preview') {
60
+ graphingPage.steps.clickOnSaveQuestionButton();
61
+ utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
62
+ itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
63
+ }
64
+ });
65
+
66
+ it('Question instructions should be visible', () => {
67
+ utilities.verifyInnerText(graphingPage.questionInstructionsText(), 'Plot the graph');
68
+ utilities.verifyElementVisibilityState(graphingPage.questionInstructionsText(), 'visible');
69
+ });
70
+
71
+ it('The toolbar options should be displayed in the preview tab and when the user hovers over the tool options then tooltips should be displayed', () => {
72
+ toolOptions.forEach((toolOption) => {
73
+ utilities.verifyElementVisibilityState(graphingPage.graphToolOptionPreviewTab(toolOption), 'exist');
74
+ graphingPage.graphToolOptionPreviewTab(toolOption)
75
+ .verifyTooltip(toolOption);
76
+ });
77
+ });
78
+
79
+ it('The plotted graph in the edit tab should be displayed in the preview tab', () => {
80
+ utilities.verifyElementCount(graphingPage.graphCirclePreviewTab(), 1);
81
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 0, xRange: 20, y: 0, yRange: 20 }, { x: 0, xRange: 20, y: 5, yRange: 20 }]);
82
+ utilities.verifyElementCount(graphingPage.graphLinePreviewTab(), 1);
83
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 2, xRange: 20, y: 1, yRange: 20 }, { x: 2, xRange: 20, y: -5, yRange: 20 }]);
84
+ });
85
+
86
+ it('By default, the point option should be in selected state and all other options should be de-selected', () => {
87
+ graphingPage.steps.verifyToolOptionSelectedPreviewTab('Point');
88
+ graphingPage.steps.verifyToolOptionNotSelectedPreviewTab(toolOptions.splice(1, toolOptions.length));
89
+ });
90
+
91
+ it('By default, the move control should be in enabled state and all other controls should be disabled', () => {
92
+ utilities.verifyElementNotDisabled(graphingPage.graphControlOptionPreviewTab('Move'));
93
+ controlOptions.splice(1, controlOptions.length).forEach((controlOption) => {
94
+ utilities.verifyElementDisabled(graphingPage.graphControlOptionPreviewTab(controlOption));
95
+ });
96
+ });
97
+
98
+ it('User should be able to plot points using the \'Point\' tool options', () => {
99
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: -4, xRange: 20, y: -4, yRange: 20 }]);
100
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: -4, xRange: 20, y: -4, yRange: 20 }]);
101
+ });
102
+
103
+ it('By default, the control options should be in displayed and when the user hovers over the tool options then tooltips should be displayed', () => {
104
+ controlOptions.forEach((controlOption) => {
105
+ utilities.verifyElementVisibilityState(graphingPage.graphControlOptionPreviewTab(controlOption), 'exist');
106
+ graphingPage.graphControlOptionPreviewTab(controlOption)
107
+ .verifyTooltip(controlOption);
108
+ });
109
+ });
110
+
111
+ it('User should be able to draw a line using the \'Line\' tool option', () => {
112
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Line');
113
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: -9, xRange: 20, y: -3, yRange: 20 }, { x: -9, xRange: 20, y: 3, yRange: 20 }]);
114
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: -9, xRange: 20, y: -3, yRange: 20 }, { x: -9, xRange: 20, y: 3, yRange: 20 }]);
115
+ utilities.verifyElementCount(graphingPage.graphLinePreviewTab(), 1);
116
+ });
117
+
118
+ it('User should be able to add a label using the \'Label\' tool option', () => {
119
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Label');
120
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: -9, xRange: 20, y: -3, yRange: 20 }]);
121
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: -9, xRange: 20, y: -3, yRange: 20 }]);
122
+ graphingPage.steps.enterTextInGraphLabelInputField('This is a line');
123
+ });
124
+
125
+ it('User should be able to draw a ray using the \'Ray\' tool option', () => {
126
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Ray');
127
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: -8, xRange: 20, y: 1, yRange: 20 }, { x: -7, xRange: 20, y: 2, yRange: 20 }]);
128
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: -8, xRange: 20, y: 1, yRange: 20 }, { x: -7, xRange: 20, y: 2, yRange: 20 }]);
129
+ utilities.verifyElementCount(graphingPage.graphLineSegmentsPreviewTab(), 2);
130
+ });
131
+
132
+ it('User should be able to draw a segment using the \'Segment\' tool option', () => {
133
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Segment');
134
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: 7, xRange: 20, y: -2, yRange: 20 }, { x: 9, xRange: 20, y: -4, yRange: 20 }]);
135
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 7, xRange: 20, y: -2, yRange: 20 }, { x: 9, xRange: 20, y: -4, yRange: 20 }]);
136
+ utilities.verifyElementCount(graphingPage.graphLineSegmentsPreviewTab(), 3);
137
+ });
138
+
139
+ it('User should be able to draw a vector using the \'Vector\' tool option', () => {
140
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Vector');
141
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: 9, xRange: 20, y: 0, yRange: 20 }, { x: 9, xRange: 20, y: 2, yRange: 20 }]);
142
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 9, xRange: 20, y: 0, yRange: 20 }, { x: 9, xRange: 20, y: 2, yRange: 20 }]);
143
+ utilities.verifyElementCount(graphingPage.graphLineSegmentsPreviewTab(), 4);
144
+ });
145
+
146
+ it('User should be able to draw a circle using the \'Circle\' tool option', () => {
147
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Circle');
148
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: 7, xRange: 20, y: 7, yRange: 20 }, { x: 7, xRange: 20, y: 8, yRange: 20 }]);
149
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 7, xRange: 20, y: 7, yRange: 20 }, { x: 7, xRange: 20, y: 8, yRange: 20 }]);
150
+ utilities.verifyElementCount(graphingPage.graphCirclePreviewTab(), 2);
151
+ });
152
+
153
+ it('User should be able to draw a parabola using the \'Parabola\' tool option', () => {
154
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Parabola');
155
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: 5, xRange: 20, y: -8, yRange: 20 }, { x: 4, xRange: 20, y: -9, yRange: 20 }]);
156
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 5, xRange: 20, y: -8, yRange: 20 }, { x: 4, xRange: 20, y: -9, yRange: 20 }]);
157
+ utilities.verifyElementCount(graphingPage.graphSineAndParabolaPreviewTab(), 1);
158
+ });
159
+
160
+ it('User should be able to draw a sine wave using the \'Sine\' tool option', () => {
161
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Sine');
162
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: 0, xRange: 20, y: 8, yRange: 20 }, { x: 1, xRange: 20, y: 9, yRange: 20 }]);
163
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: 0, xRange: 20, y: 8, yRange: 20 }, { x: 1, xRange: 20, y: 9, yRange: 20 }]);
164
+ utilities.verifyElementCount(graphingPage.graphSineAndParabolaPreviewTab(), 2);
165
+ });
166
+
167
+ it('User should be able to draw a polygon using the \'Polygon\' tool option', () => {
168
+ graphingPage.steps.selectGraphToolOptionPreviewTab('Polygon');
169
+ graphingPage.steps.plotPointsOnGraphPreviewTab([{ x: -3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: -4, yRange: 20 }, { x: -3, xRange: 20, y: 4, yRange: 20 }]);
170
+ graphingPage.steps.verifyPointsPlottedOnPreviewTab([{ x: -3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: 4, yRange: 20 }, { x: 3, xRange: 20, y: -4, yRange: 20 }]);
171
+ utilities.verifyElementCount(graphingPage.graphPolygonPreviewTab(), 1);
172
+ });
173
+
174
+ it('When the user clicks on the \'Undo\' control option then the latest action should be reversed', () => {
175
+ graphingPage.steps.selectGraphControlOptionPreviewTab('Undo');
176
+ utilities.verifyElementVisibilityState(graphingPage.graphPolygonPreviewTab(), 'notExist');
177
+ });
178
+
179
+ it('When the user clicks on the \'Redo\' control option then the latest action should be displayed again and the button should be disabled again', () => {
180
+ graphingPage.steps.selectGraphControlOptionPreviewTab('Redo');
181
+ utilities.verifyElementVisibilityState(graphingPage.graphPolygonPreviewTab(), 'visible');
182
+ });
183
+
184
+ it('When the user clicks on the \'Reset\' control option then all the actions on the preview tab should be reset', () => {
185
+ graphingPage.steps.selectGraphControlOptionPreviewTab('Reset');
186
+ graphingPage.steps.confirmReset();
187
+ utilities.verifyElementVisibilityState(graphingPage.graphPolygonPreviewTab(), 'notExist');
188
+ utilities.verifyElementVisibilityState(graphingPage.graphSineAndParabolaPreviewTab(), 'notExist');
189
+ utilities.verifyElementCount(graphingPage.graphCirclePreviewTab(), 1);
190
+ utilities.verifyElementCount(graphingPage.graphLinePreviewTab(), 1);
191
+ utilities.verifyElementDisabled(graphingPage.graphControlOptionPreviewTab('Undo'));
192
+ utilities.verifyElementDisabled(graphingPage.graphControlOptionPreviewTab('Redo'));
193
+ utilities.verifyElementDisabled(graphingPage.graphControlOptionPreviewTab('Reset'));
194
+ });
195
+
196
+ it('CSS of preview content', { tags: 'css' }, () => {
197
+ utilities.verifyCSS(graphingPage.graphLinePreviewTab(), {
198
+ 'fill': css.color.secondaryBtnDisabled,
199
+ 'fill-opacity': '1',
200
+ 'stroke-width': '2px'
201
+ });
202
+ utilities.verifyCSS(graphingPage.graphCirclePreviewTab(), {
203
+ 'fill': css.color.secondaryBtnDisabled,
204
+ 'fill-opacity': '0',
205
+ 'stroke-width': '2px'
206
+ });
207
+ utilities.verifyCSS(graphingPage.graphToolOptionPreviewTab('Point'), {
208
+ 'color': css.color.primaryBtn,
209
+ 'background-color': css.color.secondaryBtn,
210
+ });
211
+ utilities.verifyCSS(graphingPage.graphToolOptionPreviewTab('Line').find('path').last(), {
212
+ 'color': css.color.UnselectedToggleButton,
213
+ 'fill': css.color.activeButtons
214
+ });
215
+ });
216
+
217
+ it('Accessibility of preview content', { tags: 'a11y' }, () => {
218
+ cy.checkAccessibility(graphingPage.graphPreviewTab());
219
+ });
220
+ });
221
+ });
222
+ });