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,264 @@
1
+ import { createQuestionBasePage, questionInstructionsComponent, additionalSettingsPanel, commonComponents, scoringSectionBase, previewScoringAndShowCorrectAnswerComponent, maximumRecorderLengthComponent } from "../pages/components";
2
+ import utilities from "../support/helpers/utilities";
3
+ import { dialogBoxBase } from "./dialogBoxBase";
4
+
5
+ const selectors = {
6
+ ...additionalSettingsPanel,
7
+ ...createQuestionBasePage,
8
+ ...commonComponents,
9
+ ...dialogBoxBase,
10
+ ...scoringSectionBase,
11
+ ...questionInstructionsComponent,
12
+ audioRecorderStyleLabel: () => cy.get('#Audio-Recorder-Style-dropdown-label'),
13
+ audioRecorderStyleDropdown: () => cy.get('#Audio-Recorder-Style-select'),
14
+ audioRecorderStyleListOptions: (optionIndex) => cy.get('[aria-labelledby="Audio-Recorder-Style-dropdown-label Audio-Recorder-Style-placeholder"] li[role="option"]').eq(optionIndex),
15
+ audioRecorderStyleList: () => cy.get('.dropdown-list'),
16
+ stopRecordingIfSilenceIsDetectedLabel: () => cy.get('.stop-recording-length-label'),
17
+ stopRecordingIfSilenceIsDetectedInputFieldSecsSuffix: () => cy.get('.audio-stop-recording-suffix'),
18
+ stopRecordingIfSilenceIsDetectedInputField: () => cy.get('.stop-recording-on-silence-time-input-field input'),
19
+ recorderAndPlaybackControlsOptionButtonIcon: () => cy.get('.ngie-toggle-button-icon'),
20
+ //Customize recorder and playback controls (for student player)
21
+ customizeRecorderAndPlaybackControlsAccordionChevronIcon: () => cy.get('.customize-expand-icon'),
22
+ customizeRecorderAndPlaybackControlsAccordionLabel: () => cy.get('.customize_recorder_label'),
23
+ customizeRecorderAndPlaybackControlsAccordion: () => cy.get('.customize-accordion [role="button"]'),
24
+ customizeRecorderAndPlaybackControlsSection: () => cy.get('.customize-accordion'),
25
+ recorderAndPlaybackControlsOptionButtonLabel: () => cy.get('.ngie-toggle-button-label'),
26
+ //Controls for recording response
27
+ controlsForRecordingResponseLabel: () => cy.get('.audio-response-selection-panel-details .ngie-toggle-button-title').eq(0),
28
+ startRecordingOptionButton: () => cy.get('[data-ngie-testid="start-recording-toggle-button"]'),
29
+ pauseRecordingOptionButton: () => cy.get('[data-ngie-testid="pause-recording-toggle-button"]'),
30
+ stopRecordingOptionButton: () => cy.get('[data-ngie-testid="stop-recording-toggle-button"]'),
31
+ recordingCueOptionButton: () => cy.get('[data-ngie-testid="recording-cue-toggle-button"]'),
32
+ recordingOverlayOptionButton: () => cy.get('[value="recorderOverlay"]'),
33
+ //Controls for response playback
34
+ controlsForResponsePlaybackLabel: () => cy.get('.audio-response-selection-panel-details .ngie-toggle-button-title').eq(1),
35
+ playOptionButton: () => cy.get('[data-ngie-testid="play-toggle-button"]'),
36
+ pauseOptionButton: () => cy.get('[data-ngie-testid="pause-toggle-button"]'),
37
+ seekOptionButton: () => cy.get('[data-ngie-testid="seek-toggle-button"]'),
38
+ volumeControlOptionButton: () => cy.get('[data-ngie-testid="volume-control-toggle-button"]'),
39
+ playbackOverlayOptionButton: () => cy.get('[value="playbackOverlay"]'),
40
+ //Advanced recorder options
41
+ playerSettingsLabel: () => cy.get('.accordion_label'),
42
+ advancedRecorderOptionsLabel: () => cy.get('.advanced-recorder-settings .ngie-toggle-button-title'),
43
+ advancedRecorderOptionsSection: () => cy.get('[class*="AdditionalOptionstyles__AudioResponseButtonWrapper"]'),
44
+ timerOptionButton: () => cy.get('[data-ngie-testid="timer-toggle-button"]'),
45
+ progressBarOptionButton: () => cy.get('[data-ngie-testid="progress-bar-toggle-button"]'),
46
+ volumeMeterOptionButton: () => cy.get('[data-ngie-testid="volume-meter-toggle-button"]'),
47
+ waveformOptionButton: () => cy.get('[data-ngie-testid="waveform-toggle-button"]'),
48
+ waveformCursor: () => cy.get('.audio-wave-form-cursor-div'),
49
+ //Maximum width for audio recorder
50
+ maximumWidthForAudioRecorderLabel: () => cy.get('#max-width-audio-label'),
51
+ maximumWidthForAudioRecorderInputField: () => cy.get('.max-width-audio-recorder-input-field input'),
52
+ //Allow teachers to download student responses
53
+ allowTeachersToDownloadStudentResponsesCheckboxLabel: () => cy.get('[data-ngie-testid="allow-teachers-to-download-student-response-checkbox"] .MuiFormControlLabel-label'),
54
+ allowTeachersToDownloadStudentResponsesCheckbox: () => cy.get('[data-ngie-testid="allow-teachers-to-download-student-response-checkbox"] input'),
55
+ //Preview tab
56
+ previewPlaybackProgressBar: () => cy.get('.audio-playback-slider-wrapper'),//same for minimal
57
+ previewPlaybackSlider: () => cy.get('input[aria-label="Slider bar"]'),//same for minimal
58
+ previewPlaybackWaveform: () => cy.get('.audio-wave-form'),//same for minimal
59
+ previewMaxRecordTime: () => cy.get('.standard-record-timer'),
60
+ previewVolumeControlButton: () => cy.get('.audio-player-icon'),//same for minimal
61
+ previewMicIcon: () => cy.get('.audio-response-icon'),
62
+ previewVolumeMeter: () => cy.get('.volume-meter'),
63
+ previewRecordProgressBar: () => cy.get('.audio-progress-bar-wrapper'),
64
+ previewVolumeControlSlider: () => cy.get('[class*="VolumeControlstyle__StyledSlider"]'),
65
+ previewWaveformTotalWidth: () => cy.get('.audio-wave-form wave wave canvas'),
66
+ previewWaveformCurrentPositionWidth: () => cy.get('.audio-wave-form wave wave'),
67
+ previewMicGlowAnimation: () => cy.get('.standard-audio-recorder-inprogress'),
68
+ previewMutedVolumeControlIcon: () => cy.get('.audio-mute-icon-wr'),
69
+ previewUnmutedVolumeControlIcon: () => cy.get('.audio-volume-icon-wr'),
70
+ previewPlayPlaybackButton: () => cy.get('.standard-recorder-play-pause-btn[aria-label="Play"]'),//same for minimal
71
+ previewPausePlaybackButton: () => cy.get('.standard-recorder-play-pause-btn[aria-label="Pause"]'),//same for minimal
72
+ //standard style
73
+ standardPreviewStartRecordingButton: () => cy.get('.standardRecorderStart-btn'),
74
+ standardPreviewStopRecordingButton: () => cy.get('.standardRecorderStop-btn'),
75
+ standardPreviewPauseRecordingButton: () => cy.get('.standardRecorderPause-btn'),
76
+ standardPreviewPlayerHelpText: () => cy.get('.standard-recorder-player-text-wrapper'),
77
+ standardPreviewRecorderHelpText: () => cy.get('.standard-click-record-to-begin'),
78
+ standardPreviewRecordTime: () => cy.get('.standard-record-timer-wrapper'),
79
+ standardPreviewResumeRecordingButton: () => cy.get('.standardRecorderResume-btn'),
80
+ standardPreviewRetakeButton: () => cy.get('.standard-recorder-retake-btn'),
81
+ standardPreviewDisabledPlayButton: () => cy.get('.standard-recorder-play-btn'),
82
+ standardPreviewRecordingCompletedProgressBar: () => cy.get('.standard-playback-slider-wrapper'),
83
+ standardPreviewHelpTextOutsideContainer: () => cy.get('.standard-preview-help-text'),
84
+ standardPreviewRecorderWrapper: () => cy.get('.standard-recorder-wrapper'),
85
+ standardPreviewPlaybackWrapper: () => cy.get('.standard-audio-playback-wrapper'),
86
+ //minimal style
87
+ minimalPreviewRecordButton: () => cy.get('.record-button[type="button"]'),
88
+ minimalPreviewRetakeButton: () => cy.get('.retake-button[type="button"]'),
89
+ minimalPreviewStopRecordingButton: () => cy.get('.stop-button[type="button"]'),
90
+ minimalPreviewPlaybackButton: () => cy.get('.playback-button[type="button"]'),
91
+ minimalPreviewPauseRecordingButton: () => cy.get('.minimal-recording-pause-btn'),
92
+ minimalPreviewStopPlaybackButton: () => cy.get('.playback-stop-button[type="button"]'),
93
+ minimalPreviewRecorderFlyoutHelpText: () => cy.get('.minimal-recording-text'),
94
+ minimalPreviewRecorderHelpText: () => cy.get('.minimal-record-helper-text-wrapper'),
95
+ minimalPreviewRecordingOverlay: () => cy.get('.recorder-flyout-wrapper'),
96
+ minimalPreviewOverlayArrow: () => cy.get('.flyout-arrow'),
97
+ minimalPreviewPlaybackOverlay: () => cy.get('.minimal-audio-playback-wrapper'),
98
+ minimalPreviewResumeRecordingButton: () => cy.get('.minimal-recording-resume-btn'),
99
+ minimalPreviewRecordingTimer: () => cy.get('.minimal-recording-timer'),
100
+ minimalPreviewPlaybackTimer: () => cy.get('.minimal-playback-timer'),
101
+ minimalPreviewPlaybackFlyoutHelpText: () => cy.get('.minimal-playback-text'),
102
+ minimalPreviewRecorderWrapper: () => cy.get('.minimal-recorder-wrapper'),
103
+ //Retake dialogue box
104
+ confirmRetakeButton: () => cy.get('.action-btn-wrapper button').eq(1),
105
+ cancelRetakeButton: () => cy.get('.action-btn-wrapper button').eq(0),
106
+ retakePopupContent: () => cy.get('.retake-popup-content')
107
+ }
108
+
109
+ const steps = {
110
+ ...createQuestionBasePage.steps,
111
+ ...questionInstructionsComponent.steps,
112
+ ...additionalSettingsPanel.steps,
113
+ ...scoringSectionBase.steps,
114
+ ...questionInstructionsComponent.steps,
115
+ ...maximumRecorderLengthComponent.steps,
116
+ switchToMinimalRecorderStyle: () => {
117
+ audioResponsePage.audioRecorderStyleDropdown()
118
+ .click();
119
+ audioResponsePage.audioRecorderStyleListOptions(1)
120
+ .click();
121
+ },
122
+
123
+ expandCustomizeRecorderAndPlaybackControlsAccordion: () => {
124
+ audioResponsePage.customizeRecorderAndPlaybackControlsAccordion()
125
+ .click()
126
+ .should('have.attr', 'aria-expanded', 'true');
127
+ },
128
+
129
+ collapseCustomizeRecorderAndPlaybackControlsAccordion: () => {
130
+ audioResponsePage.customizeRecorderAndPlaybackControlsAccordion()
131
+ .click()
132
+ .should('have.attr', 'aria-expanded', 'false');
133
+ },
134
+
135
+ setStopRecordingIfSilenceIsDetectedAfter: (length) => {
136
+ audioResponsePage.stopRecordingIfSilenceIsDetectedInputField()
137
+ .clear()
138
+ .type(length)
139
+ .blur();
140
+ },
141
+
142
+ startRecordingStandardPreview: () => {
143
+ audioResponsePage.standardPreviewStartRecordingButton()
144
+ .click();
145
+ },
146
+
147
+ waitForRecordingToStartStandardPreview: () => {
148
+ audioResponsePage.previewMaxRecordTime()
149
+ .should('contain', '00:01 /')
150
+ },
151
+
152
+ pauseRecordingStandardPreview: () => {
153
+ audioResponsePage.standardPreviewPauseRecordingButton()
154
+ .click();
155
+ },
156
+
157
+ /**
158
+ * Verifies the recorded audio preview time against the expected time.
159
+ * @param {string} time - The expected preview time to verify.
160
+ * @throws {Error} Throws an error if the preview time does not match the expected time.
161
+ */
162
+ verifyRecordingTimeStandardPreview: (time) => {
163
+ audioResponsePage.previewMaxRecordTime()
164
+ .should('have.text', time)
165
+ },
166
+
167
+ resumeRecordingStandardPreview: () => {
168
+ audioResponsePage.standardPreviewResumeRecordingButton()
169
+ .click();
170
+ },
171
+
172
+ /**
173
+ * Verifies the recording status against the expected status for the standard preview recorder.
174
+ * @param {string} recordingStatus - The expected recording status to verify.
175
+ * @throws {Error} Throws an error if the recording status does not match the expected status.
176
+ */
177
+ verifyRecordingStatusStandardPreview: (recordingStatus) => {
178
+ utilities.verifyInnerText(audioResponsePage.standardPreviewRecorderHelpText(), recordingStatus);
179
+ utilities.verifyElementVisibilityState(audioResponsePage.standardPreviewRecorderHelpText(), 'visible');
180
+ },
181
+
182
+ verifyVolumeMeterInDb: (valueInDb) => {
183
+ audioResponsePage.previewVolumeMeter()
184
+ .should('have.text', valueInDb);
185
+ },
186
+
187
+ waitForRecordingToStartMinimalPreview: () => {
188
+ audioResponsePage.minimalPreviewRecordingTimer()
189
+ .should('contain', '00:01 /')
190
+ },
191
+
192
+ stopRecordingStandardPreview: () => {
193
+ audioResponsePage.standardPreviewStopRecordingButton()
194
+ .click();
195
+ },
196
+
197
+ /**
198
+ * Records and saves audio during the standard preview recording process.
199
+ * @param {number} time - The duration (in milliseconds) to record audio before saving.
200
+ * @throws {Error} Throws an error if there is an issue during the recording and saving process.
201
+ */
202
+ recordAndSaveAudioStandardPreview: (time) => {
203
+ audioResponsePage.steps.startRecordingStandardPreview();
204
+ audioResponsePage.steps.waitForRecordingToStartStandardPreview();
205
+ audioResponsePage.steps.addWaitToRecordAudio(time - 1000);
206
+ audioResponsePage.steps.stopRecordingStandardPreview();
207
+ },
208
+
209
+ startRecordingMinimalPreview: () => {
210
+ audioResponsePage.minimalPreviewRecordButton()
211
+ .click();
212
+ },
213
+
214
+ stopRecordingMinimalPreview: () => {
215
+ audioResponsePage.minimalPreviewStopRecordingButton()
216
+ .click();
217
+ },
218
+
219
+ waitForPlaybackToBeginStandardPreview: () => {
220
+ audioResponsePage.standardPreviewRecordTime()
221
+ .find('.standard-recorder-time-wrapper')
222
+ .should('have.text', '00:01')
223
+ },
224
+
225
+ waitForPlaybackToBeginMinimalPreview: () => {
226
+ audioResponsePage.minimalPreviewPlaybackTimer()
227
+ .find('[class*="MinimalAudioPlayerstyles__TimeWrapper"]')
228
+ .should('have.text', '00:01')
229
+ },
230
+
231
+ /**
232
+ * Adds a wait period to pause test execution, typically used to wait for audio playback to complete.
233
+ * @param {number} time - The duration (in milliseconds) to wait.
234
+ * @returns {void}
235
+ */
236
+ addWaitForPlayback: (time) => {
237
+ cy.wait(time)
238
+ },
239
+
240
+ /**
241
+ * Adds a wait period to pause test execution, typically used to simulate recording audio for a specified duration.
242
+ * @param {number} time - The duration (in milliseconds) to wait to simulate audio recording.
243
+ * @returns {void}
244
+ */
245
+ addWaitToRecordAudio: (time) => {
246
+ cy.wait(time)
247
+ }
248
+ }
249
+
250
+ const tests = {
251
+ ...createQuestionBasePage.tests,
252
+ ...questionInstructionsComponent.tests,
253
+ ...additionalSettingsPanel.tests,
254
+ ...scoringSectionBase.tests,
255
+ ...questionInstructionsComponent.tests,
256
+ ...previewScoringAndShowCorrectAnswerComponent.tests,
257
+ ...maximumRecorderLengthComponent.tests
258
+ }
259
+
260
+ export const audioResponsePage = {
261
+ ...selectors,
262
+ tests,
263
+ steps
264
+ }
@@ -0,0 +1,174 @@
1
+ import { commonComponents } from "./commonComponents";
2
+ const css = Cypress.env('css');
3
+
4
+ const selectors = {
5
+ //Comment: added .first() because in fill in the gap questions, multiple accordions are created inside additional settings panel according to number of responses
6
+ additionalSettingsPanel: () => cy.get('.additional-settings-container .MuiAccordionSummary-root').eq(0),
7
+ additionalSettingsRegion: () => cy.get('.additional-settings-container [role="region"]'),
8
+ additionalSettingsDetailsLabel: () => cy.get('.additional-settings-heading-label').last(),
9
+ additionalSettingsTeacherGuidelinesLabel: () => cy.get('.additional-settings-detail-wrapper .additional-settings-label').eq(0),
10
+ additionalSettingsSampleAnswerLabel: () => cy.get('.additional-settings-detail-wrapper .additional-settings-label').eq(1),
11
+ additionalSettingsAcknowledgementsLabel: () => cy.get('.additional-settings-detail-wrapper .additional-settings-label').eq(2),
12
+ additionalSettingsTeacherGuidelinesInputField: () => cy.get('[title="Teacher Scoring Guidelines"]'),
13
+ additionalSettingsSampleAnswerInputField: () => cy.get('[title="Sample Answer"]'),
14
+ additionalSettingsAcknowledgementsInputField: () => cy.get('[title="Acknowledgements"]'),
15
+ //Font-size dropdown
16
+ fontSizeLabel: () => cy.get('#Font-Size-dropdown-label'),
17
+ fontSizeDropdown: () => cy.get('#Font-Size-select'),
18
+ fontSizeListOptions: (optionIndex) => cy.get('[aria-labelledby="Font-Size-dropdown-label Font-Size-placeholder"] li[role="option"]').eq(optionIndex)
19
+ }
20
+
21
+ const steps = {
22
+ expandAdditonalSettings: () => {
23
+ additionalSettingsPanel.additionalSettingsPanel()
24
+ .click()
25
+ .should('have.attr', 'aria-expanded', 'true');
26
+ },
27
+
28
+ //V3 - Need to be updated in all files
29
+ selectFontSizeOptionFromFontSizeDropdown: (dropdownOptionIndex) => {
30
+ additionalSettingsPanel.fontSizeDropdown()
31
+ .click();
32
+ additionalSettingsPanel.fontSizeListOptions(dropdownOptionIndex)
33
+ .click();
34
+ }
35
+ }
36
+
37
+ const tests = {
38
+ verifyDetailsSection: () => {
39
+ it('CSS of \'Details\' section', { tags: 'css' }, () => {
40
+ additionalSettingsPanel.additionalSettingsDetailsLabel()
41
+ .verifyCSS(css.color.sectionHeading, css.fontSize.default, css.fontWeight.semibold);
42
+ additionalSettingsPanel.additionalSettingsTeacherGuidelinesLabel()
43
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
44
+ additionalSettingsPanel.additionalSettingsSampleAnswerLabel()
45
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
46
+ additionalSettingsPanel.additionalSettingsAcknowledgementsLabel()
47
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
48
+ });
49
+
50
+ //Note: a11y is covered for the entire additional settings section
51
+
52
+ it('\'Details\' label should be displayed', () => {
53
+ additionalSettingsPanel.additionalSettingsDetailsLabel()
54
+ .should('have.text', 'Details');
55
+ });
56
+
57
+ it('\'Teacher scoring guidelines\' label and input field should be displayed and user should be able to enter \'Teacher scoring guidelines\'', () => {
58
+ additionalSettingsPanel.additionalSettingsTeacherGuidelinesLabel()
59
+ .verifyInnerText('Teacher scoring guidelines');
60
+ additionalSettingsPanel.additionalSettingsTeacherGuidelinesInputField()
61
+ .type('Teacher scoring guidelines')
62
+ .should('have.text', 'Teacher scoring guidelines');
63
+ });
64
+
65
+ it('\'Sample Answer\' label and input field should be displayed and user should be able to enter \'Sample Answer\'', () => {
66
+ additionalSettingsPanel.additionalSettingsSampleAnswerLabel()
67
+ .verifyInnerText('Sample answer');
68
+ additionalSettingsPanel.additionalSettingsSampleAnswerInputField()
69
+ .type('Sample Answer')
70
+ .should('have.text', 'Sample Answer');
71
+ });
72
+
73
+ it('\'Acknowledgements\' label and input field should be displayed and user should be able to enter \'Acknowledgements\'', () => {
74
+ additionalSettingsPanel.additionalSettingsAcknowledgementsLabel()
75
+ .should('have.text', 'Acknowledgements');
76
+ additionalSettingsPanel.additionalSettingsAcknowledgementsInputField()
77
+ .type('Acknowledgements')
78
+ .should('have.text', 'Acknowledgements');
79
+ });
80
+
81
+ it('CSS of added text in input field of the Details Section', { tags: 'css' }, () => {
82
+ additionalSettingsPanel.additionalSettingsTeacherGuidelinesInputField()
83
+ .verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
84
+ additionalSettingsPanel.additionalSettingsSampleAnswerInputField()
85
+ .verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
86
+ additionalSettingsPanel.additionalSettingsAcknowledgementsInputField()
87
+ .verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
88
+ });
89
+ },
90
+
91
+ verifyAdditonalSettingsAccordionProperties: () => {
92
+ it('CSS of \'Additonal Settings\' accordion', { tags: 'css' }, () => {
93
+ additionalSettingsPanel.additionalSettingsPanel()
94
+ .find('.additional-settings')
95
+ .verifyCSS(css.color.accordionLabel, css.fontSize.default, css.fontWeight.bold);
96
+ additionalSettingsPanel.additionalSettingsPanel()
97
+ .find('svg')
98
+ .should('have.css', 'fill', css.color.activeButtons);
99
+ });
100
+
101
+ it('Accessibility of \'Additional Settings\' accordion', { tags: 'a11y' }, () => {
102
+ cy.checkAccessibility(additionalSettingsPanel.additionalSettingsPanel().parents('.additional-settings-container'));
103
+ });
104
+
105
+ it('By default \'Additional Settings\' accordion should be collapsed and by clicking on the \'Additional Settings\' accordion, user should be able to expand the accordion', () => {
106
+ additionalSettingsPanel.additionalSettingsPanel()
107
+ .should('have.attr', 'aria-expanded', 'false');
108
+ additionalSettingsPanel.steps.expandAdditonalSettings();
109
+ });
110
+ },
111
+
112
+ verifyFontSizeSectionContents: () => {
113
+ const fontsizes = ['Default', 'Small', 'Normal', 'Large', 'Extra large', 'Huge'];
114
+
115
+ it('CSS of \'Font Size\' dropdown', { tags: 'css' }, () => {
116
+ additionalSettingsPanel.fontSizeLabel()
117
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
118
+ additionalSettingsPanel.fontSizeDropdown()
119
+ .verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular);
120
+ });
121
+
122
+ // Note: a11y is covered for the entire additional settings section
123
+
124
+ it('\'Font Size\' label and dropdown should be displayed and in \'Font Size\' dropdown \'Default\' option should be selected by default', () => {
125
+ additionalSettingsPanel.fontSizeLabel()
126
+ .verifyInnerText('Font size');
127
+ additionalSettingsPanel.fontSizeDropdown()
128
+ .verifyInnerText('Default');
129
+ });
130
+
131
+ it('Clicking on Font Size dropdown should open a list of 6 options - Default, Small, Normal, Large, Extra large, Huge', () => {
132
+ additionalSettingsPanel.fontSizeDropdown()
133
+ .click();
134
+ additionalSettingsPanel.fontSizeListOptions(0)
135
+ .should('be.visible');
136
+ fontsizes.forEach((index, count) => {
137
+ additionalSettingsPanel.fontSizeListOptions(count)
138
+ .verifyInnerText(index);
139
+ });
140
+ cy.get('body')
141
+ .click();
142
+ });
143
+
144
+ it('CSS of Font size dropdown in Active state', { tags: 'css' }, () => {
145
+ cy.log('Pre step: Clicking on Font size dropdown')
146
+ additionalSettingsPanel.fontSizeDropdown()
147
+ .click();
148
+ additionalSettingsPanel.fontSizeListOptions(0)
149
+ .verifyCSS(css.color.liText, css.fontSize.default, css.fontWeight.regular)
150
+ .should('have.css', 'background-color', css.color.liTextSelectedBg);
151
+ additionalSettingsPanel.fontSizeListOptions(1)
152
+ .should('have.css', 'background-color', css.color.transparent);
153
+ cy.log('Post step: Closing the Font size dropdown')
154
+ cy.get('body')
155
+ .click();
156
+ });
157
+
158
+ it('Accessibility of Font size dropdown in active state', { tags: 'a11y' }, () => {
159
+ cy.log('Pre step: Clicking on Font size dropdown')
160
+ additionalSettingsPanel.fontSizeDropdown()
161
+ .click();
162
+ cy.checkAccessibility(commonComponents.dropdownList());
163
+ cy.log('Post step: Closing the Font size dropdown')
164
+ cy.get('body')
165
+ .click();
166
+ });
167
+ }
168
+ }
169
+
170
+ export const additionalSettingsPanel = {
171
+ ...selectors,
172
+ steps,
173
+ tests
174
+ }
@@ -0,0 +1,109 @@
1
+ import utilities from "../../support/helpers/utilities";
2
+ import { commonComponents } from "./commonComponents";
3
+ const css = Cypress.env('css');
4
+
5
+ const selectors = {
6
+ answerNumerationLabel: () => cy.get('#Answer-numeration-only-while-grading--dropdown-label'),
7
+ answerNumerationDropdown: () => cy.get('#Answer-numeration-only-while-grading--select'),
8
+ answerNumerationDropdownListOptions: (ariaLabel = null) => {
9
+ if (ariaLabel) {
10
+ return cy.get(`[aria-labelledby*="Answer-numeration-only-while-grading--dropdown-label"] li[role="option"][aria-label*="${ariaLabel}"]`)
11
+ } else {
12
+ return cy.get('[aria-labelledby*="Answer-numeration-only-while-grading--dropdown-label"] li[role="option"]')
13
+ }
14
+ },
15
+ }
16
+
17
+ const steps = {
18
+
19
+ expandAnswerNumerationDropdown: () => {
20
+ answerNumerationComponent.answerNumerationDropdown()
21
+ .click();
22
+ answerNumerationComponent.answerNumerationDropdownListOptions()
23
+ .eq(0)
24
+ .should('be.visible');
25
+ },
26
+
27
+ /**
28
+ * @param {string} dropdownOption string of the dropdown option to be selected
29
+ */
30
+ selectAnswerNumerationDropdownOption: (dropdownOption) => {
31
+ steps.expandAnswerNumerationDropdown()
32
+ answerNumerationComponent.answerNumerationDropdownListOptions()
33
+ .contains(dropdownOption)
34
+ .click();
35
+ utilities.verifyInnerText(answerNumerationComponent.answerNumerationDropdown(), `${dropdownOption}`);
36
+ },
37
+
38
+ /**
39
+ * @param {*} dropdownOptionsArray array of answer numeration dropdown options
40
+ * @description This function is used to verify the answer numeration dropdown options
41
+ */
42
+ verifyAnswerNumerationDropdownOptions: (dropdownOptionsArray) => {
43
+ answerNumerationComponent.answerNumerationDropdown()
44
+ .each(($el, index) => {
45
+ cy.wrap($el)
46
+ .should('have.text', dropdownOptionsArray[index])
47
+ });
48
+ }
49
+ }
50
+
51
+ const tests = {
52
+ verifyAnswerNumerationContents: () => {
53
+ const answerNumerationDropdownOptions = ['Numerical', 'Uppercase alphabet', 'Lowercase alphabet'];
54
+ it(`\'Answer numeration (only while grading)\' label and dropdown should be displayed and by default, ${answerNumerationDropdownOptions[0]} option should be selected in the dropdown`, () => {
55
+ utilities.verifyInnerText(answerNumerationComponent.answerNumerationLabel(), 'Answer numeration (only while grading)');
56
+ utilities.verifyElementVisibilityState(answerNumerationComponent.answerNumerationLabel(), 'visible');
57
+ utilities.verifyInnerText(answerNumerationComponent.answerNumerationDropdown(), `${answerNumerationDropdownOptions[0]}`);
58
+ });
59
+
60
+ it('CSS of Answer Numeration section', { tags: 'css' }, () => {
61
+ answerNumerationComponent.answerNumerationLabel()
62
+ utilities.verifyCSS(answerNumerationComponent.answerNumerationLabel(), {
63
+ 'color': css.color.labels,
64
+ 'font-size': css.fontSize.normal,
65
+ 'font-weight': css.fontWeight.semibold
66
+ });
67
+ utilities.verifyCSS(answerNumerationComponent.answerNumerationDropdown(), {
68
+ 'color': css.color.liText,
69
+ 'font-size': css.fontSize.default,
70
+ 'font-weight': css.fontWeight.regular
71
+ });
72
+ });
73
+
74
+ it(`When user clicks on the Answer Numeration dropdown a list of options - ${answerNumerationDropdownOptions} should be displayed`, () => {
75
+ answerNumerationComponent.steps.expandAnswerNumerationDropdown();
76
+ answerNumerationComponent.steps.verifyAnswerNumerationDropdownOptions(answerNumerationDropdownOptions);
77
+ });
78
+
79
+ it('CSS of Answer Numeration dropdown in active state', { tags: 'css' }, () => {
80
+ utilities.verifyCSS(answerNumerationComponent.answerNumerationDropdownListOptions().eq(0), {
81
+ 'color': css.color.liText,
82
+ 'font-size': css.fontSize.default,
83
+ 'font-weight': css.fontWeight.regular,
84
+ 'background-color': css.color.liTextSelectedBg
85
+ });
86
+ utilities.verifyCSS(answerNumerationComponent.answerNumerationDropdownListOptions().eq(1), {
87
+ 'color': css.color.liText,
88
+ 'font-size': css.fontSize.default,
89
+ 'font-weight': css.fontWeight.regular,
90
+ 'background-color': css.color.transparent
91
+ });
92
+ });
93
+
94
+ it('Accessbility of Answer Numeration dropdown in active state', { tags: 'a11y' }, () => {
95
+ it('Accessbility of Option style dropdown in active state', { tags: 'a11y' }, () => {
96
+ cy.checkAccessibility(commonComponents.dropdownList());
97
+ });
98
+ cy.log('Closing the answer numeration dropdown')
99
+ cy.get('body')
100
+ .click();
101
+ utilities.verifyElementVisibilityState(answerNumerationComponent.answerNumerationDropdownListOptions(), 'notExist');
102
+ });
103
+ }
104
+ }
105
+ export const answerNumerationComponent = {
106
+ ...selectors,
107
+ steps,
108
+ tests
109
+ }