itemengine-cypress-automation 1.0.72 → 1.0.73

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. package/cypress/e2e/ILC/AudioResponse/{audioResponseMinimalPreviewSection.js → audioResponseMinimalPreviewSection.smoke.js} +263 -254
  2. package/cypress/e2e/ILC/AudioResponse/{audioResponseStandardPreviewSection.js → audioResponseStandardPreviewSection.smoke.js} +100 -97
  3. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesScoring/groupedOptionsAllOrNothing.smoke.js +121 -0
  4. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesScoring/{groupedOptionsPartialScoreForEachCell.js → groupedOptionsPartialScoreForEachCell.smoke.js} +1 -1
  5. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesScoring/{groupedOptionsPartialScoreForEachResponse.js → groupedOptionsPartialScoreForEachResponse.smoke.js} +1 -1
  6. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesScoring/standardAllOrNothing.smoke.js +164 -0
  7. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesScoring/{standardTotalScoreDividedBetweenResponse.js → standardTotalScoreDividedBetweenResponse.smoke.js} +21 -18
  8. package/cypress/e2e/ILC/EditTabSettingPage/ItemPreviewSettingsTabContent.js +753 -0
  9. package/cypress/e2e/ILC/EssayResponse/essayResponseCreateCustomCategory.smoke.js +943 -0
  10. package/cypress/e2e/ILC/EssayResponse/{essayResponseCustomizeFormattingOptions1.js → essayResponseCustomizeFormattingOptions1.smoke.js} +113 -110
  11. package/cypress/e2e/ILC/EssayResponse/essayResponseEquationEditor.smoke.js +581 -0
  12. package/cypress/e2e/ILC/EssayResponse/essayResponseGradingViewAndCorrectAnswerViewContents.smoke.js +111 -0
  13. package/cypress/e2e/ILC/EssayResponse/{essayResponsePreviewContentsForAllViews.js → essayResponsePreviewContentsForAllViews.smoke.js} +6 -3
  14. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropGroupedEditTab.smoke.js +81 -0
  15. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/{fillInTheGapsDragAndDropGroupedOptionsAllOrNothingScoring.js → fillInTheGapsDragAndDropGroupedOptionsAllOrNothingScoring.smoke.js} +25 -22
  16. package/cypress/e2e/ILC/FillInTheGapsDropdown/{fillInTheGapsDropdownAllOrNothingScoring.js → fillInTheGapsDropdownAllOrNothingScoring.smoke.js} +16 -14
  17. package/cypress/e2e/ILC/{fillInTheGapsOverImageDropdown/fillInTheGapsOverImageDropdownAddResponseContainer.js → FillInTheGapsOverImageDropdown/fillInTheGapsOverImageDropdownAddResponseContainer.smoke.js} +80 -74
  18. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdown/fillInTheGapsOverImageDropdownAllOrNothingScoring.smoke.js +361 -0
  19. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdown/fillInTheGapsOverImageDropdownEditAriaLabelCheckbox.smoke.js +137 -0
  20. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdown/fillInTheGapsOverImageDropdownImageProperties.smoke.js +171 -0
  21. package/cypress/e2e/ILC/{fillInTheGapsOverImageDropdown/fillInTheGapsOverImageDropdownPreviewTab.js → FillInTheGapsOverImageDropdown/fillInTheGapsOverImageDropdownPreviewTab.smoke.js} +1 -1
  22. package/cypress/e2e/ILC/FillInTheGapsOverImageText/{fillInTheGapsOverImageTextAllOrNothingScoring.js → fillInTheGapsOverImageTextAllOrNothingScoring.smoke.js} +32 -29
  23. package/cypress/e2e/ILC/FillInTheGapsOverImageText/{fillInTheGapsOverImageTextCheckAnswerForAllViews.js → fillInTheGapsOverImageTextCheckAnswerForAllViews.smoke.js} +5 -3
  24. package/cypress/e2e/ILC/FillInTheGapsOverImageText/fillInTheGapsOverImageTextEditAriaLabelCheckbox.smoke.js +137 -0
  25. package/cypress/e2e/ILC/FillInTheGapsOverImageText/fillInTheGapsOverImageTextEditTabBasicSection.smoke.js +146 -0
  26. package/cypress/e2e/ILC/FillInTheGapsOverImageText/{fillInTheGapsOverImageTextPreviewContentsForAllViews.js → fillInTheGapsOverImageTextPreviewContentsForAllViews.smoke.js} +5 -3
  27. package/cypress/e2e/ILC/FillInTheGapsOverImageText/{fillInTheGapsOverImageTextPreviewTab.js → fillInTheGapsOverImageTextPreviewTab.smoke.js} +1 -1
  28. package/cypress/e2e/ILC/FillInTheGapsOverImageText/{fillInTheGapsOverImageTextShowCorrectAnswerForAllView.js → fillInTheGapsOverImageTextShowCorrectAnswerForAllView.smoke.js} +6 -4
  29. package/cypress/e2e/ILC/FillInTheGapsText/{fillInTheGapsTextAutoScoredScoring.js → fillInTheGapsTextAutoScoredScoring.smoke.js} +12 -9
  30. package/cypress/e2e/ILC/Highlight/HighlightScoring/{allOrNothingScoring.js → allOrNothingScoring.smoke.js} +36 -34
  31. package/cypress/e2e/ILC/Highlight/HighlightScoring/highlightBasicScoringForTextSelectionTypes.smoke.js +462 -0
  32. package/cypress/e2e/ILC/Highlight/highlightColorLibraryFlyout.smoke.js +148 -0
  33. package/cypress/e2e/ILC/Highlight/highlightQuestionInstructionsAndQuestion.smoke.js +185 -0
  34. package/cypress/e2e/ILC/HighlightImage/highlightImageEditTabBasic.smoke.js +138 -0
  35. package/cypress/e2e/ILC/HighlightImage/{highlightImagePreviewTab.js → highlightImagePreviewTab.smoke.js} +1 -1
  36. package/cypress/e2e/ILC/HighlightImage/{highlightImageToolsFunctionalityPreviewTab.js → highlightImageToolsFunctionalityPreviewTab.smoke.js} +4 -4
  37. package/cypress/e2e/ILC/ListMatching/ListMatchingScoring/groupedOptionsAllOrNothingScoring.smoke.js +122 -0
  38. package/cypress/e2e/ILC/ListMatching/{listMatchingAlternateAnswer.js → listMatchingAlternateAnswer.smoke.js} +47 -43
  39. package/cypress/e2e/ILC/ListMatching/listMatchingGroupedOptionsSection.smoke.js +211 -0
  40. package/cypress/e2e/ILC/ListMatching/listMatchingQuestionInstructionsAndStemsSection.smoke.js +254 -0
  41. package/cypress/e2e/ILC/ListMatching/listMatchingStandardOptionsSetCorrectAnswerCheckboxesPreviewTab.smoke.js +191 -0
  42. package/cypress/e2e/ILC/ListOrdering/ListOrderingScoring/{allOrNothingScoring.js → allOrNothingScoring.smoke.js} +34 -32
  43. package/cypress/e2e/ILC/ListSorting/ListSortingScoring/{allOrNothingScoring.js → allOrNothingScoring.smoke.js} +41 -38
  44. package/cypress/e2e/ILC/ListSorting/listSortingSetCorrectAnswerCheckboxes.smoke.js +269 -0
  45. package/cypress/e2e/ILC/MultipleSelectionGrid/{multipleSelectionGridAutoScoredScoring.js → multipleSelectionGridAutoScoredScoring.smoke.js} +36 -34
  46. package/cypress/e2e/ILC/ShortTextResponse/shortTextResponseAutoScoredScoring.smoke.js +407 -0
  47. package/cypress/e2e/ILC/SingleSelectionGrid/{singleSelectionGridAutoScoredScoring.js → singleSelectionGridAutoScoredScoring.smoke.js} +32 -29
  48. package/cypress/e2e/ILC/UploadResponse/{uploadResponsePreview.js → uploadResponsePreview.smoke.js} +64 -59
  49. package/cypress/e2e/ILC/VideoResponse/{videoResponsePreviewTab.js → videoResponsePreviewTab.smoke.js} +290 -281
  50. package/cypress/pages/components/additionalSettingsPanel.js +0 -27
  51. package/cypress/pages/components/autoScoredSetCorrectAnswerSection.js +1 -1
  52. package/cypress/pages/components/autoScoredSpecifyCorrectAnswerSection.js +321 -0
  53. package/cypress/pages/components/createQuestionBasePage.js +1 -7
  54. package/cypress/pages/components/essayResponseCommonComponents.js +0 -6
  55. package/cypress/pages/components/fillInTheGapsCommonComponents.js +0 -13
  56. package/cypress/pages/components/index.js +2 -1
  57. package/cypress/pages/components/mcqAdditionalSettingsBase.js +0 -10
  58. package/cypress/pages/components/scoringSectionBase.js +3 -2
  59. package/cypress/pages/createItemPage.js +3 -79
  60. package/cypress/pages/dialogBoxBase.js +8 -23
  61. package/cypress/pages/index.js +1 -4
  62. package/cypress/pages/itemPreviewSettingsPage.js +446 -0
  63. package/cypress/pages/multipleSelectionPage.js +113 -64
  64. package/cypress/pages/selectQuestionResourceToolPage.js +0 -5
  65. package/cypress/pages/shortTextResponsePage.js +0 -6
  66. package/cypress/pages/singleSelectionPage.js +0 -1
  67. package/package.json +2 -2
  68. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesScoring/groupedOptionsAllOrNothing.js +0 -116
  69. package/cypress/e2e/ILC/DragAndDropIntoCategories/dragAndDropIntoCategoriesScoring/standardAllOrNothing.js +0 -160
  70. package/cypress/e2e/ILC/EssayResponse/essayResponseCreateCustomCategory.js +0 -932
  71. package/cypress/e2e/ILC/EssayResponse/essayResponseEquationEditor.js +0 -572
  72. package/cypress/e2e/ILC/EssayResponse/essayResponseGradingViewAndCorrectAnswerViewContents.js +0 -106
  73. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropGroupedEditTab.js +0 -76
  74. package/cypress/e2e/ILC/FillInTheGapsOverImageText/fillInTheGapsOverImageTextEditAriaLabelCheckbox.js +0 -134
  75. package/cypress/e2e/ILC/FillInTheGapsOverImageText/fillInTheGapsOverImageTextEditTabBasicSection.js +0 -133
  76. package/cypress/e2e/ILC/Highlight/HighlightScoring/highlightBasicScoringForTextSelectionTypes.js +0 -457
  77. package/cypress/e2e/ILC/Highlight/highlightColorLibraryFlyout.js +0 -143
  78. package/cypress/e2e/ILC/Highlight/highlightQuestionInstructionsAndQuestion.js +0 -178
  79. package/cypress/e2e/ILC/HighlightImage/highlightImageEditTabBasic.js +0 -125
  80. package/cypress/e2e/ILC/ListMatching/ListMatchingScoring/groupedOptionsAllOrNothingScoring.js +0 -117
  81. package/cypress/e2e/ILC/ListMatching/listMatchingGroupedOptionsSection.js +0 -207
  82. package/cypress/e2e/ILC/ListMatching/listMatchingQuestionInstructionsAndStemsSection.js +0 -246
  83. package/cypress/e2e/ILC/ListMatching/listMatchingStandardOptionsSetCorrectAnswerCheckboxesPreviewTab.js +0 -185
  84. package/cypress/e2e/ILC/ListSorting/listSortingAdditionalSettings.js +0 -820
  85. package/cypress/e2e/ILC/ListSorting/listSortingAutoScoredScoring.js +0 -936
  86. package/cypress/e2e/ILC/ListSorting/listSortingSetCorrectAnswerCheckboxes.js +0 -263
  87. package/cypress/e2e/ILC/ShortTextResponse/shortTextResponseAutoScoredScoring.js +0 -402
  88. package/cypress/e2e/ILC/fillInTheGapsOverImageDropdown/fillInTheGapsOverImageDropdownAllOrNothingScoring.js +0 -356
  89. package/cypress/e2e/ILC/fillInTheGapsOverImageDropdown/fillInTheGapsOverImageDropdownEditAriaLabelCheckbox.js +0 -134
  90. package/cypress/e2e/ILC/fillInTheGapsOverImageDropdown/fillInTheGapsOverImageDropdownImageProperties.js +0 -156
@@ -0,0 +1,943 @@
1
+ import { equationEditorCategoriesAndSymbols } from "../../../fixtures/equationEditorCategoriesAndSymbols ";
2
+ import { essayResponsePage } from "../../../pages";
3
+ import { commonComponents } from "../../../pages/components";
4
+ import { createCustomCategoryFlyout } from "../../../pages/components/createCustomCategoryFlyout";
5
+ import { equationEditorFlyout } from "../../../pages/components/equationEditorFlyout";
6
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
7
+ const css = Cypress.env('css');
8
+ const grepTags = Cypress.env('grepTags');
9
+
10
+ const allCategories = Object.keys(equationEditorCategoriesAndSymbols)
11
+ const customCategory = {
12
+ symbols: {
13
+ one: {
14
+ title: 'One',
15
+ textElement: '1',
16
+ ariaLabel: 'one',
17
+ displayText: '1'
18
+ },
19
+ two: {
20
+ title: 'Two',
21
+ textElement: '2',
22
+ ariaLabel: 'two',
23
+ displayText: '2'
24
+ },
25
+ three: {
26
+ title: 'Three',
27
+ textElement: '3',
28
+ ariaLabel: 'three',
29
+ displayText: '3'
30
+ },
31
+ four: {
32
+ title: 'Four',
33
+ textElement: '4',
34
+ ariaLabel: 'four',
35
+ displayText: '4'
36
+ },
37
+ five: {
38
+ title: 'Five',
39
+ textElement: '5',
40
+ ariaLabel: 'five',
41
+ displayText: '5'
42
+ },
43
+ six: {
44
+ title: 'Six',
45
+ textElement: '6',
46
+ ariaLabel: 'six',
47
+ displayText: '6'
48
+ },
49
+ seven: {
50
+ title: 'Seven',
51
+ textElement: '7',
52
+ ariaLabel: 'seven',
53
+ displayText: '7'
54
+ },
55
+ eight: {
56
+ title: 'Eight',
57
+ textElement: '8',
58
+ ariaLabel: 'eight',
59
+ displayText: '8'
60
+ },
61
+ nine: {
62
+ title: 'Nine',
63
+ textElement: '9',
64
+ ariaLabel: 'nine',
65
+ displayText: '9'
66
+ },
67
+ zero: {
68
+ title: 'Zero',
69
+ textElement: '0',
70
+ ariaLabel: 'zero',
71
+ displayText: '0'
72
+ },
73
+ dotMultiplier: {
74
+ title: 'Dot Multiplier',
75
+ textElement: null,
76
+ ariaLabel: 'dotMultiplier',
77
+ displayText: '·'
78
+ },
79
+ comma: {
80
+ title: 'Comma',
81
+ textElement: null,
82
+ ariaLabel: 'comma',
83
+ displayText: ','
84
+ },
85
+ add: {
86
+ title: 'Addition',
87
+ textElement: null,
88
+ ariaLabel: 'plus',
89
+ displayText: '+'
90
+ },
91
+ subtract: {
92
+ title: 'Subtraction',
93
+ textElement: null,
94
+ ariaLabel: 'minus',
95
+ displayText: '−'
96
+ },
97
+ multiply: {
98
+ title: 'Multiply',
99
+ textElement: null,
100
+ ariaLabel: 'multiply',
101
+ displayText: '×'
102
+ },
103
+ divide: {
104
+ title: 'Division',
105
+ textElement: null,
106
+ ariaLabel: 'division',
107
+ displayText: '÷'
108
+ },
109
+ equalTo: {
110
+ title: 'Equal To',
111
+ textElement: null,
112
+ ariaLabel: 'equalTo',
113
+ displayText: '='
114
+ },
115
+ polygonLeft: {
116
+ title: 'Polygon Left',
117
+ textElement: null,
118
+ ariaLabel: 'polygonLeft',
119
+ displayText: null
120
+ },
121
+ polygonRight: {
122
+ title: 'Polygon Right',
123
+ textElement: null,
124
+ ariaLabel: 'polygonRight',
125
+ displayText: null
126
+ },
127
+ clear: {
128
+ title: 'Clear',
129
+ textElement: null,
130
+ ariaLabel: 'clear',
131
+ displayText: null
132
+ },
133
+ gamma: {
134
+ title: 'Gamma',
135
+ text: null,
136
+ ariaLabel: 'gamma',
137
+ displayText: 'γ'
138
+ },
139
+ delta: {
140
+ title: 'Delta',
141
+ text: null,
142
+ ariaLabel: 'delta',
143
+ displayText: 'δ'
144
+ }
145
+ }
146
+ }
147
+
148
+ describe('Create question page - Essay Response: Create custom category', () => {
149
+ before(() => {
150
+ cy.loginAs('admin');
151
+ });
152
+
153
+ describe('Create custom category contents', { tags: 'smoke' }, () => {
154
+ abortEarlySetup();
155
+ before(() => {
156
+ essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
157
+ essayResponsePage.steps.expandCustomizeFormattingOptionsAccordion();
158
+ essayResponsePage.steps.selectCustomizedFormattingOption(['Equation Editor'])
159
+ });
160
+
161
+ it('When user clicks on the \'Create custom category\' button a \'Custom category\' flyout should appear', () => {
162
+ essayResponsePage.createCustomCategoryButton()
163
+ .click();
164
+ createCustomCategoryFlyout.dialogBox()
165
+ .should('be.visible');
166
+ });
167
+
168
+ it('Title of the flyout should be \'Custom Category\'', () => {
169
+ createCustomCategoryFlyout.createCustomCategoryFlyoutTitle()
170
+ .verifyInnerText('Custom category')
171
+ .should('be.visible');
172
+ });
173
+
174
+ it('\'Category Name\' and \'Category Icon\' labels along with input fields should be displayed in the flyout. Their input fields should be blank by default', () => {
175
+ createCustomCategoryFlyout.categoryNameLabel()
176
+ .verifyInnerText('Category name')
177
+ createCustomCategoryFlyout.categoryNameInputField()
178
+ .verifyInnerText('')
179
+ .should('be.visible')
180
+ createCustomCategoryFlyout.categoryIconLabel()
181
+ .verifyInnerText('Category icon')
182
+ createCustomCategoryFlyout.categoryIconInputField()
183
+ .verifyInnerText('')
184
+ .should('be.visible');
185
+ });
186
+
187
+ it('\'Selected Symbols:\' label should be displayed in the flyout. By default, no symbols should be present under it', () => {
188
+ createCustomCategoryFlyout.selectedSymbolsLabel()
189
+ .verifyInnerText('Selected symbols:')
190
+ createCustomCategoryFlyout.selectedSymbols()
191
+ .should('not.exist');
192
+ });
193
+
194
+ it('\'Select the symbols to display to the students.\' help text should be displayed in the flyout', () => {
195
+ createCustomCategoryFlyout.selectSymbolsToDisplayLabel()
196
+ .verifyInnerText('Select the symbols to display to the students.')
197
+ });
198
+
199
+ it(`${allCategories} accordions should be displayed with unchecked checkboxes. `, () => {
200
+ createCustomCategoryFlyout.categoryAccordions()
201
+ .each(($el, index) => {
202
+ cy.wrap($el)
203
+ .parents('.accordian-structure-equation-editor')
204
+ .within(() => {
205
+ createCustomCategoryFlyout.categoryAccordionCheckbox()
206
+ .should('not.be.checked')
207
+ .and('exist');
208
+ createCustomCategoryFlyout.categoryAccordionLabel()
209
+ .verifyInnerText(`${equationEditorCategoriesAndSymbols[allCategories[index]].displayName}`)
210
+ });
211
+ });
212
+ });
213
+
214
+ it(`By default, the ${equationEditorCategoriesAndSymbols['keypad'].displayName} category accordion should be expanded and other all acoordions should be in collapsed state`, () => {
215
+ createCustomCategoryFlyout.categoryAccordions()
216
+ .each(($el, index) => {
217
+ if (index == 0) {
218
+ cy.wrap($el)
219
+ .should('have.class', 'Mui-expanded')
220
+ } else {
221
+ cy.wrap($el)
222
+ .should('not.have.class', 'Mui-expanded')
223
+ }
224
+ });
225
+ });
226
+
227
+ it('\'Save\' button should be displayed in the flyout', () => {
228
+ createCustomCategoryFlyout.buttonSave()
229
+ .verifyInnerText('Save')
230
+ .should('be.visible')
231
+ });
232
+
233
+ it('\'Cancel\' button should be displayed. When user clicks on the \'Cancel\' button the flyout should close', () => {
234
+ createCustomCategoryFlyout.buttonCancel()
235
+ .verifyInnerText('Cancel')
236
+ .should('be.visible')
237
+ .click();
238
+ createCustomCategoryFlyout.dialogBox()
239
+ .should('not.exist');
240
+ });
241
+
242
+ it('Prestep: Clicking on the Create custom category button and collapsing the Keypad accordion', () => {
243
+ essayResponsePage.createCustomCategoryButton()
244
+ .click();
245
+ createCustomCategoryFlyout.categoryAccordionLabel()
246
+ .contains(`${equationEditorCategoriesAndSymbols['keypad'].displayName}`)
247
+ .click();
248
+ });
249
+
250
+ allCategories.forEach((categoryName) => {
251
+ createCustomCategoryFlyout.tests.verifyCustomCategoryFlyoutContents(categoryName);
252
+ });
253
+
254
+ it('CSS of Custom category flyout', { tags: 'css' }, () => {
255
+ createCustomCategoryFlyout.createCustomCategoryFlyoutTitle()
256
+ .verifyCSS(css.color.flyoutTitle, css.fontSize.heading, css.fontWeight.bold)
257
+ createCustomCategoryFlyout.categoryNameLabel()
258
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold)
259
+ createCustomCategoryFlyout.categoryIconLabel()
260
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold)
261
+ createCustomCategoryFlyout.selectedSymbolsLabel()
262
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold)
263
+ createCustomCategoryFlyout.selectSymbolsToDisplayLabel()
264
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold)
265
+ createCustomCategoryFlyout.categoryAccordionLabel()
266
+ .eq(0)
267
+ .verifyCSS(css.color.accordionLabel, css.fontSize.default, css.fontWeight.bold)
268
+ createCustomCategoryFlyout.buttonCancel()
269
+ .verifyCSS(css.color.secondaryBtn, css.fontSize.default, css.fontWeight.semibold)
270
+ .should('have.css', 'background-color', css.color.transparent);
271
+ createCustomCategoryFlyout.buttonSave()
272
+ .verifyCSS(css.color.successBtn, css.fontSize.default, css.fontWeight.semibold)
273
+ .should('have.css', 'background-color', css.color.successBtnBg);
274
+ });
275
+
276
+ //Failing due to https://redmine.zeuslearning.com/issues/525223
277
+ it('Accessibility of Custom category flyout', { tags: 'a11y' }, () => {
278
+ cy.checkAccessibility(createCustomCategoryFlyout.dialogBox())
279
+ });
280
+ });
281
+
282
+ if (!grepTags || !grepTags.includes('smoke')) {
283
+ describe('Category Checkbox validation cases', () => {
284
+ abortEarlySetup();
285
+ before(() => {
286
+ essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
287
+ essayResponsePage.steps.expandCustomizeFormattingOptionsAccordion();
288
+ essayResponsePage.steps.selectCustomizedFormattingOption(['Equation Editor'])
289
+ essayResponsePage.createCustomCategoryButton()
290
+ .click();
291
+ });
292
+
293
+ it('When user clicks on a symbol then that symbol should get selected and appear in the selected symbols region', () => {
294
+ createCustomCategoryFlyout.categoryAccordions()
295
+ .contains(`${equationEditorCategoriesAndSymbols['keypad'].displayName}`)
296
+ .parents('.accordian-structure-equation-editor')
297
+ .within(() => {
298
+ createCustomCategoryFlyout.cateogoryCharacters(equationEditorCategoriesAndSymbols.keypad.symbols.one.ariaLabel)
299
+ .click()
300
+ .should('have.class', 'Mui-selected')
301
+ .within(() => {
302
+ essayResponsePage.equationEditorSectionTickIcon()
303
+ .should('be.visible');
304
+ });
305
+ });
306
+ createCustomCategoryFlyout.selectedSymbolsWrapper()
307
+ .within(() => {
308
+ createCustomCategoryFlyout.cateogoryCharacters()
309
+ .invoke('attr', 'aria-label')
310
+ .then((ariaLabel) => {
311
+ const expectedValue = `${equationEditorCategoriesAndSymbols.keypad.symbols.one.ariaLabel} selected`;
312
+ expect(ariaLabel.toLowerCase()).to.equal(expectedValue.toLowerCase());
313
+ });
314
+ essayResponsePage.equationEditorSectionTickIcon()
315
+ .should('exist');
316
+ createCustomCategoryFlyout.selectedCharacterDragIcon()
317
+ .should('exist');
318
+ });
319
+ });
320
+
321
+ it('When user partially selects symbols from any category then that category\'s checkbox should be in partially checked state', () => {
322
+ createCustomCategoryFlyout.categoryAccordions()
323
+ .contains(`${equationEditorCategoriesAndSymbols['keypad'].displayName}`)
324
+ .parents('.accordian-structure-equation-editor')
325
+ .within(() => {
326
+ createCustomCategoryFlyout.categoryAccordionCheckbox()
327
+ .should('have.attr', 'data-indeterminate', 'true');
328
+ });
329
+ });
330
+
331
+ it('When user selects a symbol shared between two categories from any one of the categories then the symbol should get selected in the other category as well and the checkboxes should be partially checked', () => {
332
+ createCustomCategoryFlyout.categoryAccordions()
333
+ .contains(`${equationEditorCategoriesAndSymbols['keypad'].displayName}`)
334
+ .parents('.accordian-structure-equation-editor')
335
+ .within(() => {
336
+ createCustomCategoryFlyout.cateogoryCharacters(equationEditorCategoriesAndSymbols.keypad.symbols.dotMultiplier.ariaLabel)
337
+ .click();
338
+ });
339
+ createCustomCategoryFlyout.categoryAccordions()
340
+ .contains(`${equationEditorCategoriesAndSymbols['basic'].displayName}`)
341
+ .parents('.accordian-structure-equation-editor')
342
+ .within(() => {
343
+ createCustomCategoryFlyout.cateogoryCharacters(equationEditorCategoriesAndSymbols.basic.symbols.dotMultiplier.ariaLabel)
344
+ .should('have.class', 'Mui-selected');
345
+ });
346
+ createCustomCategoryFlyout.categoryAccordions()
347
+ .contains(`${equationEditorCategoriesAndSymbols['keypad'].displayName}`)
348
+ .parents('.accordian-structure-equation-editor')
349
+ .within(() => {
350
+ createCustomCategoryFlyout.categoryAccordionCheckbox()
351
+ .should('have.attr', 'data-indeterminate', 'true');
352
+ });
353
+ createCustomCategoryFlyout.categoryAccordions()
354
+ .contains(`${equationEditorCategoriesAndSymbols['basic'].displayName}`)
355
+ .click()
356
+ .parents('.accordian-structure-equation-editor')
357
+ .within(() => {
358
+ createCustomCategoryFlyout.categoryAccordionCheckbox()
359
+ .should('have.attr', 'data-indeterminate', 'true');
360
+ });
361
+ cy.log('Post step: Close the Custom category flyout by clicking on Cancel button')
362
+ createCustomCategoryFlyout.buttonCancel()
363
+ .click();
364
+ });
365
+
366
+ it('When user selects the checkbox of a partially checked category then all the symbols from that category should appear in the \'Selected symbols:\' section', () => {
367
+ const symbolsArray = Object.values(equationEditorCategoriesAndSymbols['keypad'].symbols)
368
+ cy.log('Open the Custom category flyout and partially select a category')
369
+ essayResponsePage.createCustomCategoryButton()
370
+ .click();
371
+ createCustomCategoryFlyout.categoryAccordions()
372
+ .contains(`${equationEditorCategoriesAndSymbols['keypad'].displayName}`)
373
+ .parents('.accordian-structure-equation-editor')
374
+ .within(() => {
375
+ createCustomCategoryFlyout.cateogoryCharacters(equationEditorCategoriesAndSymbols.keypad.symbols.one.ariaLabel)
376
+ .click();
377
+ createCustomCategoryFlyout.categoryAccordionCheckbox()
378
+ .should('have.attr', 'data-indeterminate', 'true');
379
+ });
380
+ createCustomCategoryFlyout.categoryAccordions()
381
+ .contains(`${equationEditorCategoriesAndSymbols['keypad'].displayName}`)
382
+ .parents('.accordian-structure-equation-editor')
383
+ .within(() => {
384
+ createCustomCategoryFlyout.categoryAccordionCheckbox()
385
+ .click()
386
+ .should('be.checked');
387
+ createCustomCategoryFlyout.cateogoryCharacters()
388
+ .each(($el) => {
389
+ cy.wrap($el)
390
+ .should('have.class', 'Mui-selected')
391
+ .and('have.attr', 'aria-pressed', 'true');
392
+ });
393
+ });
394
+ createCustomCategoryFlyout.selectedSymbolsWrapper()
395
+ .within(() => {
396
+ createCustomCategoryFlyout.cateogoryCharacters()
397
+ .each(($el, index) => {
398
+ cy.wrap($el)
399
+ .should('have.attr', 'aria-label', `${symbolsArray[index].ariaLabel} selected`)
400
+ });
401
+ essayResponsePage.equationEditorSectionTickIcon()
402
+ .should('exist');
403
+ createCustomCategoryFlyout.selectedCharacterDragIcon()
404
+ .should('exist');
405
+ });
406
+ });
407
+
408
+ it('When user unchecks the fully checked checkbox then all the symbols from that category as well as from the shared categories should get deselected and should not be displayed in \'Selected symbols:\' section', () => {
409
+ createCustomCategoryFlyout.categoryAccordions()
410
+ .contains(`${equationEditorCategoriesAndSymbols['keypad'].displayName}`)
411
+ .parents('.accordian-structure-equation-editor')
412
+ .within(() => {
413
+ createCustomCategoryFlyout.categoryAccordionCheckbox()
414
+ .click()
415
+ .should('not.be.checked');
416
+ });
417
+ createCustomCategoryFlyout.selectedSymbols()
418
+ .should('not.exist');
419
+ createCustomCategoryFlyout.categoryAccordions()
420
+ .contains(`${equationEditorCategoriesAndSymbols['keypad'].displayName}`)
421
+ .parents('.accordian-structure-equation-editor')
422
+ .within(() => {
423
+ createCustomCategoryFlyout.cateogoryCharacters()
424
+ .each(($el) => {
425
+ cy.wrap($el)
426
+ .should('not.have.class', 'Mui-selected')
427
+ .and('have.attr', 'aria-pressed', 'false');
428
+ });
429
+ });
430
+ createCustomCategoryFlyout.categoryAccordions()
431
+ .contains(`${equationEditorCategoriesAndSymbols['basic'].displayName}`)
432
+ .parents('.accordian-structure-equation-editor')
433
+ .within(() => {
434
+ createCustomCategoryFlyout.cateogoryCharacters()
435
+ .each(($el) => {
436
+ cy.wrap($el)
437
+ .should('not.have.class', 'Mui-selected')
438
+ .and('have.attr', 'aria-pressed', 'false');
439
+ });
440
+ });
441
+ });
442
+
443
+ it('When user selects a unchecked category then the checkbox should be checked and all the symbols should be displayed in the \'Selected symbols:\' section', () => {
444
+ const symbolsArray = Object.values(equationEditorCategoriesAndSymbols['greek'].symbols)
445
+ createCustomCategoryFlyout.categoryAccordions()
446
+ .contains(`${equationEditorCategoriesAndSymbols['greek'].displayName}`)
447
+ .parents('.accordian-structure-equation-editor')
448
+ .within(() => {
449
+ createCustomCategoryFlyout.categoryAccordionCheckbox()
450
+ .click()
451
+ .should('be.checked');
452
+ createCustomCategoryFlyout.cateogoryCharacters()
453
+ .each(($el) => {
454
+ cy.wrap($el)
455
+ .should('have.class', 'Mui-selected')
456
+ .and('have.attr', 'aria-pressed', 'true');
457
+ });
458
+ });
459
+ createCustomCategoryFlyout.selectedSymbolsWrapper()
460
+ .within(() => {
461
+ createCustomCategoryFlyout.cateogoryCharacters()
462
+ .each(($el, index) => {
463
+ cy.wrap($el)
464
+ .should('have.attr', 'aria-label', `${symbolsArray[index].ariaLabel} selected`)
465
+ .find('title')
466
+ .should('have.text', symbolsArray[index].title);
467
+ });
468
+ });
469
+ });
470
+
471
+ it('CSS of selected symbols', { tags: 'css' }, () => {
472
+ essayResponsePage.equationEditorSectionCategoryLabel()
473
+ .verifyCSS(css.color.primaryBtn, css.fontSize.small, css.fontWeight.regular);
474
+ essayResponsePage.equationEditorSectionTickIcon()
475
+ .find('[data-name*="Icon"]')
476
+ .should('have.css', 'fill', css.color.activeButtons);
477
+ essayResponsePage.equationEditorSectionCategoriesDragIcon()
478
+ .find('path')
479
+ .should('have.css', 'fill', css.color.activeButtons);
480
+ });
481
+
482
+ it('Accessibility of selected symbols', { tags: 'a11y' }, () => {
483
+ cy.checkAccessibility(createCustomCategoryFlyout.selectedSymbolsWrapper())
484
+ });
485
+
486
+ it('When user de-selects a symbol by clicking on it from the category accordion then that symbol should disappear from the Selected Symbols section. Also, it should get deselected from its respective category\'s accordion', () => {
487
+ createCustomCategoryFlyout.categoryAccordions()
488
+ .contains(`${equationEditorCategoriesAndSymbols['greek'].displayName}`)
489
+ .click()
490
+ .parents('.accordian-structure-equation-editor')
491
+ .within(() => {
492
+ createCustomCategoryFlyout.cateogoryCharacters(equationEditorCategoriesAndSymbols.greek.symbols.alpha.ariaLabel)
493
+ .click()
494
+ .should('not.have.class', 'Mui-selected');
495
+ createCustomCategoryFlyout.categoryAccordionCheckbox()
496
+ .should('have.attr', 'data-indeterminate', 'true')
497
+ });
498
+ createCustomCategoryFlyout.selectedSymbols()
499
+ .contains(equationEditorCategoriesAndSymbols.greek.symbols.alpha.ariaLabel)
500
+ .should('not.exist');
501
+ });
502
+
503
+ it('If user selects all the symbols from within a category then the checkbox for that category should get checked and the symbols should be displayed in \'Selected symbols:\' section', () => {
504
+ createCustomCategoryFlyout.categoryAccordions()
505
+ .contains(`${equationEditorCategoriesAndSymbols['arrows'].displayName}`)
506
+ .click()
507
+ .parents('.accordian-structure-equation-editor')
508
+ .within(() => {
509
+ createCustomCategoryFlyout.cateogoryCharacters()
510
+ .each(($el) => {
511
+ cy.wrap($el)
512
+ .click();
513
+ });
514
+ createCustomCategoryFlyout.categoryAccordionCheckbox()
515
+ .should('be.checked');
516
+ });
517
+ });
518
+
519
+ it('When a user de-selects a symbol by clicking on it from the category accordion then the symbol should get deselected from the category as well as the \'Selected symbols:\' section', () => {
520
+ createCustomCategoryFlyout.selectedSymbolsWrapper()
521
+ .within(() => {
522
+ createCustomCategoryFlyout.cateogoryCharacters(`${equationEditorCategoriesAndSymbols.greek.symbols.pi.ariaLabel} selected`)
523
+ .click();
524
+ });
525
+ createCustomCategoryFlyout.selectedSymbolsWrapper()
526
+ .contains(`${equationEditorCategoriesAndSymbols.greek.symbols.pi.ariaLabel} selected`)
527
+ .should('not.exist');
528
+ createCustomCategoryFlyout.categoryAccordions()
529
+ .contains(`${equationEditorCategoriesAndSymbols['greek'].displayName}`)
530
+ .click()
531
+ .parents('.accordian-structure-equation-editor')
532
+ .within(() => {
533
+ createCustomCategoryFlyout.cateogoryCharacters(equationEditorCategoriesAndSymbols.greek.symbols.pi.ariaLabel)
534
+ .should('not.have.class', 'Mui-selected');
535
+ createCustomCategoryFlyout.categoryAccordionCheckbox()
536
+ .should('have.attr', 'data-indeterminate', 'true')
537
+ });
538
+ });
539
+
540
+ it('If all symbols are deselected from a category then the checkbox for that category should get unchecked', () => {
541
+ cy.log('Pre step: Close the create custom category and select one category')
542
+ createCustomCategoryFlyout.buttonCancel()
543
+ .click();
544
+ essayResponsePage.createCustomCategoryButton()
545
+ .click();
546
+ createCustomCategoryFlyout.categoryAccordions()
547
+ .contains(`${equationEditorCategoriesAndSymbols['keypad'].displayName}`)
548
+ .parents('.accordian-structure-equation-editor')
549
+ .within(() => {
550
+ createCustomCategoryFlyout.categoryAccordionCheckbox()
551
+ .click();
552
+ });
553
+ createCustomCategoryFlyout.selectedSymbols()
554
+ .then(($selectedSymbols) => {
555
+ createCustomCategoryFlyout.selectedSymbolsWrapper()
556
+ .within(() => {
557
+ for (let i = $selectedSymbols.length - 1; i >= 0; i--) {
558
+ createCustomCategoryFlyout.cateogoryCharacters()
559
+ .eq(i)
560
+ .click();
561
+ }
562
+ });
563
+ });
564
+ createCustomCategoryFlyout.categoryAccordions()
565
+ .contains(`${equationEditorCategoriesAndSymbols['keypad'].displayName}`)
566
+ .parents('.accordian-structure-equation-editor')
567
+ .within(() => {
568
+ createCustomCategoryFlyout.categoryAccordionCheckbox()
569
+ .should('not.be.checked');
570
+ });
571
+ });
572
+ });
573
+ }
574
+
575
+ if (!grepTags || !grepTags.includes('smoke')) {
576
+ describe('Save a custom category', () => {
577
+ abortEarlySetup();
578
+ before(() => {
579
+ essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
580
+ essayResponsePage.steps.expandCustomizeFormattingOptionsAccordion();
581
+ essayResponsePage.steps.selectCustomizedFormattingOption(['Equation Editor'])
582
+ essayResponsePage.createCustomCategoryButton()
583
+ .click();
584
+ });
585
+
586
+ it('When user clicks on \'Save\' button without adding any Category name an error message \'Error: Category name is required.\' should appear ', () => {
587
+ createCustomCategoryFlyout.buttonSave()
588
+ .click()
589
+ createCustomCategoryFlyout.dialogBox()
590
+ .should('exist');
591
+ commonComponents.errorMessage()
592
+ .verifyInnerText('Error: Category name is required.')
593
+ });
594
+
595
+ essayResponsePage.tests.verifyCSSAnda11yOfErrorMessage()
596
+
597
+ it('When user adds a Category name the error message should disappear', () => {
598
+ createCustomCategoryFlyout.categoryNameInputField()
599
+ .type('Custom category without characters');
600
+ commonComponents.errorMessage()
601
+ .should('not.exist');
602
+ });
603
+
604
+ it('When user clicks on \'Save\' button after adding Category name and has not selected any symbols then the category should be added to Equation Editor Section', () => {
605
+ createCustomCategoryFlyout.buttonSave()
606
+ .click();
607
+ createCustomCategoryFlyout.dialogBox()
608
+ .should('not.exist');
609
+ essayResponsePage.equationEditorSectionCategories()
610
+ .last()
611
+ .should('have.attr', 'aria-label', 'Custom category without characters')
612
+ .within(() => {
613
+ essayResponsePage.equationEditorSectionCategoryLabel()
614
+ .verifyInnerText('Custom category without characters');
615
+ });
616
+ });
617
+
618
+ it('When user selects symbols and adds Category name then user should be able to save the category and the category should be added to Equation Editor Section', () => {
619
+ cy.log('Pre step: Click on create custom category button')
620
+ createCustomCategoryFlyout.steps.createCustomCategoryWithMultipleCategoryCharacters();
621
+ essayResponsePage.equationEditorSectionCategories()
622
+ .last()
623
+ .should('have.attr', 'aria-label', 'Custom category with name.')
624
+ .within(() => {
625
+ essayResponsePage.equationEditorSectionCategoryLabel()
626
+ .verifyInnerText('Custom category with name.');
627
+ essayResponsePage.equationEditorSectionCategoryIcon()
628
+ .verifyInnerText('');
629
+ });
630
+ });
631
+
632
+ it('When user selects symbols and adds Category name and Category Symbol then user should be able to save the category should be added to Equation Editor Section', () => {
633
+ cy.log('Pre step: Click on create custom category button')
634
+ createCustomCategoryFlyout.steps.createCustomCategory();
635
+ essayResponsePage.equationEditorSectionCategories()
636
+ .last()
637
+ .should('have.attr', 'aria-label', 'Custom category with name and icon.')
638
+ .within(() => {
639
+ essayResponsePage.equationEditorSectionCategoryLabel()
640
+ .verifyInnerText('Custom category with name and icon.');
641
+ essayResponsePage.equationEditorSectionCategoryIcon()
642
+ .verifyInnerText('#');
643
+ });
644
+ });
645
+
646
+ it('By default, the categories added by the user should be in selected state and should have an \'Delete Icon\' and \'Edit Icon\'', () => {
647
+ essayResponsePage.equationEditorSectionCategories()
648
+ .contains('Custom category without characters')
649
+ .parents('[id*="DraggableItem"]')
650
+ .within(() => {
651
+ essayResponsePage.equationEditorSectionCategoriesEditIcon()
652
+ .should('exist');
653
+ essayResponsePage.equationEditorSectionDeleteCustomCategoryIcon()
654
+ .should('exist');
655
+ });
656
+ essayResponsePage.equationEditorSectionCategories()
657
+ .contains('Custom category with name.')
658
+ .parents('[id*="DraggableItem"]')
659
+ .within(() => {
660
+ essayResponsePage.equationEditorSectionCategoriesEditIcon()
661
+ .should('exist');
662
+ essayResponsePage.equationEditorSectionDeleteCustomCategoryIcon()
663
+ .should('exist');
664
+ });
665
+ essayResponsePage.equationEditorSectionCategories()
666
+ .contains('Custom category with name and icon.')
667
+ .parents('[id*="DraggableItem"]')
668
+ .within(() => {
669
+ essayResponsePage.equationEditorSectionCategoriesEditIcon()
670
+ .should('exist');
671
+ essayResponsePage.equationEditorSectionDeleteCustomCategoryIcon()
672
+ .should('exist');
673
+ });
674
+ });
675
+ });
676
+ }
677
+
678
+ if (!grepTags || !grepTags.includes('smoke')) {
679
+ describe('Create custom category: Preview tab', () => {
680
+ abortEarlySetup();
681
+ before(() => {
682
+ essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
683
+ essayResponsePage.steps.expandCustomizeFormattingOptionsAccordion();
684
+ essayResponsePage.steps.selectCustomizedFormattingOption(['Equation Editor'])
685
+ essayResponsePage.createCustomCategoryButton()
686
+ .click();
687
+ cy.log('Pre step: Add Custom category without characters')
688
+ createCustomCategoryFlyout.categoryNameInputField()
689
+ .type('Custom category without characters');
690
+ createCustomCategoryFlyout.buttonSave()
691
+ .click();
692
+ cy.log('Pre step: Add Category with Only category name')
693
+ createCustomCategoryFlyout.steps.createCustomCategoryWithMultipleCategoryCharacters();
694
+ cy.log('Pre step: Add Category with Category Name and Icon')
695
+ createCustomCategoryFlyout.steps.createCustomCategory();
696
+ cy.log('Switching to preview tab and opening Equation editor flyout')
697
+ essayResponsePage.steps.switchToPreviewTab();
698
+ essayResponsePage.previewTabToolbarOption('Equation Editor')
699
+ .click();
700
+ });
701
+
702
+ it('The category with no added characters should not be displayed in the preview tab equation editor', () => {
703
+ equationEditorFlyout.categoryTab()
704
+ .contains('Custom category without characters')
705
+ .should('not.exist');
706
+ });
707
+
708
+ it('The category with only category name should be displayed in the preview tab equation editor', () => {
709
+ equationEditorFlyout.categoryTab()
710
+ .eq(8)
711
+ .within(() => {
712
+ equationEditorFlyout.categoryTabTitle()
713
+ .should('have.text', 'Custom category with name.');
714
+ equationEditorFlyout.categoryTabIcon()
715
+ .should('have.text', '');
716
+ });
717
+ });
718
+
719
+ it('The category with category name and icon should be displayed in the preview tab equation editor', () => {
720
+ equationEditorFlyout.categoryTab()
721
+ .eq(9)
722
+ .within(() => {
723
+ equationEditorFlyout.categoryTabTitle()
724
+ .should('have.text', 'Custom category with name and icon.');
725
+ equationEditorFlyout.categoryTabIcon()
726
+ .should('have.text', '#');
727
+ });
728
+ });
729
+
730
+ it('All the selected symbols of the Custom category should be displayed in the Equation editor flyout', () => {
731
+ const symbolsArray = Object.values(customCategory.symbols)
732
+ equationEditorFlyout.categoryTab('Custom category with name.')
733
+ .click();
734
+ equationEditorFlyout.categoryCharacters()
735
+ .each(($el, index) => {
736
+ cy.wrap($el)
737
+ .should('have.attr', 'aria-label', symbolsArray[index].ariaLabel)
738
+ .find('title')
739
+ .should('have.text', symbolsArray[index].title);
740
+ if (symbolsArray[index].textElement) {
741
+ cy.wrap($el)
742
+ .verifyInnerText(symbolsArray[index].textElement)
743
+ }
744
+ });
745
+ });
746
+
747
+ it('User should be able to add symbols from both the custom categories to the Equation Editor Input field', () => {
748
+ equationEditorFlyout.categoryCharacters(customCategory.symbols.nine.ariaLabel)
749
+ .click();
750
+ equationEditorFlyout.categoryCharacters(customCategory.symbols.divide.ariaLabel)
751
+ .click();
752
+ equationEditorFlyout.categoryCharacters(customCategory.symbols.delta.ariaLabel)
753
+ .click();
754
+ equationEditorFlyout.categoryTab('Custom category with name and icon.')
755
+ .click();
756
+ equationEditorFlyout.categoryCharacters(equationEditorCategoriesAndSymbols.arrows.symbols.downArrowDouble.ariaLabel)
757
+ .click();
758
+ equationEditorFlyout.categoryCharacters(equationEditorCategoriesAndSymbols.arrows.symbols.leftwardsArrowHook.ariaLabel)
759
+ .click();
760
+ equationEditorFlyout.previewInputField()
761
+ .contains('9÷δ⇓↩');
762
+ });
763
+
764
+ essayResponsePage.tests.insertEquationAndVerifyInputFieldContentsAndWordCount('9÷δ⇓↩', '1/10000');
765
+
766
+ it('When user deselects any added custom category from the Equation editor section, it should not be displayed in the Equation editor flyout', () => {
767
+ cy.log('Switch to edit tab')
768
+ essayResponsePage.steps.switchToEditTab()
769
+ essayResponsePage.equationEditorSectionCategories()
770
+ .contains('Custom category with name.')
771
+ .click();
772
+ cy.log('Switching to preview tab and opening Equation editor flyout')
773
+ essayResponsePage.steps.switchToPreviewTab();
774
+ essayResponsePage.previewTabToolbarOption('Equation Editor')
775
+ .click();
776
+ equationEditorFlyout.categoryTab()
777
+ .contains('Custom category with name.')
778
+ .should('not.exist');
779
+ });
780
+ });
781
+ }
782
+
783
+ if (!grepTags || !grepTags.includes('smoke')) {
784
+ describe('Create custom category: Edit category', () => {
785
+ abortEarlySetup();
786
+ before(() => {
787
+ essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
788
+ essayResponsePage.steps.expandCustomizeFormattingOptionsAccordion();
789
+ essayResponsePage.steps.selectCustomizedFormattingOption(['Equation Editor'])
790
+ cy.log('Pre step: Add Category with Category Name and Icon')
791
+ createCustomCategoryFlyout.steps.createCustomCategory();
792
+ });
793
+
794
+ it('When user clicks on Edit button under an added Custom category, the Custom category flyout should open', () => {
795
+ essayResponsePage.equationEditorSectionCategories()
796
+ .contains('Custom category with name and icon.')
797
+ .parents('[id*="DraggableItem"]')
798
+ .within(() => {
799
+ essayResponsePage.equationEditorSectionCategoriesEditIcon()
800
+ .should('be.visible')
801
+ .click();
802
+ });
803
+ createCustomCategoryFlyout.dialogBox()
804
+ .should('be.visible');
805
+ createCustomCategoryFlyout.createCustomCategoryFlyoutTitle()
806
+ .verifyInnerText('Custom category')
807
+ .should('be.visible');
808
+ });
809
+
810
+ it('The Category name and Category icon should be prefilled and selected symbols should be displayed', () => {
811
+ const symbolsArray = Object.values(equationEditorCategoriesAndSymbols['arrows'].symbols)
812
+ createCustomCategoryFlyout.categoryAccordions()
813
+ .contains(`${equationEditorCategoriesAndSymbols['arrows'].displayName}`)
814
+ .parents('.accordian-structure-equation-editor')
815
+ .within(() => {
816
+ createCustomCategoryFlyout.cateogoryCharacters()
817
+ .each(($el) => {
818
+ cy.wrap($el)
819
+ .should('have.class', 'Mui-selected')
820
+ });
821
+ });
822
+ createCustomCategoryFlyout.categoryNameInputField()
823
+ .should('have.value', 'Custom category with name and icon.');
824
+ createCustomCategoryFlyout.categoryIconInputField()
825
+ .should('have.value', '#');
826
+ createCustomCategoryFlyout.selectedSymbolsWrapper()
827
+ .within(() => {
828
+ createCustomCategoryFlyout.cateogoryCharacters()
829
+ .each(($el, index) => {
830
+ cy.wrap($el)
831
+ .invoke('attr', 'aria-label')
832
+ .then((ariaLabel) => {
833
+ const expectedValue = `${symbolsArray[index].ariaLabel} selected`;
834
+ expect(ariaLabel.toLowerCase()).to.equal(expectedValue.toLowerCase());
835
+ cy.wrap($el)
836
+ .find('title')
837
+ .should('have.text', symbolsArray[index].title);
838
+ if (symbolsArray[index].textElement) {
839
+ cy.wrap($el)
840
+ .verifyInnerText(symbolsArray[index].textElement)
841
+ }
842
+ });
843
+ });
844
+ });
845
+ });
846
+
847
+ it('When the user edits the Category name, Category Icon and selected symbols, then on clicking save the updated changes should be displayed in the Equation editor section', () => {
848
+ createCustomCategoryFlyout.categoryNameInputField()
849
+ .clear()
850
+ .type('Edited category name');
851
+ createCustomCategoryFlyout.categoryIconInputField()
852
+ .clear()
853
+ .type('@');
854
+ createCustomCategoryFlyout.categoryAccordions()
855
+ .contains(`${equationEditorCategoriesAndSymbols['arrows'].displayName}`)
856
+ .click()
857
+ .parents('.accordian-structure-equation-editor')
858
+ .within(() => {
859
+ createCustomCategoryFlyout.cateogoryCharacters(equationEditorCategoriesAndSymbols.arrows.symbols.leftArrow.ariaLabel)
860
+ .click();
861
+ });
862
+ createCustomCategoryFlyout.buttonSave()
863
+ .click();
864
+ essayResponsePage.equationEditorSectionCategories()
865
+ .last()
866
+ .within(() => {
867
+ essayResponsePage.equationEditorSectionCategoryLabel()
868
+ .verifyInnerText('Edited category name');
869
+ essayResponsePage.equationEditorSectionCategoryIcon()
870
+ .verifyInnerText('@');
871
+ });
872
+ });
873
+
874
+ it('The updated Category name, Category Icon and selected symbols should also be displayed in the Equation editor flyout', () => {
875
+ const symbolsArray = Object.values(equationEditorCategoriesAndSymbols['arrows'].symbols)
876
+ cy.log('Switching to preview tab and opening Equation editor flyout')
877
+ essayResponsePage.steps.switchToPreviewTab();
878
+ essayResponsePage.previewTabToolbarOption('Equation Editor')
879
+ .click();
880
+ equationEditorFlyout.categoryTab()
881
+ .eq(8)
882
+ .click()
883
+ .within(() => {
884
+ equationEditorFlyout.categoryTabTitle()
885
+ .should('have.text', 'Edited category name');
886
+ equationEditorFlyout.categoryTabIcon()
887
+ .should('have.text', '@');
888
+ });
889
+ equationEditorFlyout.categoryCharacters()
890
+ .contains(equationEditorCategoriesAndSymbols.arrows.symbols.leftArrow.ariaLabel)
891
+ .should('not.exist');
892
+ //Failing due to https://redmine.zeuslearning.com/issues/526950
893
+ equationEditorFlyout.categoryCharacters()
894
+ .each(($el, index) => {
895
+ cy.wrap($el)
896
+ .invoke('attr', 'aria-label')
897
+ .then((ariaLabel) => {
898
+ const expectedValue = symbolsArray[index + 1].ariaLabel;
899
+ expect(ariaLabel.toLowerCase()).to.equal(expectedValue.toLowerCase());
900
+ cy.wrap($el)
901
+ .find('title')
902
+ .should('have.text', symbolsArray[index + 1].title);
903
+ if (symbolsArray[index].textElement) {
904
+ cy.wrap($el)
905
+ .verifyInnerText(symbolsArray[index + 1].textElement)
906
+ }
907
+ });
908
+ });
909
+ });
910
+ });
911
+ }
912
+
913
+ if (!grepTags || !grepTags.includes('smoke')) {
914
+ describe('Delete Custom category', () => {
915
+ abortEarlySetup();
916
+ before(() => {
917
+ essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
918
+ essayResponsePage.steps.expandCustomizeFormattingOptionsAccordion();
919
+ essayResponsePage.steps.selectCustomizedFormattingOption(['Equation Editor'])
920
+ cy.log('Pre step: Add Category with Category Name and Icon')
921
+ createCustomCategoryFlyout.steps.createCustomCategory();
922
+ });
923
+
924
+ it('When user clicks on Delete button below the added custom category then the category should be deleted from the Equation Editor section', () => {
925
+ essayResponsePage.equationEditorSectionDeleteCustomCategoryIcon()
926
+ .click();
927
+ essayResponsePage.equationEditorSectionCategories()
928
+ .contains('Custom category with name and icon.')
929
+ .should('not.exist');
930
+ });
931
+
932
+ it('The deleted category should not be displayed in the Equation editor flyout', () => {
933
+ cy.log('Switching to preview tab and opening Equation editor flyout')
934
+ essayResponsePage.steps.switchToPreviewTab();
935
+ essayResponsePage.previewTabToolbarOption('Equation Editor')
936
+ .click();
937
+ equationEditorFlyout.categoryTab()
938
+ .contains('Custom category with name and icon.')
939
+ .should('not.exist');
940
+ });
941
+ });
942
+ }
943
+ });