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,370 @@
1
+ import { additionalSettingsPanel, autoScoredAdditionalSettings, autoScoredPreviewBase, autoScoredScoringSection, autoScoredScoringSectionMultipleResponsesType, autoScoredSetCorrectAnswerSection, commonComponents, createQuestionBasePage, mcqOptionsComponent, mcqScoringComponent, optionsWrapperComponent, previewScoringAndShowCorrectAnswerComponent, questionInstructionsComponent, scoringSectionBase } from "./components";
2
+ import { gridCommonComponents } from "./components/gridCommonComponents";
3
+ import { studentResponseAndLayoutComponent } from "./components/studentResponseAreaAndLayoutComponent";
4
+ const css = Cypress.env('css');
5
+
6
+ const selectors = {
7
+ ...questionInstructionsComponent,
8
+ ...commonComponents,
9
+ ...scoringSectionBase,
10
+ ...autoScoredSetCorrectAnswerSection,
11
+ ...mcqOptionsComponent,
12
+ ...autoScoredScoringSectionMultipleResponsesType,
13
+ ...autoScoredAdditionalSettings,
14
+ ...previewScoringAndShowCorrectAnswerComponent,
15
+ ...autoScoredPreviewBase,
16
+ ...createQuestionBasePage,
17
+ ...gridCommonComponents,
18
+ ...additionalSettingsPanel,
19
+ optionNumeration: () => cy.get('[class*="SingleOptionstyle__AdornmentWrapper"]'),
20
+ //Options section
21
+ optionsSectionWrapper: () => cy.get('.edit-mcq-options-wrapper.single-selection-grid'),
22
+ //Set correct answer section
23
+ optionsRadioButton: () => cy.get('.choice-option-radio-button [type="radio"]'),
24
+ pointsWrapper: () => cy.get('.single-selection-grid-points-wrapper'),
25
+ randomizeOptionsCheckbox: () => cy.get('[data-ngie-testid="randomize-options-checkbox"] input'),
26
+ randomizeOptionsCheckboxLabel: () => cy.get('[data-ngie-testid="randomize-options-checkbox"] .MuiFormControlLabel-label'),
27
+ //Preview tab
28
+ radioButtonWrapper: () => cy.get('.choice-option-radio-button'),
29
+ previewTabRadioButtonWrapper: () => cy.get('.edit-question-preview-wrapper .choice-option-radio-button'),
30
+ //Scoring
31
+ pointsPerResponseLabel: () => cy.get('[class*="indexstyles__PartialDifferentPointsHeader"]'),
32
+ partialEqualWeightsPointsPerResponseScore: () => cy.get('.partial-different-points-wrapper [aria-label*="Points per response"]'),
33
+ partialDifferentWeightsPointsInputField: () => cy.get('.partial-different-points-wrapper .points-input-field input[type="text"]'),
34
+ correctIncorrectIconWrapper: () => cy.get('.tick-icon-wrapper'),
35
+ correctIncorrectAnswerBorder: () => cy.get('.edit-question-preview-wrapper [class*="indexstyles__CorrectIncorrectBorderWrapper"]')
36
+ };
37
+
38
+ const steps = {
39
+ ...createQuestionBasePage.steps,
40
+ ...questionInstructionsComponent.steps,
41
+ ...scoringSectionBase.steps,
42
+ ...commonComponents.steps,
43
+ ...autoScoredSetCorrectAnswerSection.steps,
44
+ ...autoScoredScoringSectionMultipleResponsesType.steps,
45
+ ...additionalSettingsPanel.steps,
46
+ ...previewScoringAndShowCorrectAnswerComponent.steps,
47
+ ...autoScoredPreviewBase.steps,
48
+ ...autoScoredAdditionalSettings.steps,
49
+ ...gridCommonComponents.steps,
50
+ ...autoScoredScoringSection.steps,
51
+ //Set correct section
52
+ /**
53
+ * @param {number} rowIndex index of the row
54
+ * @param {number} optionIndex index of the option
55
+ * @description This function selects option from the set correct answer table
56
+ */
57
+ selectOptionFromSetCorrectAnswerTable: (rowIndex, optionIndex) => {
58
+ singleSelectionGridPage.setCorrectAnswerTableRow()
59
+ .eq(rowIndex)
60
+ .within(() => {
61
+ singleSelectionGridPage.optionsRadioButton()
62
+ .eq(optionIndex)
63
+ .click()
64
+ .should('be.checked');
65
+ });
66
+ },
67
+
68
+ /**
69
+ * @param {array} optionIndexInQuestionStemRow array of options to be selected for all question stems
70
+ * @description This function checkmarks all the options in the set correct answer table
71
+ */
72
+ selectOptionForAllQuestionStemsInSetCorrectAnswerTable: (optionIndexInQuestionStemRow) => {
73
+ optionIndexInQuestionStemRow.forEach((options, optionIndex) => {
74
+ singleSelectionGridPage.setCorrectAnswerTableRow()
75
+ .eq(optionIndex)
76
+ .within(() => {
77
+ singleSelectionGridPage.optionsRadioButton()
78
+ .eq(options)
79
+ .click()
80
+ .should('be.checked');
81
+ });
82
+ });
83
+ },
84
+
85
+ /**
86
+ * @param {number} rowIndex index of the row
87
+ * @param {number} radioButtonsCount number of radio buttons present in the row
88
+ * @description This function verifies the count of radio buttons present in a row
89
+ */
90
+ verifyTableRowRadioButtonsInSetCorrectAnswerTable: (rowIndex, radioButtonsCount) => {
91
+ singleSelectionGridPage.setCorrectAnswerTableRow()
92
+ .eq(rowIndex)
93
+ .within(() => {
94
+ singleSelectionGridPage.optionsRadioButton()
95
+ .should('have.length', radioButtonsCount)
96
+ });
97
+ },
98
+
99
+ /**
100
+ * @param {number} rowIndex index of the row
101
+ * @description this function verifies disabled radio button
102
+ */
103
+ verifyDisabledTableRowRadioButtonsInSetCorrectAnswerTable: (rowIndex) => {
104
+ singleSelectionGridPage.setCorrectAnswerTableRow()
105
+ .eq(rowIndex)
106
+ .within(() => {
107
+ singleSelectionGridPage.optionsRadioButton()
108
+ .each(($el) => {
109
+ cy.wrap($el)
110
+ .should('be.disabled');
111
+ });
112
+ });
113
+ },
114
+
115
+ /**
116
+ * @param {number} rowIndex index of the row
117
+ * @description this function verifies enabled and unchecked radio button
118
+ */
119
+ verifyEnabledUncheckedTableRowRadioButtonsInSetCorrectAnswerTable: (rowIndex) => {
120
+ singleSelectionGridPage.setCorrectAnswerTableRow()
121
+ .eq(rowIndex)
122
+ .within(() => {
123
+ singleSelectionGridPage.optionsRadioButton()
124
+ .each(($el) => {
125
+ cy.wrap($el)
126
+ .should('be.enabled')
127
+ .and('not.be.checked');
128
+ });
129
+ });
130
+ },
131
+
132
+ //Preview tab
133
+ /**
134
+ * @param {number} rowIndex index of the row
135
+ * @param {number} radioButtonsCount number of radio buttons present in the row
136
+ * @description This function verifies the count of radio buttons present in a row
137
+ */
138
+ verifyTableRowRadioButtonsInPreviewTabAnswerTable: (rowIndex, radioButtonsCount) => {
139
+ singleSelectionGridPage.previewTabAnswerTableRow()
140
+ .eq(rowIndex)
141
+ .within(() => {
142
+ singleSelectionGridPage.optionsRadioButton()
143
+ .should('have.length', radioButtonsCount)
144
+ });
145
+ },
146
+
147
+ /**
148
+ * @param {number[]} optionIndexInQuestionStemRow array of options to be selected to each question stem
149
+ * @description This function selects the options for all the question stems
150
+ */
151
+ selectOptionForAllQuestionStemsInPreviewTabAnswerTable: (optionIndexInQuestionStemRow) => {
152
+ optionIndexInQuestionStemRow.forEach((options, optionIndex) => {
153
+ singleSelectionGridPage.previewTabAnswerTableRow()
154
+ .eq(optionIndex)
155
+ .within(() => {
156
+ singleSelectionGridPage.optionsRadioButton()
157
+ .eq(options)
158
+ .click()
159
+ .should('be.checked');
160
+ });
161
+ });
162
+ },
163
+
164
+ verifyRadioButtonsUncheckedInPreviewTabAnswerTable: () => {
165
+ singleSelectionGridPage.previewTabAnswerTable()
166
+ .within(() => {
167
+ singleSelectionGridPage.optionsRadioButton()
168
+ .each(($el) => {
169
+ cy.wrap($el)
170
+ .should('not.be.checked')
171
+ });
172
+ });
173
+ },
174
+
175
+ //Scoring
176
+ /**
177
+ * @param {number} rowIndex index of the row
178
+ * @param {number} optionIndex index of the option to be selected within the row
179
+ * @description This function verifies the incorrect icon in the preview tab table
180
+ */
181
+ verifyIncorrectOptionCrossmarkIcon: (rowIndex, optionIndex) => {
182
+ singleSelectionGridPage.previewTabAnswerTableRow()
183
+ .eq(rowIndex)
184
+ .within(() => {
185
+ singleSelectionGridPage.radioButtonWrapper()
186
+ .eq(optionIndex)
187
+ .within(() => {
188
+ singleSelectionGridPage.correctIncorrectIconWrapper()
189
+ .should('have.class', 'icon-incorrect')
190
+ .and('be.visible');
191
+ });
192
+ });
193
+ },
194
+
195
+ /**
196
+ * @param {number} rowIndex index of the row
197
+ * @param {number} optionIndex index of the option to be selected within the row
198
+ * @description This function verifies the correct icon in the preview tab table
199
+ */
200
+ verifyCorrectOptionCheckmarkIcon: (rowIndex, optionIndex) => {
201
+ singleSelectionGridPage.previewTabAnswerTableRow()
202
+ .eq(rowIndex)
203
+ .within(() => {
204
+ singleSelectionGridPage.radioButtonWrapper()
205
+ .eq(optionIndex)
206
+ .within(() => {
207
+ singleSelectionGridPage.correctIncorrectIconWrapper()
208
+ .should('have.class', 'icon-correct')
209
+ .and('be.visible');
210
+ });
211
+ });
212
+ },
213
+
214
+ /**
215
+ * @param {number[]} incorrectOptionsArray the array of incorrect answer options
216
+ * @description this function verifies the crossmark icon beside the options for all question stems
217
+ */
218
+ verifyIncorrectOptionCrossmarkIconForAllQuestionStems: (incorrectOptionsArray) => {
219
+ incorrectOptionsArray.forEach((incorrectOptionsIndex, rowIndex) => {
220
+ steps.verifyIncorrectOptionCrossmarkIcon(rowIndex, incorrectOptionsIndex)
221
+ });
222
+ },
223
+
224
+ /**
225
+ * @param {number[]} correctOptionsArray the array of correct answer options
226
+ * @description this function verifies the checkmark icon beside the options for all question stems
227
+ */
228
+ verifyCorrectOptionCheckmarkIconForAllQuestionStems: (correctOptionsArray) => {
229
+ correctOptionsArray.forEach((correctOptionsIndex, rowIndex) => {
230
+ steps.verifyCorrectOptionCheckmarkIcon(rowIndex, correctOptionsIndex)
231
+ });
232
+ },
233
+
234
+ //TODO: Make all border related changes once https://redmine.zeuslearning.com/issues/518498 is resolved
235
+ verifyCorrectAttemptBorder: () => {
236
+ singleSelectionGridPage.correctIncorrectAnswerBorder()
237
+ .should('have.css', 'border', `1px solid ${css.color.correctAnswer}`);
238
+ },
239
+
240
+ verifyIncorrectAttemptBorder: () => {
241
+ singleSelectionGridPage.correctIncorrectAnswerBorder()
242
+ .should('have.css', 'border', `1px solid ${css.color.incorrectAnswer}`);
243
+ },
244
+
245
+ verifyCorrectIncorrectBorderNotVisible: () => {
246
+ singleSelectionGridPage.correctIncorrectAnswerBorder()
247
+ .should('have.css', 'border')
248
+ .and('match', /0px none/);
249
+ },
250
+ };
251
+
252
+ const tests = {
253
+ ...createQuestionBasePage.tests,
254
+ ...questionInstructionsComponent.tests,
255
+ ...autoScoredSetCorrectAnswerSection.tests,
256
+ ...autoScoredScoringSection.tests,
257
+ ...scoringSectionBase.tests,
258
+ ...mcqScoringComponent.tests,
259
+ ...commonComponents.tests,
260
+ ...previewScoringAndShowCorrectAnswerComponent.tests,
261
+ ...gridCommonComponents.tests,
262
+ ...additionalSettingsPanel.tests,
263
+ ...autoScoredAdditionalSettings.tests,
264
+ ...studentResponseAndLayoutComponent.tests,
265
+ /**
266
+ * @param {string} scoringType the type of scoring selected by the user
267
+ * @param {string[]} questionStemsArray the array of question stems to be verified in the set correct answer table
268
+ * @param {string[]} optionsArray the array of options to be verified in the set correct answer table
269
+ * @description this function is used to verify the contents of the set correct answer table when a scoring type is selected
270
+ */
271
+ verifyAllContentsOfSetCorrectAnswerTableForScoringType: (scoringType, questionStemsArray, optionsArray) => {
272
+ it(`When user has selected ${scoringType} scoring type then added question stems, options and enabled radio buttons should be displayed`, () => {
273
+ singleSelectionGridPage.steps.verifyQuestionStemsInSetCorrectAnswerTable(questionStemsArray);
274
+ singleSelectionGridPage.steps.verifyTableHeaderContentsInSetCorrectAnswerTable(optionsArray);
275
+ for (let index = 0; index < 4; index++) {
276
+ singleSelectionGridPage.steps.verifyEnabledUncheckedTableRowRadioButtonsInSetCorrectAnswerTable(index);
277
+ }
278
+ });
279
+ },
280
+
281
+ /**
282
+ * @param {number} totalPoints the maximum points that can be scored by the user
283
+ * @description this function verifies the functionality of minimum points when penalty points are not set and user attempts incorrect answer
284
+ */
285
+ verifyMinimumScoreAwardedIfAttemptedFunctionalityForIncorrectAnswer: (totalPoints) => {
286
+ it('When user has provided minimum score awarded (if attempted) points, then in Preview tab on entering incorrect answer, minimum score should be provided for the question', () => {
287
+ cy.log('Switch to edit tab and set minimum score if attempted points')
288
+ createQuestionBasePage.steps.switchToEditTab();
289
+ scoringSectionBase.steps.allotMinimumScoreAwardedIfAttempted('1')
290
+ createQuestionBasePage.steps.switchToPreviewTab()
291
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInPreviewTabAnswerTable([1, 0, 1, 0]);
292
+ singleSelectionGridPage.previewScoreText()
293
+ .verifyInnerText(`1/${totalPoints}`);
294
+ });
295
+
296
+ it('When user removes minimum score awarded (if attempted) points, then in Preview tab on selecting any options other than correct answers, points should not be provided', () => {
297
+ cy.log('Switch to edit tab and remove minimum score if attempted points')
298
+ createQuestionBasePage.steps.switchToEditTab();
299
+ singleSelectionGridPage.steps.clearMinimumScoreIfAttemptedPointsField();
300
+ createQuestionBasePage.steps.switchToPreviewTab()
301
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInPreviewTabAnswerTable([1, 0, 1, 0]);
302
+ singleSelectionGridPage.previewScoreText()
303
+ .verifyInnerText(`0/${totalPoints}`);
304
+ });
305
+ },
306
+
307
+ /**
308
+ *
309
+ * @param {number} scoredPoints the points scored by the user
310
+ * @param {number} totalPoints the maximum points that can be scored by the user
311
+ * @description this function verifies the functionality of Penalty points when minimum points are not set and user attempts incorrect answer
312
+ */
313
+ verifyPenaltyPointsFunctionalityForIncorrectAnswer: (scoredPoints, totalPoints) => {
314
+ it('When user has defined penalty points', () => {
315
+ cy.log('Pre-step: Switch to edit tab and set penalty points');
316
+ createQuestionBasePage.steps.switchToEditTab();
317
+ singleSelectionGridPage.steps.allotPenaltyPoints('3')
318
+
319
+ cy.log('After switching to preview tab, when user adds an incorrect answer input, then 0 points should be awarded(no negative points)');
320
+ createQuestionBasePage.steps.switchToPreviewTab();
321
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInPreviewTabAnswerTable([1, 0, 1, 0]);
322
+ singleSelectionGridPage.previewScoreText()
323
+ .verifyInnerText(`0/${totalPoints}`);
324
+
325
+ cy.log('When user adds a partially correct answer input, the points should be updated accordingly with deducted penalty points');
326
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInPreviewTabAnswerTable([0, 1, 1, 1]);
327
+ singleSelectionGridPage.previewScoreText()
328
+ .verifyInnerText(`${scoredPoints}/${totalPoints}`);
329
+ });
330
+ },
331
+ /**
332
+ * @param {number} scoredPoints the points scored by the user
333
+ * @param {number} totalPoints the maximum points that can be scored by the user
334
+ * @description this function verifies the functionality of Minimum score if attempted points when penalty points are set and user attempts incorrect answer
335
+ */
336
+ verifyMinimumScoreIfAttemptedAndPenaltyPointsFunctionalityForIncorrectAnswer: (scoredPoints, totalPoints) => {
337
+ it('When user has defined both penalty points and minimum score awarded (if attempted) points', () => {
338
+ cy.log('Pre-step: Switch to edit tab and set minimum score awarded (if attempted) points');
339
+ createQuestionBasePage.steps.switchToEditTab();
340
+ scoringSectionBase.steps.allotMinimumScoreAwardedIfAttempted('1');
341
+
342
+ cy.log('Switch to preview tab and give incorrect answer input to check that minimum points are displayed');
343
+ createQuestionBasePage.steps.switchToPreviewTab();
344
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInPreviewTabAnswerTable([1, 0, 1, 0]);
345
+ singleSelectionGridPage.previewScoreText()
346
+ .verifyInnerText(`1/${totalPoints}`);
347
+
348
+ cy.log('When user adds a partially correct answer such that the points of the attempt(with penalty points deducted) is more than the minimum score awarded(if attempted) points');
349
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInPreviewTabAnswerTable([0, 1, 1, 1]);
350
+ singleSelectionGridPage.previewScoreText()
351
+ .verifyInnerText(`${scoredPoints}/${totalPoints}`);
352
+
353
+ cy.log('When user switches to edit tab and increases the minimum score awarded (if attempted) points to check the case for an attempt in which points of the attempt is less than minimum score awarded (if attempted) points, then the minimum score awarded (if attempted) points should be displayed to the user');
354
+ createQuestionBasePage.steps.switchToEditTab();
355
+ singleSelectionGridPage.steps.clearMinimumScoreIfAttemptedPointsField()
356
+ scoringSectionBase.steps.allotMinimumScoreAwardedIfAttempted('6')
357
+ cy.log('Switching to preview tab');
358
+ createQuestionBasePage.steps.switchToPreviewTab();
359
+ singleSelectionGridPage.steps.selectOptionForAllQuestionStemsInPreviewTabAnswerTable([0, 0, 1, 0]);
360
+ singleSelectionGridPage.previewScoreText()
361
+ .verifyInnerText(`6/${totalPoints}`);
362
+ });
363
+ }
364
+ };
365
+
366
+ export const singleSelectionGridPage = {
367
+ ...selectors,
368
+ steps,
369
+ tests
370
+ };
@@ -0,0 +1,65 @@
1
+ import { additionalSettingsPanel, autoScoredPreviewBase, createQuestionBasePage, mcqAdditionalSettingsBase, mcqPreviewComponents, mcqQuestionCommonComponents, mcqSetCorrectAnswerSection, scoringSectionBase, autoScoredAdditionalSettings, autoScoredSetCorrectAnswerSection, autoScoredScoringSection, mcqScoringComponent, previewScoringAndShowCorrectAnswerComponent, optionsWrapperComponent } from "./components";
2
+ import { mcqOptionsComponent } from "./components/mcqOptionsComponent";
3
+ import { questionInstructionsComponent } from "./components/questionInstructionsComponent";
4
+
5
+ const selectors = {
6
+ ...createQuestionBasePage,
7
+ ...questionInstructionsComponent,
8
+ ...mcqOptionsComponent,
9
+ ...additionalSettingsPanel,
10
+ ...mcqQuestionCommonComponents,
11
+ ...mcqAdditionalSettingsBase,
12
+ ...autoScoredPreviewBase,
13
+ ...mcqSetCorrectAnswerSection,
14
+ ...scoringSectionBase,
15
+ ...autoScoredSetCorrectAnswerSection,
16
+ ...autoScoredAdditionalSettings,
17
+ ...previewScoringAndShowCorrectAnswerComponent,
18
+ ...optionsWrapperComponent,
19
+ optionsRadioButton: () => cy.get('input[type="radio"]')
20
+ };
21
+
22
+ const steps = {
23
+ ...createQuestionBasePage.steps,
24
+ ...questionInstructionsComponent.steps,
25
+ ...mcqOptionsComponent.steps,
26
+ ...additionalSettingsPanel.steps,
27
+ ...mcqQuestionCommonComponents.steps,
28
+ ...autoScoredAdditionalSettings.steps,
29
+ ...autoScoredPreviewBase.steps,
30
+ ...scoringSectionBase.steps,
31
+ ...mcqSetCorrectAnswerSection.steps,
32
+ ...mcqPreviewComponents.steps,
33
+ ...autoScoredSetCorrectAnswerSection.steps,
34
+ ...autoScoredScoringSection.steps,
35
+ checkCorrectAnswerRadioButton: (option) => {
36
+ mcqSetCorrectAnswerSection.correctAnswerOptionsWrapper(option)
37
+ .click()
38
+ .within(() => {
39
+ singleSelectionPage.optionsRadioButton()
40
+ .should('be.checked');
41
+ });
42
+ }
43
+ };
44
+
45
+ const tests = {
46
+ ...createQuestionBasePage.tests,
47
+ ...questionInstructionsComponent.tests,
48
+ ...mcqOptionsComponent.tests,
49
+ ...additionalSettingsPanel.tests,
50
+ ...mcqQuestionCommonComponents.tests,
51
+ ...mcqAdditionalSettingsBase.tests,
52
+ ...scoringSectionBase.tests,
53
+ ...mcqSetCorrectAnswerSection.tests,
54
+ ...autoScoredAdditionalSettings.tests,
55
+ ...autoScoredSetCorrectAnswerSection.tests,
56
+ ...autoScoredScoringSection.tests,
57
+ ...mcqScoringComponent.tests,
58
+ ...previewScoringAndShowCorrectAnswerComponent.tests,
59
+ };
60
+
61
+ export const singleSelectionPage = {
62
+ ...selectors,
63
+ tests,
64
+ steps
65
+ };
@@ -0,0 +1,110 @@
1
+ import { commonComponents, questionInstructionsComponent, scoringSectionBase, createQuestionBasePage, additionalSettingsPanel, previewScoringAndShowCorrectAnswerComponent } from "./components";
2
+ import { dialogBoxBase } from ".";
3
+
4
+ const selectors = {
5
+ ...dialogBoxBase,
6
+ ...scoringSectionBase,
7
+ ...createQuestionBasePage,
8
+ ...additionalSettingsPanel,
9
+ ...questionInstructionsComponent,
10
+ //Supported file accordion
11
+ supportedFileTypesAccordion: () => cy.get('.freeresponse-accordian-label'),
12
+ selectedFileTypeCount: () => cy.get('.supported-file-types-count'),
13
+ supportedFileTypeCheckbox: () => cy.get('.ngie-checkbox input'),
14
+ supportedFileTypesAccordionWrapper: () => cy.get('.edit-question-edit-tab-wrapper .ngie-accordion-summary'),
15
+ supportedFileTypesCheckboxWrapper: (fileTypeNumber) => cy.get('.edit-question-supported-files-wrapper .ngie-checkbox-control-label').eq(fileTypeNumber),
16
+ //Max files dropdown
17
+ maxFilesLabel: () => cy.get('#Maximum-number-of-files-dropdown-label'),
18
+ maxFilesDropdown: () => cy.get('#Maximum-number-of-files-select'),
19
+ maxFilesDropdownListOptions: (optionNumber) => cy.get('.dropdown-menu-item ').eq(optionNumber),
20
+ //Additional settings accordian
21
+ fileSettingsAndLayoutLabel: () => cy.get('[class*="AdditionalOptionstyles__ScoringLabel"]'),//TODO: need to change post issue for unique class name
22
+ allowStudentsToCapturePhotosLabel: () => cy.get('[data-ngie-testid="allow-students-to-capture-photos-checkbox"] .MuiFormControlLabel-label'),
23
+ allowStudentsToCapturePhotosCheckbox: () => cy.get('[data-ngie-testid="allow-students-to-capture-photos-checkbox"] input'),
24
+ uploadFileContentWrapper: () => cy.get('.upload-file-content'),
25
+ uploadCloudIcon: () => cy.get('.upload-question-upload-cloud-icon-wrapper'),
26
+ dragAndDropFilesText: () => cy.get('.drag-and-drop-file-text'),
27
+ fileUploadOptionsLabel: () => cy.get('.file-input-label'),
28
+ deviceLink: () => cy.get('.icon-Device'),
29
+ googleDriveLink: () => cy.get('.icon-Google-Drive'),
30
+ cameraIcon: () => cy.get('.icon-Capture-an-image'),
31
+ supportedFileFormatLabel: () => cy.get('.supported-file-text'),
32
+ supportedFileInfoIcon: () => cy.get('.supported-file-icon-wrapper'),
33
+ uploadingProgressBar: () => cy.get('.uploading-document-progress-bar'),
34
+ uploadingFileName: () => cy.get('.upload-filename'),
35
+ uploadingFileSize: () => cy.get('.upload-file-size-details'),
36
+ stopUploadingButton: () => cy.get('.document-stop-uploading-icon-wrapper'),
37
+ uploadedFileCount: () => cy.get('.file-upload-limit'),
38
+ supportedFilesTooltip: () => cy.get('.upload-question-supported-file-tooltip'),
39
+ inputTypeFile: () => cy.get('input[type="file"]'),
40
+ uploadedFilesSectionWrapper: () => cy.get('.uploaded-document-wrapper'),
41
+ uploadedFileWrapper: () => cy.get('.uploaded-document'),
42
+ editDisplayTextIcon: () => cy.get('.icon-pencil'),
43
+ //Add File description
44
+ addFileDescriptionInput: () => cy.get('[placeholder="Add file description"]'),
45
+ addFileDescriptionIcon: () => cy.get('.icon-File-description'),
46
+ scanningForVirusPreLoader: () => cy.get('img[alt="loader"]'),
47
+ virusErrorMessageWrapper: () => cy.get('.FileUploadStatementLarge'),
48
+ uploadedFileLink: () => cy.get('a[href*="/files/document?key=freeResponse/"]'),
49
+ editDisplayTextPopupInputField: () => cy.get('.inline-text-question-prefix-wrapper .update-display-text-input'),
50
+ rejectButton: () => cy.get('.popup-button-wrapper button').eq(0),//TODO: need to use selector from common components, once common class is implemented
51
+ acceptButton: () => cy.get('.popup-button-wrapper button').eq(1),//TODO: need to use selector from common components, once common class is implemented
52
+ deleteButton: () => cy.get('.icon-Delete.upload-response-state')
53
+ }
54
+
55
+ const steps = {
56
+ ...createQuestionBasePage.steps,
57
+ ...questionInstructionsComponent.steps,
58
+ ...scoringSectionBase.steps,
59
+ ...additionalSettingsPanel.steps,
60
+ checkCapturePhotosCheckbox: () => {
61
+ uploadResponsePage.allowStudentsToCapturePhotosCheckbox()
62
+ .click()
63
+ .should('be.checked');
64
+ },
65
+
66
+ checkUncheckSupportedFileType: (fileTypeIndex, fileType, checkedUnchecked) => {
67
+ uploadResponsePage.supportedFileTypesCheckboxWrapper(fileTypeIndex)
68
+ .verifyInnerText(fileType)
69
+ .within(() => {
70
+ uploadResponsePage.supportedFileTypeCheckbox()
71
+ .click()
72
+ .should(checkedUnchecked);
73
+ });
74
+ },
75
+
76
+ fileUploadAndVerify: (filesToUploadArray) => {
77
+ filesToUploadArray.forEach((file) => {
78
+ uploadResponsePage.inputTypeFile()
79
+ .attachFile(`uploads/${file}`);
80
+ uploadResponsePage.uploadedFileLink()
81
+ .last()
82
+ .should('have.text', file);
83
+ uploadResponsePage.scanningForVirusPreLoader()
84
+ .should('not.be.visible');
85
+ });
86
+ },
87
+ }
88
+
89
+ const tests = {
90
+ ...createQuestionBasePage.tests,
91
+ ...questionInstructionsComponent.tests,
92
+ ...additionalSettingsPanel.tests,
93
+ ...scoringSectionBase.tests,
94
+ ...previewScoringAndShowCorrectAnswerComponent.tests,
95
+ verifyErrorMessageDisappear: () => {
96
+ it('The error message should disappear if the user clicks anywhere in the upload file content wrapper', () => {
97
+ uploadResponsePage.inputTypeFile()
98
+ .parent()
99
+ .click();
100
+ commonComponents.errorMessage()
101
+ .should('not.exist');
102
+ });
103
+ }
104
+ }
105
+
106
+ export const uploadResponsePage = {
107
+ ...selectors,
108
+ steps,
109
+ tests
110
+ }