itemengine-cypress-automation 1.0.255-update-version-d46686e.0 → 1.0.256-updatedRepo18thNov-3c7b396.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/cypress/e2e/ILC/CkEditorAudioPlayer/audioPlayerPreviewTab.js +21 -21
  2. package/cypress/e2e/ILC/CkEditorAudioPlayer/audioPlayerPreviewTabSupportedFileTypes.js +6 -6
  3. package/cypress/e2e/ILC/CkEditorAudioPlayer/audioPlayerPreviewTabTranscript.js +4 -4
  4. package/cypress/e2e/ILC/CkEditorEquationEditor/equationEditorBasicFile.js +86 -5
  5. package/cypress/e2e/ILC/CkEditorEquationEditor/selectModeEditorBasic.js +114 -0
  6. package/cypress/e2e/ILC/CkEditorInsertImage/imageInfo.js +160 -0
  7. package/cypress/e2e/ILC/CkEditorInsertImage/insertImageBasicFile.js +83 -0
  8. package/cypress/e2e/ILC/CkEditorInsertImage/upload.js +53 -0
  9. package/cypress/e2e/ILC/CkEditorLink/linkBasic.js +85 -0
  10. package/cypress/e2e/ILC/CkEditorLink/linkInfoSection.js +94 -0
  11. package/cypress/e2e/ILC/CkEditorLink/linkPreview.js +38 -0
  12. package/cypress/e2e/ILC/CkEditorLink/uploadSection.js +59 -0
  13. package/cypress/e2e/ILC/EssayResponse/equationEditor.smoke.js +14 -279
  14. package/cypress/e2e/ILC/EssayResponse/equationEditorCategories1.js +78 -0
  15. package/cypress/e2e/ILC/FillInTheGapsTextNew/additionalSettingsForAnswerInputFields.js +2 -2
  16. package/cypress/e2e/ILC/Graphing/acceptRepeatedPoints.js +75 -0
  17. package/cypress/e2e/ILC/TextEntryMath/additionalSettingsBasic.js +84 -0
  18. package/cypress/e2e/ILC/TextEntryMath/additionalSettingsForAnswerInputFields.js +286 -0
  19. package/cypress/e2e/ILC/TextEntryMath/customSettingsSeparators.ts +107 -0
  20. package/cypress/e2e/ILC/TextEntryMath/equationEditor.smoke.js +99 -0
  21. package/cypress/fixtures/equationEditorCategoriesAndSymbols .js +336 -0
  22. package/cypress/pages/components/ariaLabelSectionComponent.js +1 -1
  23. package/cypress/pages/components/ckEditorAudioPlayerComponent.js +0 -11
  24. package/cypress/pages/components/ckEditorEquationEditorComponent.js +175 -7
  25. package/cypress/pages/components/ckEditorInsertImageComponent.js +272 -0
  26. package/cypress/pages/components/ckEditorLinkComponent.js +142 -0
  27. package/cypress/pages/components/customSettingsSeparatorsComponent.ts +97 -0
  28. package/cypress/pages/components/equationEditorSectionCommonComponent.js +528 -0
  29. package/cypress/pages/components/gradingViewEnumerationComponent.js +11 -6
  30. package/cypress/pages/components/index.js +2 -1
  31. package/cypress/pages/components/questionInstructionsComponent.js +10 -0
  32. package/cypress/pages/essayResponsePage.js +4 -121
  33. package/cypress/pages/graphingPage.js +24 -2
  34. package/cypress/pages/multipleSelectionPage.js +8 -0
  35. package/cypress/pages/textEntryMathPage.js +125 -18
  36. package/cypress/support/index.d.ts +7 -0
  37. package/cypress/tsconfig.json +11 -0
  38. package/package.json +1 -1
  39. package/scripts/sorry-cypress.mjs +5 -5
@@ -0,0 +1,528 @@
1
+ import utilities from "../../support/helpers/utilities";
2
+ import { equationEditorCategoriesAndSymbols } from "../../fixtures/equationEditorCategoriesAndSymbols ";
3
+ import { equationEditorFlyout, commonComponents } from ".";
4
+ import { essayResponseCommonComponents } from "../components/essayResponseCommonComponents";
5
+ import { createQuestionBasePage } from "../components/createQuestionBasePage";
6
+ const css = Cypress.env('css');
7
+ const allCategories = Object.values(equationEditorCategoriesAndSymbols)
8
+ const defaultSelectedCategories = ['Numpad', 'Keypad', 'Intermediate', 'Primary', 'General', 'Common', 'Algebra', 'Geo', 'Compare', 'Matrices'];
9
+
10
+ const selectors = {
11
+ ...commonComponents,
12
+ ...essayResponseCommonComponents,
13
+ //Equation Editor section
14
+ equationEditorSectionWrapper: () => cy.get('.essay-response-eqn-editor-wrapper'),
15
+ equationEditorSectionCategories: () => cy.get('[class*="DraggableItemsGrid"] .icon-button-custom-format'),
16
+ equationEditorSectionCategoryLabel: () => cy.get('.equation-editor-label-wrapper'),
17
+ equationEditorSection: () => cy.get('[class*="EquationEditorOptionsWrapper"]'),
18
+ equationEditorSectionTitle: () => cy.get('[class*="EssayResponseComponentstyles__SectionTitle"],[class*="ClozeMathstyle__SectionTitle"]'),
19
+ equationEditorSectionHelperText: () => cy.get('.equation-editor-description-text'),
20
+ equationEditorSectionCategoriesDragIcon: () => cy.get('.drag-icon-equation-editor-button'),
21
+ equationEditorSectionCategoriesEditIcon: () => cy.get('.edit-icon-button button'),
22
+ equationEditorSectionTickIcon: () => cy.get('.tick-icon-wrapper'),
23
+ selectACategoryErrorMessage: () => cy.get('[class*="ErrorBlock"]'),
24
+ equationEditorSectionCategoryIcon: () => cy.get('.equation-editor-icon'),
25
+ equationEditorSectionDeleteCustomCategoryIcon: () => cy.get('.delete-button-icon button'),
26
+ displayNativeKeyboardLabel: () => cy.get('.cloze-math-eqn-editor-wrapper .MuiFormControlLabel-label'),
27
+ displayNativeKeyboardCheckbox: () => cy.get('.cloze-math-eqn-editor-wrapper input'),
28
+ categoryLabel: () => cy.get('[class*="ClozeMathstyle__SectionDescription"]'),
29
+ responseFieldPreviewTab: () => cy.get('.preview-question-text-wrapper .equation-input-without-andornment .mq-root-block'),
30
+ }
31
+
32
+ const steps = {
33
+ ...createQuestionBasePage.steps,
34
+ ...essayResponseCommonComponents.steps,
35
+ verifyDefaultCategoriesDisplayedInEquationEditorSectionEditTab: () => {
36
+ equationEditorSectionCommonComponent.equationEditorSectionCategories()
37
+ .each(($el, index) => {
38
+ cy.wrap($el)
39
+ .invoke('text')
40
+ .then((textContent) => {
41
+ const expectedValue = allCategories[index].displayName;
42
+ expect(textContent.toLowerCase()).to.equal(expectedValue.toLowerCase())
43
+ });
44
+ cy.wrap($el)
45
+ .parents('[id*="DraggableItem"]')
46
+ .within(() => {
47
+ utilities.verifyElementVisibilityState(equationEditorSectionCommonComponent.equationEditorSectionCategoriesDragIcon(), 'visible');
48
+ if (allCategories[index].displayName === 'Keypad') {
49
+ utilities.verifyElementVisibilityState(equationEditorSectionCommonComponent.equationEditorSectionCategoriesEditIcon(), 'notExist');
50
+ }
51
+ else {
52
+ utilities.verifyElementVisibilityState(equationEditorSectionCommonComponent.equationEditorSectionCategoriesEditIcon(), 'visible');
53
+ }
54
+ });
55
+ });
56
+ },
57
+
58
+ /**
59
+ * @description Verify tooltips of categories in equation editor section edit tab
60
+ * @param {string[]} categoryNamesArray Array of names of categories
61
+ */
62
+ verifyTooltipsOfCategoryTilesInEquationEditorSectionEditTab: (categoryNamesArray) => {
63
+ categoryNamesArray.forEach((categoryTooltipName) => {
64
+ equationEditorSectionCommonComponent.equationEditorSectionCategories()
65
+ .contains(categoryTooltipName, { matchCase: false })
66
+ .trigger('mouseover')
67
+ commonComponents.tooltipText()
68
+ .and('be.visible')
69
+ .should('have.text', categoryTooltipName)
70
+ equationEditorSectionCommonComponent.equationEditorSectionCategories()
71
+ .contains(categoryTooltipName, { matchCase: false })
72
+ .trigger('mouseout')
73
+ commonComponents.tooltipText()
74
+ .should('not.exist');
75
+ });
76
+ },
77
+
78
+ /**
79
+ * @description Verify selected category in equation editor section edit tab
80
+ * @param {string[]} categoryName Name of categories
81
+ */
82
+ verifySelectedCategoryInEquationEditorSectionEditTab: (categoryName) => {
83
+ equationEditorSectionCommonComponent.equationEditorSectionCategories()
84
+ .contains(categoryName, { matchCase: false })
85
+ .parents('.icon-button-custom-format')
86
+ .should('have.class', 'Mui-selected')
87
+ .within(() => {
88
+ utilities.verifyElementVisibilityState(equationEditorSectionCommonComponent.equationEditorSectionTickIcon(), 'visible');
89
+ });
90
+ },
91
+
92
+ /**
93
+ * @description Verify deselected category in equation editor section edit tab
94
+ * @param {string[]} categoryName Name of categories
95
+ */
96
+ deselectACategoryInEquationEditorSectionEditTab: (categoryName) => {
97
+ equationEditorSectionCommonComponent.equationEditorSectionCategories()
98
+ .contains(categoryName, { matchCase: false })
99
+ .click();
100
+ equationEditorSectionCommonComponent.equationEditorSectionCategories()
101
+ .contains(categoryName, { matchCase: false })
102
+ .parents('.icon-button-custom-format')
103
+ .should('not.have.class', 'Mui-selected');
104
+ },
105
+
106
+ /**
107
+ * @description Select a category in equation editor section edit tab
108
+ * @param {string[]} categoryName Name of categories
109
+ */
110
+ selectACategoryInEquationEditorSectionEditTab: (categoryName) => {
111
+ equationEditorSectionCommonComponent.equationEditorSectionCategories()
112
+ .contains(categoryName, { matchCase: false })
113
+ .click();
114
+ equationEditorSectionCommonComponent.equationEditorSectionCategories()
115
+ .contains(categoryName, { matchCase: false })
116
+ .parents('.icon-button-custom-format')
117
+ .should('have.class', 'Mui-selected');
118
+ },
119
+
120
+ /**
121
+ * @description Verify select category in equation editor section
122
+ * @param {string[]} categoryName Name of categories
123
+ */
124
+ selectingCategories: (categoriesArray) => {
125
+ categoriesArray.forEach((categoryName) => {
126
+ equationEditorSectionCommonComponent.equationEditorSectionCategories()
127
+ .contains(categoryName, { matchCase: false })
128
+ .click();
129
+ });
130
+ },
131
+
132
+ /**
133
+ * @description Verify deselected category in equation editor section edit tab
134
+ * @param {string[]} categoryName Name of category
135
+ */
136
+ verifyDeselectedCategoryInEquationEditorSectionEditTab: (categoryName) => {
137
+ equationEditorSectionCommonComponent.equationEditorSectionCategories()
138
+ .contains(categoryName, { matchCase: false })
139
+ .parents('.icon-button-custom-format')
140
+ .should('not.have.class', 'Mui-selected')
141
+ .within(() => {
142
+ utilities.verifyElementVisibilityState(equationEditorSectionCommonComponent.equationEditorSectionTickIcon(), 'hidden');
143
+ });
144
+ },
145
+
146
+ /**
147
+ * Focus in the answer input fields of the preview tab
148
+ * @param {number} responseIndex indx of the response to add input
149
+ */
150
+ focusInResponseAnswerInputFieldPreviewTab: (responseIndex) => {
151
+ equationEditorSectionCommonComponent.responseFieldPreviewTab()
152
+ .eq(responseIndex)
153
+ .click();
154
+ },
155
+
156
+ /**
157
+ * verify response field equation text content
158
+ * @param {number} equationIndex index of equation
159
+ * @param {string} equationText equation text content
160
+ */
161
+ verifyResponseFieldEquationTextNew: (equationIndex, equationText) => {
162
+ utilities.verifyTextContent(utilities.getNthElement(equationEditorSectionCommonComponent.responseFieldPreviewTab(), equationIndex), equationText)
163
+ },
164
+
165
+ /**
166
+ * @description deselect category in equation editor section in edit tab
167
+ * @param {string} categoryName Name of category
168
+ */
169
+ deselectCategoryInEquationEditorSectionEditTab: (categoryName) => {
170
+ equationEditorSectionCommonComponent.equationEditorSectionCategories()
171
+ .contains(`${categoryName}`)
172
+ .click();
173
+ },
174
+
175
+ }
176
+
177
+ const tests = {
178
+ ...commonComponents.tests,
179
+ verifyEquationEditorSection: () => {
180
+ it('All the categories should be displayed with a drag icon should and an Edit icon should be displayed below all the categories irrespective of their selected state', () => {
181
+ equationEditorSectionCommonComponent.steps.verifyDefaultCategoriesDisplayedInEquationEditorSectionEditTab();
182
+ });
183
+
184
+ it('When user hovers on a category with a long name, then a tooltip should be displayed.', () => {
185
+ let categoriesWithTooltip = ['Greek Symbols', 'Measurement', 'Other Symbols'];
186
+ equationEditorSectionCommonComponent.steps.verifyTooltipsOfCategoryTilesInEquationEditorSectionEditTab(categoriesWithTooltip);
187
+ });
188
+
189
+ it(`By default, ${defaultSelectedCategories.toString()} should be selected`, () => {
190
+ defaultSelectedCategories.forEach((category) => {
191
+ equationEditorSectionCommonComponent.steps.verifySelectedCategoryInEquationEditorSectionEditTab(category);
192
+ });
193
+ });
194
+
195
+ it('CSS of selected and deselected category', { tags: 'css' }, () => {
196
+ cy.log('CSS of selected category')
197
+ utilities.verifyCSS(utilities.getNthElement(equationEditorSectionCommonComponent.equationEditorSectionCategories(), 0), {
198
+ 'background-color': css.color.activeButtons
199
+ });
200
+ utilities.getNthElement(equationEditorSectionCommonComponent.equationEditorSectionCategories(), 0)
201
+ .within(() => {
202
+ utilities.verifyCSS(equationEditorSectionCommonComponent.equationEditorSectionCategoryLabel(), {
203
+ 'color': css.color.primaryBtn,
204
+ 'font-size': css.fontSize.small,
205
+ 'font-weight': css.fontWeight.regular
206
+ });
207
+ utilities.verifyCSS(equationEditorSectionCommonComponent.equationEditorSectionTickIcon().find('[data-name*="Icon"]'), {
208
+ 'fill': css.color.activeButtons
209
+ });
210
+ utilities.verifyCSS(equationEditorSectionCommonComponent.equationEditorSectionCategoriesDragIcon().find('path'), {
211
+ 'fill': css.color.activeButtons
212
+ });
213
+ });
214
+ cy.log('CSS of deselected category')
215
+ utilities.verifyCSS(utilities.getNthElement(equationEditorSectionCommonComponent.equationEditorSectionCategories(), 12), {
216
+ 'background-color': css.color.primaryBtn
217
+ });
218
+ utilities.getNthElement(equationEditorSectionCommonComponent.equationEditorSectionCategories(), 12)
219
+ .within(() => {
220
+ utilities.verifyCSS(equationEditorSectionCommonComponent.equationEditorSectionCategoryLabel(), {
221
+ 'color': css.color.secondaryBtn,
222
+ 'font-size': css.fontSize.small,
223
+ 'font-weight': css.fontWeight.regular
224
+ });
225
+ utilities.verifyCSS(equationEditorSectionCommonComponent.equationEditorSectionCategoriesDragIcon().find('path'), {
226
+ 'fill': css.color.secondaryBtn
227
+ });
228
+ });
229
+ });
230
+
231
+ it('Accessibility of selected and deselected category', { tags: 'a11y' }, () => {
232
+ cy.checkAccessibility(equationEditorSectionCommonComponent.equationEditorSectionCategories().contains(`${equationEditorCategoriesAndSymbols['numPad'].displayName}`).parents('[class*="DraggableItemsGrid"]'))
233
+ });
234
+ },
235
+
236
+ /**
237
+ * verify functionality of equation editor section .
238
+ * @param {string} questionType - The type of the question .
239
+ */
240
+ verifyFunctionalityOfEquationEditorSection: (questionType) => {
241
+ it('User should be able select and deselect a category and it should be reflected in the Equation Editor flyout and the first category should be selected by default', () => {
242
+ cy.log('Selecting and deselecting a category')
243
+ equationEditorSectionCommonComponent.steps.deselectACategoryInEquationEditorSectionEditTab(`${equationEditorCategoriesAndSymbols['numPad'].displayName}`);
244
+ equationEditorSectionCommonComponent.steps.selectACategoryInEquationEditorSectionEditTab(`${equationEditorCategoriesAndSymbols['greek'].displayName}`);
245
+ cy.log('Switching to Preview tab')
246
+ equationEditorSectionCommonComponent.steps.switchToPreviewTab();
247
+ if (questionType == 'essay response') {
248
+ equationEditorSectionCommonComponent.steps.selectPreviewTabToolbarOption('Equation Editor');
249
+ }
250
+ else {
251
+ equationEditorSectionCommonComponent.steps.focusInResponseAnswerInputFieldPreviewTab(0);
252
+ }
253
+ equationEditorFlyout.steps.verifyCategoryNotDisplayedInEquationEditor(`${equationEditorCategoriesAndSymbols['numPad'].displayName}`);
254
+ equationEditorFlyout.steps.clickOnEquationEditorButtonNext()
255
+ equationEditorFlyout.steps.verifyCategoryIsDisplayedInEquationEditor(`${equationEditorCategoriesAndSymbols['greek'].displayName}`);
256
+ });
257
+
258
+ it('On deselecting all the categories an error message should be displayed \'Error: Please select a category.\' and the preview tab Equation Editor flyout should be empty', () => {
259
+ cy.log('Pre step: Switching to Edit tab')
260
+ equationEditorSectionCommonComponent.steps.switchToEditTab();
261
+ if (questionType == 'essay response') {
262
+ //Need to remove this once https://redmine.zeuslearning.com/issues/577356 is resolved
263
+ equationEditorSectionCommonComponent.steps.expandCustomizeFormattingOptionsAccordion();
264
+ }
265
+ equationEditorSectionCommonComponent.steps.selectingCategories([`${equationEditorCategoriesAndSymbols['intermediate'].displayName}`, `${equationEditorCategoriesAndSymbols['primary'].displayName}`, `${equationEditorCategoriesAndSymbols['general'].displayName}`, `${equationEditorCategoriesAndSymbols['common'].displayName}`, `${equationEditorCategoriesAndSymbols['algebra'].displayName}`, `${equationEditorCategoriesAndSymbols['geo'].displayName}`, `${equationEditorCategoriesAndSymbols['compare'].displayName}`, `${equationEditorCategoriesAndSymbols['matrices'].displayName}`, `${equationEditorCategoriesAndSymbols['greek'].displayName}`, `${equationEditorCategoriesAndSymbols['keyPad'].displayName}`]);
266
+ utilities.verifyInnerText(equationEditorSectionCommonComponent.selectACategoryErrorMessage(), 'Error: Please select a category.');
267
+ cy.log('Switching to Preview tab')
268
+ equationEditorSectionCommonComponent.steps.switchToPreviewTab();
269
+ if (questionType == 'essay response') {
270
+ equationEditorSectionCommonComponent.steps.selectPreviewTabToolbarOption('Equation Editor');
271
+ }
272
+ else {
273
+ equationEditorSectionCommonComponent.steps.focusInResponseAnswerInputFieldPreviewTab(0);
274
+ }
275
+ utilities.verifyElementVisibilityState(equationEditorFlyout.dialogBox(), 'visible');
276
+ utilities.verifyElementVisibilityState(equationEditorFlyout.categoryTabTitle(), 'notExist');
277
+ utilities.verifyElementVisibilityState(equationEditorFlyout.categoryCharactersWrapper(), 'notExist');
278
+ cy.log('Post step: Switching to Edit tab')
279
+ equationEditorSectionCommonComponent.steps.switchToEditTab();
280
+ if (questionType == 'essay response') {
281
+ //Need to remove this once https://redmine.zeuslearning.com/issues/577356 is resolved
282
+ equationEditorSectionCommonComponent.steps.expandCustomizeFormattingOptionsAccordion();
283
+ };
284
+ });
285
+
286
+ //https://redmine.zeuslearning.com/issues/530205
287
+ it('CSS of error message', { tags: 'css' }, () => {
288
+ utilities.verifyCSS(equationEditorSectionCommonComponent.selectACategoryErrorMessage(), {
289
+ 'color': css.color.errorText,
290
+ 'font-size': css.fontSize.small,
291
+ 'font-weight': css.fontWeight.regular
292
+ });
293
+ });
294
+
295
+ it('Accessibility of error message', { tags: 'a11y' }, () => {
296
+ cy.checkAccessibility(equationEditorSectionCommonComponent.selectACategoryErrorMessage());
297
+ });
298
+
299
+ it('When user selects any category then the error message should disappear', () => {
300
+ equationEditorSectionCommonComponent.steps.selectACategoryInEquationEditorSectionEditTab(`${equationEditorCategoriesAndSymbols['numPad'].displayName}`);
301
+ utilities.verifyElementVisibilityState(equationEditorSectionCommonComponent.selectACategoryErrorMessage(), 'notExist');
302
+ });
303
+ },
304
+
305
+ /**
306
+ * make change in equation in preview tab .
307
+ * @param {string} questionType - The type of the question .
308
+ */
309
+ editEquationInPreviewTab: (questionType) => {
310
+ it('When user clicks on an added equation in preview input field, the Equation editor flyout should open', () => {
311
+ if (questionType === 'essay response') {
312
+ equationEditorSectionCommonComponent.steps.openResponseFieldEquationContainerEquationEditor(0);
313
+ }
314
+ else {
315
+ equationEditorSectionCommonComponent.steps.focusInResponseAnswerInputFieldPreviewTab(0);
316
+ }
317
+ utilities.verifyElementVisibilityState(equationEditorFlyout.dialogBox(), 'visible');
318
+ });
319
+
320
+ it(`In the equation editor flyout the ${allCategories[0].displayName} should be selected by default and the Equation editor input field should be prefilled with the added equation`, () => {
321
+ equationEditorFlyout.steps.verifyCategoryTileSelectedInEquationEditor(`${equationEditorCategoriesAndSymbols['numPad'].displayName}`);
322
+ cy.log('Adding this to focus out of input field')
323
+ equationEditorFlyout.steps.selectEquationEditorCategoryPreviewTab(`${equationEditorCategoriesAndSymbols['numPad'].displayName}`)
324
+ utilities.verifyTextContent(equationEditorFlyout.previewInputField(), 'x+5=1​');
325
+ });
326
+
327
+ it('When user clicks on Cancel button the equation should be displayed in the preview input field without any changes', () => {
328
+ equationEditorFlyout.steps.clickOnEquationEditorCancelButton();
329
+ if (questionType === 'essay response') {
330
+ equationEditorSectionCommonComponent.steps.verifyResponseFieldEquationText(0, 'x+5=1');
331
+ }
332
+ else {
333
+ equationEditorSectionCommonComponent.steps.verifyResponseFieldEquationTextNew(0, 'x+5=1');
334
+ }
335
+ });
336
+
337
+ it('When user edits the added equation and clicks on Ok button, the edited equation should be displayed in the preview input field', () => {
338
+ if (questionType === 'essay response') {
339
+ equationEditorSectionCommonComponent.steps.openResponseFieldEquationContainerEquationEditor(0);
340
+ }
341
+ else {
342
+ equationEditorSectionCommonComponent.steps.focusInResponseAnswerInputFieldPreviewTab(0);
343
+ }
344
+ equationEditorFlyout.steps.enterTextInPreviewInputField('{backspace}{backspace}');
345
+ equationEditorFlyout.steps.enterEquation([{ categoryName: 'numPad', symbolName: ['multiply', 'zero'] }]);
346
+ equationEditorFlyout.steps.clickOnOkButton();
347
+ if (questionType === 'essay response') {
348
+ equationEditorSectionCommonComponent.steps.verifyResponseFieldEquationText(0, 'x+5×0');
349
+ }
350
+ else {
351
+ equationEditorSectionCommonComponent.steps.verifyResponseFieldEquationTextNew(0, 'x+5×0​');
352
+ }
353
+ });
354
+ },
355
+
356
+ /**
357
+ * verify equation editor flyout in preview tab .
358
+ * @param {string} questionType - The type of the question .
359
+ */
360
+ equationEditorFlyoutInPreviewTab: (questionType) => {
361
+ it('When user clicks on \'Equation Editor\' icon in preview tab toolbar, then Equation Editor flyout should appear', () => {
362
+ if (questionType == 'essay response') {
363
+ equationEditorSectionCommonComponent.steps.selectPreviewTabToolbarOption('Equation Editor');
364
+ }
365
+ else {
366
+ equationEditorSectionCommonComponent.steps.focusInResponseAnswerInputFieldPreviewTab(0);
367
+ }
368
+ utilities.verifyElementVisibilityState(equationEditorFlyout.dialogBox(), 'visible');
369
+ });
370
+
371
+ it('\'Done\'button should be displayed at the bottom of the flyout', () => {
372
+ utilities.verifyElementVisibilityState(equationEditorFlyout.buttonOk(), 'visible');
373
+ utilities.verifyInnerText(equationEditorFlyout.buttonOk(), 'Done');
374
+ });
375
+
376
+ it('Equation Editor input field should be displayed and when user focuses in the input field should have cursor', () => {
377
+ equationEditorFlyout.steps.verifyDefaultEquationEditorInputFieldWithCursor();
378
+ });
379
+
380
+ it('All the default selected categories in the \'Equation Editor\' section should be displayed and first category must be selected by default in the \'Equation Editor\' flyout', () => {
381
+ equationEditorFlyout.steps.verifyEquationEditorCategoryTiles(defaultSelectedCategories);
382
+ equationEditorFlyout.steps.verifyCategoryTileSelectedInEquationEditor(equationEditorCategoriesAndSymbols['numPad'].displayName);
383
+ });
384
+
385
+ it('CSS of \'Equation Editor\' flyout', { tags: 'css' }, () => {
386
+ cy.log('CSS of selected category')
387
+ utilities.getNthElement(equationEditorFlyout.categoryTab(), 0)
388
+ .within(() => {
389
+ utilities.verifyCSS(equationEditorFlyout.categoryTabTitle(), {
390
+ 'color': css.color.activeButtons,
391
+ 'font-size': css.fontSize.small,
392
+ 'font-weight': css.fontWeight.regular
393
+ });
394
+ utilities.verifyCSS(equationEditorFlyout.categoryTabIcon(), {
395
+ 'color': css.color.activeButtons,
396
+ 'font-size': css.fontSize.default,
397
+ 'font-weight': css.fontWeight.regular
398
+ });
399
+ });
400
+ cy.log('CSS of unselected category')
401
+ utilities.getNthElement(equationEditorFlyout.categoryTab(), 0)
402
+ .within(() => {
403
+ utilities.verifyCSS(equationEditorFlyout.categoryTabTitle(), {
404
+ 'color': css.color.activeButtons,
405
+ 'font-size': css.fontSize.small,
406
+ 'font-weight': css.fontWeight.regular
407
+ });
408
+ utilities.verifyCSS(equationEditorFlyout.categoryTabIcon(), {
409
+ 'color': css.color.activeButtons,
410
+ 'font-size': css.fontSize.default,
411
+ 'font-weight': css.fontWeight.regular
412
+ });
413
+ });
414
+ utilities.verifyCSS(equationEditorFlyout.previewInputField(), {
415
+ 'background-color': css.color.defaultBackground
416
+ });
417
+ utilities.verifyCSS(equationEditorFlyout.buttonCancel(), {
418
+ 'color': css.color.secondaryBtn,
419
+ 'font-size': css.fontSize.default,
420
+ 'font-weight': css.fontWeight.semibold,
421
+ 'background-color': css.color.secondaryBtnBg,
422
+ });
423
+ utilities.verifyCSS(equationEditorFlyout.buttonOk(), {
424
+ 'color': css.color.whiteText,
425
+ 'font-size': css.fontSize.default,
426
+ 'font-weight': css.fontWeight.semibold,
427
+ 'background-color': css.color.primaryBtnBg,
428
+ });
429
+ });
430
+
431
+ //Failing due to https://redmine.zeuslearning.com/issues/564678
432
+ it('Accessibility of \'Equation Editor\' flyout', { tags: 'a11y' }, () => {
433
+ cy.checkAccessibility(equationEditorFlyout.dialogBox());
434
+ });
435
+
436
+ it('Cancel button should be displayed in the flyout and when user clicks the \'Cancel\' button then the flyout should close', () => {
437
+ utilities.verifyElementVisibilityState(equationEditorFlyout.buttonCancel(), 'visible');
438
+ utilities.verifyInnerText(equationEditorFlyout.buttonCancel(), 'Cancel');
439
+ equationEditorFlyout.steps.clickOnEquationEditorCancelButton();
440
+ utilities.verifyElementVisibilityState(equationEditorFlyout.dialogBox(), 'notExist');
441
+ });
442
+ },
443
+
444
+ /**
445
+ * verify next and preview button in preview tab .
446
+ * @param {string} questionType - The type of the question .
447
+ */
448
+ verifyNextAndPreviewButtonInPreviewTab: (questionType) => {
449
+ it('When the selected number of equation categories fit the dialog box width then \'Next button\' and \'Previous button\' should not be displayed in the equation editor flyout', () => {
450
+ if (questionType == 'essay response') {
451
+ equationEditorSectionCommonComponent.steps.selectPreviewTabToolbarOption('Equation Editor');
452
+ }
453
+ else {
454
+ equationEditorSectionCommonComponent.steps.focusInResponseAnswerInputFieldPreviewTab(0);
455
+ }
456
+ utilities.verifyElementVisibilityState(equationEditorFlyout.buttonNext(), 'notExist');
457
+ utilities.verifyElementVisibilityState(equationEditorFlyout.buttonPrevious(), 'notExist');
458
+ });
459
+
460
+ it('When the selected number of equation categories do not fit the dialog box width then \'Next button\' and \'Previous button\' should be displayed in the equation editor flyout', () => {
461
+ cy.log('Pre step: Switch to Edit tab and select categories from the Equation Editor section')
462
+ equationEditorSectionCommonComponent.steps.switchToEditTab();
463
+ if (questionType == 'essay response') {
464
+ //Need to remove this once https://redmine.zeuslearning.com/issues/577356 is resolved
465
+ equationEditorSectionCommonComponent.steps.expandCustomizeFormattingOptionsAccordion();
466
+ }
467
+ equationEditorSectionCommonComponent.steps.selectingCategories([`${equationEditorCategoriesAndSymbols['algebra'].displayName}`, `${equationEditorCategoriesAndSymbols['matrices'].displayName}`, `${equationEditorCategoriesAndSymbols['geo'].displayName}`, `${equationEditorCategoriesAndSymbols['compare'].displayName}`, `${equationEditorCategoriesAndSymbols['calculus'].displayName}`, `${equationEditorCategoriesAndSymbols['trig'].displayName}`, `${equationEditorCategoriesAndSymbols['delimiters'].displayName}`, `${equationEditorCategoriesAndSymbols['greek'].displayName}`, `${equationEditorCategoriesAndSymbols['measurement'].displayName}`, `${equationEditorCategoriesAndSymbols['setNotation'].displayName}`]);
468
+ cy.log('Switching to Preview tab')
469
+ equationEditorSectionCommonComponent.steps.switchToPreviewTab()
470
+ if (questionType == 'essay response') {
471
+ equationEditorSectionCommonComponent.steps.selectPreviewTabToolbarOption('Equation Editor');
472
+ }
473
+ else {
474
+ equationEditorSectionCommonComponent.steps.focusInResponseAnswerInputFieldPreviewTab(0);
475
+ }
476
+ utilities.verifyElementVisibilityState(equationEditorFlyout.buttonNext(), 'visible');
477
+ utilities.verifyElementVisibilityState(equationEditorFlyout.buttonPrevious(), 'visible');
478
+ });
479
+
480
+ it('CSS of \'Next button\' and \'Previous button\'', { tags: 'css' }, () => {
481
+ utilities.verifyCSS(equationEditorFlyout.buttonPrevious().find('svg'), {
482
+ 'background-color': css.color.transparent
483
+ });
484
+ utilities.verifyCSS(equationEditorFlyout.buttonPrevious().find('svg').find('path'), {
485
+ 'fill': css.color.nextPreviousButtonFill
486
+ });
487
+ utilities.verifyCSS(equationEditorFlyout.buttonNext().find('svg'), {
488
+ 'background-color': css.color.defaultBackground
489
+ });
490
+ utilities.verifyCSS(equationEditorFlyout.buttonNext().find('svg').find('path'), {
491
+ 'fill': css.color.nextPreviousButtonFill
492
+ });
493
+ });
494
+
495
+ it('Accessibility of \'Next button\' and \'Previous button\'', { tags: 'a11y' }, () => {
496
+ cy.checkAccessibility(equationEditorFlyout.buttonPrevious());
497
+ cy.checkAccessibility(equationEditorFlyout.buttonNext());
498
+ });
499
+
500
+ it('By default, the \'Previous button\' should be disabled and \'Next button\' should be enabled on opening the flyout as user is at the beginning of the tablist', () => {
501
+ utilities.verifyElementDisabled(equationEditorFlyout.buttonPrevious());
502
+ utilities.verifyElementNotDisabled(equationEditorFlyout.buttonNext());
503
+ });
504
+
505
+ it('When user clicks on the \'Next button\', the \'Previous button\' and the \'Next button\' both should get enabled, When the user reaches end of the tablist the \'Next button\' should get disabled and \'Previous button\' should remain enabled.', () => {
506
+ equationEditorFlyout.steps.clickOnEquationEditorButtonNext();
507
+ utilities.verifyElementNotDisabled(equationEditorFlyout.buttonPrevious());
508
+ utilities.verifyElementNotDisabled(equationEditorFlyout.buttonNext());
509
+ cy.log('Clicking on Next button to reach end of tablist')
510
+ equationEditorFlyout.steps.clickOnEquationEditorButtonNext()
511
+ utilities.verifyElementNotDisabled(equationEditorFlyout.buttonPrevious());
512
+ utilities.verifyElementDisabled(equationEditorFlyout.buttonNext());
513
+ });
514
+
515
+ it('When user clicks on the \'Previous button\', and reaches the beginning of the tablist \'Previous button\' should become disabled and \'Next button\' should become enabled', () => {
516
+ equationEditorFlyout.steps.clickOnEquationEditorButtonPrevious()
517
+ equationEditorFlyout.steps.clickOnEquationEditorButtonPrevious()
518
+ utilities.verifyElementDisabled(equationEditorFlyout.buttonPrevious());
519
+ utilities.verifyElementNotDisabled(equationEditorFlyout.buttonNext());
520
+ });
521
+ }
522
+ }
523
+
524
+ export const equationEditorSectionCommonComponent = {
525
+ ...selectors,
526
+ steps,
527
+ tests
528
+ }
@@ -77,7 +77,9 @@ const tests = {
77
77
  });
78
78
 
79
79
  it(`When "with enumeration" radio button is in checked state, "${typeOfInput} identifiers" label along with ${gradingEnumerationButtons.length} toggle buttons. By default, 'Numerical' toggle button should be in selected state of the ${gradingEnumerationButtons.join(' , ')} toggle buttons`, () => {
80
- utilities.verifyInnerText(gradingViewEnumerationComponent.identifiersLabel(), `${typeOfInput} identifiers`);
80
+ if (typeOfInput != "") {
81
+ utilities.verifyInnerText(gradingViewEnumerationComponent.identifiersLabel(), `${typeOfInput} identifiers`);
82
+ }
81
83
  utilities.verifyElementVisibilityState(gradingViewEnumerationComponent.numericalToggleButton(), 'visible');
82
84
  utilities.verifyElementVisibilityState(gradingViewEnumerationComponent.alphabetUppercaseToggleButton(), 'visible');
83
85
  utilities.verifyElementVisibilityState(gradingViewEnumerationComponent.alphabetLowercaseToggleButton(), 'visible');
@@ -111,11 +113,14 @@ const tests = {
111
113
  'font-size': css.fontSize.normal,
112
114
  'font-weight': css.fontWeight.regular
113
115
  });
114
- utilities.verifyCSS(gradingViewEnumerationComponent.identifiersLabel(), {
115
- 'color': css.color.labels,
116
- 'font-size': css.fontSize.normal,
117
- 'font-weight': css.fontWeight.semibold
118
- });
116
+
117
+ if (typeOfInput != "") {
118
+ utilities.verifyCSS(gradingViewEnumerationComponent.identifiersLabel(), {
119
+ 'color': css.color.labels,
120
+ 'font-size': css.fontSize.normal,
121
+ 'font-weight': css.fontWeight.semibold
122
+ });
123
+ }
119
124
  utilities.verifyCSS(gradingViewEnumerationComponent.numericalToggleButton(), {
120
125
  'background-color': css.color.secondaryBtnBg,
121
126
  'border': `2px solid ${css.color.secondaryBtnActive}`
@@ -67,4 +67,5 @@ export * from './showAvailableOptionsToStudents';
67
67
  export * from './showStudentMaximumNumberOfPossibleSelections';
68
68
  export * from './draggableOptionsStyleAndLayoutComponent';
69
69
  export * from './connectorStyleStyleAndLayoutCustomizationComponent';
70
- export * from './ckEditorAudioPlayerComponent';
70
+ export * from './equationEditorSectionCommonComponent';
71
+ export * from './ckEditorAudioPlayerComponent';
@@ -77,6 +77,16 @@ const steps = {
77
77
  questionInstructionsComponent.questionInstructionsInputField()
78
78
  .click()
79
79
  .blur();
80
+ },
81
+
82
+ focusInQuestionInstructionsInputField: () => {
83
+ questionInstructionsComponent.questionInstructionsInputField()
84
+ .click();
85
+ },
86
+
87
+ focusOutQuestionInstructionsInputField: () => {
88
+ questionInstructionsComponent.questionInstructionsInputField()
89
+ .blur();
80
90
  }
81
91
  }
82
92