itemengine-cypress-automation 1.0.38 → 1.0.40

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,317 @@
1
+ import { dragAndDropIntoCategoriesPage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ import utilities from "../../../support/helpers/utilities";
4
+ const css = Cypress.env('css');
5
+ const optionsArray = ['Bat', 'Eagle', 'Parrot', 'Whale'];
6
+ const fontSizeDropdownOptions = ['Default', 'Small', 'Normal', 'Large', 'Extra large', 'Huge'];
7
+ const fontSizes = ['16px', '12px', '14px', '17px', '20px', '24px'];
8
+
9
+ describe('Create item page: Drag and drop into categories: Additional settings', () => {
10
+ before(() => {
11
+ cy.loginAs('admin');
12
+ });
13
+
14
+ describe('Additional settings accordion', () => {
15
+ abortEarlySetup();
16
+ before(() => {
17
+ cy.log('Navigate to Drag and drop into categories question type');
18
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
19
+ });
20
+
21
+ dragAndDropIntoCategoriesPage.tests.verifyAdditonalSettingsAccordionProperties();
22
+ });
23
+
24
+ describe('Additional settings: Student response area and layout', () => {
25
+ abortEarlySetup();
26
+ before(() => {
27
+ cy.log('Navigate to Drag and drop into categories question type');
28
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
29
+ dragAndDropIntoCategoriesPage.steps.expandAdditonalSettings();
30
+ });
31
+
32
+ dragAndDropIntoCategoriesPage.tests.verifyStudentResponseAreaAndLayoutLabelAndCSS();
33
+
34
+ //Note: a11y covered in verifyAdditonalSettingsAccordionProperties
35
+ });
36
+
37
+ describe('Additional settings: Font size - Contents', () => {
38
+ abortEarlySetup();
39
+ before(() => {
40
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
41
+ cy.barsPreLoaderWait();
42
+ dragAndDropIntoCategoriesPage.steps.addOption();
43
+ dragAndDropIntoCategoriesPage.steps.addOption();
44
+ dragAndDropIntoCategoriesPage.steps.addInputToOptionsForDragAndDropFields(optionsArray);
45
+ dragAndDropIntoCategoriesPage.steps.allotPoints(20);
46
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Bat', 0);
47
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Eagle', 1);
48
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Whale', 2);
49
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Platypus', 3);
50
+ dragAndDropIntoCategoriesPage.steps.expandAdditonalSettings();
51
+ });
52
+
53
+ dragAndDropIntoCategoriesPage.tests.verifyFontSizeSectionContents();
54
+ });
55
+
56
+ //Note: Will need to work on the font size describes after https://redmine.zeuslearning.com/issues/543473 gets resolved
57
+ describe('Additional settings: Font size - Set correct answer section', () => {
58
+ abortEarlySetup();
59
+ before(() => {
60
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
61
+ cy.barsPreLoaderWait();
62
+ dragAndDropIntoCategoriesPage.steps.setQuestion();
63
+ dragAndDropIntoCategoriesPage.steps.allotPoints(20);
64
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Bat', 0);
65
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Eagle', 1);
66
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Whale', 2);
67
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Platypus', 3);
68
+ dragAndDropIntoCategoriesPage.steps.expandAdditonalSettings();
69
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowHeadingInputField('Row heading');
70
+ });
71
+
72
+ fontSizeDropdownOptions.forEach((option, fontsIndex) => {
73
+ it(`When the user selects \'${option}\' option from the Font Size dropdown, then font size of the set correct answer section (options, labels) should be changed to ${option}`, () => {
74
+ dragAndDropIntoCategoriesPage.steps.selectFontSizeOptionFromFontSizeDropdown(fontsIndex)
75
+ dragAndDropIntoCategoriesPage.fontSizeDropdown()
76
+ .verifyInnerText(`${option}`);
77
+ dragAndDropIntoCategoriesPage.setCorrectAnswerDraggableOptionsWrapper('drag and drop into categories')
78
+ .within(() => {
79
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption(), {
80
+ 'font-size': fontSizes[fontsIndex]
81
+ });
82
+ });
83
+ dragAndDropIntoCategoriesPage.setCorrectAnswerSectionCategoryGrid()
84
+ .within(() => {
85
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption(), {
86
+ 'font-size': fontSizes[fontsIndex]
87
+ });
88
+ });
89
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.setCorrectAnswerSectionCategoryTitle(), {
90
+ 'font-size': fontSizes[fontsIndex]
91
+ });
92
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.setCorrectAnswerSectionRowTitle(), {
93
+ 'font-size': fontSizes[fontsIndex]
94
+ });
95
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.rowHeadingSetCorrectAnswerSection(), {
96
+ 'font-size': fontSizes[fontsIndex]
97
+ });
98
+ });
99
+ });
100
+ });
101
+
102
+ describe('Additional settings: Font size - Preview tab', () => {
103
+ abortEarlySetup();
104
+ before(() => {
105
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
106
+ cy.barsPreLoaderWait();
107
+ dragAndDropIntoCategoriesPage.steps.setQuestion();
108
+ dragAndDropIntoCategoriesPage.steps.allotPoints(20);
109
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Bat', 0);
110
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Eagle', 1);
111
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Whale', 2);
112
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Platypus', 3);
113
+ dragAndDropIntoCategoriesPage.steps.expandAdditonalSettings();
114
+ });
115
+
116
+ fontSizeDropdownOptions.forEach((option, fontsIndex) => {
117
+ it(`When the user selects \'${option}\' option from the Font Size dropdown, then font size of the preview (options, question instructions question stems) should be changed to ${option} in the preview tab Answer table`, () => {
118
+ dragAndDropIntoCategoriesPage.steps.selectFontSizeOptionFromFontSizeDropdown(fontsIndex);
119
+ utilities.verifyInnerText(dragAndDropIntoCategoriesPage.fontSizeDropdown(), `${option}`);
120
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
121
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.questionInstructionsText(), {
122
+ 'font-size': fontSizes[fontsIndex]
123
+ });
124
+ dragAndDropIntoCategoriesPage.previewTabDraggableOptionsWrapper('drag and drop into categories')
125
+ .within(() => {
126
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption(), {
127
+ 'font-size': fontSizes[fontsIndex]
128
+ });
129
+ });
130
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Bat', 0);
131
+ dragAndDropIntoCategoriesPage.previewTabCategoryGrid()
132
+ .within(() => {
133
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.draggableOption(), {
134
+ 'font-size': fontSizes[fontsIndex]
135
+ });
136
+ });
137
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.previewTabCategoryTitle(), {
138
+ 'font-size': fontSizes[fontsIndex]
139
+ });
140
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.previewTabRowTitle(), {
141
+ 'font-size': fontSizes[fontsIndex]
142
+ });
143
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.rowHeadingPreviewTab(), {
144
+ 'font-size': fontSizes[fontsIndex]
145
+ });
146
+ cy.log('Font size of answer numeration and correct answer container when show correct answer is checked')
147
+ dragAndDropIntoCategoriesPage.steps.checkShowCorrectAnswerCheckbox();
148
+ dragAndDropIntoCategoriesPage.previewTabCategoryGrid()
149
+ .within(() => {
150
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.categoryCellNumeration(), {
151
+ 'font-size': fontSizes[fontsIndex]
152
+ });
153
+ });
154
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.correctAnswerLabel(), {
155
+ 'font-size': fontSizes[fontsIndex]
156
+ });
157
+ dragAndDropIntoCategoriesPage.correctAnswerContainer()
158
+ .within(() => {
159
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.categoryCellNumeration(), {
160
+ 'font-size': fontSizes[fontsIndex]
161
+ });
162
+ });
163
+ dragAndDropIntoCategoriesPage.correctAnswerContainer()
164
+ .within(() => {
165
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.correctAnswerOption(), {
166
+ 'font-size': fontSizes[fontsIndex]
167
+ });
168
+ });
169
+ cy.log('Uncheck show correct answer checkbox')
170
+ dragAndDropIntoCategoriesPage.steps.uncheckShowCorrectAnswerCheckbox()
171
+ cy.log('Font size of answer numeration when check answer is selected')
172
+ dragAndDropIntoCategoriesPage.steps.checkAnswer()
173
+ dragAndDropIntoCategoriesPage.previewTabCategoryGrid()
174
+ .within(() => {
175
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.categoryCellNumeration(), {
176
+ 'font-size': fontSizes[fontsIndex]
177
+ });
178
+ });
179
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
180
+ });
181
+ });
182
+ });
183
+
184
+ describe('Additional settings: Check answer', () => {
185
+ abortEarlySetup();
186
+ before(() => {
187
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
188
+ cy.barsPreLoaderWait();
189
+ dragAndDropIntoCategoriesPage.steps.setQuestion();
190
+ dragAndDropIntoCategoriesPage.steps.allotPoints(20);
191
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Bat', 0);
192
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Eagle', 1);
193
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Whale', 2);
194
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Platypus', 3);
195
+ dragAndDropIntoCategoriesPage.steps.expandAdditonalSettings();
196
+ });
197
+
198
+ dragAndDropIntoCategoriesPage.tests.verifyCheckAnswerSectionAndPreviewTabCheckAnswerButton();
199
+ });
200
+
201
+ describe('Additional settings: Check answer - Functionality', () => {
202
+ abortEarlySetup();
203
+ before(() => {
204
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
205
+ cy.barsPreLoaderWait();
206
+ dragAndDropIntoCategoriesPage.steps.setQuestion();
207
+ dragAndDropIntoCategoriesPage.steps.allotPoints(20);
208
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Bat', 0);
209
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Eagle', 1);
210
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Whale', 2);
211
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfSetCorrectAnswerSection('Platypus', 3);
212
+ dragAndDropIntoCategoriesPage.steps.expandAdditonalSettings();
213
+ dragAndDropIntoCategoriesPage.steps.setMaximumCheckAnswerAttempts(2);
214
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
215
+ });
216
+
217
+ dragAndDropIntoCategoriesPage.tests.verifyCheckAnswerButtonFunctionalityWhenQuestionIsUnattempted();
218
+
219
+ it('When the user attempts the question partially correct, then on clicking on the \'Check answer\' button, green check-mark icon should be displayed besides the correct response, red cross-mark should be displayed besides incorrect response and \'Incorrect answer\' label should be displayed below the question preview', () => {
220
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Bat', 0);
221
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Eagle', 1);
222
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Whale', 3);
223
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Platypus', 2);
224
+ dragAndDropIntoCategoriesPage.steps.checkAnswer();
225
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionCheckmarkIcon(0);
226
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionCheckmarkIcon(1);
227
+ dragAndDropIntoCategoriesPage.steps.verifyIncorrectOptionCrossmarkIcon(2);
228
+ dragAndDropIntoCategoriesPage.steps.verifyIncorrectOptionCrossmarkIcon(3);
229
+ dragAndDropIntoCategoriesPage.steps.verifyIncorrectAttemptBorder();
230
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectAnswerLabel('Incorrect');
231
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerSectionNotVisible();
232
+ cy.log('Dropping the options back to the options container')
233
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInResponseContainerOfPreviewTab('Whale');
234
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInResponseContainerOfPreviewTab('Platypus');
235
+ });
236
+
237
+ it('When the user attempts the question correctly, then on clicking on the \'Check answer\' button, green check-mark icon should be displayed besides the correct response and \'Correct answer\' label should be displayed below the question preview', () => {
238
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Whale', 2);
239
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Platypus', 3);
240
+ dragAndDropIntoCategoriesPage.steps.checkAnswer();
241
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionCheckmarkIcon(0);
242
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionCheckmarkIcon(1);
243
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionCheckmarkIcon(2);
244
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectOptionCheckmarkIcon(3);
245
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAttemptBorder();
246
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectIncorrectAnswerLabel('Correct');
247
+ dragAndDropIntoCategoriesPage.steps.verifyCorrectAnswerSectionNotVisible();
248
+ });
249
+
250
+ dragAndDropIntoCategoriesPage.tests.verifyDisabledCheckAnswerButtonWithCSSAnda11y();
251
+
252
+ it('When the user updates the value of Maximum check answer attempts input field, it should get reflected on the Preview tab', () => {
253
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
254
+ dragAndDropIntoCategoriesPage.steps.clearMaximumCheckAnswerAttemptsInputField();
255
+ dragAndDropIntoCategoriesPage.steps.addInputToMaximumCheckAnswerAttemptsInputField(1);
256
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
257
+ dragAndDropIntoCategoriesPage.steps.verifyCheckAnswerButtonEnabled();
258
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Bat', 0);
259
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Eagle', 1);
260
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Whale', 3);
261
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Platypus', 2);
262
+ dragAndDropIntoCategoriesPage.steps.checkAnswer();
263
+ dragAndDropIntoCategoriesPage.steps.verifyCheckAnswerButtonDisabled();
264
+ });
265
+
266
+ it('When the \'Maximum check answer attempts\' input field has value \'0\' and user switches to Preview tab, then the \'Check Answer\' button should be enabled and user should be able to check answer multiple times', () => {
267
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
268
+ dragAndDropIntoCategoriesPage.steps.clearMaximumCheckAnswerAttemptsInputField();
269
+ dragAndDropIntoCategoriesPage.steps.addInputToMaximumCheckAnswerAttemptsInputField(0);
270
+ cy.log('Switching to Preview tab')
271
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
272
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Bat', 0);
273
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Eagle', 1);
274
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Whale', 3);
275
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Platypus', 2);
276
+ dragAndDropIntoCategoriesPage.steps.checkAnswer();
277
+ dragAndDropIntoCategoriesPage.steps.verifyCheckAnswerButtonEnabled();
278
+ cy.log('Dropping the options back to the options container')
279
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInResponseContainerOfPreviewTab('Whale');
280
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInResponseContainerOfPreviewTab('Platypus');
281
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Whale', 2);
282
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Platypus', 3);
283
+ dragAndDropIntoCategoriesPage.steps.checkAnswer();
284
+ dragAndDropIntoCategoriesPage.steps.verifyCheckAnswerButtonEnabled();
285
+ });
286
+
287
+ it('When the \'Maximum check answer attempts\' input field is empty and user switches to Preview tab, then the \'Check Answer\' button should be enabled and user should be able to check answer multiple times', () => {
288
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
289
+ dragAndDropIntoCategoriesPage.steps.clearMaximumCheckAnswerAttemptsInputField()
290
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
291
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Bat', 0);
292
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Eagle', 1);
293
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Whale', 3);
294
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Platypus', 2);
295
+ dragAndDropIntoCategoriesPage.steps.checkAnswer();
296
+ dragAndDropIntoCategoriesPage.steps.verifyCheckAnswerButtonEnabled();
297
+ cy.log('Dropping the options back to the options container')
298
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInResponseContainerOfPreviewTab('Whale');
299
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInResponseContainerOfPreviewTab('Platypus');
300
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Whale', 2);
301
+ dragAndDropIntoCategoriesPage.steps.clickAndDropDraggableOptionInCategoryCellOfPreviewTab('Platypus', 3);
302
+ dragAndDropIntoCategoriesPage.steps.checkAnswer();
303
+ dragAndDropIntoCategoriesPage.steps.verifyCheckAnswerButtonEnabled();
304
+ });
305
+ });
306
+
307
+ describe('Additional settings: Details section', () => {
308
+ abortEarlySetup();
309
+ before(() => {
310
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
311
+ cy.barsPreLoaderWait();
312
+ dragAndDropIntoCategoriesPage.steps.expandAdditonalSettings();
313
+ });
314
+
315
+ dragAndDropIntoCategoriesPage.tests.verifyDetailsSection();
316
+ });
317
+ });