itemengine-cypress-automation 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. package/.build_wna +4 -0
  2. package/README.md +3 -0
  3. package/currents.config.js +6 -0
  4. package/cypress/API/createItem/toggleItemMode.js +15 -0
  5. package/cypress/config-files/ildev.json +15 -0
  6. package/cypress/config-files/ilprod.json +15 -0
  7. package/cypress/config-files/ilqa.json +15 -0
  8. package/cypress/config-files/ilstage.json +15 -0
  9. package/cypress/e2e/ILC/sorry-cypress-test/spec1.js +18 -0
  10. package/cypress/e2e/ILC/sorry-cypress-test/spec2.js +18 -0
  11. package/cypress/e2e/ILC/sorry-cypress-test/spec3.js +18 -0
  12. package/cypress/fixtures/accessibilityConfig.json +6 -0
  13. package/cypress/fixtures/constants.js +18 -0
  14. package/cypress/fixtures/equationEditorCategoriesAndSymbols .js +2271 -0
  15. package/cypress/fixtures/specialAndMathCharacters.js +118 -0
  16. package/cypress/fixtures/theme/ilc.json +150 -0
  17. package/cypress/fixtures/theme/ngie.json +26 -0
  18. package/cypress/fixtures/uploads/20mbFile.png +0 -0
  19. package/cypress/fixtures/uploads/80mbFile.pdf +0 -0
  20. package/cypress/fixtures/uploads/highlightImage.jpg +0 -0
  21. package/cypress/fixtures/uploads/image.png +0 -0
  22. package/cypress/fixtures/uploads/sample.aac +0 -0
  23. package/cypress/fixtures/uploads/sample.accdb +0 -0
  24. package/cypress/fixtures/uploads/sample.csv +100 -0
  25. package/cypress/fixtures/uploads/sample.doc +0 -0
  26. package/cypress/fixtures/uploads/sample.gif +0 -0
  27. package/cypress/fixtures/uploads/sample.heic +0 -0
  28. package/cypress/fixtures/uploads/sample.heif +0 -0
  29. package/cypress/fixtures/uploads/sample.hevc +0 -0
  30. package/cypress/fixtures/uploads/sample.jpeg +0 -0
  31. package/cypress/fixtures/uploads/sample.jpg +0 -0
  32. package/cypress/fixtures/uploads/sample.mp3 +0 -0
  33. package/cypress/fixtures/uploads/sample.mp4 +0 -0
  34. package/cypress/fixtures/uploads/sample.pdf +0 -0
  35. package/cypress/fixtures/uploads/sample.ppt +0 -0
  36. package/cypress/fixtures/uploads/sample.pub +0 -0
  37. package/cypress/fixtures/uploads/sample.rtf +7902 -0
  38. package/cypress/fixtures/uploads/sample.svg +10 -0
  39. package/cypress/fixtures/uploads/sample.txt +1 -0
  40. package/cypress/fixtures/uploads/sample.wav +0 -0
  41. package/cypress/fixtures/uploads/sample.xlsx +0 -0
  42. package/cypress/fixtures/uploads/sample.xps +0 -0
  43. package/cypress/fixtures/uploads/sample.zip +0 -0
  44. package/cypress/fixtures/uploads/sample1.jpg +0 -0
  45. package/cypress/fixtures/uploads/sample1.mp3 +0 -0
  46. package/cypress/fixtures/uploads/sample1.zip +0 -0
  47. package/cypress/fixtures/uploads/sample10Sec.mp3 +0 -0
  48. package/cypress/fixtures/uploads/sample2.jpg +0 -0
  49. package/cypress/fixtures/uploads/sample2.mp3 +0 -0
  50. package/cypress/fixtures/uploads/sampleVirus.zip +0 -0
  51. package/cypress/pages/audioPlayerPage.js +628 -0
  52. package/cypress/pages/audioResponsePage.js +264 -0
  53. package/cypress/pages/components/additionalSettingsPanel.js +174 -0
  54. package/cypress/pages/components/answerNumerationComponent.js +109 -0
  55. package/cypress/pages/components/autoScoredAdditionalSettings.js +183 -0
  56. package/cypress/pages/components/autoScoredPreviewBase.js +94 -0
  57. package/cypress/pages/components/autoScoredScoringSection.js +195 -0
  58. package/cypress/pages/components/autoScoredScoringSectionMultipleResponsesType.js +268 -0
  59. package/cypress/pages/components/autoScoredSetCorrectAnswerSection.js +291 -0
  60. package/cypress/pages/components/ckEditorToolbar.js +64 -0
  61. package/cypress/pages/components/colorPopupComponent.js +293 -0
  62. package/cypress/pages/components/commonComponents.js +93 -0
  63. package/cypress/pages/components/componentsFlowChart/figFlowChart.png +0 -0
  64. package/cypress/pages/components/createCustomCategoryFlyout.js +138 -0
  65. package/cypress/pages/components/createQuestionBasePage.js +225 -0
  66. package/cypress/pages/components/customizeHighlightPropertiesComponent.js +318 -0
  67. package/cypress/pages/components/dragAndDropResponseOptions.js +738 -0
  68. package/cypress/pages/components/dragAndDropSetCorrectAnswerCheckboxComponents.js +124 -0
  69. package/cypress/pages/components/draggableOptionsContainer.js +857 -0
  70. package/cypress/pages/components/editCategoryFlyout.js +40 -0
  71. package/cypress/pages/components/equationEditorFlyout.js +158 -0
  72. package/cypress/pages/components/essayResponseCommonComponents.js +86 -0
  73. package/cypress/pages/components/figOverImageCommonComponent.js +924 -0
  74. package/cypress/pages/components/fillInTheGapsCommonComponents.js +687 -0
  75. package/cypress/pages/components/fillInTheGapsDropdownCommonComponent.js +442 -0
  76. package/cypress/pages/components/fillInTheGapsTextCommonComponent.js +884 -0
  77. package/cypress/pages/components/gridCommonComponents.js +951 -0
  78. package/cypress/pages/components/index.js +38 -0
  79. package/cypress/pages/components/listSortingAndOrderingBase.js +401 -0
  80. package/cypress/pages/components/maximumRecorderLengthComponent.js +116 -0
  81. package/cypress/pages/components/mcqAdditionalSettingsBase.js +390 -0
  82. package/cypress/pages/components/mcqOptionsComponent.js +263 -0
  83. package/cypress/pages/components/mcqPreviewComponents.js +78 -0
  84. package/cypress/pages/components/mcqQuestionCommonComponents.js +265 -0
  85. package/cypress/pages/components/mcqScoringComponent.js +120 -0
  86. package/cypress/pages/components/mcqSetCorrectAnswerSection.js +143 -0
  87. package/cypress/pages/components/optionsWrapperComponent.js +221 -0
  88. package/cypress/pages/components/playbackControlsBaseComponent.js +163 -0
  89. package/cypress/pages/components/previewScoringAndShowCorrectAnswerComponent.js +90 -0
  90. package/cypress/pages/components/questionInstructionsComponent.js +112 -0
  91. package/cypress/pages/components/scoringSectionBase.js +308 -0
  92. package/cypress/pages/components/setPointsPopupBase.js +79 -0
  93. package/cypress/pages/components/specialAndCustomSpecialCharactersComponent.js +79 -0
  94. package/cypress/pages/components/specialCharactersFlyoutComponent.js +58 -0
  95. package/cypress/pages/components/studentResponseAreaAndLayoutComponent.js +28 -0
  96. package/cypress/pages/components/uploadImageSectionComponent.js +594 -0
  97. package/cypress/pages/createItemPage.js +28 -0
  98. package/cypress/pages/dialogBoxBase.js +111 -0
  99. package/cypress/pages/dragAndDropIntoCategoriesAllOrNothingScoring.js +1161 -0
  100. package/cypress/pages/dragAndDropIntoCategoriesCellsScoring.js +1559 -0
  101. package/cypress/pages/dragAndDropIntoCategoriesPage.js +1556 -0
  102. package/cypress/pages/dragAndDropIntoCategoriesResponseScoring.js +1396 -0
  103. package/cypress/pages/essayResponseBasicPage.js +57 -0
  104. package/cypress/pages/essayResponseMathPage.js +47 -0
  105. package/cypress/pages/essayResponsePage.js +385 -0
  106. package/cypress/pages/feedbackScalePage.js +698 -0
  107. package/cypress/pages/fillInTheGapsDragAndDropPage.js +742 -0
  108. package/cypress/pages/fillInTheGapsDropdownPage.js +99 -0
  109. package/cypress/pages/fillInTheGapsOverImageDropdownPage.js +232 -0
  110. package/cypress/pages/fillInTheGapsOverImageTextPage.js +135 -0
  111. package/cypress/pages/fillInTheGapsScoring.js +5974 -0
  112. package/cypress/pages/fillInTheGapsSetCorrectAnswerSection.js +260 -0
  113. package/cypress/pages/fillInTheGapsTextPage.js +225 -0
  114. package/cypress/pages/highlightImagePage.js +1316 -0
  115. package/cypress/pages/highlightPage.js +870 -0
  116. package/cypress/pages/index.js +30 -0
  117. package/cypress/pages/listMatchingPage.js +1330 -0
  118. package/cypress/pages/listMatchingScoring.js +2635 -0
  119. package/cypress/pages/listOrderingPage.js +751 -0
  120. package/cypress/pages/listSortingPage.js +1201 -0
  121. package/cypress/pages/multipleSelectionGridPage.js +359 -0
  122. package/cypress/pages/multipleSelectionPage.js +88 -0
  123. package/cypress/pages/passagePage.js +426 -0
  124. package/cypress/pages/readingRulerPage.js +302 -0
  125. package/cypress/pages/selectQuestionResourceToolPage.js +64 -0
  126. package/cypress/pages/shortTextResponsePage.js +197 -0
  127. package/cypress/pages/singleSelectionGridPage.js +370 -0
  128. package/cypress/pages/singleSelectionPage.js +65 -0
  129. package/cypress/pages/uploadResponsePage.js +110 -0
  130. package/cypress/pages/videoResponsePage.js +375 -0
  131. package/cypress/support/commands.js +140 -0
  132. package/cypress/support/e2e.js +14 -0
  133. package/cypress/support/helpers/abortEarly.js +19 -0
  134. package/cypress/support/helpers/accessibility.js +34 -0
  135. package/cypress/support/helpers/cypressUtilities.js +64 -0
  136. package/cypress/support/helpers/localStorage.js +13 -0
  137. package/cypress/support/helpers/selectText.js +77 -0
  138. package/cypress/support/helpers/utilities.js +126 -0
  139. package/cypress.config.js +76 -0
  140. package/il.yaml +14 -0
  141. package/language +1 -0
  142. package/package.json +26 -0
@@ -0,0 +1,268 @@
1
+ import { commonComponents } from "./commonComponents";
2
+ import { scoringSectionBase } from "./scoringSectionBase";
3
+ const css = Cypress.env('css');
4
+
5
+ const selectors = {
6
+ allOrNothingCheckboxLabel: () => cy.get('label[for*="defaultScoring"]'),
7
+ allOrNothingCheckbox: () => cy.get('input[type*="radio"][aria-label="All or Nothing"]'),
8
+ partialDifferentWeightsCheckboxLabel: () => cy.get('label[for*="partialScoring"]'),
9
+ partialDifferentWeightsCheckbox: () => cy.get('input[type*="radio"][aria-label="Partial - different weights"]'),
10
+ partialEqualWeightsCheckbox: () => cy.get('input[type="radio"][aria-label="Partial - equal weights"]'),
11
+ partialEqualWeightsCheckboxLabel: () => cy.get('label[for*="partialEqualScoring"]'),
12
+ pointsPerResponseLabel: () => cy.get('[class*="partial-points-per-response-label"]'),
13
+ partialEqualWeightsPointsPerResponseScore: () => cy.get('.cloze-with-text-partial-points'),
14
+ penaltyPointsLabel: () => cy.get('.penalty-points-label'),
15
+ penaltyPointsInputField: () => cy.get('.penlty-points-input-field [type="text"]'),
16
+ rounddownScoreCheckboxLabel: () => cy.get('[data-ngie-testid="round-down-score-checkbox"] .MuiFormControlLabel-label'),
17
+ rounddownScoreCheckbox: () => cy.get('[data-ngie-testid="round-down-score-checkbox"] input'),
18
+ }
19
+
20
+ const steps = {
21
+ //V3 - This function should be updated in all files
22
+ selectAllOrNothingCheckbox: () => {
23
+ autoScoredScoringSectionMultipleResponsesType.allOrNothingCheckbox()
24
+ .click()
25
+ .should('be.checked');
26
+ },
27
+
28
+ //V3 - This function should be updated in all files
29
+ selectPartialEqualWeightsCheckbox: () => {
30
+ autoScoredScoringSectionMultipleResponsesType.partialEqualWeightsCheckbox()
31
+ .click()
32
+ .should('be.checked');
33
+ },
34
+
35
+ //V3 - This function should be updated in all files
36
+ selectPartialDifferentWeightsCheckbox: () => {
37
+ autoScoredScoringSectionMultipleResponsesType.partialDifferentWeightsCheckbox()
38
+ .click()
39
+ .should('be.checked');
40
+ },
41
+
42
+ //V3 - This function should be updated in all files
43
+ verifyDefaultPenaltyPointsInputFieldAndLabel: () => {
44
+ autoScoredScoringSectionMultipleResponsesType.penaltyPointsLabel()
45
+ .verifyInnerText('Penalty points')
46
+ .should('be.visible');
47
+ autoScoredScoringSectionMultipleResponsesType.penaltyPointsInputField()
48
+ .should('have.value', '')
49
+ .and('be.visible');
50
+ },
51
+
52
+ //V3 - This function should be updated in all files
53
+ verifyDefaultRoundDownScoreCheckboxCheckedAndLabel: () => {
54
+ autoScoredScoringSectionMultipleResponsesType.rounddownScoreCheckboxLabel()
55
+ .verifyInnerText('Round down score')
56
+ .and('be.visible');
57
+ autoScoredScoringSectionMultipleResponsesType.rounddownScoreCheckbox()
58
+ .should('be.checked');
59
+ },
60
+
61
+ //V3 - This function should be updated in all files
62
+ allotPenaltyPoints: (points) => {
63
+ autoScoredScoringSectionMultipleResponsesType.penaltyPointsInputField()
64
+ .clear()
65
+ .type(points)
66
+ .should('have.value', points);
67
+ },
68
+
69
+ //V3 - This function should be updated in all files
70
+ clearPenaltyPoints: () => {
71
+ autoScoredScoringSectionMultipleResponsesType.penaltyPointsInputField()
72
+ .clear()
73
+ .should('have.value', '');
74
+ },
75
+
76
+ //V3 - This function should be updated in all files
77
+ uncheckRoundDownScoreCheckbox: () => {
78
+ autoScoredScoringSectionMultipleResponsesType.rounddownScoreCheckbox()
79
+ .click()
80
+ .should('not.be.checked');
81
+ },
82
+
83
+ //V3 - This function should be updated in all files
84
+ addPartialDifferentWeightsPoints: (responsePointsArray) => {
85
+ responsePointsArray.forEach((points, count) => {
86
+ scoringSectionBase.pointsInputField()
87
+ .eq(count)
88
+ .clear()
89
+ .type(points, { delay: 500 })
90
+ .blur()
91
+ .should('have.value', points);
92
+ });
93
+ },
94
+
95
+ //V3 - This function should be updated in all files
96
+ /**
97
+ * @param {number} points points displayed in partial equal weights points per response
98
+ * @description Verify points displayed in partial equal weights points per response
99
+ */
100
+ verifyPartialEqualWeightsPointsPerResponseScore: (points) => {
101
+ autoScoredScoringSectionMultipleResponsesType.partialEqualWeightsPointsPerResponseScore()
102
+ .each(($element) => {
103
+ cy.wrap($element)
104
+ .verifyInnerText(`${points}`);
105
+ });
106
+ },
107
+
108
+ //V3 - This function should be updated in all files
109
+ verifyPointsPerResponseLabel: () => {
110
+ autoScoredScoringSectionMultipleResponsesType.pointsPerResponseLabel()
111
+ .verifyInnerText('Points per response')
112
+ .should('be.visible');
113
+ },
114
+
115
+ //V3 - This function should be updated in all files
116
+ verifyPartialDifferentWeightsPointsInputFieldIsEmpty: () => {
117
+ scoringSectionBase.pointsInputField()
118
+ .each(($element) => {
119
+ cy.wrap($element)
120
+ .should('have.value', '')
121
+ .and('exist');
122
+ });
123
+ },
124
+
125
+ //V3 - This function should be updated in all files
126
+ verifyPartialDifferentWeightsPointsInputFieldIsDisabled: () => {
127
+ scoringSectionBase.pointsInputField()
128
+ .each(($element) => {
129
+ cy.wrap($element)
130
+ .should('be.disabled');
131
+ });
132
+ },
133
+
134
+ //V3 - This function should be updated in all files
135
+ verifyPartialDifferentWeightsPointsInputFieldIsEnabled: (index) => {
136
+ scoringSectionBase.pointsInputField()
137
+ .eq(index)
138
+ .should('not.be.disabled');
139
+ },
140
+
141
+ //V3 - This function should be updated in all files
142
+ verifyCheckedStateOfRoundDownScoreCheckbox: () => {
143
+ autoScoredScoringSectionMultipleResponsesType.rounddownScoreCheckbox()
144
+ .should('be.checked');
145
+ },
146
+
147
+ //V3 - This function should be updated in all files
148
+ verifyPartialDifferentWeightsPointsInputFieldValue: (pointsFieldArray) => {
149
+ pointsFieldArray.forEach((points, count) => {
150
+ scoringSectionBase.pointsInputField()
151
+ .eq(count)
152
+ .should('have.value', points);
153
+ });
154
+ },
155
+ }
156
+
157
+ const tests = {
158
+ verifyAutoScoredScoringTypeSectionWithCSSAnda11y: () => {
159
+ it('\'All or nothing\', \'Partial - equal weights\' and \'Partial - different weights\' labels and radio buttons should be displayed and by default \'All or nothing\' radio button should be selected', () => {
160
+ autoScoredScoringSectionMultipleResponsesType.allOrNothingCheckboxLabel()
161
+ .verifyInnerText('All or nothing')
162
+ .and('be.visible');
163
+ autoScoredScoringSectionMultipleResponsesType.allOrNothingCheckbox()
164
+ .should('be.checked');
165
+ autoScoredScoringSectionMultipleResponsesType.partialEqualWeightsCheckboxLabel()
166
+ .verifyInnerText('Partial - equal weights')
167
+ .and('be.visible');
168
+ autoScoredScoringSectionMultipleResponsesType.partialEqualWeightsCheckbox()
169
+ .should('not.be.checked');
170
+ autoScoredScoringSectionMultipleResponsesType.partialDifferentWeightsCheckboxLabel()
171
+ .verifyInnerText('Partial - different weights')
172
+ .and('be.visible');
173
+ autoScoredScoringSectionMultipleResponsesType.partialDifferentWeightsCheckbox()
174
+ .should('not.be.checked');
175
+ });
176
+
177
+ it('CSS of Scoring section', { tags: 'css' }, () => {
178
+ scoringSectionBase.scoringLabel()
179
+ .verifyCSS(css.color.sectionHeading, css.fontSize.default, css.fontWeight.semibold);
180
+ scoringSectionBase.scoringTypeLabel()
181
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
182
+ scoringSectionBase.scoringTypeDropdown()
183
+ .find('.dropdown-label-text')
184
+ .verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular);
185
+ autoScoredScoringSectionMultipleResponsesType.allOrNothingCheckboxLabel()
186
+ .verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.regular);
187
+ autoScoredScoringSectionMultipleResponsesType.partialEqualWeightsCheckboxLabel()
188
+ .verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.regular);
189
+ autoScoredScoringSectionMultipleResponsesType.partialDifferentWeightsCheckboxLabel()
190
+ .verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.regular);
191
+ });
192
+
193
+ it('Accessibility of Scoring Section', { tags: 'a11y' }, () => {
194
+ cy.checkAccessibility(scoringSectionBase.scoringTypeDropdown());
195
+ cy.checkAccessibility(autoScoredScoringSectionMultipleResponsesType.allOrNothingCheckbox().parents('.ngie-radio-group-wrapper'));
196
+ });
197
+ },
198
+
199
+ //V3- need to update this for all files
200
+ verifyPenaltyPointsInputField: () => {
201
+ it('User should be able to enter points in \'Penalty Points\' input field', () => {
202
+ autoScoredScoringSectionMultipleResponsesType.steps.allotPenaltyPoints(2);
203
+ });
204
+
205
+ it('CSS of \'Penalty Points\' label and input field', { tags: 'css' }, () => {
206
+ autoScoredScoringSectionMultipleResponsesType.penaltyPointsLabel()
207
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
208
+ autoScoredScoringSectionMultipleResponsesType.penaltyPointsInputField()
209
+ .verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
210
+ });
211
+
212
+ it('Accessibility of \'Penalty Points\' label and input field', { tags: 'a11y' }, () => {
213
+ cy.checkAccessibility(autoScoredScoringSectionMultipleResponsesType.penaltyPointsLabel().parents('.points-container'));
214
+ });
215
+ },
216
+
217
+ //V3- need to update this for all files
218
+ verifyPenaltyPointsErroredState: (allocatedPoints, penaltyPoints) => {
219
+ it('When the user focuses in and out of the empty \'Penalty points\' input field, any validation text should not be displayed', () => {
220
+ autoScoredScoringSectionMultipleResponsesType.penaltyPointsInputField()
221
+ .click()
222
+ .blur();
223
+ commonComponents.errorMessage()
224
+ .should('not.exist');
225
+ });
226
+
227
+ it(`If the user enters points more than the allocated points in \'Penalty points\' input field, an error message \'Error: Penalty points cannot be greater than allocated points: ${allocatedPoints}\' should be displayed`, () => {
228
+ autoScoredScoringSectionMultipleResponsesType.penaltyPointsInputField()
229
+ .clear()
230
+ .type(penaltyPoints)
231
+ .should('have.value', penaltyPoints)
232
+ .blur();
233
+ commonComponents.errorMessage()
234
+ .verifyInnerText(`Error: Penalty points cannot be greater than allocated points:${allocatedPoints}`);
235
+ });
236
+
237
+ it('The error message should disappear once the user removes the entered points from the \'Penalty points\' input field', () => {
238
+ autoScoredScoringSectionMultipleResponsesType.penaltyPointsInputField()
239
+ .clear()
240
+ .blur();
241
+ commonComponents.errorMessage()
242
+ .should('not.exist');
243
+ });
244
+ },
245
+
246
+ //V3- need to update this for all files
247
+ verifyCSSandA11yOfRoundDownScoreCheckboxInCheckedState: () => {
248
+ it('CSS of \'Round down score\' checkbox - checked state', { tags: 'css' }, () => {
249
+ autoScoredScoringSectionMultipleResponsesType.rounddownScoreCheckboxLabel()
250
+ .verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.regular);
251
+ autoScoredScoringSectionMultipleResponsesType.rounddownScoreCheckbox()
252
+ .parent()
253
+ .find('svg g g')
254
+ .should('have.css', 'fill', css.color.activeButtons);
255
+ });
256
+
257
+ it('Accessibility of \'Round down score\' checkbox - checked state', { tags: 'a11y' }, () => {
258
+ cy.checkAccessibility(autoScoredScoringSectionMultipleResponsesType.rounddownScoreCheckboxLabel());
259
+ });
260
+ },
261
+ }
262
+
263
+
264
+ export const autoScoredScoringSectionMultipleResponsesType = {
265
+ ...selectors,
266
+ steps,
267
+ tests
268
+ }
@@ -0,0 +1,291 @@
1
+ import { dialogBoxBase } from "../dialogBoxBase";
2
+ import { scoringSectionBase } from "./scoringSectionBase";
3
+ import { commonComponents } from "./commonComponents";
4
+ const css = Cypress.env('css');
5
+
6
+ const selectors = {
7
+ setCorrectAnswerLabel: () => cy.get('.set-correct-answer-label'),
8
+ setCorrectAnswerHelpText: () => cy.get('.edit-set-correct-answer-help-text'),
9
+ alternateAnswerButton: () => cy.get('.edit-question-auto-scored-set-correct-answer-wrapper .ngie-button'),
10
+ alternateAnswerTab: (tabIndex) => cy.get('[data-ngie-testid*="alternate-"][data-ngie-testid*="tab"]').eq(tabIndex - 1),
11
+ deleteAlternateTabButton: () => cy.get('.ngie-tablist-tab-button .styled-close-button'),
12
+ correctTab: () => cy.get('[data-ngie-testid="correct-tab"]'),
13
+ setCorrectAnswerErrorIcon: () => cy.get('[aria-label="Error In"]'),
14
+ }
15
+
16
+ const steps = {
17
+ clickOnAddAlternateAnswerButton: () => {
18
+ autoScoredSetCorrectAnswerSection.alternateAnswerButton()
19
+ .click();
20
+ },
21
+
22
+ addAlternateTab: (index) => {
23
+ autoScoredSetCorrectAnswerSection.steps.clickOnAddAlternateAnswerButton()
24
+ autoScoredSetCorrectAnswerSection.alternateAnswerTab(index)
25
+ .verifyInnerText(`Alternate ${index}`);
26
+ },
27
+
28
+ verifySetCorrectAnswerErrorIconIsNotDisplayed: () => {
29
+ autoScoredSetCorrectAnswerSection.setCorrectAnswerErrorIcon()
30
+ .should('not.exist');
31
+ },
32
+
33
+ verifySetCorrectAnswerErrorIconIsDisplayed: () => {
34
+ autoScoredSetCorrectAnswerSection.setCorrectAnswerErrorIcon()
35
+ .should('have.text', 'Error-Icon');
36
+ },
37
+
38
+ navigateToAlternateTab: (tabIndex) => {
39
+ autoScoredSetCorrectAnswerSection.alternateAnswerTab(tabIndex)
40
+ .click();
41
+ },
42
+
43
+ //V3- Need to update the function in all files
44
+ navigateToCorrectTab: () => {
45
+ autoScoredSetCorrectAnswerSection.correctTab()
46
+ .click();
47
+ },
48
+
49
+ deleteAlternateTab: () => {
50
+ autoScoredSetCorrectAnswerSection.deleteAlternateTabButton()
51
+ .click();
52
+ },
53
+
54
+ verifyActiveStateOfCorrectTab: () => {
55
+ autoScoredSetCorrectAnswerSection.correctTab()
56
+ .should('have.attr', 'aria-selected', 'true');
57
+ },
58
+
59
+ verifyActiveStateOfAlternateTab: (tabIndex) => {
60
+ autoScoredSetCorrectAnswerSection.alternateAnswerTab(tabIndex)
61
+ .should('have.attr', 'aria-selected', 'true');
62
+ },
63
+
64
+ switchToCorrectTab: () => {
65
+ autoScoredSetCorrectAnswerSection.correctTab()
66
+ .click();
67
+ },
68
+
69
+ //V3- Need to update the function in all files
70
+ verifySetCorrectAnswerSectionErrorMessage: () => {
71
+ commonComponents.errorMessage()
72
+ .last()
73
+ .verifyInnerText('Error: Please set a correct answer.');
74
+ }
75
+ }
76
+
77
+ const tests = {
78
+ verifyAutoScoredSetCorrectAnswerHeaderSectionContents: (questionType) => {
79
+ it('\'Set Correct Answer\' label and help text should be displayed in \'Set Correct Answer\' section', () => {
80
+ autoScoredSetCorrectAnswerSection.setCorrectAnswerLabel()
81
+ .verifyInnerText('Set correct answer');
82
+
83
+ let helpText;
84
+ switch (questionType) {
85
+ case 'multiple selection':
86
+ helpText = 'You can set the correct answer by selecting the correct answer option(s).';
87
+ break;
88
+ case 'single selection':
89
+ helpText = 'You can set the correct answer by selecting the correct answer option.';
90
+ break;
91
+ case 'fill in the gaps - text':
92
+ helpText = 'You can set the correct answer by entering the correct answer(s) in the response area(s).';
93
+ break;
94
+ case 'short text response':
95
+ helpText = 'You can set the correct answer by entering the correct answer in the input field.';
96
+ break;
97
+ case 'fill in the gaps - dropdown':
98
+ helpText = 'You can set the correct answer by selecting the correct answer(s) in the response area(s).';
99
+ break;
100
+ case 'fill in the gaps - drag and drop':
101
+ helpText = 'You can set the correct answer by dragging the correct answer(s) in the response area(s).';
102
+ break;
103
+ case 'single selection grid':
104
+ helpText = 'You can set the correct answer(s) by selecting the correct answer option(s).';
105
+ break;
106
+ case 'multiple selection grid':
107
+ helpText = 'You can set the correct answer(s) by selecting the correct answer option(s).';
108
+ break;
109
+ case 'drag and drop into categories':
110
+ helpText = 'You can set the correct answer by dragging the correct answer(s) in the response area(s).';
111
+ break;
112
+ case 'list matching':
113
+ helpText = 'You can set the correct answer by dragging the correct answer(s) in the response area(s).'
114
+ break;
115
+ case 'list ordering':
116
+ helpText = 'You can set the correct answer by ordering the correct answer(s) in the response area(s).';
117
+ break;
118
+ case 'list sorting':
119
+ helpText = 'You can set the correct answer by sorting the correct answer(s) in the response area(s).';
120
+ break;
121
+ case 'highlight':
122
+ helpText = 'You can set the correct answer by highlighting the correct answer(s) in the response area(s).';
123
+ break;
124
+ case 'highlight image':
125
+ helpText = 'You can set the correct answer by selecting the correct answer(s) in the response area(s).';
126
+ break;
127
+ case 'fill in the gaps over image - text':
128
+ helpText = 'You can set the correct answer by entering the correct answer(s) in the response area(s).';
129
+ break;
130
+ case 'fill in the gaps over image - dropdown':
131
+ helpText = 'You can set the correct answer by selecting the correct answer(s) in the response area(s).';
132
+ break;
133
+ default:
134
+ throw new Error('Invalid question type');
135
+ }
136
+ autoScoredSetCorrectAnswerSection.setCorrectAnswerHelpText().verifyInnerText(helpText);
137
+ });
138
+
139
+ it('CSS of \'Set correct answer\' header section', { tags: 'css' }, () => {
140
+ cy.log('CSS of set correct answer label')
141
+ autoScoredSetCorrectAnswerSection.setCorrectAnswerLabel()
142
+ .verifyCSS(css.color.sectionHeading, css.fontSize.default, css.fontWeight.semibold);
143
+ cy.log('CSS of set correct answer help text')
144
+ autoScoredSetCorrectAnswerSection.setCorrectAnswerHelpText()
145
+ .verifyCSS(css.color.helperText, css.fontSize.normal, css.fontWeight.regular);
146
+ cy.log('CSS of set correct answer correct tab')
147
+ autoScoredSetCorrectAnswerSection.correctTab()
148
+ .verifyCSS(css.color.secondaryBtnActive, css.fontSize.default, css.fontWeight.bold);
149
+ });
150
+
151
+ it('\'Correct\' tab should be present and selected', () => {
152
+ autoScoredSetCorrectAnswerSection.correctTab()
153
+ .should('have.attr', 'aria-selected', 'true');
154
+ });
155
+ },
156
+
157
+ verifyAutoScoredAlternateAnswer: (questionType = null) => {
158
+ it('\'Add Alternate Answer\' button should be present', () => {
159
+ autoScoredSetCorrectAnswerSection.alternateAnswerButton()
160
+ .verifyInnerText('Add alternate answer');
161
+ });
162
+
163
+ it('CSS of \'Add Alternate Answer\' button', { tags: 'css' }, () => {
164
+ autoScoredSetCorrectAnswerSection.alternateAnswerButton()
165
+ .verifyCSS(css.color.secondaryBtnActive, css.fontSize.default, css.fontWeight.medium);
166
+ });
167
+
168
+ it('If user has not added points and/or selected correct answer in the Correct tab, the user should get a warning popup', () => {
169
+ cy.log('click on alternate button to display warning popup')
170
+ autoScoredSetCorrectAnswerSection.alternateAnswerButton()
171
+ .click();
172
+ dialogBoxBase.dialogBox()
173
+ .should('be.visible');
174
+ dialogBoxBase.dialogBoxTitle()
175
+ .verifyInnerText('Warning!')
176
+ dialogBoxBase.dialogBoxContent()
177
+ .verifyInnerText('Please fill the required fields.');
178
+ dialogBoxBase.buttonClose()
179
+ .should('be.visible');
180
+ });
181
+
182
+ it('CSS of warning popup', { tags: 'css' }, () => {
183
+ dialogBoxBase.dialogBoxTitle()
184
+ .verifyCSS(css.color.liText, css.fontSize.heading, css.fontWeight.semibold);
185
+ dialogBoxBase.dialogBoxContent()
186
+ .verifyCSS(css.color.labels, css.fontSize.default, css.fontWeight.regular);
187
+ dialogBoxBase.buttonClose()
188
+ .find('svg')
189
+ .should('have.css', 'fill', css.color.closeIcon);
190
+ });
191
+
192
+ it('Accessibility of warning popup', { tags: 'a11y' }, () => {
193
+ cy.checkAccessibility(dialogBoxBase.dialogBox());
194
+ });
195
+
196
+ it('Warning popup should close on clicking the Close icon button', () => {
197
+ dialogBoxBase.buttonClose()
198
+ .click();
199
+ dialogBoxBase.dialogBox()
200
+ .should('not.exist');
201
+ });
202
+
203
+ it('\'Error: Please set a correct answer.\' and \'Error: Please enter points.\' validation error messages should be displayed', () => {
204
+ autoScoredSetCorrectAnswerSection.setCorrectAnswerErrorIcon()
205
+ .should('be.visible')
206
+ .and('have.text', 'Error-Icon');
207
+ scoringSectionBase.pleaseEnterPointsErrorMessage()
208
+ .should('be.visible')
209
+ .verifyInnerText('Error: Please enter points.');
210
+ if (questionType != 'list ordering') {
211
+ commonComponents.errorMessage()
212
+ .eq(1)
213
+ .should('be.visible')
214
+ .verifyInnerText('Error: Please set a correct answer.');
215
+ }
216
+ });
217
+ },
218
+
219
+ verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty: (tabName) => {
220
+ it(`When the user focuses in and out of the empty points input field, \'Error: Please enter points.\' validation text should be displayed below the points input field and error icon should be displayed on the \'${tabName}\'`, () => {
221
+ scoringSectionBase.pointsInputField()
222
+ .focus();
223
+ scoringSectionBase.pointsInputField()
224
+ .blur();
225
+ scoringSectionBase.pleaseEnterPointsErrorMessage()
226
+ .should('be.visible')
227
+ .verifyInnerText('Error: Please enter points.');
228
+ if (tabName == 'Correct tab') {
229
+ autoScoredSetCorrectAnswerSection.correctTab()
230
+ .within(() => {
231
+ autoScoredSetCorrectAnswerSection.setCorrectAnswerErrorIcon()
232
+ .should('be.visible');
233
+ });
234
+ } else {
235
+ autoScoredSetCorrectAnswerSection.alternateAnswerTab(1)
236
+ .within(() => {
237
+ autoScoredSetCorrectAnswerSection.setCorrectAnswerErrorIcon()
238
+ .should('be.visible');
239
+ });
240
+ };
241
+ });
242
+
243
+ it('When the user enters point in Points input field then the \'Error: Please enter points.\' validation text and error icon displayed on the \'Correct\' tab the should disappear', () => {
244
+ scoringSectionBase.pointsInputField()
245
+ .type(20)
246
+ .should('have.value', 20);
247
+ scoringSectionBase.pleaseEnterPointsErrorMessage()
248
+ .should('not.exist');
249
+ autoScoredSetCorrectAnswerSection.setCorrectAnswerErrorIcon()
250
+ .should('not.exist');
251
+ });
252
+ },
253
+
254
+ verifyCSSAndA11yOfAutoScoredSetCorrectAnswerErrorMessage: () => {
255
+ it('CSS of \'Correct answer section\' error messages', { tags: 'css' }, () => {
256
+ commonComponents.errorMessage()
257
+ .verifyCSS(css.color.errorText, css.fontSize.small, css.fontWeight.regular);
258
+ autoScoredSetCorrectAnswerSection.setCorrectAnswerErrorIcon()
259
+ .find('path')
260
+ .should('have.css', 'fill', css.color.errorText);
261
+ });
262
+
263
+ it('Accessibility of \'Correct answer section\' error messages', { tags: 'a11y' }, () => {
264
+ cy.checkAccessibility(commonComponents.errorMessage());
265
+ cy.checkAccessibility(autoScoredSetCorrectAnswerSection.setCorrectAnswerErrorIcon());
266
+ });
267
+ },
268
+
269
+ verifyWarningPopupAndTabNavigationWhenNoPointsAddedInAlternateTab: () => {
270
+ it('When user clicks on Correct tab when all the mandatory fields are not filled in Alternate tab a warning popup should be displayed and on closing the popup user should be on the Alternate 2 tab.', () => {
271
+ autoScoredSetCorrectAnswerSection.correctTab()
272
+ .click();
273
+ dialogBoxBase.steps.allFieldsRequiredWarningPopupContents();
274
+ dialogBoxBase.steps.closeWarningPopup();
275
+ autoScoredSetCorrectAnswerSection.alternateAnswerTab(2)
276
+ .should('have.attr', 'aria-selected', 'true');
277
+ });
278
+ },
279
+
280
+ verifyA11yOfAlternateAnswerTab: () => {
281
+ it('Accessibility of \'Alternate\' answer tab', { tags: 'a11y' }, () => {
282
+ cy.checkAccessibility(autoScoredSetCorrectAnswerSection.correctTab().parents('[class*="styles__AnswerTabWrapper"]'));
283
+ });
284
+ }
285
+ }
286
+
287
+ export const autoScoredSetCorrectAnswerSection = {
288
+ ...selectors,
289
+ steps,
290
+ tests
291
+ }
@@ -0,0 +1,64 @@
1
+ import constants from "../../fixtures/constants";
2
+
3
+ const selectors = {
4
+ imageIcon: () => cy.get('a[title="Insert Image"]:visible'),
5
+ boldIcon: () => cy.get('.cke_button__bold:visible'),
6
+ equationEditorIcon: () => cy.get('.cke_button__nextgeneqneditor:visible'),
7
+ linkIcon: () => cy.get('.cke_button__link:visible'),
8
+ ckeDialogbox: () => cy.get('.cke_dialog_body:visible'),
9
+ //Image dialog box
10
+ imageUrlInputField: () => cy.get('input[type="text"].cke_dialog_ui_input_text').eq(0),
11
+ alternativeTextInputField: () => cy.get('input[type="text"].cke_dialog_ui_input_text').eq(1),
12
+ ckeOkButton: () => cy.get('a[title="OK"]:visible'),
13
+ //Link dialog box
14
+ linkDialogboxDisplayTextInputField: () => cy.get('input[class*="cke_dialog_ui_input_text"]:visible').eq(0),
15
+ linkDialogboxURLInputField: () => cy.get('input[class*="cke_dialog_ui_input_text"]:visible').eq(1),
16
+ }
17
+
18
+ const steps = {
19
+ selectBoldOptionFromCKEditorToolbar: () => {
20
+ ckEditorToolbar.boldIcon()
21
+ .click();
22
+ },
23
+
24
+ selectImageOptionFromCKEditorToolbar: () => {
25
+ ckEditorToolbar.imageIcon()
26
+ .click();
27
+ },
28
+
29
+ selectEquationEditorOptionFromCKEditorToolbar: () => {
30
+ ckEditorToolbar.equationEditorIcon()
31
+ .click();
32
+ },
33
+
34
+ selectLinkOptionFromCKEditorToolbar: () => {
35
+ ckEditorToolbar.linkIcon()
36
+ .click();
37
+ },
38
+
39
+ addImageToInputField: () => {
40
+ ckEditorToolbar.imageUrlInputField()
41
+ .type(constants.foxImageLink);
42
+ ckEditorToolbar.alternativeTextInputField()
43
+ .type(constants.foxImageAltText);
44
+ ckEditorToolbar.ckeOkButton()
45
+ .click();
46
+ },
47
+
48
+ addLinkToInputField: () => {
49
+ ckEditorToolbar.ckeDialogbox()
50
+ .within(() => {
51
+ ckEditorToolbar.linkDialogboxDisplayTextInputField()
52
+ .type('lorem')
53
+ .should('have.value', 'lorem');
54
+ ckEditorToolbar.linkDialogboxURLInputField()
55
+ .type(`${Cypress.config().baseUrl}`);
56
+ ckEditorToolbar.ckeOkButton()
57
+ .click();
58
+ });
59
+ },
60
+ }
61
+ export const ckEditorToolbar = {
62
+ ...selectors,
63
+ steps
64
+ }