itemengine-cypress-automation 1.0.30 → 1.0.31

Sign up to get free protection for your applications and to get access to all the features.
Files changed (22) hide show
  1. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesAdditionalSettings.js +963 -0
  2. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesClickAndDrop.js +669 -0
  3. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesEditTabScoringTypes.js +205 -0
  4. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesGroupedOptionsAllOrNothing.js +143 -0
  5. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesGroupedOptionsPartialScoreForEachCell.js +145 -0
  6. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesGroupedOptionsPartialScoreForEachResponse.js +141 -0
  7. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesGroupedOptionsTotalScoreDividedBetweenCell.js +165 -0
  8. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesGroupedOptionsTotalScoreDividedBetweenResponses.js +420 -0
  9. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesGroupedSetCorrectAnswerCheckboxes.js +266 -0
  10. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesHeaderSection.js +83 -0
  11. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesManuallyAndNonScored.js +184 -0
  12. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesResponseOptionsSection.js +112 -0
  13. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesRowsAndCategoriesSection.js +569 -0
  14. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesSetCorrectAnswerSection.js +130 -0
  15. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesStandardAllOrNothing.js +186 -0
  16. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesStandardPartialScoreForEachCell.js +145 -0
  17. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesStandardPartialScoreForEachResponse.js +140 -0
  18. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesStandardSetCorrectAnswerCheckboxes.js +234 -0
  19. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesStandardTotalScoreDividedBetweenCell.js +165 -0
  20. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesStandardTotalScoreDividedBetweenResponse.js +420 -0
  21. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesSwitchingCases.js +45 -0
  22. package/package.json +1 -1
@@ -0,0 +1,569 @@
1
+ import { dragAndDropIntoCategoriesPage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ const css = Cypress.env('css');
4
+ describe('Create Item page - Drag and drop into categories: Question instructions, Category, Row', () => {
5
+ before(() => {
6
+ cy.loginAs('admin');
7
+ });
8
+
9
+ describe('Question Instructions input field - Edit tab', () => {
10
+ abortEarlySetup();
11
+ before(() => {
12
+ cy.log('Navigating to drag and drop into categories question type');
13
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
14
+ });
15
+
16
+ dragAndDropIntoCategoriesPage.tests.verifyQuestionInstructionsInputFieldEditTab();
17
+ });
18
+
19
+ describe('Question Instructions input field - Preview tab', () => {
20
+ abortEarlySetup();
21
+ before(() => {
22
+ cy.log('Navigating to drag and drop into categories question type');
23
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
24
+ });
25
+
26
+ dragAndDropIntoCategoriesPage.tests.verifyQuestionInstructionsInputFieldPreviewTab();
27
+ });
28
+
29
+ describe('Category - Basic', () => {
30
+ abortEarlySetup();
31
+ before(() => {
32
+ cy.log('Navigating to drag and drop into categories question type');
33
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
34
+ cy.barsPreLoaderWait();
35
+ });
36
+
37
+ it('\'Category\' label should be displayed', () => {
38
+ dragAndDropIntoCategoriesPage.categoryLabel()
39
+ .verifyInnerText('Category')
40
+ .should('be.visible');
41
+ });
42
+
43
+ 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', () => {
44
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryInputFields(2);
45
+ for (let categoryIndex = 0; categoryIndex < 2; categoryIndex++) {
46
+ dragAndDropIntoCategoriesPage.categoryInputField()
47
+ .eq(categoryIndex)
48
+ .should('have.text', `Category ${categoryIndex + 1}`);
49
+ };
50
+ dragAndDropIntoCategoriesPage.steps.verifyNumerationOfCategoryInputFields();
51
+ dragAndDropIntoCategoriesPage.steps.verifyDeleteCategoryButton(0);
52
+ dragAndDropIntoCategoriesPage.steps.verifyDeleteCategoryButton(1);
53
+ });
54
+
55
+ 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', () => {
56
+ dragAndDropIntoCategoriesPage.steps.clearTextInCategoryInputField(0);
57
+ dragAndDropIntoCategoriesPage.steps.verifyPlaceholderTextInCategoryInputField(0);
58
+ dragAndDropIntoCategoriesPage.steps.enterTextInCategoryInputField(0, 'Category 1');
59
+ dragAndDropIntoCategoriesPage.steps.verifyPlaceholderTextNotExistInCategoryInputField(0);
60
+ });
61
+
62
+ it('CSS of Category section', { tags: 'css' }, () => {
63
+ dragAndDropIntoCategoriesPage.categoryLabel()
64
+ .verifyCSS(css.color.sectionHeading, css.fontSize.normal, css.fontWeight.semibold);
65
+ dragAndDropIntoCategoriesPage.categoryInputField()
66
+ .parents('[class*="OptionsComponentstyles__TitleWrapper"]')
67
+ .eq(0)
68
+ .within(() => {
69
+ dragAndDropIntoCategoriesPage.deleteButton()
70
+ .verifyPseudoClassBeforeProperty('color', css.color.deleteIcon);
71
+ dragAndDropIntoCategoriesPage.categoryInputField()
72
+ .verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
73
+ });
74
+ dragAndDropIntoCategoriesPage.addCategoryButton()
75
+ .verifyCSS(css.color.secondaryBtnActive, css.fontSize.default, css.fontWeight.medium);
76
+ });
77
+
78
+ it('\'Add category\' button should be present', () => {
79
+ dragAndDropIntoCategoriesPage.addCategoryButton()
80
+ .verifyInnerText('Add category')
81
+ .should('be.visible');
82
+ });
83
+
84
+ 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', () => {
85
+ dragAndDropIntoCategoriesPage.steps.addCategory();
86
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryInputFields(3);
87
+ dragAndDropIntoCategoriesPage.steps.verifyPlaceholderTextInCategoryInputField(2);
88
+ dragAndDropIntoCategoriesPage.steps.verifyNumerationOfCategoryInputFields();
89
+ dragAndDropIntoCategoriesPage.steps.verifyDeleteCategoryButton(2);
90
+ });
91
+
92
+ it('When the user focuses in and out of the \'Category\' input field, no error message should appear', () => {
93
+ dragAndDropIntoCategoriesPage.steps.focusInAndFocusOutOfCategoryInputField(2);
94
+ dragAndDropIntoCategoriesPage.steps.verifyErrorMessageIsNotDisplayed();
95
+ });
96
+
97
+ 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', () => {
98
+ dragAndDropIntoCategoriesPage.steps.verifyDeleteCategoryTooltip(0);
99
+ });
100
+
101
+ it('When user clicks on the \'Delete category\' button then the respective options input field should get deleted, option numeration should change accordingly', () => {
102
+ dragAndDropIntoCategoriesPage.steps.deleteCategoryInputField(0);
103
+ dragAndDropIntoCategoriesPage.steps.verifyNumerationOfCategoryInputFields();
104
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryInputFields(2);
105
+ });
106
+
107
+ it('The user should be able to delete all category input fields and only \'Category\' label and \'Add category\' button should be present', () => {
108
+ dragAndDropIntoCategoriesPage.steps.deleteCategoryInputField(0);
109
+ dragAndDropIntoCategoriesPage.steps.deleteCategoryInputField(0);
110
+ dragAndDropIntoCategoriesPage.categoryInputField()
111
+ .should('not.exist');
112
+ dragAndDropIntoCategoriesPage.categoryLabel()
113
+ .should('be.visible');
114
+ dragAndDropIntoCategoriesPage.addCategoryButton()
115
+ .should('be.visible');
116
+ });
117
+ });
118
+
119
+ describe('Category - Set correct answer section', () => {
120
+ abortEarlySetup();
121
+ before(() => {
122
+ cy.log('Navigating to drag and drop into categories question type');
123
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
124
+ cy.barsPreLoaderWait();
125
+ });
126
+
127
+ it('By default, two categories should be present with category titles \'Category #\' in the \'Set correct answer\' section', () => {
128
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryTitlesInSetCorrectAnswerSection(2);
129
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoriesInSetCorrectAnswerSection(2);
130
+ for (let categoryIndex = 0; categoryIndex < 2; categoryIndex++) {
131
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInSetCorrectAnswerSection(categoryIndex, `Category ${categoryIndex + 1}`);
132
+ };
133
+ });
134
+
135
+ 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', () => {
136
+ dragAndDropIntoCategoriesPage.steps.clearTextInCategoryInputField(0);
137
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInSetCorrectAnswerSection(0, '');
138
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryTitlesInSetCorrectAnswerSection(2);
139
+ dragAndDropIntoCategoriesPage.steps.enterTextInCategoryInputField(0, 'Category 1');
140
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInSetCorrectAnswerSection(0, 'Category 1');
141
+ });
142
+
143
+ it('CSS of Category in the \'Set correct answer\' section', { tags: 'css' }, () => {
144
+ dragAndDropIntoCategoriesPage.setCorrectAnswerSectionCategoryTitle()
145
+ .should('have.css', 'background-color', css.color.titleContainerBg)
146
+ .and('have.css', 'border', `1px solid ${css.color.titleContainerBorder}`)
147
+ .find('.question-text-wrapper')
148
+ .verifyCSS(css.color.text, css.fontSize.normal, css.fontWeight.semibold);
149
+ });
150
+
151
+ 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', () => {
152
+ dragAndDropIntoCategoriesPage.steps.addCategory();
153
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryTitlesInSetCorrectAnswerSection(3);
154
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoriesInSetCorrectAnswerSection(3);
155
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInSetCorrectAnswerSection(2, '');
156
+ });
157
+
158
+ 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', () => {
159
+ cy.log('Pre step: Setting title for newly added category')
160
+ dragAndDropIntoCategoriesPage.steps.enterTextInCategoryInputField(2, 'Category 3');
161
+ dragAndDropIntoCategoriesPage.steps.deleteCategoryInputField(2);
162
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryTitlesInSetCorrectAnswerSection(2);
163
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoriesInSetCorrectAnswerSection(2);
164
+ for (let categoryIndex = 0; categoryIndex < 2; categoryIndex++) {
165
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInSetCorrectAnswerSection(categoryIndex, `Category ${categoryIndex + 1}`);
166
+ };
167
+ });
168
+
169
+ 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', () => {
170
+ dragAndDropIntoCategoriesPage.steps.deleteCategoryInputField(0);
171
+ dragAndDropIntoCategoriesPage.steps.deleteCategoryInputField(0);
172
+ dragAndDropIntoCategoriesPage.setCorrectAnswerSectionCategoryTitle()
173
+ .should('not.exist');
174
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoriesInSetCorrectAnswerSection(1);
175
+ });
176
+
177
+ //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
178
+ //minimum width 110ox for a category height 100px
179
+ //TODO: the below case will be different for desktop and mobile view
180
+ 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', () => {
181
+
182
+ });
183
+
184
+ it.skip('CSS of scrollable buttons and label', { tags: 'css' }, () => {
185
+
186
+ });
187
+
188
+ it.skip('Accessibility of scrollable buttons and label', { tags: 'css' }, () => {
189
+
190
+ });
191
+
192
+ it.skip('The user should be able to scroll across the categories using next and previous buttons', () => {
193
+
194
+ });
195
+
196
+ 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', () => {
197
+
198
+ });
199
+ });
200
+
201
+ describe('Category - Preview tab', () => {
202
+ abortEarlySetup();
203
+ before(() => {
204
+ cy.log('Navigating to drag and drop into categories question type');
205
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
206
+ cy.barsPreLoaderWait();
207
+ });
208
+
209
+ it('By default, two categories should be present with category titles \'Category #\' in the \'Preview\' tab', () => {
210
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
211
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryTitlesInPreviewTab(2);
212
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoriesInPreviewTab(2);
213
+ for (let categoryIndex = 0; categoryIndex < 2; categoryIndex++) {
214
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInPreviewTab(categoryIndex, `Category ${categoryIndex + 1}`);
215
+ };
216
+ });
217
+
218
+ 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', () => {
219
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
220
+ dragAndDropIntoCategoriesPage.steps.clearTextInCategoryInputField(0);
221
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
222
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInPreviewTab(0, '');
223
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryTitlesInPreviewTab(2);
224
+
225
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
226
+ dragAndDropIntoCategoriesPage.steps.enterTextInCategoryInputField(0, 'Category 1');
227
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
228
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInPreviewTab(0, 'Category 1');
229
+ });
230
+
231
+ it('CSS of Category in the \'Preview\' tab', { tags: 'css' }, () => {
232
+ dragAndDropIntoCategoriesPage.previewTabCategoryTitle()
233
+ .should('have.css', 'background-color', css.color.titleContainerBg)
234
+ .and('have.css', 'border', `1px solid ${css.color.titleContainerBorder}`)
235
+ .find('.question-text-wrapper')
236
+ .verifyCSS(css.color.text, css.fontSize.normal, css.fontWeight.semibold);
237
+ });
238
+
239
+ 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', () => {
240
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
241
+ dragAndDropIntoCategoriesPage.steps.addCategory();
242
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
243
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryTitlesInPreviewTab(3);
244
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoriesInPreviewTab(3);
245
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInPreviewTab(2, '');
246
+ });
247
+
248
+ 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', () => {
249
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
250
+ cy.log('Pre step: Setting title for newly added category')
251
+ dragAndDropIntoCategoriesPage.steps.enterTextInCategoryInputField(2, 'Category 3');
252
+ dragAndDropIntoCategoriesPage.steps.deleteCategoryInputField(2);
253
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
254
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoryTitlesInPreviewTab(2);
255
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoriesInPreviewTab(2);
256
+ for (let categoryIndex = 0; categoryIndex < 2; categoryIndex++) {
257
+ dragAndDropIntoCategoriesPage.steps.verifyCategoryTitleInPreviewTab(categoryIndex, `Category ${categoryIndex + 1}`);
258
+ };
259
+ });
260
+
261
+ 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', () => {
262
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
263
+ dragAndDropIntoCategoriesPage.steps.deleteCategoryInputField(0);
264
+ dragAndDropIntoCategoriesPage.steps.deleteCategoryInputField(0);
265
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
266
+ dragAndDropIntoCategoriesPage.previewTabCategoryTitle()
267
+ .should('not.exist');
268
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfCategoriesInPreviewTab(1);
269
+ });
270
+
271
+ //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
272
+
273
+ //TODO: the below case will be different for desktop and mobile view
274
+ 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', () => {
275
+
276
+ });
277
+
278
+ it('CSS of scrollable buttons and label', { tags: 'css' }, () => {
279
+
280
+ });
281
+
282
+ it('Accessibility of scrollable buttons and label', { tags: 'css' }, () => {
283
+
284
+ });
285
+
286
+ it('The user should be able to scroll across the categories using next and previous buttons', () => {
287
+
288
+ });
289
+
290
+ it('When the user deletes some categories, the scroll buttons should disappear and all the categories should be visible in the \'Preview\' tab', () => {
291
+
292
+ });
293
+ });
294
+
295
+ describe('Row - Basic', () => {
296
+ abortEarlySetup();
297
+ before(() => {
298
+ cy.log('Navigating to drag and drop into categories question type');
299
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
300
+ cy.barsPreLoaderWait();
301
+ });
302
+
303
+ it('\'Row\' label should be displayed', () => {
304
+ dragAndDropIntoCategoriesPage.rowLabel()
305
+ .verifyInnerText('Row')
306
+ .should('be.visible');
307
+ });
308
+
309
+ it('By default, 1 empty \'Row\' input field with \'Enter Row title\' placeholder text, numeration and disabled \'Delete row\' icon button should be displayed', () => {
310
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfRowInputFields(1);
311
+ dragAndDropIntoCategoriesPage.steps.verifyDefaultStateOfRowInputField(0);
312
+ dragAndDropIntoCategoriesPage.steps.verifyDisabledDeleteRowButton(0);
313
+ });
314
+
315
+ it('The user should be able to enter text in the \'Row\' input field and when the user enters text in the input field, the placeholder should disappear', () => {
316
+ dragAndDropIntoCategoriesPage.steps.verifyPlaceholderTextInRowInputField(0);
317
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowInputField(0, 'Row 1');
318
+ dragAndDropIntoCategoriesPage.steps.verifyPlaceholderTextNotExistInRowInputField(0);
319
+ });
320
+
321
+ it('CSS of \'Row\' section', { tags: 'css' }, () => {
322
+ dragAndDropIntoCategoriesPage.rowLabel()
323
+ .verifyCSS(css.color.sectionHeading, css.fontSize.normal, css.fontWeight.semibold);
324
+ dragAndDropIntoCategoriesPage.rowInputField()
325
+ .parents('[class*="OptionsComponentstyles__TitleWrapper"]')
326
+ .within(() => {
327
+ dragAndDropIntoCategoriesPage.deleteButton()
328
+ .should('have.css', 'opacity', '0.5')
329
+ .verifyPseudoClassBeforeProperty('color', css.color.deleteIcon);
330
+ dragAndDropIntoCategoriesPage.rowInputField()
331
+ .verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
332
+ });
333
+ dragAndDropIntoCategoriesPage.addRowButton()
334
+ .verifyCSS(css.color.secondaryBtnActive, css.fontSize.default, css.fontWeight.medium);
335
+ });
336
+
337
+ it('When the user hovers disabled \'Delete row\' icon button of the row input field, \'Minimum one row is required\' message should be displayed on a tooltip and the tooltip should disappear if focus is removed from the \'Delete row\' icon button', () => {
338
+ dragAndDropIntoCategoriesPage.steps.verifyDisabledRowInputFieldTooltip();
339
+ });
340
+
341
+ it('CSS of disabled \'Delete row\' tooltip', { tags: 'css' }, () => {
342
+ dragAndDropIntoCategoriesPage.rowInputField()
343
+ .parents('[class*="OptionsComponentstyles__TitleWrapper"]')
344
+ .within(() => {
345
+ dragAndDropIntoCategoriesPage.deleteButton()
346
+ .trigger('mouseover', { force: true });
347
+ });
348
+ dragAndDropIntoCategoriesPage.tooltipText()
349
+ .should('be.visible')
350
+ .verifyCSS(css.color.whiteText, css.fontSize.normal, css.fontWeight.regular);
351
+ dragAndDropIntoCategoriesPage.rowInputField()
352
+ .parents('[class*="OptionsComponentstyles__TitleWrapper"]')
353
+ .within(() => {
354
+ dragAndDropIntoCategoriesPage.deleteButton()
355
+ .trigger('mouseout', { force: true });
356
+ });
357
+ dragAndDropIntoCategoriesPage.tooltipText()
358
+ .should('not.exist');
359
+ });
360
+
361
+ it('Accessibility of disabled \'Delete row\' tooltip', { tags: 'a11y' }, () => {
362
+ dragAndDropIntoCategoriesPage.rowInputField()
363
+ .parents('[class*="OptionsComponentstyles__TitleWrapper"]')
364
+ .within(() => {
365
+ dragAndDropIntoCategoriesPage.deleteButton()
366
+ .trigger('mouseover', { force: true });
367
+ });
368
+ cy.checkAccessibility(dragAndDropIntoCategoriesPage.tooltipText());
369
+ dragAndDropIntoCategoriesPage.rowInputField()
370
+ .parents('[class*="OptionsComponentstyles__TitleWrapper"]')
371
+ .within(() => {
372
+ dragAndDropIntoCategoriesPage.deleteButton()
373
+ .trigger('mouseout', { force: true });
374
+ });
375
+ dragAndDropIntoCategoriesPage.tooltipText()
376
+ .should('not.exist');
377
+ });
378
+
379
+ it('\'Add row\' button should be present', () => {
380
+ dragAndDropIntoCategoriesPage.addRowButton()
381
+ .verifyInnerText('Add row')
382
+ .should('be.visible');
383
+ });
384
+
385
+ it('When user adds a row using the \'Add row\' button then added row input field should be empty and displayed with \'Enter Row title\' placeholder text, option numeration and delete button', () => {
386
+ dragAndDropIntoCategoriesPage.steps.addRow();
387
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfRowInputFields(2);
388
+ dragAndDropIntoCategoriesPage.steps.verifyDefaultStateOfRowInputField(1);
389
+ dragAndDropIntoCategoriesPage.steps.verifyEnabledDeleteRowButton(1);
390
+ dragAndDropIntoCategoriesPage.steps.verifyNumerationOfRowInputFields();
391
+ });
392
+
393
+ it('When the user focuses in and out of the \'Row\' input field, no error message should appear', () => {
394
+ dragAndDropIntoCategoriesPage.steps.focusInAndFocusOutOfRowInputField(1)
395
+ dragAndDropIntoCategoriesPage.steps.verifyErrorMessageIsNotDisplayed();
396
+ });
397
+
398
+ it('When more than 1 row input fields are present, the \'Delete row\' icon buttons of the row input field should get enabled', () => {
399
+ dragAndDropIntoCategoriesPage.steps.verifyEnabledDeleteRowButton(0);
400
+ dragAndDropIntoCategoriesPage.steps.verifyEnabledDeleteRowButton(1);
401
+ });
402
+
403
+ it('CSS of enabled \'Delete row\' icon button', { tags: 'css' }, () => {
404
+ dragAndDropIntoCategoriesPage.rowInputField()
405
+ .eq(0)
406
+ .parents('[class*="OptionsComponentstyles__TitleWrapper"]')
407
+ .within(() => {
408
+ dragAndDropIntoCategoriesPage.deleteButton()
409
+ .should('have.css', 'opacity', '1')
410
+ .verifyPseudoClassBeforeProperty('color', css.color.deleteIcon);
411
+ });
412
+ });
413
+
414
+ it('Accessibility of enabled \'Delete row\' icon button', { tags: 'a11y' }, () => {
415
+ cy.checkAccessibility(dragAndDropIntoCategoriesPage.rowInputField().parents('[class*="OptionsComponentstyles__TitleWrapper"]'));
416
+ });
417
+
418
+ it('When the user hovers over the enabled \'Delete row\' icon button, then \'Delete row\' message should be displayed on a tooltip and the tooltip should disappear if focus is removed from the \'Delete row\' icon button', () => {
419
+ dragAndDropIntoCategoriesPage.steps.verifyEnabledDeleteRowInputFieldTooltip(0);
420
+ });
421
+
422
+ it('CSS of enabled \'Delete row\' tooltip', { tags: 'css' }, () => {
423
+ dragAndDropIntoCategoriesPage.rowInputField()
424
+ .eq(0)
425
+ .parents('[class*="OptionsComponentstyles__TitleWrapper"]')
426
+ .within(() => {
427
+ dragAndDropIntoCategoriesPage.deleteButton()
428
+ .trigger('mouseover');
429
+ });
430
+ dragAndDropIntoCategoriesPage.tooltipText()
431
+ .should('be.visible')
432
+ .verifyCSS(css.color.whiteText, css.fontSize.normal, css.fontWeight.regular);
433
+ dragAndDropIntoCategoriesPage.rowInputField()
434
+ .eq(0)
435
+ .parents('[class*="OptionsComponentstyles__TitleWrapper"]')
436
+ .within(() => {
437
+ dragAndDropIntoCategoriesPage.deleteButton()
438
+ .trigger('mouseout');
439
+ });
440
+ dragAndDropIntoCategoriesPage.tooltipText()
441
+ .should('not.exist');
442
+ });
443
+
444
+ it('Accessibility of enabled \'Delete row\' tooltip', { tags: 'a11y' }, () => {
445
+ dragAndDropIntoCategoriesPage.rowInputField()
446
+ .eq(0)
447
+ .parents('[class*="OptionsComponentstyles__TitleWrapper"]')
448
+ .within(() => {
449
+ dragAndDropIntoCategoriesPage.deleteButton()
450
+ .trigger('mouseover');
451
+ });
452
+ cy.checkAccessibility(dragAndDropIntoCategoriesPage.tooltipText());
453
+ dragAndDropIntoCategoriesPage.rowInputField()
454
+ .eq(0)
455
+ .parents('[class*="OptionsComponentstyles__TitleWrapper"]')
456
+ .within(() => {
457
+ dragAndDropIntoCategoriesPage.deleteButton()
458
+ .trigger('mouseout');
459
+ });
460
+ dragAndDropIntoCategoriesPage.tooltipText()
461
+ .should('not.exist');
462
+ });
463
+
464
+ it('When user clicks on the \'Delete row\' icon button then the respective row input field should get deleted, option numeration should change accordingly', () => {
465
+ dragAndDropIntoCategoriesPage.steps.deleteRowInputField(0);
466
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfRowInputFields(1);
467
+ dragAndDropIntoCategoriesPage.steps.verifyNumerationOfRowInputFields();
468
+ });
469
+
470
+ it('When only one row input field is present, the \'Delete row\' icon button should get disabled', () => {
471
+ dragAndDropIntoCategoriesPage.steps.verifyDisabledDeleteRowButton(0);
472
+ });
473
+ });
474
+
475
+ describe('Row - Set correct answer section', () => {
476
+ abortEarlySetup();
477
+ before(() => {
478
+ cy.log('Navigating to drag and drop into categories question type');
479
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
480
+ cy.barsPreLoaderWait();
481
+ });
482
+
483
+ it('By default, one row with no row title should be displayed in the \'Set correct answer\' section', () => {
484
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfRowsInSetCorrectAnswerSection(1);
485
+ dragAndDropIntoCategoriesPage.setCorrectAnswerSectionRowTitle()
486
+ .should('not.exist');
487
+ });
488
+
489
+ it('When the user adds a row title, a row title should be displayed in the \'Set correct answer\' section', () => {
490
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowInputField(0, 'Row 1');
491
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleInSetCorrectAnswerSection(0, 'Row 1');
492
+ });
493
+
494
+ it('CSS of \'Row\' in the \'Set correct answer\' section', { tags: 'css' }, () => {
495
+ dragAndDropIntoCategoriesPage.setCorrectAnswerSectionRowTitle()
496
+ .should('have.css', 'background-color', css.color.titleContainerBg)
497
+ .and('have.css', 'border', `1px solid ${css.color.titleContainerBorder}`)
498
+ .find('.question-text-wrapper')
499
+ .verifyCSS(css.color.text, css.fontSize.normal, css.fontWeight.semibold);
500
+ });
501
+
502
+ it('When user adds a row using the \'Add row\' button then added row should be displayed with a blank row title in the \'Set correct answer\' section', () => {
503
+ dragAndDropIntoCategoriesPage.steps.addRow();
504
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfRowsInSetCorrectAnswerSection(2);
505
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfRowTitlesInSetCorrectAnswerSection(2);
506
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleInSetCorrectAnswerSection(1, '');
507
+ });
508
+
509
+ it('When the user deletes a row, the respective row should get removed from the \'Set correct answer\' section and the titles of other rows should not get affected', () => {
510
+ cy.log('Entering text in 2nd row input field')
511
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowInputField(1, 'Row 2');
512
+ dragAndDropIntoCategoriesPage.steps.deleteRowInputField(0);
513
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfRowsInSetCorrectAnswerSection(1);
514
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfRowTitlesInSetCorrectAnswerSection(1);
515
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleInSetCorrectAnswerSection(0, 'Row 2');
516
+ });
517
+ });
518
+
519
+ describe('Row - Preview tab', () => {
520
+ abortEarlySetup();
521
+ before(() => {
522
+ cy.log('Navigating to drag and drop into categories question type');
523
+ dragAndDropIntoCategoriesPage.steps.navigateToCreateQuestion('drag and drop into categories');
524
+ cy.barsPreLoaderWait();
525
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
526
+ });
527
+
528
+ it('When the user has not added any row title, no row title should be displayed in the \'Preview\' tab', () => {
529
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfRowsInPreviewTab(1);
530
+ dragAndDropIntoCategoriesPage.previewTabRowTitle()
531
+ .should('not.exist');
532
+ });
533
+
534
+ it('When the user adds a row title, a row title should be displayed in the \'Preview\' tab', () => {
535
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
536
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowInputField(0, 'Row 1');
537
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
538
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleInPreviewTab(0, 'Row 1');
539
+ });
540
+
541
+ it('CSS of \'Row\' in the \'Preview\' tab', { tags: 'css' }, () => {
542
+ dragAndDropIntoCategoriesPage.previewTabRowTitle()
543
+ .should('have.css', 'background-color', css.color.titleContainerBg)
544
+ .and('have.css', 'border', `1px solid ${css.color.titleContainerBorder}`)
545
+ .find('.question-text-wrapper')
546
+ .verifyCSS(css.color.text, css.fontSize.normal, css.fontWeight.semibold);
547
+ });
548
+
549
+ it('When user adds a row using the \'Add row\' button then added row should be displayed with a blank row title in the \'Preview\' tab', () => {
550
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
551
+ dragAndDropIntoCategoriesPage.steps.addRow();
552
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
553
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfRowsInPreviewTab(2);
554
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfRowTitlesInPreviewTab(2);
555
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleInPreviewTab(1, '');
556
+ });
557
+
558
+ it('When the user deletes a row, the respective row should get removed from the \'Preview\' tab and the titles of other rows should not get affected', () => {
559
+ dragAndDropIntoCategoriesPage.steps.switchToEditTab();
560
+ cy.log('Entering text in 2nd row input field')
561
+ dragAndDropIntoCategoriesPage.steps.enterTextInRowInputField(1, 'Row 2');
562
+ dragAndDropIntoCategoriesPage.steps.deleteRowInputField(0);
563
+ dragAndDropIntoCategoriesPage.steps.switchToPreviewTab();
564
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfRowsInPreviewTab(1);
565
+ dragAndDropIntoCategoriesPage.steps.verifyCountOfRowTitlesInPreviewTab(1);
566
+ dragAndDropIntoCategoriesPage.steps.verifyRowTitleInPreviewTab(0, 'Row 2');
567
+ });
568
+ });
569
+ });