itemengine-cypress-automation 1.0.21 → 1.0.23

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,151 @@
1
+ import { audioResponsePage } from '../../../pages/audioResponsePage';
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ const css = Cypress.env('css');
4
+
5
+ const fontsizes = ['Default', 'Small', 'Normal', 'Large', 'Extra large', 'Huge'];
6
+ const font = ['16px', '12px', '14px', '17px', '20px', '24px'];
7
+
8
+ describe('Create Item page - Audio response: Additional Settings', () => {
9
+ before(() => {
10
+ cy.loginAs('admin');
11
+ });
12
+
13
+ describe('\'Additional settings\' accordion', () => {
14
+ abortEarlySetup();
15
+ before(() => {
16
+ audioResponsePage.steps.navigateToCreateQuestion('audio response');
17
+ });
18
+
19
+ audioResponsePage.tests.verifyAdditonalSettingsAccordionProperties();
20
+
21
+ it('\'Player settings\' label should be displayed', () => {
22
+ audioResponsePage.playerSettingsLabel()
23
+ .verifyInnerText('Player settings')
24
+ .and('be.visible');
25
+ });
26
+
27
+ it('CSS of \'Player settings\' section', { tags: 'css' }, () => {
28
+ audioResponsePage.playerSettingsLabel()
29
+ .verifyCSS(css.color.sectionHeading, css.fontSize.default, css.fontWeight.semibold);
30
+ });
31
+
32
+ it('Accessibility of \'Player settings\' section', { tags: 'a11y' }, () => {
33
+ cy.checkAccessibility(audioResponsePage.playerSettingsLabel());
34
+ });
35
+ });
36
+
37
+ describe('Player settings for standard recorder: Font size dropdown', () => {
38
+ abortEarlySetup();
39
+ before(() => {
40
+ audioResponsePage.steps.navigateToCreateQuestion('audio response');
41
+ audioResponsePage.steps.addQuestionInstructions();
42
+ audioResponsePage.steps.expandAdditonalSettings();
43
+ });
44
+
45
+ audioResponsePage.tests.verifyFontSizeSectionContents();//bug posted https://redmine.zeuslearning.com/issues/526284
46
+
47
+ fontsizes.forEach((option, count) => {
48
+ it(`When the user selects '${option}' option from the Font Size dropdown, then font size for the question instructions in the student player should be changed to ${option} in the 'Preview' tab`, () => {
49
+ audioResponsePage.fontSizeDropdown()
50
+ .click();
51
+ audioResponsePage.fontSizeListOptions(count)
52
+ .click();
53
+ audioResponsePage.fontSizeDropdown()
54
+ .verifyInnerText(`${option}`);
55
+ cy.log('Switching to Preview tab.');
56
+ audioResponsePage.steps.switchToPreviewTab();
57
+ audioResponsePage.questionInstructionsText()
58
+ .should('have.css', 'font-size', font[count]);//TO DO: Query posted https://redmine.zeuslearning.com/issues/526031
59
+ cy.log('Post step: Switch to Edit tab')
60
+ audioResponsePage.steps.switchToEditTab();
61
+ });
62
+ });
63
+ });
64
+
65
+ describe('Player settings for minimal recorder: Font size dropdown', () => {
66
+ abortEarlySetup();
67
+ before(() => {
68
+ audioResponsePage.steps.navigateToCreateQuestion('audio response');
69
+ audioResponsePage.steps.addQuestionInstructions();
70
+ audioResponsePage.steps.switchToMinimalRecorderStyle();
71
+ audioResponsePage.steps.expandAdditonalSettings();
72
+ audioResponsePage.fontSizeDropdown()
73
+ .should('be.visible');
74
+ });
75
+
76
+ fontsizes.forEach((option, count) => {
77
+ it(`When the user selects '${option}' option from the Font Size dropdown, then font size for the question instructions in the student player should be changed to ${option} in the 'Preview' tab`, () => {
78
+ audioResponsePage.fontSizeDropdown()
79
+ .click();
80
+ audioResponsePage.fontSizeListOptions(count)
81
+ .click();
82
+ audioResponsePage.fontSizeDropdown()
83
+ .verifyInnerText(`${option}`);
84
+ cy.log('Switching to Preview tab.');
85
+ audioResponsePage.steps.switchToPreviewTab();
86
+ audioResponsePage.questionInstructionsText()
87
+ .should('have.css', 'font-size', font[count]);
88
+ cy.log('Post step: Switch to Edit tab')
89
+ audioResponsePage.steps.switchToEditTab();
90
+ });
91
+ });
92
+ });
93
+
94
+ describe('Details section: Allow teachers to download student response', () => {
95
+ abortEarlySetup();
96
+ before(() => {
97
+ audioResponsePage.steps.navigateToCreateQuestion('audio response');
98
+ audioResponsePage.steps.expandAdditonalSettings();
99
+ });
100
+
101
+ it('CSS of \'Allow teacher to download student response\' section', () => {
102
+ audioResponsePage.allowTeachersToDownloadStudentResponsesCheckboxLabel()
103
+ .verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.regular);
104
+ audioResponsePage.allowTeachersToDownloadStudentResponsesCheckbox()
105
+ .parent()
106
+ .find('svg g g')
107
+ .should('have.css', 'fill', css.color.activeButtons);
108
+ });
109
+
110
+ it('Accessibility of \'Allow students to capture photos\' section', { tags: 'a11y' }, () => {
111
+ cy.checkAccessibility(audioResponsePage.allowTeachersToDownloadStudentResponsesCheckboxLabel());
112
+ });
113
+
114
+ it('\'Allow teacher to download student response\' label and checkbox should be displayed in details section. By default \'Allow teacher to download student response\' checkbox should be checked', () => {
115
+ audioResponsePage.allowTeachersToDownloadStudentResponsesCheckboxLabel()
116
+ .verifyInnerText('Allow teachers to download student response');
117
+ audioResponsePage.allowTeachersToDownloadStudentResponsesCheckbox()
118
+ .should('be.checked')
119
+ .parent()
120
+ .should('be.visible');
121
+ });
122
+
123
+ it('User should be able to uncheck \'Allow teacher to download student response\' checkbox', () => {
124
+ audioResponsePage.allowTeachersToDownloadStudentResponsesCheckbox()
125
+ .click()
126
+ .should('not.be.checked')
127
+ .parent()
128
+ .should('be.visible');
129
+ });
130
+
131
+ it('User should be able to check the \'Allow teacher to download student response\' checkbox again', () => {
132
+ audioResponsePage.allowTeachersToDownloadStudentResponsesCheckbox()
133
+ .click()
134
+ .should('be.checked')
135
+ .parent()
136
+ .should('be.visible');
137
+ });
138
+ });
139
+
140
+ describe('Additional Settings: Details section', () => {
141
+ abortEarlySetup();
142
+ before(() => {
143
+ audioResponsePage.steps.navigateToCreateQuestion('audio response');
144
+ cy.log('Adding question instructions and expanding Additional Settings accordion.');
145
+ audioResponsePage.steps.addQuestionInstructions();
146
+ audioResponsePage.steps.expandAdditonalSettings();
147
+ });
148
+
149
+ audioResponsePage.tests.verifyDetailsSection();
150
+ });
151
+ });
@@ -0,0 +1,308 @@
1
+ import { audioResponsePage } from '../../../pages/audioResponsePage';
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ const css = Cypress.env('css');
4
+
5
+ describe('Create Item page - Audio response: Controls for recording response', () => {
6
+ before(() => {
7
+ cy.loginAs('admin');
8
+ });
9
+
10
+ describe('\'Customize recorder and playback controls (for student player)\' Section', () => {
11
+ abortEarlySetup();
12
+ before(() => {
13
+ cy.log('Navigating to Audio Response question type');
14
+ audioResponsePage.steps.navigateToCreateQuestion('audio response');
15
+ });
16
+
17
+ it('\'Customize recorder and playback controls (for student player)\' accordion should be displayed along with chevron icon and by default it should be in collapsed state', () => {
18
+ audioResponsePage.customizeRecorderAndPlaybackControlsAccordionLabel()
19
+ .verifyInnerText('Customize recorder and playback controls (for student player)')
20
+ .should('be.visible');
21
+ audioResponsePage.customizeRecorderAndPlaybackControlsAccordionChevronIcon()
22
+ .should('be.visible');
23
+ audioResponsePage.customizeRecorderAndPlaybackControlsAccordion()
24
+ .should('have.attr', 'aria-expanded', 'false')
25
+ .should('be.visible');
26
+ });
27
+
28
+ it('User should be able to expand and collapse \'Customize recorder and playback controls (for student player)\' accordion', () => {
29
+ cy.log('Expanding \'Customize recorder and playback controls (for student player)\' accordion');
30
+ audioResponsePage.steps.expandCustomizeRecorderAndPlaybackControlsAccordion();
31
+ cy.log('Collapsing \'Customize recorder and playback controls (for student player)\' accordion');
32
+ audioResponsePage.steps.collapseCustomizeRecorderAndPlaybackControlsAccordion();
33
+ });
34
+
35
+ it('\'Controls for recordings response\' and \'Controls for response playback\' label should be displayed', () => {
36
+ cy.log('Pre-step : Expanding \'Customize recorder and playback controls (for student player)\' accordion');
37
+ audioResponsePage.steps.expandCustomizeRecorderAndPlaybackControlsAccordion();
38
+ audioResponsePage.controlsForRecordingResponseLabel()
39
+ .verifyInnerText('Controls for recording response')
40
+ .should('be.visible');
41
+ audioResponsePage.controlsForResponsePlaybackLabel()
42
+ .verifyInnerText('Controls for response playback')
43
+ .should('be.visible');
44
+ });
45
+
46
+ it('CSS of \'Customize recorder and playback controls (for student player)\' section in collapsed state', { tags: 'css' }, () => {
47
+ audioResponsePage.customizeRecorderAndPlaybackControlsAccordionLabel()
48
+ .verifyCSS(css.color.accordionLabel, css.fontSize.default, css.fontWeight.bold);
49
+ audioResponsePage.customizeRecorderAndPlaybackControlsAccordionChevronIcon()
50
+ .find('path')
51
+ .should('have.css', 'fill', css.color.accordionLabel);
52
+ });
53
+
54
+ //Note: a11y is covered for Customize recorder and playback controls (for student player) section in HeaderSection file using verifya11yOfCreateItemWrapperContents
55
+ });
56
+
57
+ describe('Controls for recording response- Start recording', () => {
58
+ abortEarlySetup();
59
+ before(() => {
60
+ cy.log('Navigating to Audio Response question type');
61
+ audioResponsePage.steps.navigateToCreateQuestion('audio response');
62
+ cy.log('Expand \'Customize recorder and playback controls (for student player)\' accordion');
63
+ audioResponsePage.steps.expandCustomizeRecorderAndPlaybackControlsAccordion();
64
+ });
65
+
66
+ it('In standard mode, when the start recording option is selected the start recording icon button should be enabled in the preview tab', () => {
67
+ cy.log('Pre-step: Switching to Preview tab');
68
+ audioResponsePage.steps.switchToPreviewTab();
69
+ audioResponsePage.standardPreviewStartRecordingButton()
70
+ .should('be.enabled')
71
+ .and('be.visible');
72
+ });
73
+
74
+ it('In standard mode, when the start recording option is deselected the start recording icon button should be disabled in the preview tab', () => {
75
+ cy.log('Pre-step: Switching to Edit tab');
76
+ audioResponsePage.steps.switchToEditTab();
77
+ audioResponsePage.startRecordingOptionButton()
78
+ .click()
79
+ .should('have.class', 'ngie-toggle-button-not-selected')
80
+ cy.log('Switching to Preview tab');
81
+ audioResponsePage.steps.switchToPreviewTab();
82
+ audioResponsePage.standardPreviewStartRecordingButton()
83
+ .should('be.visible')
84
+ .and('be.disabled');
85
+ });
86
+
87
+ it('In minimal mode, when the start recording option is selected the record icon button should be enabled in the preview tab', () => {
88
+ cy.log('Pre-step: Switching to Edit tab and selecting minimal audio recorder style option from audio recorder style dropdown');
89
+ audioResponsePage.steps.switchToEditTab();
90
+ audioResponsePage.steps.switchToMinimalRecorderStyle();
91
+ audioResponsePage.startRecordingOptionButton()
92
+ .click()
93
+ .should('have.class', 'ngie-toggle-button-selected')
94
+ cy.log('Switching to Preview tab');
95
+ audioResponsePage.steps.switchToPreviewTab();
96
+ audioResponsePage.minimalPreviewRecordButton()
97
+ .should('be.visible')
98
+ .and('be.enabled');
99
+ });
100
+
101
+ it('In minimal mode, when the start recording option is deselected the record icon button should be disabled in the preview tab', () => {
102
+ cy.log('Pre-step: Switching to Edit tab');
103
+ audioResponsePage.steps.switchToEditTab();
104
+ audioResponsePage.startRecordingOptionButton()
105
+ .click()
106
+ .should('have.class', 'ngie-toggle-button-not-selected')
107
+ cy.log('Switching to Preview tab');
108
+ audioResponsePage.steps.switchToPreviewTab();
109
+ audioResponsePage.minimalPreviewRecordButton()
110
+ .should('be.visible')
111
+ .and('be.disabled');
112
+ });
113
+ });
114
+
115
+ describe('Controls for recording response- Pause recording', () => {
116
+ abortEarlySetup();
117
+ before(() => {
118
+ cy.log('Navigating to Audio Response question type');
119
+ audioResponsePage.steps.navigateToCreateQuestion('audio response');
120
+ cy.log('Setting Maximum recorder length to 5 seconds');
121
+ audioResponsePage.steps.setMaximumRecorderLength(5);
122
+ cy.log('Expand \'Customize recorder and playback controls (for student player)\' accordion');
123
+ audioResponsePage.steps.expandCustomizeRecorderAndPlaybackControlsAccordion();
124
+ });
125
+
126
+ it('In standard mode, when the \'Pause recording\' option is selected the pause icon button should be enabled in the preview tab', () => {
127
+ cy.log('Pre-step: Switching to Preview tab and starting the recording');
128
+ audioResponsePage.steps.switchToPreviewTab();
129
+ audioResponsePage.standardPreviewStartRecordingButton()
130
+ .click();
131
+ audioResponsePage.standardPreviewPauseRecordingButton()
132
+ .should('be.visible')
133
+ .and('be.enabled');
134
+ });
135
+
136
+ it('In standard mode, when the pause recording option is deselected the pause recording icon button should be disabled in the preview tab and user should not be able to pause recording', () => {
137
+ cy.log('Pre-step: Switching to Edit tab, deselecting pause recording option button and switching back to preview tab');
138
+ audioResponsePage.steps.switchToEditTab();
139
+ audioResponsePage.pauseRecordingOptionButton()
140
+ .click()
141
+ .should('have.class', 'ngie-toggle-button-not-selected')
142
+ audioResponsePage.steps.switchToPreviewTab();
143
+ audioResponsePage.standardPreviewStartRecordingButton()
144
+ .click();
145
+ audioResponsePage.standardPreviewPauseRecordingButton()
146
+ .should('be.visible')
147
+ .and('be.disabled');
148
+ audioResponsePage.standardPreviewPlayerHelpText()
149
+ .verifyInnerText('Your response has been recorded');
150
+ });
151
+
152
+ it('In minimal mode, when the pause recording option is selected the pause recording icon button should be enabled in the preview tab', () => {
153
+ cy.log('Pre-step: Switching to Edit tab and selecting minimal audio recorder style option from audio recorder style dropdown');
154
+ audioResponsePage.steps.switchToEditTab();
155
+ audioResponsePage.steps.switchToMinimalRecorderStyle();
156
+ audioResponsePage.pauseRecordingOptionButton()
157
+ .click()
158
+ .should('have.class', 'ngie-toggle-button-selected')
159
+ cy.log('Switching to Preview tab and starting a recording');
160
+ audioResponsePage.steps.switchToPreviewTab();
161
+ audioResponsePage.minimalPreviewRecordButton()
162
+ .click();
163
+ audioResponsePage.minimalPreviewPauseRecordingButton()
164
+ .should('be.visible')
165
+ .and('be.enabled');
166
+ });
167
+
168
+ it('In minimal mode, when the pause recording option is deselected the pause recording icon button should be disabled in the preview tab. User should not be able to pause recording', () => {
169
+ cy.log('Pre-step: Switching to Edit tab, deselecting Pause recording option button, switching back to preview tab and starting a recording')
170
+ audioResponsePage.steps.switchToEditTab();
171
+ audioResponsePage.pauseRecordingOptionButton()
172
+ .click()
173
+ .should('have.class', 'ngie-toggle-button-not-selected')
174
+ audioResponsePage.steps.switchToPreviewTab();
175
+ audioResponsePage.minimalPreviewRecordButton()
176
+ .click();
177
+ audioResponsePage.minimalPreviewPauseRecordingButton()
178
+ .should('be.visible')
179
+ .and('be.disabled');
180
+ audioResponsePage.minimalPreviewRecorderHelpText()
181
+ .should('have.text', 'Your response has been recorded');
182
+ });
183
+ });
184
+
185
+ describe('Controls for recording response- Stop recording', () => {
186
+ abortEarlySetup();
187
+ before(() => {
188
+ audioResponsePage.steps.navigateToCreateQuestion('audio response');
189
+ cy.log('Expand \'Customize recorder and playback controls (for student player)\' accordion');
190
+ audioResponsePage.steps.expandCustomizeRecorderAndPlaybackControlsAccordion();
191
+ });
192
+
193
+ it('In standard mode, when the \'Stop recording\' option is selected the stop recording icon button should be enabled in the preview tab', () => {
194
+ cy.log('Pre-step: Switching to Preview tab')
195
+ audioResponsePage.steps.switchToPreviewTab();
196
+ audioResponsePage.standardPreviewStartRecordingButton()
197
+ .click();
198
+ audioResponsePage.standardPreviewStopRecordingButton()
199
+ .should('be.visible')
200
+ .and('be.enabled');
201
+ });
202
+
203
+ it('In standard mode, when the stop recording option is deselected the stop recording icon button should be disabled in the preview tab and user should not able to stop recording until the \'Maximum recorder length\' is recorded', () => {
204
+ cy.log('Pre-step: Switching to Edit tab');
205
+ audioResponsePage.steps.switchToEditTab();
206
+ audioResponsePage.steps.setMaximumRecorderLength('5');
207
+ audioResponsePage.stopRecordingOptionButton()
208
+ .click()
209
+ .should('have.class', 'ngie-toggle-button-not-selected')
210
+ cy.log('Switching to Preview tab');
211
+ audioResponsePage.steps.switchToPreviewTab();
212
+ cy.log('Clicking on start recording and letting it record until maximum recorder length of 5 seconds is reached');
213
+ audioResponsePage.standardPreviewStartRecordingButton()
214
+ .click();
215
+ audioResponsePage.standardPreviewStopRecordingButton()
216
+ .should('be.visible')
217
+ .and('be.disabled');
218
+ audioResponsePage.standardPreviewPlayerHelpText()
219
+ .verifyInnerText('Your response has been recorded');
220
+ });
221
+
222
+ it('In minimal mode, when the stop recording option is selected the stop icon button should be enabled in the preview tab', () => {
223
+ cy.log('Pre-step: Switching to Edit tab and selecting minimal audio recorder style option from audio recorder style dropdown');
224
+ audioResponsePage.steps.switchToEditTab();
225
+ audioResponsePage.steps.switchToMinimalRecorderStyle();
226
+ audioResponsePage.stopRecordingOptionButton()
227
+ .click()
228
+ .should('have.class', 'ngie-toggle-button-selected')
229
+ cy.log('Switching to Preview tab');
230
+ audioResponsePage.steps.switchToPreviewTab();
231
+ audioResponsePage.minimalPreviewRecordButton()
232
+ .click();
233
+ audioResponsePage.minimalPreviewStopRecordingButton()
234
+ .should('be.visible')
235
+ .and('be.enabled');
236
+ });
237
+
238
+ it('In minimal mode, when the stop recording option is deselected the stop button should be disabled in the preview tab and user should not able to stop recording until the \'Maximum recorder length\' is recorded', () => {
239
+ cy.log('Pre-step: Switching to Edit tab');
240
+ audioResponsePage.steps.switchToEditTab();
241
+ audioResponsePage.stopRecordingOptionButton()
242
+ .click();
243
+ cy.log('Switching to Preview tab');
244
+ audioResponsePage.steps.switchToPreviewTab();
245
+ cy.log('Clicking on start recording and letting it record until maximum recorder length of 5 seconds is reached');
246
+ audioResponsePage.minimalPreviewRecordButton()
247
+ .click();
248
+ audioResponsePage.minimalPreviewStopRecordingButton()
249
+ .should('be.visible')
250
+ .should('be.disabled');
251
+ audioResponsePage.minimalPreviewRecorderHelpText()
252
+ .should('have.text', 'Your response has been recorded');
253
+ });
254
+ });
255
+
256
+ //TODO : revisit later, as we are unable to detect cue in cypress
257
+ describe.skip('Controls for recording response- Recording cue', () => {
258
+ abortEarlySetup();
259
+ before(() => {
260
+ audioResponsePage.steps.navigateToCreateQuestion('audio response');
261
+ audioResponsePage.steps.expandCustomizeRecorderAndPlaybackControlsAccordion();
262
+ });
263
+
264
+ it('In standard mode, when the \'Recording cue\' option is selected and in preview tab when recording is initiated, a beep sound should play', () => {
265
+ });
266
+
267
+ it('In standard mode, when the \'Recording cue\' option is deselected and in preview tab when recording is initiated, a beep sound should not play', () => {
268
+ });
269
+
270
+ it('In minimal mode, when the \'Recording cue\' option is selected and in preview tab when recording is initiated, a beep sound should play', () => {
271
+ });
272
+
273
+ it('In minimal mode, when the \'Recording cue\' option is deselected and in preview tab when recording is initiated, a beep sound should not play', () => {
274
+ });
275
+ });
276
+
277
+ describe('Controls for recording response- Recording overlay', () => {
278
+ abortEarlySetup();
279
+ before(() => {
280
+ audioResponsePage.steps.navigateToCreateQuestion('audio response');
281
+ cy.log('Expand \'Customize recorder and playback controls (for student player)\' accordion and switching to Minimal recorder style');
282
+ audioResponsePage.steps.switchToMinimalRecorderStyle();
283
+ audioResponsePage.steps.expandCustomizeRecorderAndPlaybackControlsAccordion();
284
+ });
285
+
286
+ it('In minimal mode, when the \'Recording overlay\' option is selected, recording overlay should be displayed once recording is started in the preview tab', () => {
287
+ cy.log('Pre-step: Switching to Preview tab and starting the recording');
288
+ audioResponsePage.steps.switchToPreviewTab();
289
+ audioResponsePage.minimalPreviewRecordButton()
290
+ .click();
291
+ audioResponsePage.minimalPreviewRecordingOverlay()
292
+ .should('be.visible');
293
+ });
294
+
295
+ it('In minimal mode, when the recording overlay option is deselected, overlay should not be displayed', () => {
296
+ cy.log('Pre-step: Switching to Edit tab, deselecting recording overlay option button and switching back to preview tab to start a recording');
297
+ audioResponsePage.steps.switchToEditTab();
298
+ audioResponsePage.recordingOverlayOptionButton()
299
+ .click()
300
+ .should('have.class', 'ngie-toggle-button-not-selected')
301
+ audioResponsePage.steps.switchToPreviewTab();
302
+ audioResponsePage.minimalPreviewRecordButton()
303
+ .click();
304
+ audioResponsePage.minimalPreviewRecordingOverlay()
305
+ .should('not.exist');
306
+ });
307
+ });
308
+ });