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,628 @@
1
+ import constants from "../fixtures/constants";
2
+ import utilities from "../support/helpers/utilities";
3
+ import { dialogBoxBase } from "./dialogBoxBase";
4
+ import { selectQuestionResourceToolPage } from "./selectQuestionResourceToolPage";
5
+ import { createQuestionBasePage, commonComponents, ckEditorToolbar, equationEditorFlyout, playbackControlsBaseComponent } from "./components"
6
+
7
+ const selectors = {
8
+ ...commonComponents,
9
+ ...ckEditorToolbar,
10
+ ...playbackControlsBaseComponent,
11
+ addUrlLabel: () => cy.get('[class*="RadioGroupMUI5styles__RadioOptionContainer"] .ngie-radio-label').eq(0),
12
+ addUrlRadioButton: () => cy.get('.ngie-radio-btn input').eq(0),
13
+ addAudioFileLabel: () => cy.get('[class*="RadioGroupMUI5styles__RadioOptionContainer"] .ngie-radio-label').eq(1),
14
+ addAudioFileRadioButton: () => cy.get('.ngie-radio-btn input').eq(1),
15
+ sourceUrlLabel: () => cy.get('.inline-text-property-label').eq(0),
16
+ sourceUrlInputField: () => cy.get('input[aria-label="Source URL"]'),
17
+ noFileChosenLabel: () => cy.get('[aria-label="No file chosen"]'),
18
+ uploadedFileNameLabel: () => cy.get('.selected-file'),
19
+ uploadLabel: () => cy.get('[class*="AudioPlayerstyles__AudioLabel"]').eq(0),
20
+ fileNameLabel: () => cy.get('[class*="AudioPlayerstyles__AudioLabel"]').eq(1),
21
+ chooseFileButton: () => cy.get('.choose-file-button'),
22
+ fileUploadProgressBar: () => cy.get('[class*="AudioPlayerstyles__ProgressBar-"]'),
23
+ inputTypeFile: () => cy.get('input[type="file"]'),
24
+ playerTypeLabel: () => cy.get('.player-type-dropdown-label'),
25
+ playerTypeDropdown: () => cy.get('#Player-type-select'),
26
+ playbackLimitLabel: () => cy.get('.playback-limit-wrapper [class*="Label"]'),
27
+ playbackLimitInputField: () => cy.get('.playback-limit-wrapper input'),
28
+ titleLabel: () => cy.get('.inline-text-property-label').last(),
29
+ titleInputField: () => cy.get('input[aria-label="Title"]'),
30
+ descriptionLabel: () => cy.get('.additional-settings-label').eq(0),
31
+ descriptionInputField: () => cy.get('[role="textbox"][title="Description"]'),
32
+ transcriptLabel: () => cy.get('.additional-settings-label').eq(1),
33
+ transcriptInputField: () => cy.get('[role="textbox"][title="Transcript"]'),
34
+ customizeUIControlAccordion: () => cy.get('.ngie-accordion').eq(0),
35
+ advancedPlayerSettingsAccordion: () => cy.get('.ngie-accordion').eq(1),
36
+ customizeControlPlayButton: () => cy.get('[data-ngie-testid="play-toggle-button"]'),
37
+ customizeControlButtonLabel: () => cy.get('.audio-response-selection-panel-details').eq(0).find('.customized_button_label'),
38
+ customizeControlPauseButton: () => cy.get('[data-ngie-testid="pause-toggle-button"]'),
39
+ customizeControlSeekButton: () => cy.get('[data-ngie-testid="seek-toggle-button"]'),
40
+ advancedPlayerButtonLabel: () => cy.get('.audio-response-selection-panel-details').eq(1).find('.customized_button_label'),
41
+ advancedPlayerTimerButton: () => cy.get('[data-ngie-testid="timer-toggle-button"]'),
42
+ advancedPlayerProgressBarButton: () => cy.get('[data-ngie-testid="progress-bar-toggle-button"]'),
43
+ advancedPlayerVolumeControlButton: () => cy.get('[data-ngie-testid="volume-control-toggle-button"]'),
44
+ allowStudentsToDownloadAudioLabel: () => cy.get('[data-ngie-testid="allow-students-to-download-the-audio-checkbox"] .MuiFormControlLabel-label'),
45
+ allowStudentsToDownloadAudioCheckbox: () => cy.get('[data-ngie-testid="allow-students-to-download-the-audio-checkbox"] input'),
46
+ selectedButtonIcon: () => cy.get('.ngie-toggle-button-tick-icon'),
47
+ accordionChevronIcon: () => cy.get('[class*="expandIcon"]'),
48
+ accordionButtonLabel: () => cy.get('.customized_button_label'),
49
+ audioDownloadButton: () => cy.get('.audio-download-icon-wr'),
50
+ playbackLimitHelpText: () => cy.get('.playback-limit-remaining'),
51
+ playbackElapsedTime: () => cy.get('.audio-player-current-time'),
52
+ playbackTotalTime: () => cy.get('.audio-player-duration'),
53
+ audioFileSrc: () => cy.get('.audio-player-toolbar audio'),
54
+ titlePreviewTab: () => cy.get('.audio-resource-title'),
55
+ descriptionPreviewTab: () => cy.get('.audio-resource-preview-wrapper .question-text-wrapper'),
56
+ transcriptTitlePreviewTab: () => cy.get('.transcript-title'),
57
+ transcriptPrintButton: () => cy.get('button[aria-label="Print preview"]'),
58
+ transcriptModalCloseButton: () => cy.get('button[aria-label="Close"]'),
59
+ transcriptContentPreviewTab: () => cy.get('[class*="Transcriptstyles__TranscriptContent"]'),
60
+ transcriptButton: () => cy.get('button[aria-label="Transcript"]'),
61
+ transcriptModal: () => cy.get('[class*="Transcriptstyles__TranscriptWrapper"]'),
62
+ audioDownloadButton: () => cy.get('.audio-download-icon-wr'),
63
+ playbackLimitHelpText: () => cy.get('.playback-limit-remaining'),
64
+ playbackPlayer: () => cy.get('.audio-player-toolbar')
65
+ }
66
+
67
+ const steps = {
68
+ ...createQuestionBasePage.steps,
69
+ ...ckEditorToolbar.steps,
70
+ ...equationEditorFlyout.steps,
71
+ ...commonComponents.steps,
72
+ ...playbackControlsBaseComponent.steps,
73
+ verifyAddUrlCheckedState: () => {
74
+ audioPlayerPage.addUrlRadioButton()
75
+ .should('be.checked');
76
+ },
77
+
78
+ verifyAddUrlUncheckedState: () => {
79
+ audioPlayerPage.addUrlRadioButton()
80
+ .should('not.be.checked');
81
+ },
82
+
83
+ clickOnAddUrlRadioButton: () => {
84
+ audioPlayerPage.addUrlRadioButton()
85
+ .click();
86
+ },
87
+
88
+ verifyAddAudioFileCheckedState: () => {
89
+ audioPlayerPage.addAudioFileRadioButton()
90
+ .should('be.checked');
91
+ },
92
+
93
+ verifyAddAudioFileUncheckedState: () => {
94
+ audioPlayerPage.addAudioFileRadioButton()
95
+ .should('not.be.checked');
96
+ },
97
+
98
+ clickOnAddAudioFileRadioButton: () => {
99
+ audioPlayerPage.addAudioFileRadioButton()
100
+ .click();
101
+ },
102
+
103
+ focusInAndFocusOutOfSourceURLInputField: () => {
104
+ audioPlayerPage.sourceUrlInputField()
105
+ .click()
106
+ .blur();
107
+ },
108
+
109
+ /**
110
+ * Enters text into the source URL input field on the audio player page.
111
+ * @param {string} text - The text to be entered into the source URL input field.
112
+ * @returns {void}
113
+ */
114
+ enterTextInSourceURLInputField: (text) => {
115
+ audioPlayerPage.sourceUrlInputField()
116
+ .type(text, { delay: 0 })
117
+ .blur();
118
+ },
119
+
120
+ clearTextInSourceURLInputField: () => {
121
+ audioPlayerPage.sourceUrlInputField()
122
+ .clear();
123
+ },
124
+
125
+ /**
126
+ * Uploads a file to the audio player by attaching the file located at the specified filePath.
127
+ * @param {string} filePath - The file path to the file to be uploaded.
128
+ * @returns {void}
129
+ */
130
+ uploadFile: (filePath) => {
131
+ audioPlayerPage.inputTypeFile()
132
+ .attachFile(filePath);
133
+ utilities.verifyElementVisibilityState(audioPlayerPage.fileUploadProgressBar(), 'hidden');
134
+ },
135
+
136
+ verifyPlayerTypeDropdownDisabledState: () => {
137
+ audioPlayerPage.playerTypeDropdown()
138
+ .should('have.class', 'Mui-disabled');
139
+ },
140
+
141
+ /**
142
+ * Sets the playback limit value in the audio player's input field.
143
+ * @param {string|number} value - The value to set as the playback limit.
144
+ * @returns {void}
145
+ */
146
+ setPlaybackLimit: (value) => {
147
+ audioPlayerPage.playbackLimitInputField()
148
+ .clear()
149
+ .type(value)
150
+ },
151
+
152
+ /**
153
+ * Verifies that the playback limit input field in the audio player has the expected value.
154
+ * @param {string|number} value - The expected value to be verified.
155
+ * @returns {void}
156
+ */
157
+ verifyPlaybackLimitInputFieldValue: (value) => {
158
+ audioPlayerPage.playbackLimitInputField()
159
+ .should('have.attr', 'value', value);
160
+ },
161
+
162
+ focusInAndFocusOutOfPlaybackLimitInputField: () => {
163
+ audioPlayerPage.playbackLimitInputField()
164
+ .click()
165
+ .blur();
166
+ },
167
+
168
+ /**
169
+ * Enters text into the title input field on the audio player page.
170
+ * @param {string} text - The text to be entered into the title input field.
171
+ * @returns {void}
172
+ */
173
+ enterTextInTitleInputField: (text) => {
174
+ audioPlayerPage.titleInputField()
175
+ .type(text, { delay: 0 });
176
+ },
177
+
178
+ /**
179
+ * Verifies that the title input field in the audio player has the expected text value.
180
+ * @param {string} value - The expected text value to be verified.
181
+ * @returns {void}
182
+ */
183
+ verifyTextInTitleInputField: (value) => {
184
+ audioPlayerPage.titleInputField()
185
+ .should('have.attr', 'value', value)
186
+ },
187
+
188
+ focusInDescriptionInputField: () => {
189
+ audioPlayerPage.descriptionInputField()
190
+ .click();
191
+ },
192
+
193
+ enterTextInDescriptionInputField: (text) => {
194
+ audioPlayerPage.descriptionInputField()
195
+ .type(text)
196
+ .blur();
197
+ },
198
+
199
+ clearDescriptionInputField: () => {
200
+ audioPlayerPage.descriptionInputField()
201
+ .clear();
202
+ },
203
+
204
+ verifyImageAndAltTextInDescriptionInputField: () => {
205
+ audioPlayerPage.descriptionInputField()
206
+ .find('img')
207
+ .should('have.attr', 'src', constants.foxImageLink)
208
+ .and('have.attr', 'alt', constants.foxImageAltText);
209
+ },
210
+
211
+ verifyImageAndAltTextInDescriptionPreviewTab: () => {
212
+ audioPlayerPage.descriptionPreviewTab()
213
+ .find('img')
214
+ .should('have.attr', 'src', constants.foxImageLink)
215
+ .and('have.attr', 'alt', constants.foxImageAltText);
216
+ },
217
+
218
+ verifyEquationInDescriptionInputField: () => {
219
+ audioPlayerPage.descriptionInputField()
220
+ .find('[data-widget="ngie_equation"]')
221
+ .should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
222
+ .contains(constants.CKEditorInputFieldEnteredEquationText);
223
+ },
224
+
225
+ verifyEquationInDescriptionPreviewTab: () => {
226
+ audioPlayerPage.descriptionPreviewTab()
227
+ .find('[role="math"]')
228
+ .should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
229
+ .contains(constants.CKEditorInputFieldEnteredEquationText);
230
+ },
231
+
232
+ verifyLinkInDescriptionInputField: () => {
233
+ audioPlayerPage.descriptionInputField()
234
+ .find('a')
235
+ .should('have.text', 'lorem')
236
+ .and('have.attr', 'href', `${Cypress.config().baseUrl}`);
237
+ },
238
+
239
+ verifyLinkInDescriptionPreviewTab: () => {
240
+ audioPlayerPage.descriptionPreviewTab()
241
+ .find('a')
242
+ .should('have.text', 'lorem')
243
+ .and('have.attr', 'href', `${Cypress.config().baseUrl}`);
244
+ },
245
+
246
+ verifyBoldTextInDescriptionInputField: () => {
247
+ audioPlayerPage.descriptionInputField()
248
+ .find('strong')
249
+ .should('exist')
250
+ .should('have.text', '​​​​​​​This is a bold text in description input field');
251
+ },
252
+
253
+ verifyBoldTextInDescriptionPreviewTab: () => {
254
+ audioPlayerPage.descriptionPreviewTab()
255
+ .find('strong')
256
+ .should('exist')
257
+ .should('have.text', 'This is a bold text in description');
258
+ },
259
+
260
+ focusInTranscriptInputField: () => {
261
+ audioPlayerPage.transcriptInputField()
262
+ .click();
263
+ },
264
+
265
+ enterTextInTranscriptInputField: (text) => {
266
+ audioPlayerPage.transcriptInputField()
267
+ .type(text)
268
+ .blur();
269
+ },
270
+
271
+ clearTranscriptInputField: () => {
272
+ audioPlayerPage.transcriptInputField()
273
+ .clear();
274
+ },
275
+
276
+ verifyImageAndAltTextInTranscriptInputField: () => {
277
+ audioPlayerPage.transcriptInputField()
278
+ .find('img')
279
+ .should('have.attr', 'src', constants.foxImageLink)
280
+ .and('have.attr', 'alt', constants.foxImageAltText);
281
+ },
282
+
283
+ verifyImageAndAltTextInTranscriptPreviewTab: () => {
284
+ audioPlayerPage.transcriptContentPreviewTab()
285
+ .find('img')
286
+ .should('have.attr', 'src', constants.foxImageLink)
287
+ .and('have.attr', 'alt', constants.foxImageAltText);
288
+ },
289
+
290
+ verifyEquationInTranscriptInputField: () => {
291
+ audioPlayerPage.transcriptInputField()
292
+ .find('[data-widget="ngie_equation"]')
293
+ .should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
294
+ .contains(constants.CKEditorInputFieldEnteredEquationText);
295
+ },
296
+
297
+ verifyEquationInTranscriptPreviewTab: () => {
298
+ audioPlayerPage.transcriptContentPreviewTab()
299
+ .find('[role="math"]')
300
+ .should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
301
+ .contains(constants.CKEditorInputFieldEnteredEquationText);
302
+ },
303
+
304
+ verifyLinkInTranscriptInputField: () => {
305
+ audioPlayerPage.transcriptInputField()
306
+ .find('a')
307
+ .should('have.text', 'lorem')
308
+ .and('have.attr', 'href', `${Cypress.config().baseUrl}`);
309
+ },
310
+
311
+ verifyLinkInTranscriptPreviewTab: () => {
312
+ audioPlayerPage.transcriptContentPreviewTab()
313
+ .find('a')
314
+ .should('have.text', 'lorem')
315
+ .and('have.attr', 'href', `${Cypress.config().baseUrl}`);
316
+ },
317
+
318
+ verifyBoldTextInTranscriptInputField: () => {
319
+ audioPlayerPage.transcriptInputField()
320
+ .find('strong')
321
+ .should('exist')
322
+ .should('have.text', '​​​​​​​This is a bold text in transcript input field');
323
+ },
324
+
325
+ verifyBoldTextInTranscriptPreviewTab: () => {
326
+ audioPlayerPage.transcriptContentPreviewTab()
327
+ .find('strong')
328
+ .should('exist')
329
+ .should('have.text', 'This is a bold text in transcript');
330
+ },
331
+
332
+ verifyCustomizeUIControlAccordionChevronIcon: () => {
333
+ audioPlayerPage.customizeUIControlAccordion()
334
+ .within(() => {
335
+ audioPlayerPage.accordionChevronIcon()
336
+ .should('be.visible');
337
+ });
338
+ },
339
+
340
+ verifyAdvancedPlayerAccordionChevronIcon: () => {
341
+ audioPlayerPage.advancedPlayerSettingsAccordion()
342
+ .within(() => {
343
+ audioPlayerPage.accordionChevronIcon()
344
+ .should('be.visible');
345
+ });
346
+ },
347
+
348
+ verifyCustomizeUIControlAccordionCollapsedState: () => {
349
+ audioPlayerPage.customizeUIControlAccordion()
350
+ .should('have.attr', 'aria-expanded', 'false');
351
+ },
352
+
353
+ verifyCustomizeUIControlAccordionExpandedState: () => {
354
+ audioPlayerPage.customizeUIControlAccordion()
355
+ .should('have.attr', 'aria-expanded', 'true');
356
+ },
357
+
358
+ clickOnCustomizeUIControlAccordion: () => {
359
+ audioPlayerPage.customizeUIControlAccordion()
360
+ .click();
361
+ },
362
+
363
+ verifyAdvancedPlayerSettingsAccordionCollapsedState: () => {
364
+ audioPlayerPage.advancedPlayerSettingsAccordion()
365
+ .should('have.attr', 'aria-expanded', 'false');
366
+ },
367
+
368
+ verifyAdvancedPlayerSettingsAccordionExpandedState: () => {
369
+ audioPlayerPage.advancedPlayerSettingsAccordion()
370
+ .should('have.attr', 'aria-expanded', 'true');
371
+ },
372
+
373
+ clickOnAdvancedPlayerSettingsAccordion: () => {
374
+ audioPlayerPage.advancedPlayerSettingsAccordion()
375
+ .click();
376
+ },
377
+
378
+ verifyCustomizeControlPlayButtonSelectedState: () => {
379
+ audioPlayerPage.customizeControlPlayButton()
380
+ .should('have.class', 'ngie-toggle-button-selected')
381
+ .within(() => {
382
+ utilities.verifyElementVisibilityState(audioPlayerPage.selectedButtonIcon(), 'visible');
383
+ });
384
+ },
385
+
386
+ verifyCustomizeControlPauseButtonSelectedState: () => {
387
+ audioPlayerPage.customizeControlPauseButton()
388
+ .should('have.class', 'ngie-toggle-button-selected')
389
+ .within(() => {
390
+ utilities.verifyElementVisibilityState(audioPlayerPage.selectedButtonIcon(), 'visible');
391
+ });
392
+ },
393
+
394
+ verifyCustomizeControlSeekButtonSelectedState: () => {
395
+ audioPlayerPage.customizeControlSeekButton()
396
+ .should('have.class', 'ngie-toggle-button-selected')
397
+ .within(() => {
398
+ utilities.verifyElementVisibilityState(audioPlayerPage.selectedButtonIcon(), 'visible');
399
+ });
400
+ },
401
+
402
+ verifyCustomizeControlPlayButtonDeselectedState: () => {
403
+ audioPlayerPage.customizeControlPlayButton()
404
+ .should('have.class', 'ngie-toggle-button-not-selected')
405
+ .within(() => {
406
+ utilities.verifyElementVisibilityState(audioPlayerPage.selectedButtonIcon(), 'hidden');
407
+ });
408
+ },
409
+
410
+ verifyCustomizeControlPauseButtonDeselectedState: () => {
411
+ audioPlayerPage.customizeControlPauseButton()
412
+ .should('have.class', 'ngie-toggle-button-not-selected')
413
+ .within(() => {
414
+ utilities.verifyElementVisibilityState(audioPlayerPage.selectedButtonIcon(), 'hidden');
415
+ });
416
+ },
417
+
418
+ verifyCustomizeControlSeekButtonDeselectedState: () => {
419
+ audioPlayerPage.customizeControlSeekButton()
420
+ .should('have.class', 'ngie-toggle-button-not-selected')
421
+ .within(() => {
422
+ utilities.verifyElementVisibilityState(audioPlayerPage.selectedButtonIcon(), 'hidden');
423
+ });
424
+ },
425
+
426
+ clickOnCustomizeControlPlayButton: () => {
427
+ audioPlayerPage.customizeControlPlayButton()
428
+ .click();
429
+ },
430
+
431
+ clickOnCustomizeControlPauseButton: () => {
432
+ audioPlayerPage.customizeControlPauseButton()
433
+ .click();
434
+ },
435
+
436
+ clickOnCustomizeControlSeekButton: () => {
437
+ audioPlayerPage.customizeControlSeekButton()
438
+ .click();
439
+ },
440
+
441
+ verifyAdvancedPlayerTimerButtonSelectedState: () => {
442
+ audioPlayerPage.advancedPlayerTimerButton()
443
+ .should('have.class', 'ngie-toggle-button-selected')
444
+ .within(() => {
445
+ utilities.verifyElementVisibilityState(audioPlayerPage.selectedButtonIcon(), 'visible');
446
+ });
447
+ },
448
+
449
+ verifyAdvancedPlayerProgressBarButtonSelectedState: () => {
450
+ audioPlayerPage.advancedPlayerProgressBarButton()
451
+ .should('have.class', 'ngie-toggle-button-selected')
452
+ .within(() => {
453
+ utilities.verifyElementVisibilityState(audioPlayerPage.selectedButtonIcon(), 'visible');
454
+ });
455
+ },
456
+
457
+ verifyAdvancedPlayerVolumeControlButtonSelectedState: () => {
458
+ audioPlayerPage.advancedPlayerVolumeControlButton()
459
+ .should('have.class', 'ngie-toggle-button-selected')
460
+ .within(() => {
461
+ utilities.verifyElementVisibilityState(audioPlayerPage.selectedButtonIcon(), 'visible');
462
+ });
463
+ },
464
+
465
+ verifyAdvancedPlayerTimerButtonDeselectedState: () => {
466
+ audioPlayerPage.advancedPlayerTimerButton()
467
+ .should('have.class', 'ngie-toggle-button-not-selected')
468
+ .within(() => {
469
+ utilities.verifyElementVisibilityState(audioPlayerPage.selectedButtonIcon(), 'hidden');
470
+ });
471
+ },
472
+
473
+ verifyAdvancedPlayerProgressBarButtonDeselectedState: () => {
474
+ audioPlayerPage.advancedPlayerProgressBarButton()
475
+ .should('have.class', 'ngie-toggle-button-not-selected')
476
+ .within(() => {
477
+ utilities.verifyElementVisibilityState(audioPlayerPage.selectedButtonIcon(), 'hidden');
478
+ });
479
+ },
480
+
481
+ verifyAdvancedPlayerVolumeControlButtonDeselectedState: () => {
482
+ audioPlayerPage.advancedPlayerVolumeControlButton()
483
+ .should('have.class', 'ngie-toggle-button-not-selected')
484
+ .within(() => {
485
+ utilities.verifyElementVisibilityState(audioPlayerPage.selectedButtonIcon(), 'hidden');
486
+ });
487
+ },
488
+
489
+ clickOnAdvancedPlayerTimerButton: () => {
490
+ audioPlayerPage.advancedPlayerTimerButton()
491
+ .click();
492
+ },
493
+
494
+ clickOnAdvancedPlayerProgressBarButton: () => {
495
+ audioPlayerPage.advancedPlayerProgressBarButton()
496
+ .click();
497
+ },
498
+
499
+ clickOnAdvancedPlayerVolumeControlButton: () => {
500
+ audioPlayerPage.advancedPlayerVolumeControlButton()
501
+ .click();
502
+ },
503
+
504
+ verifyAllowStudentsToDownloadAudioCheckboxNotChecked: () => {
505
+ audioPlayerPage.allowStudentsToDownloadAudioCheckbox()
506
+ .should('not.be.checked');
507
+ },
508
+
509
+ verifyAllowStudentsToDownloadAudioCheckboxChecked: () => {
510
+ audioPlayerPage.allowStudentsToDownloadAudioCheckbox()
511
+ .should('be.checked');
512
+ },
513
+
514
+ checkUncheckAllowStudentsToDownloadAudioCheckbox: () => {
515
+ audioPlayerPage.allowStudentsToDownloadAudioCheckbox()
516
+ .click();
517
+ },
518
+
519
+ //Preview tab
520
+ waitForPlaybackToBegin: () => {
521
+ steps.waitForAudioFileSrcToLoad();
522
+ audioPlayerPage.playbackElapsedTime()
523
+ .should('have.text', '00:01');
524
+ },
525
+
526
+ /**
527
+ * Verifies the audio playback timer on the audio player.
528
+ * @param {string} time - The elapsed time and total time in the format "elapsed/total."
529
+ * @returns {void}
530
+ */
531
+ verifyAudioPlaybackTimer: (time) => {
532
+ const elapsedTime = time.split('/')[0];
533
+ const totalTime = time.split('/')[1];
534
+ audioPlayerPage.playbackElapsedTime()
535
+ .should('have.text', elapsedTime)
536
+ audioPlayerPage.playbackTotalTime()
537
+ .should('have.text', `/${totalTime}`)
538
+ },
539
+
540
+ /**
541
+ * Adds a wait to pause test execution for a specified amount of time.
542
+ * @param {number} time - The time, in milliseconds, to pause test execution.
543
+ * @returns {void}
544
+ */
545
+ addWaitToPlayAudio: (time) => {
546
+ cy.wait(time)
547
+ },
548
+
549
+ clickOnTranscriptButton: () => {
550
+ audioPlayerPage.transcriptButton()
551
+ .click();
552
+ },
553
+
554
+ closeTranscriptModal: () => {
555
+ audioPlayerPage.transcriptModalCloseButton()
556
+ .click();
557
+ },
558
+
559
+ focusAwayFromElement: () => {
560
+ cy.get('body')
561
+ .click({ position: 'topLeft' });
562
+ },
563
+
564
+ verifyWindowOpenMethodAfterClickingOnDownloadAudioButton: () => {
565
+ cy.window()
566
+ .then((win) => {
567
+ cy.stub(win, 'open')
568
+ .as('windowOpen')
569
+ });
570
+ audioPlayerPage.audioDownloadButton()
571
+ .click();
572
+ cy.get('@windowOpen')
573
+ .should('be.calledWith', '');
574
+ },
575
+
576
+ waitForAudioFileSrcToLoad: () => {
577
+ audioPlayerPage.audioFileSrc()
578
+ .should('have.attr', 'src')
579
+ .and('not.be.empty');
580
+ }
581
+ }
582
+
583
+ const tests = {
584
+ ...createQuestionBasePage.tests,
585
+ ...commonComponents.tests,
586
+ //Header section
587
+ verifyCancelButton: () => {
588
+ it('When user has made no edits and clicks on Cancel button, the user should be directed back to the \'Select a Question\' page', () => {
589
+ createQuestionBasePage.cancelButton()
590
+ .click();
591
+ utilities.verifyElementVisibilityState(selectQuestionResourceToolPage.selectAQuestionHeaderText(), 'visible');
592
+ utilities.verifyElementVisibilityState(selectQuestionResourceToolPage.questionTypeOptionTitle(), 'visible');
593
+ });
594
+
595
+ it('When user has made some edits/changes and clicks on Cancel button, a popup should be displayed', () => {
596
+ selectQuestionResourceToolPage.steps.selectResourceType('Audio Player');
597
+ audioPlayerPage.steps.setPlaybackLimit('5');
598
+ createQuestionBasePage.cancelButton()
599
+ .click();
600
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible')
601
+ });
602
+
603
+ dialogBoxBase.tests.verifyContentsOfLeavePagePopupWithCSSAnda11y();
604
+
605
+ it(`Clicking on \'No, I'd like to go back\' button should close the popup and user should remain on the edit interface of the question`, () => {
606
+ dialogBoxBase.buttonReject()
607
+ .click();
608
+ createQuestionBasePage.editTab()
609
+ .should('have.attr', 'aria-selected', 'true')
610
+ audioPlayerPage.steps.verifyPlaybackLimitInputFieldValue('5');
611
+ });
612
+
613
+ it(`Clicking on \'Yes, I want to leave this page\' button should discard all changes and direct the user to the \'Select a question\' page.`, () => {
614
+ createQuestionBasePage.cancelButton()
615
+ .click();
616
+ dialogBoxBase.buttonAccept()
617
+ .click();
618
+ utilities.verifyElementVisibilityState(selectQuestionResourceToolPage.selectAQuestionHeaderText(), 'visible');
619
+ utilities.verifyElementVisibilityState(selectQuestionResourceToolPage.questionTypeOptionTitle(), 'visible');
620
+ });
621
+ },
622
+ }
623
+
624
+ export const audioPlayerPage = {
625
+ ...selectors,
626
+ steps,
627
+ tests
628
+ }