itemengine-cypress-automation 1.0.39 → 1.0.40

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,372 @@
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
+
6
+ describe('Create item page: Drag and drop into categories: Additional settings', () => {
7
+ before(() => {
8
+ cy.loginAs('admin');
9
+ });
10
+
11
+ describe('Additional settings: \'Row title width (px)\' - Contents', () => {
12
+ abortEarlySetup();
13
+ before(() => {
14
+ cy.log('Navigate to Drag and drop into categories question type');
15
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
16
+ cy.barsPreLoaderWait();
17
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowInputField(0, 'Can fly');
18
+ dragAndDropIntoCategoriesPage.steps.expandAdditonalSettings();
19
+ });
20
+
21
+ it('\'Row title width (px)\' label and input field should be displayed. By default, the \'Row title width\' input field should be empty', () => {
22
+ utilities.verifyInnerText(dragAndDropIntoCategoriesPage.rowTitleWidthLabel(), 'Row title width (px)');
23
+ utilities.verifyElementVisibilityState(dragAndDropIntoCategoriesPage.rowTitleWidthLabel(), 'visible');
24
+ utilities.verifyElementVisibilityState(dragAndDropIntoCategoriesPage.rowTitleWidthInputField(), 'visible');
25
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleWidthInputFieldValue('');
26
+ });
27
+
28
+ it('CSS of \'Row title width (px)\' contents', { tags: 'css' }, () => {
29
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.rowTitleWidthLabel(), {
30
+ 'color': css.color.labels,
31
+ 'font-size': css.fontSize.normal,
32
+ 'font-weight': css.fontWeight.semibold
33
+ });
34
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.rowTitleWidthInputField(), {
35
+ 'color': css.color.text,
36
+ 'font-size': css.fontSize.default,
37
+ 'font-weight': css.fontWeight.regular
38
+ });
39
+ });
40
+
41
+ //Note: a11y covered in verifyAdditonalSettingsAccordionProperties
42
+
43
+ it('The user should only be able to enter only numeric value in the \'Row title width\' input field', () => {
44
+ dragAndDropIntoCategoriesPage.steps.clearTextInRowTitleWidthInputField();
45
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowTitleWidthInputField('a!1b#c4d0');
46
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleWidthInputFieldValue(140);
47
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleWidthSetCorrectAnswerSection(140);
48
+ });
49
+ });
50
+
51
+ //https://redmine.zeuslearning.com/issues/547937
52
+ describe('Additional settings: \'Row title width (px)\' - Set correct answer section', () => {
53
+ abortEarlySetup();
54
+ before(() => {
55
+ cy.log('Navigate to Drag and drop into categories question type');
56
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
57
+ cy.barsPreLoaderWait();
58
+ dragAndDropIntoCategoriesPage.steps.setQuestion();
59
+ dragAndDropIntoCategoriesPage.steps.allotPoints('20');
60
+ dragAndDropIntoCategoriesPage.steps.expandAdditonalSettings();
61
+ dragAndDropIntoCategoriesPage.steps.checkAllowStudentsToCheckAnswerCheckbox();
62
+ });
63
+
64
+ it('When the user has not set any value in the \'Row title width\' input field, the width of the row title should be 64px by default', () => {
65
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleWidthSetCorrectAnswerSection(64);
66
+ });
67
+
68
+ it('When the user enters a numeric value in the \'Row title width\' input field, the row title width should get updated accordingly', () => {
69
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowTitleWidthInputField(100);
70
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleWidthInputFieldValue(100);
71
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleWidthSetCorrectAnswerSection(100);
72
+ });
73
+
74
+ it('When the users adds a value greater than 400, the entered value should automatically update to 400 and the row title width should change to 400px', () => {
75
+ dragAndDropIntoCategoriesPage.steps.clearTextInRowTitleWidthInputField();
76
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowTitleWidthInputField(500);
77
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleWidthInputFieldValue(400);
78
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleWidthSetCorrectAnswerSection(400);
79
+ });
80
+
81
+ it('When user clears the \'Row title width\' input field, the row title width should change back to the default value', () => {
82
+ dragAndDropIntoCategoriesPage.steps.clearTextInRowTitleWidthInputField();
83
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleWidthSetCorrectAnswerSection(64);
84
+ });
85
+
86
+ it('When the users adds a value less than 64, the entered value should automatically update to 64 and the row title width should change to 64px', () => {
87
+ dragAndDropIntoCategoriesPage.steps.clearTextInRowTitleWidthInputField();
88
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowTitleWidthInputField(50);
89
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleWidthInputFieldValue(64);
90
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleWidthSetCorrectAnswerSection(64);
91
+ });
92
+ });
93
+
94
+ describe('Additional settings: \'Row title width (px)\' - Preview tab', () => {
95
+ abortEarlySetup();
96
+ before(() => {
97
+ cy.log('Navigate to Drag and drop into categories question type');
98
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
99
+ cy.barsPreLoaderWait();
100
+ dragAndDropIntoCategoriesPage.steps.setQuestion();
101
+ dragAndDropIntoCategoriesPage.steps.allotPoints('20');
102
+ dragAndDropIntoCategoriesPage.steps.expandAdditonalSettings();
103
+ dragAndDropIntoCategoriesPage.steps.checkAllowStudentsToCheckAnswerCheckbox();
104
+ });
105
+
106
+ it('When the user has not set any value in the \'Row title width\' input field, the width of the row title should be 64px by default in the preview tab', () => {
107
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
108
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleWidthPreviewTab(64);
109
+ });
110
+
111
+ it('When the user enters a numeric value in the \'Row title width\' input field, the row title width should get updated accordingly in the preview tab', () => {
112
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
113
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowTitleWidthInputField(100);
114
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleWidthInputFieldValue(100);
115
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
116
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleWidthPreviewTab(100);
117
+ });
118
+
119
+ it('When user clears the \'Row title width\' input field, the row title width should change back to the default value in the preview tab', () => {
120
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
121
+ dragAndDropIntoCategoriesPage.steps.clearTextInRowTitleWidthInputField();
122
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
123
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleWidthPreviewTab(64);
124
+ });
125
+
126
+ it('When the users adds a value greater than 400, the entered value should automatically update to 400 and the row title width should change to 400px in the preview tab', () => {
127
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
128
+ dragAndDropIntoCategoriesPage.steps.clearTextInRowTitleWidthInputField();
129
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowTitleWidthInputField(500);
130
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleWidthInputFieldValue(400);
131
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
132
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleWidthPreviewTab(400);
133
+ });
134
+
135
+ it('When the users adds a value less than 64, the entered value should automatically update to 64 and the row title width should change to 64px in the preview tab', () => {
136
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
137
+ dragAndDropIntoCategoriesPage.steps.clearTextInRowTitleWidthInputField();
138
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowTitleWidthInputField(50);
139
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleWidthInputFieldValue(64);
140
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
141
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleWidthPreviewTab(64);
142
+ });
143
+ });
144
+
145
+ describe('Additional settings: \'Row minimum height (px)\' - Contents', () => {
146
+ abortEarlySetup();
147
+ before(() => {
148
+ cy.log('Navigate to Drag and drop into categories question type');
149
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
150
+ cy.barsPreLoaderWait();
151
+ dragAndDropIntoCategoriesPage.steps.expandAdditonalSettings();
152
+ });
153
+
154
+ it('\'Row minimum height (px)\' label and input field should be displayed. By default, the \'Row minimum height\' input field should be empty', () => {
155
+ utilities.verifyInnerText(dragAndDropIntoCategoriesPage.rowMinHeightLabel(), 'Row minimum height (px)');
156
+ utilities.verifyElementVisibilityState(dragAndDropIntoCategoriesPage.rowMinHeightLabel(), 'visible');
157
+ utilities.verifyElementVisibilityState(dragAndDropIntoCategoriesPage.rowMinHeightInputField(), 'visible');
158
+ dragAndDropIntoCategoriesPage.steps.verifyRowMinHeightInputFieldValue('');
159
+ });
160
+
161
+ it('CSS of \'Row minimum height (px)\' contents', { tags: 'css' }, () => {
162
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.rowMinHeightLabel(), {
163
+ 'color': css.color.labels,
164
+ 'font-size': css.fontSize.normal,
165
+ 'font-weight': css.fontWeight.semibold
166
+ });
167
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.rowMinHeightInputField(), {
168
+ 'color': css.color.text,
169
+ 'font-size': css.fontSize.default,
170
+ 'font-weight': css.fontWeight.regular
171
+ });
172
+ });
173
+
174
+ //Note: a11y covered in verifyAdditonalSettingsAccordionProperties
175
+
176
+ it('The user should only be able to enter only numeric value in the \'Row minimum height\' input field', () => {
177
+ dragAndDropIntoCategoriesPage.steps.clearTextInRowMinHeightInputField();
178
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowMinHeightInputField('a!1b#c4d0');
179
+ dragAndDropIntoCategoriesPage.steps.verifyRowMinHeightInputFieldValue(140);
180
+ dragAndDropIntoCategoriesPage.steps.verifyRowMinHeightSetCorrectAnswerSection(140);
181
+ });
182
+ });
183
+
184
+ describe('Additional settings: \'Row minimum height (px)\' - Set correct answer section', () => {
185
+ abortEarlySetup();
186
+ before(() => {
187
+ cy.log('Navigate to Drag and drop into categories question type');
188
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
189
+ cy.barsPreLoaderWait();
190
+ dragAndDropIntoCategoriesPage.steps.setQuestion();
191
+ dragAndDropIntoCategoriesPage.steps.allotPoints('20');
192
+ dragAndDropIntoCategoriesPage.steps.expandAdditonalSettings();
193
+ });
194
+
195
+ it('\'Row minimum height (px)\' label and input field should be displayed. By default, the \'Row minimum height\' input field should be empty', () => {
196
+ utilities.verifyInnerText(dragAndDropIntoCategoriesPage.rowMinHeightLabel(), 'Row minimum height (px)');
197
+ utilities.verifyElementVisibilityState(dragAndDropIntoCategoriesPage.rowMinHeightLabel(), 'visible');
198
+ utilities.verifyElementVisibilityState(dragAndDropIntoCategoriesPage.rowMinHeightInputField(), 'visible');
199
+ dragAndDropIntoCategoriesPage.steps.verifyRowMinHeightInputFieldValue('');
200
+ });
201
+
202
+ it('When the user has not set any value in the \'Row minimum height\' input field, the minimum row height should be 100px by default', () => {
203
+ dragAndDropIntoCategoriesPage.steps.verifyRowMinHeightSetCorrectAnswerSection(100);
204
+ });
205
+
206
+ it('When the user enters a numeric value in the \'Row minimum height\' input field, the minimum row height should get updated accordingly', () => {
207
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowMinHeightInputField(200);
208
+ dragAndDropIntoCategoriesPage.steps.verifyRowMinHeightInputFieldValue(200);
209
+ dragAndDropIntoCategoriesPage.steps.verifyRowMinHeightSetCorrectAnswerSection(200);
210
+ });
211
+
212
+ it('When user clears the \'Row minimum height\' input field, the minimum row height should change back to the default value', () => {
213
+ dragAndDropIntoCategoriesPage.steps.clearTextInRowMinHeightInputField();
214
+ dragAndDropIntoCategoriesPage.steps.verifyRowMinHeightSetCorrectAnswerSection(100);
215
+ });
216
+
217
+ it('When the users adds a value greater than 400, the entered value should automatically update to 400 and the minimum row height should change to 400px', () => {
218
+ dragAndDropIntoCategoriesPage.steps.clearTextInRowMinHeightInputField();
219
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowMinHeightInputField(500);
220
+ dragAndDropIntoCategoriesPage.steps.verifyRowMinHeightInputFieldValue(400);
221
+ dragAndDropIntoCategoriesPage.steps.verifyRowMinHeightSetCorrectAnswerSection(400);
222
+ });
223
+
224
+ it('When the users adds a value less than 50, the entered value should automatically update to 50 and the minimum row height should change to 50px', () => {
225
+ dragAndDropIntoCategoriesPage.steps.clearTextInRowMinHeightInputField();
226
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowMinHeightInputField(40);
227
+ dragAndDropIntoCategoriesPage.steps.verifyRowMinHeightInputFieldValue(50);
228
+ dragAndDropIntoCategoriesPage.steps.verifyRowMinHeightSetCorrectAnswerSection(50);
229
+ });
230
+ });
231
+
232
+ describe('Additional settings: \'Row minimum height (px)\' - Preview tab', () => {
233
+ abortEarlySetup();
234
+ before(() => {
235
+ cy.log('Navigate to Drag and drop into categories question type');
236
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
237
+ cy.barsPreLoaderWait();
238
+ dragAndDropIntoCategoriesPage.steps.setQuestion();
239
+ dragAndDropIntoCategoriesPage.steps.allotPoints('20');
240
+ dragAndDropIntoCategoriesPage.steps.expandAdditonalSettings();
241
+ });
242
+
243
+ it('When the user has not set any value in the \'Row minimum height\' input field, the minimum row height should be 100px by default in the preview tab', () => {
244
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
245
+ dragAndDropIntoCategoriesPage.steps.verifyRowMinHeightPreviewTab(100);
246
+ });
247
+
248
+ it('When the user enters a numeric value in the \'Row minimum height\' input field, the minimum row height should get updated accordingly in the preview tab', () => {
249
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
250
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowMinHeightInputField(200);
251
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
252
+ dragAndDropIntoCategoriesPage.steps.verifyRowMinHeightPreviewTab(200);
253
+ });
254
+
255
+ it('When user clears the \'Row minimum height\' input field, the minimum row height should change back to the default value in the preview tab', () => {
256
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
257
+ dragAndDropIntoCategoriesPage.steps.clearTextInRowMinHeightInputField();
258
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
259
+ dragAndDropIntoCategoriesPage.steps.verifyRowMinHeightPreviewTab(100);
260
+ });
261
+
262
+ it('When the users adds a value greater than 400, the entered value should automatically update to 400 and the minimum row height should change to 400px in the preview tab', () => {
263
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
264
+ dragAndDropIntoCategoriesPage.steps.clearTextInRowMinHeightInputField();
265
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowMinHeightInputField(500);
266
+ dragAndDropIntoCategoriesPage.steps.verifyRowMinHeightInputFieldValue(400);
267
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
268
+ dragAndDropIntoCategoriesPage.steps.verifyRowMinHeightPreviewTab(400);
269
+ });
270
+
271
+ it('When the users adds a value less than 50, the entered value should automatically update to 50 and the minimum row height should change to 50px in the preview tab', () => {
272
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
273
+ dragAndDropIntoCategoriesPage.steps.clearTextInRowMinHeightInputField();
274
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowMinHeightInputField(40);
275
+ dragAndDropIntoCategoriesPage.steps.verifyRowMinHeightInputFieldValue(50);
276
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
277
+ dragAndDropIntoCategoriesPage.steps.verifyRowMinHeightPreviewTab(50);
278
+ });
279
+ });
280
+
281
+ describe('Additional settings: \'Row heading\' - Contents', () => {
282
+ abortEarlySetup();
283
+ before(() => {
284
+ cy.log('Navigate to Drag and drop into categories question type');
285
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
286
+ cy.barsPreLoaderWait();
287
+ dragAndDropIntoCategoriesPage.steps.expandAdditonalSettings();
288
+ });
289
+
290
+ it('\'Row heading\' label and input field should be displayed. By default, the \'Row heading\' input field should be empty', () => {
291
+ utilities.verifyInnerText(dragAndDropIntoCategoriesPage.rowHeadingLabel(), 'Row heading');
292
+ utilities.verifyElementVisibilityState(dragAndDropIntoCategoriesPage.rowHeadingLabel(), 'visible');
293
+ utilities.verifyElementVisibilityState(dragAndDropIntoCategoriesPage.rowHeadingInputField(), 'visible');
294
+ dragAndDropIntoCategoriesPage.steps.verifyRowHeadingInputFieldValue('');
295
+ });
296
+
297
+ it('CSS of \'Row heading\' contents', { tags: 'css' }, () => {
298
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.rowHeadingLabel(), {
299
+ 'color': css.color.labels,
300
+ 'font-size': css.fontSize.normal,
301
+ 'font-weight': css.fontWeight.semibold
302
+ });
303
+ utilities.verifyCSS(dragAndDropIntoCategoriesPage.rowHeadingInputField(), {
304
+ 'color': css.color.text,
305
+ 'font-size': css.fontSize.default,
306
+ 'font-weight': css.fontWeight.regular
307
+ });
308
+ });
309
+
310
+ //Note: a11y covered in verifyAdditonalSettingsAccordionProperties
311
+ });
312
+
313
+ describe('Additional settings: \'Row heading\' - Set correct answer section', () => {
314
+ abortEarlySetup();
315
+ before(() => {
316
+ cy.log('Navigate to Drag and drop into categories question type');
317
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
318
+ cy.barsPreLoaderWait();
319
+ dragAndDropIntoCategoriesPage.steps.setQuestion();
320
+ dragAndDropIntoCategoriesPage.steps.allotPoints('20');
321
+ dragAndDropIntoCategoriesPage.steps.expandAdditonalSettings();
322
+ dragAndDropIntoCategoriesPage.steps.checkAllowStudentsToCheckAnswerCheckbox();
323
+ });
324
+
325
+ it('When the user has not entered any value in the \'Row heading\' input field, Row heading should not be displayed', () => {
326
+ utilities.verifyElementVisibilityState(dragAndDropIntoCategoriesPage.rowHeadingSetCorrectAnswerSection(), 'notExist');
327
+ });
328
+
329
+ it('When the user enters text in the \'Row heading\' input field, a Row heading should be displayed', () => {
330
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowHeadingInputField('Row heading');
331
+ utilities.verifyInnerText(dragAndDropIntoCategoriesPage.rowHeadingSetCorrectAnswerSection(), 'Row heading');
332
+ utilities.verifyElementVisibilityState(dragAndDropIntoCategoriesPage.rowHeadingSetCorrectAnswerSection(), 'visible');
333
+ });
334
+
335
+ it('When user clears the \'Row heading\' input field, the Row heading should disappear', () => {
336
+ dragAndDropIntoCategoriesPage.steps.clearTextInRowHeadingInputField();
337
+ utilities.verifyElementVisibilityState(dragAndDropIntoCategoriesPage.rowHeadingSetCorrectAnswerSection(), 'notExist');
338
+ });
339
+ });
340
+
341
+ describe('Additional settings: \'Row heading\' - Preview tab', () => {
342
+ abortEarlySetup();
343
+ before(() => {
344
+ cy.log('Navigate to Drag and drop into categories question type');
345
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
346
+ cy.barsPreLoaderWait();
347
+ dragAndDropIntoCategoriesPage.steps.setQuestion();
348
+ dragAndDropIntoCategoriesPage.steps.allotPoints('20');
349
+ dragAndDropIntoCategoriesPage.steps.expandAdditonalSettings();
350
+ dragAndDropIntoCategoriesPage.steps.checkAllowStudentsToCheckAnswerCheckbox();
351
+ });
352
+
353
+ it('When the user has not entered any value in the \'Row heading\' input field, Row heading should not be displayed in the preview tab', () => {
354
+ utilities.verifyElementVisibilityState(dragAndDropIntoCategoriesPage.rowHeadingPreviewTab(), 'notExist');
355
+ });
356
+
357
+ it('When the user enters text in the \'Row heading\' input field, a Row heading should be displayed in the preview tab', () => {
358
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
359
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowHeadingInputField('Row heading');
360
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
361
+ utilities.verifyInnerText(dragAndDropIntoCategoriesPage.rowHeadingPreviewTab(), 'Row heading');
362
+ utilities.verifyElementVisibilityState(dragAndDropIntoCategoriesPage.rowHeadingPreviewTab(), 'visible');
363
+ });
364
+
365
+ it('When user clears the \'Row heading\' input field, the Row heading should disappear from the preview tab', () => {
366
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
367
+ dragAndDropIntoCategoriesPage.steps.clearTextInRowHeadingInputField();
368
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
369
+ utilities.verifyElementVisibilityState(dragAndDropIntoCategoriesPage.rowHeadingPreviewTab(), 'notExist');
370
+ });
371
+ });
372
+ });
@@ -0,0 +1,275 @@
1
+ import { dragAndDropIntoCategoriesPage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ const css = Cypress.env('css');
4
+
5
+ describe('Create Item page - Drag and drop into categories: Question instructions, Category, Row', () => {
6
+ before(() => {
7
+ cy.loginAs('admin');
8
+ });
9
+
10
+ describe('Category - Basic', () => {
11
+ abortEarlySetup();
12
+ before(() => {
13
+ cy.log('Navigating to drag and drop into categories question type');
14
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
15
+ cy.barsPreLoaderWait();
16
+ });
17
+
18
+ it('\'Category\' label should be displayed', () => {
19
+ dragAndDropIntoCategoriesPage.categoryLabel()
20
+ .verifyInnerText('Category')
21
+ .should('be.visible');
22
+ });
23
+
24
+ it('By default, 2 \'Category\' input fields with prefilled text \'Category #\' should be displayed and numeration, \'Delete category\' icon buttons should be displayed besides each input field', () => {
25
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryInputFields(2);
26
+ for (let categoryIndex = 0; categoryIndex < 2; categoryIndex++) {
27
+ dragAndDropIntoCategoriesPage.categoryInputField()
28
+ .eq(categoryIndex)
29
+ .should('have.text', `Category ${categoryIndex + 1}`);
30
+ };
31
+ dragAndDropIntoCategoriesPage.steps.verifyNumerationOfCategoryInputFields();
32
+ dragAndDropIntoCategoriesPage.steps.verifyDeleteCategoryButton(0);
33
+ dragAndDropIntoCategoriesPage.steps.verifyDeleteCategoryButton(1);
34
+ });
35
+
36
+ it('When the user clears a \'Category\' input field, \'Enter category title\' placeholder text should be displayed and when the user enters text in the input field, the placeholder should disappear', () => {
37
+ dragAndDropIntoCategoriesPage.steps.clearTextInCategoryInputField(0);
38
+ dragAndDropIntoCategoriesPage.steps.verifyPlaceholderTextInCategoryInputField(0);
39
+ dragAndDropIntoCategoriesPage.steps.enterTextInCategoryInputField(0, 'Category 1');
40
+ dragAndDropIntoCategoriesPage.steps.verifyPlaceholderTextNotExistInCategoryInputField(0);
41
+ });
42
+
43
+ it('CSS of Category section', { tags: 'css' }, () => {
44
+ dragAndDropIntoCategoriesPage.categoryLabel()
45
+ .verifyCSS(css.color.sectionHeading, css.fontSize.normal, css.fontWeight.semibold);
46
+ dragAndDropIntoCategoriesPage.categoryInputField()
47
+ .parents('[class*="OptionsComponentstyles__TitleWrapper"]')
48
+ .eq(0)
49
+ .within(() => {
50
+ dragAndDropIntoCategoriesPage.deleteButton()
51
+ .verifyPseudoClassBeforeProperty('color', css.color.deleteIcon);
52
+ dragAndDropIntoCategoriesPage.categoryInputField()
53
+ .verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
54
+ });
55
+ dragAndDropIntoCategoriesPage.addCategoryButton()
56
+ .verifyCSS(css.color.secondaryBtnActive, css.fontSize.default, css.fontWeight.medium);
57
+ });
58
+
59
+ it('\'Add category\' button should be present', () => {
60
+ dragAndDropIntoCategoriesPage.addCategoryButton()
61
+ .verifyInnerText('Add category')
62
+ .should('be.visible');
63
+ });
64
+
65
+ it('When user adds a category using the \'Add category\' button then added category input field should be displayed with \'Enter category title\' placeholder text, option numeration and delete button', () => {
66
+ dragAndDropIntoCategoriesPage.steps.addCategory();
67
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryInputFields(3);
68
+ dragAndDropIntoCategoriesPage.steps.verifyPlaceholderTextInCategoryInputField(2);
69
+ dragAndDropIntoCategoriesPage.steps.verifyNumerationOfCategoryInputFields();
70
+ dragAndDropIntoCategoriesPage.steps.verifyDeleteCategoryButton(2);
71
+ });
72
+
73
+ it('When the user focuses in and out of the \'Category\' input field, no error message should appear', () => {
74
+ dragAndDropIntoCategoriesPage.steps.focusInAndFocusOutOfCategoryInputField(2);
75
+ dragAndDropIntoCategoriesPage.steps.verifyErrorMessageIsNotDisplayed();
76
+ });
77
+
78
+ it('When the user hovers the delete button of the category input field, \'Delete category\' message should be displayed on a tooltip and the tooltip should disappear if focus is removed from the \'Delete\' icon button', () => {
79
+ dragAndDropIntoCategoriesPage.steps.verifyDeleteCategoryTooltip(0);
80
+ });
81
+
82
+ it('When user clicks on the \'Delete category\' button then the respective options input field should get deleted, option numeration should change accordingly', () => {
83
+ dragAndDropIntoCategoriesPage.steps.deleteCategoryInputField(0);
84
+ dragAndDropIntoCategoriesPage.steps.verifyNumerationOfCategoryInputFields();
85
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryInputFields(2);
86
+ });
87
+
88
+ it('The user should be able to delete all category input fields and only \'Category\' label and \'Add category\' button should be present', () => {
89
+ dragAndDropIntoCategoriesPage.steps.deleteCategoryInputField(0);
90
+ dragAndDropIntoCategoriesPage.steps.deleteCategoryInputField(0);
91
+ dragAndDropIntoCategoriesPage.categoryInputField()
92
+ .should('not.exist');
93
+ dragAndDropIntoCategoriesPage.categoryLabel()
94
+ .should('be.visible');
95
+ dragAndDropIntoCategoriesPage.addCategoryButton()
96
+ .should('be.visible');
97
+ });
98
+ });
99
+
100
+ describe('Category - Set correct answer section', () => {
101
+ abortEarlySetup();
102
+ before(() => {
103
+ cy.log('Navigating to drag and drop into categories question type');
104
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
105
+ cy.barsPreLoaderWait();
106
+ });
107
+
108
+ it('By default, two categories should be present with category titles \'Category #\' in the \'Set correct answer\' section', () => {
109
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryTitlesInSetCorrectAnswerSection(2);
110
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoriesInSetCorrectAnswerSection(2);
111
+ for (let categoryIndex = 0; categoryIndex < 2; categoryIndex++) {
112
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInSetCorrectAnswerSection(categoryIndex, `Category ${categoryIndex + 1}`);
113
+ };
114
+ });
115
+
116
+ it('When the user clears a \'Category\' input field, the category title should appear as blank and on entering the text again, the category title should update accordingly in the \'Set correct answer\' section', () => {
117
+ dragAndDropIntoCategoriesPage.steps.clearTextInCategoryInputField(0);
118
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInSetCorrectAnswerSection(0, '');
119
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryTitlesInSetCorrectAnswerSection(2);
120
+ dragAndDropIntoCategoriesPage.steps.enterTextInCategoryInputField(0, 'Category 1');
121
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInSetCorrectAnswerSection(0, 'Category 1');
122
+ });
123
+
124
+ it('CSS of Category in the \'Set correct answer\' section', { tags: 'css' }, () => {
125
+ dragAndDropIntoCategoriesPage.setCorrectAnswerSectionCategoryTitle()
126
+ .should('have.css', 'background-color', css.color.titleContainerBg)
127
+ .and('have.css', 'border', `1px solid ${css.color.titleContainerBorder}`)
128
+ .find('.question-text-wrapper')
129
+ .verifyCSS(css.color.text, css.fontSize.normal, css.fontWeight.semibold);
130
+ });
131
+
132
+ it('When the user adds a category using the \'Add category\' button then added category should be displayed with a blank category title in the \'Set correct answer\' section', () => {
133
+ dragAndDropIntoCategoriesPage.steps.addCategory();
134
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryTitlesInSetCorrectAnswerSection(3);
135
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoriesInSetCorrectAnswerSection(3);
136
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInSetCorrectAnswerSection(2, '');
137
+ });
138
+
139
+ it('When the user deletes a category, the respective category should get removed from the \'Set correct answer\' section and the titles of other categories should not get affected', () => {
140
+ cy.log('Pre step: Setting title for newly added category')
141
+ dragAndDropIntoCategoriesPage.steps.enterTextInCategoryInputField(2, 'Category 3');
142
+ dragAndDropIntoCategoriesPage.steps.deleteCategoryInputField(2);
143
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryTitlesInSetCorrectAnswerSection(2);
144
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoriesInSetCorrectAnswerSection(2);
145
+ for (let categoryIndex = 0; categoryIndex < 2; categoryIndex++) {
146
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInSetCorrectAnswerSection(categoryIndex, `Category ${categoryIndex + 1}`);
147
+ };
148
+ });
149
+
150
+ it('When the user deletes all categories, all the category titles should get removed and only one empty container should be displayed in the \'Set correct answer\' section', () => {
151
+ dragAndDropIntoCategoriesPage.steps.deleteCategoryInputField(0);
152
+ dragAndDropIntoCategoriesPage.steps.deleteCategoryInputField(0);
153
+ dragAndDropIntoCategoriesPage.setCorrectAnswerSectionCategoryTitle()
154
+ .should('not.exist');
155
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoriesInSetCorrectAnswerSection(1);
156
+ });
157
+
158
+ //need to add cases of scroll buttons appearing when more than 5 categories are added after this query gets resolved https://redmine.zeuslearning.com/issues/532267
159
+ //minimum width 110ox for a category height 100px
160
+ //TODO: the below case will be different for desktop and mobile view
161
+ it.skip('When the user adds more than __ categories, the categories should become scrollable and next and previous buttons with label \'Displaying # of #\' should appear in the \'Set correct answer\' section', () => {
162
+
163
+ });
164
+
165
+ it.skip('CSS of scrollable buttons and label', { tags: 'css' }, () => {
166
+
167
+ });
168
+
169
+ it.skip('Accessibility of scrollable buttons and label', { tags: 'css' }, () => {
170
+
171
+ });
172
+
173
+ it.skip('The user should be able to scroll across the categories using next and previous buttons', () => {
174
+
175
+ });
176
+
177
+ it.skip('When the user deletes some categories, the scroll buttons should disappear and all the categories should be visible in the \'Set correct answer\' section', () => {
178
+
179
+ });
180
+ });
181
+
182
+ describe('Category - Preview tab', () => {
183
+ abortEarlySetup();
184
+ before(() => {
185
+ cy.log('Navigating to drag and drop into categories question type');
186
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
187
+ cy.barsPreLoaderWait();
188
+ });
189
+
190
+ it('By default, two categories should be present with category titles \'Category #\' in the \'Preview\' tab', () => {
191
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
192
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryTitlesInPreviewTab(2);
193
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoriesInPreviewTab(2);
194
+ for (let categoryIndex = 0; categoryIndex < 2; categoryIndex++) {
195
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInPreviewTab(categoryIndex, `Category ${categoryIndex + 1}`);
196
+ };
197
+ });
198
+
199
+ it('When the user clears a \'Category\' input field, the category title should appear as blank and on entering the text again, the category title should update accordingly in the \'Preview\' tab', () => {
200
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
201
+ dragAndDropIntoCategoriesPage.steps.clearTextInCategoryInputField(0);
202
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
203
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInPreviewTab(0, '');
204
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryTitlesInPreviewTab(2);
205
+
206
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
207
+ dragAndDropIntoCategoriesPage.steps.enterTextInCategoryInputField(0, 'Category 1');
208
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
209
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInPreviewTab(0, 'Category 1');
210
+ });
211
+
212
+ it('CSS of Category in the \'Preview\' tab', { tags: 'css' }, () => {
213
+ dragAndDropIntoCategoriesPage.previewTabCategoryTitle()
214
+ .should('have.css', 'background-color', css.color.titleContainerBg)
215
+ .and('have.css', 'border', `1px solid ${css.color.titleContainerBorder}`)
216
+ .find('.question-text-wrapper')
217
+ .verifyCSS(css.color.text, css.fontSize.normal, css.fontWeight.semibold);
218
+ });
219
+
220
+ it('When the user adds a category using the \'Add category\' button then added category should be displayed with a blank category title in the \'Preview\' tab', () => {
221
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
222
+ dragAndDropIntoCategoriesPage.steps.addCategory();
223
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
224
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryTitlesInPreviewTab(3);
225
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoriesInPreviewTab(3);
226
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInPreviewTab(2, '');
227
+ });
228
+
229
+ it('When the user deletes a category, the category should get removed from the \'Set correct answer\' section and the titles of other categories should not get affected', () => {
230
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
231
+ cy.log('Pre step: Setting title for newly added category')
232
+ dragAndDropIntoCategoriesPage.steps.enterTextInCategoryInputField(2, 'Category 3');
233
+ dragAndDropIntoCategoriesPage.steps.deleteCategoryInputField(2);
234
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
235
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryTitlesInPreviewTab(2);
236
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoriesInPreviewTab(2);
237
+ for (let categoryIndex = 0; categoryIndex < 2; categoryIndex++) {
238
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInPreviewTab(categoryIndex, `Category ${categoryIndex + 1}`);
239
+ };
240
+ });
241
+
242
+ it('When the user deletes all categories, all the category titles should get removed and only one empty container should be displayed in the \'Preview\' tab', () => {
243
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
244
+ dragAndDropIntoCategoriesPage.steps.deleteCategoryInputField(0);
245
+ dragAndDropIntoCategoriesPage.steps.deleteCategoryInputField(0);
246
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
247
+ dragAndDropIntoCategoriesPage.previewTabCategoryTitle()
248
+ .should('not.exist');
249
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoriesInPreviewTab(1);
250
+ });
251
+
252
+ //need to add cases of scroll buttons appearing when more than 5 categories are added after this query gets resolved https://redmine.zeuslearning.com/issues/532267
253
+
254
+ //TODO: the below case will be different for desktop and mobile view
255
+ it('When the user adds more than __ categories, the categories should become scrollable and next and previous buttons with label \'Displaying # of #\' should appear in the \'Preview\' tab', () => {
256
+
257
+ });
258
+
259
+ it('CSS of scrollable buttons and label', { tags: 'css' }, () => {
260
+
261
+ });
262
+
263
+ it('Accessibility of scrollable buttons and label', { tags: 'css' }, () => {
264
+
265
+ });
266
+
267
+ it('The user should be able to scroll across the categories using next and previous buttons', () => {
268
+
269
+ });
270
+
271
+ it('When the user deletes some categories, the scroll buttons should disappear and all the categories should be visible in the \'Preview\' tab', () => {
272
+
273
+ });
274
+ });
275
+ });