itemengine-cypress-automation 1.0.19 → 1.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. package/cypress/e2e/ILC/EssayResponse/essayResponseAdditionalSettings.js +432 -0
  2. package/cypress/e2e/ILC/EssayResponse/essayResponseAdditionalSettingsBasic.js +134 -0
  3. package/cypress/e2e/ILC/EssayResponse/essayResponseCreateCustomCategory.js +932 -0
  4. package/cypress/e2e/ILC/EssayResponse/essayResponseCustomizeFormattingOptions1.js +333 -0
  5. package/cypress/e2e/ILC/EssayResponse/essayResponseCustomizeFormattingOptions2.js +332 -0
  6. package/cypress/e2e/ILC/EssayResponse/essayResponseCustomizeFormattingOptions3.js +522 -0
  7. package/cypress/e2e/ILC/EssayResponse/essayResponseEditCategoryFlyout.js +402 -0
  8. package/cypress/e2e/ILC/EssayResponse/essayResponseEditTabBasicSections.js +558 -0
  9. package/cypress/e2e/ILC/EssayResponse/essayResponseEquationEditor.js +572 -0
  10. package/cypress/e2e/ILC/EssayResponse/essayResponseEquationEditorCategories1.js +290 -0
  11. package/cypress/e2e/ILC/EssayResponse/essayResponseEquationEditorCategories2.js +514 -0
  12. package/cypress/e2e/ILC/EssayResponse/essayResponseHeaderSection.js +80 -0
  13. package/cypress/e2e/ILC/EssayResponse/essayResponsePreviewAddTable.js +412 -0
  14. package/cypress/e2e/ILC/EssayResponse/essayResponsePreviewEditTable.js +659 -0
  15. package/cypress/e2e/ILC/EssayResponse/essayResponsePreviewHyperlink.js +318 -0
  16. package/cypress/e2e/ILC/EssayResponse/essayResponseScoringSection.js +59 -0
  17. package/cypress/e2e/ILC/EssayResponse/essayResponseSpecialCharacters.js +33 -0
  18. package/cypress/e2e/ILC/EssayResponseBasic/essayResponseBasicCustomizeFormattingOptions.js +207 -0
  19. package/cypress/e2e/ILC/EssayResponseMath/essayResponseMathCharacters.js +38 -0
  20. package/cypress/e2e/ILC/EssayResponseMath/essayResponseMathCreateItem.js +243 -0
  21. package/package.json +1 -1
@@ -0,0 +1,402 @@
1
+ import { equationEditorCategoriesAndSymbols } from "../../../fixtures/equationEditorCategoriesAndSymbols ";
2
+ import { essayResponsePage } from "../../../pages";
3
+ import { editCategoryFlyout } from "../../../pages/components/editCategoryFlyout";
4
+ import { equationEditorFlyout } from "../../../pages/components/equationEditorFlyout";
5
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
6
+ const css = Cypress.env('css');
7
+
8
+ describe('Create question page - Essay Response: Edit category', () => {
9
+ before(() => {
10
+ cy.loginAs('admin');
11
+ });
12
+
13
+ describe('Edit category flyout contents', () => {
14
+ abortEarlySetup();
15
+ before(() => {
16
+ essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
17
+ essayResponsePage.steps.expandCustomizeFormattingOptionsAccordion();
18
+ essayResponsePage.steps.selectCustomizedFormattingOption(['Equation Editor'])
19
+ });
20
+
21
+ it('When user clicks on the Edit category icon below the categories in the Equation Editor section the Edit category flyout should open', () => {
22
+ editCategoryFlyout.steps.openEditCategoryFlyout();
23
+ editCategoryFlyout.dialogBox()
24
+ .should('be.visible')
25
+ });
26
+
27
+ it('Title of the flyout should be \'Edit category\'', () => {
28
+ editCategoryFlyout.dialogBoxTitle()
29
+ .verifyInnerText('Edit Category')
30
+ .should('exist');
31
+ });
32
+
33
+ it('\'Select the symbols to display to the students.\' help text should be displayed below the title', () => {
34
+ editCategoryFlyout.selectSymbolsToDisplayLabel()
35
+ .verifyInnerText('Select the symbols to display to the students.')
36
+ .should('exist');
37
+ });
38
+
39
+ it('The name of the category should be displayed in the flyout with a checked checkbox', () => {
40
+ editCategoryFlyout.categoryLabel()
41
+ .verifyInnerText(`${equationEditorCategoriesAndSymbols['keypad'].displayName}`)
42
+ .should('be.visible');
43
+ editCategoryFlyout.categoryCheckbox()
44
+ .should('be.checked');
45
+ });
46
+
47
+ it(`All the ${equationEditorCategoriesAndSymbols['keypad'].displayName} characters should be displayed and should be in selected state`, () => {
48
+ const symbolsArray = Object.values(equationEditorCategoriesAndSymbols['keypad'].symbols)
49
+ editCategoryFlyout.categoryCharacters()
50
+ .each(($el, index) => {
51
+ cy.wrap($el)
52
+ .within(() => {
53
+ editCategoryFlyout.characterDragIcon()
54
+ .should('be.visible')
55
+ editCategoryFlyout.characterTickIcon()
56
+ .should('not.have.attr', 'aria-checked', 'false');
57
+ })
58
+ .should('have.class', 'Mui-selected')
59
+ .invoke('attr', 'aria-label')
60
+ .then((ariaLabel) => {
61
+ const expectedValue = `${symbolsArray[index].ariaLabel} selected`;
62
+ expect(ariaLabel.toLowerCase()).to.equal(expectedValue.toLowerCase());
63
+ cy.wrap($el)
64
+ .find('title')
65
+ .should('have.text', symbolsArray[index].title);
66
+ if (symbolsArray[index].textElement) {
67
+ cy.wrap($el)
68
+ .verifyInnerText(symbolsArray[index].textElement)
69
+ }
70
+ });
71
+ });
72
+ });
73
+
74
+ it('Reset button should be displayed in the flyout', () => {
75
+ editCategoryFlyout.buttonReset()
76
+ .verifyInnerText('Reset')
77
+ .should('exist');
78
+ editCategoryFlyout.resetIcon()
79
+ .should('exist');
80
+ });
81
+
82
+ it('\'Save\' button should be displayed in the flyout', () => {
83
+ editCategoryFlyout.buttonSave()
84
+ .verifyInnerText('Save')
85
+ .should('be.visible');
86
+ });
87
+
88
+ it('CSS of Edit category flyout components', { tags: 'css' }, () => {
89
+ editCategoryFlyout.dialogBoxTitle()
90
+ .verifyCSS(css.color.flyoutTitle, css.fontSize.heading, css.fontWeight.semibold);
91
+ editCategoryFlyout.categoryLabel()
92
+ .verifyCSS(css.color.accordionLabel, css.fontSize.default, css.fontWeight.bold);
93
+ editCategoryFlyout.categoryCheckbox()
94
+ .parents('.MuiCheckbox-root')
95
+ .find('svg')
96
+ .should('have.css', 'fill', css.color.activeButtons)
97
+ editCategoryFlyout.selectSymbolsToDisplayLabel()
98
+ .verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
99
+ editCategoryFlyout.categoryCharacters()
100
+ .eq(0)
101
+ .should('have.css', 'background-color', css.color.activeButtons)
102
+ .within(() => {
103
+ editCategoryFlyout.characterDragIcon()
104
+ .should('have.css', 'background-color', css.color.defaultBackground)
105
+ .find('path')
106
+ .eq(1)
107
+ .verifyCSS(css.color.activeButtons, css.fontSize.normal, css.fontWeight.bold);
108
+ editCategoryFlyout.characterTickIcon()
109
+ .find('path')
110
+ .eq(1)
111
+ .should('have.css', 'fill', css.color.activeButtons)
112
+ });
113
+ editCategoryFlyout.buttonSave()
114
+ .verifyCSS(css.color.primaryBtn, css.fontSize.default, css.fontWeight.semibold)
115
+ .should('have.css', 'background-color', css.color.primaryBtnBg);
116
+ editCategoryFlyout.buttonCancel()
117
+ .verifyCSS(css.color.secondaryBtn, css.fontSize.default, css.fontWeight.semibold)
118
+ .should('have.css', 'background-color', css.color.transparent);
119
+ });
120
+
121
+ it('Accessibility of Edit category flyout components', { tags: 'a11y' }, () => {
122
+ cy.checkAccessibility(editCategoryFlyout.dialogBox());
123
+ });
124
+
125
+ it('\'Cancel\' button should be displayed and on clicking it the flyout should close', () => {
126
+ editCategoryFlyout.buttonCancel()
127
+ .verifyInnerText('Cancel')
128
+ .should('be.visible')
129
+ .click();
130
+ editCategoryFlyout.dialogBox()
131
+ .should('not.exist');
132
+ });
133
+ });
134
+
135
+ describe('Category checkbox validation states', () => {
136
+ abortEarlySetup();
137
+ before(() => {
138
+ essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
139
+ essayResponsePage.steps.expandCustomizeFormattingOptionsAccordion();
140
+ essayResponsePage.steps.selectCustomizedFormattingOption(['Equation Editor']);
141
+ editCategoryFlyout.steps.openEditCategoryFlyout();
142
+ });
143
+
144
+ it('When user deselects any one character by clicking on it then the category checkbox should be in partially checked state', () => {
145
+ editCategoryFlyout.categoryCharacters()
146
+ .contains('[aria-label]', `${equationEditorCategoriesAndSymbols.keypad.symbols.one.ariaLabel}`, { matchCase: false })
147
+ .click()
148
+ .should('not.have.class', 'Mui-selected');
149
+ editCategoryFlyout.categoryCheckbox()
150
+ .should('have.attr', 'data-indeterminate', 'true');
151
+ });
152
+
153
+ it('When user clicks on the partially checked category checkbox then all the characters should be selected', () => {
154
+ editCategoryFlyout.categoryCheckbox()
155
+ .should('have.attr', 'data-indeterminate', 'true')
156
+ .click()
157
+ .should('be.checked');
158
+ editCategoryFlyout.categoryCharacters()
159
+ .each(($el) => {
160
+ cy.wrap($el)
161
+ .should('have.class', 'Mui-selected');
162
+ });
163
+ });
164
+
165
+ it('When user clicks on checked category checkbox then all the characters should get de-selected', () => {
166
+ editCategoryFlyout.categoryCheckbox()
167
+ .should('be.checked')
168
+ .click()
169
+ .should('not.be.checked');
170
+ editCategoryFlyout.categoryCharacters()
171
+ .each(($el) => {
172
+ cy.wrap($el)
173
+ .should('not.have.class', 'Mui-selected');
174
+ });
175
+ });
176
+
177
+ it('CSS of de-selected character', { tags: 'css' }, () => {
178
+ editCategoryFlyout.categoryCharacters()
179
+ .eq(0)
180
+ .should('have.css', 'background-color', css.color.defaultBackground)
181
+ .find('text')
182
+ .verifyCSS(css.color.liText, css.fontSize.normal, css.fontWeight.bold)
183
+ .parents('.icon-button-custom-format')
184
+ .within(() => {
185
+ editCategoryFlyout.characterDragIcon()
186
+ .should('have.css', 'background-color', css.color.defaultBackground)
187
+ .find('path')
188
+ .eq(1)
189
+ .verifyCSS(css.color.secondaryBtn, css.fontSize.normal, css.fontWeight.bold);
190
+ });
191
+ });
192
+
193
+ it('Accessibility of de-selected character', { tags: 'a11y' }, () => {
194
+ cy.checkAccessibility(editCategoryFlyout.categoryCharacters(0).parents('[class*="DragItemstyles__ItemContainer"]'))
195
+ });
196
+
197
+ it('When user clicks on the unchecked category checkbox then all the characters should get selected', () => {
198
+ editCategoryFlyout.categoryCheckbox()
199
+ .should('not.be.checked')
200
+ .click()
201
+ .and('be.checked');
202
+ editCategoryFlyout.categoryCharacters()
203
+ .each(($el) => {
204
+ cy.wrap($el)
205
+ .should('have.class', 'Mui-selected');
206
+ });
207
+ });
208
+
209
+ it('When user clicks on all the selected characters then the category checkbox should get unchecked', () => {
210
+ editCategoryFlyout.categoryCheckbox()
211
+ .should('be.checked');
212
+ editCategoryFlyout.categoryCharacters()
213
+ .each(($el) => {
214
+ cy.wrap($el)
215
+ .click()
216
+ .should('not.have.class', 'Mui-selected');
217
+ });
218
+ editCategoryFlyout.categoryCheckbox()
219
+ .should('not.be.checked');
220
+ });
221
+
222
+ it('When user clicks on all the de-selected characters the category checkbox should get checked', () => {
223
+ editCategoryFlyout.categoryCharacters()
224
+ .each(($el) => {
225
+ cy.wrap($el)
226
+ .click()
227
+ .should('have.class', 'Mui-selected');
228
+ });
229
+ editCategoryFlyout.categoryCheckbox()
230
+ .should('be.checked');
231
+ });
232
+ });
233
+
234
+ describe('\'Reset\' button validation states', () => {
235
+ abortEarlySetup();
236
+ before(() => {
237
+ essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
238
+ essayResponsePage.steps.expandCustomizeFormattingOptionsAccordion();
239
+ essayResponsePage.steps.selectCustomizedFormattingOption(['Equation Editor']);
240
+ });
241
+
242
+ it('When user opens the Edit category flyout then the Reset button should be disabled by default', () => {
243
+ editCategoryFlyout.steps.openEditCategoryFlyout();
244
+ editCategoryFlyout.buttonReset()
245
+ .should('be.disabled');
246
+ });
247
+
248
+ it('When user de-selects any character by clicking on it then the Reset button should get enabled', () => {
249
+ editCategoryFlyout.categoryCharacters()
250
+ .contains('[aria-label]', `${equationEditorCategoriesAndSymbols.keypad.symbols.one.ariaLabel}`, { matchCase: false })
251
+ .click()
252
+ .should('not.have.class', 'Mui-selected');
253
+ editCategoryFlyout.buttonReset()
254
+ .should('be.enabled');
255
+ });
256
+
257
+ it('CSS of enabled Reset button', { tags: 'css' }, () => {
258
+ editCategoryFlyout.buttonReset()
259
+ .verifyCSS(css.color.activeButtons, css.fontSize.default, css.fontWeight.regular);
260
+ });
261
+
262
+ it('Accessibility of enabled Reset button', { tags: 'a11y' }, () => {
263
+ cy.checkAccessibility(editCategoryFlyout.buttonReset());
264
+ })
265
+
266
+ it('When user clicks on the Reset button the changes should be reverted and the all the character should be selected again', () => {
267
+ editCategoryFlyout.buttonReset()
268
+ .click();
269
+ editCategoryFlyout.categoryCharacters()
270
+ .each(($el) => {
271
+ cy.wrap($el)
272
+ .should('have.class', 'Mui-selected');
273
+ });
274
+ });
275
+
276
+ it('When user de-selects characters and re-selects them then the Reset button should be disabled', () => {
277
+ editCategoryFlyout.categoryCharacters()
278
+ .contains('[aria-label]', `${equationEditorCategoriesAndSymbols.keypad.symbols.one.ariaLabel}`, { matchCase: false })
279
+ .click()
280
+ .should('not.have.class', 'Mui-selected');
281
+ editCategoryFlyout.categoryCharacters()
282
+ .contains('[aria-label]', `${equationEditorCategoriesAndSymbols.keypad.symbols.two.ariaLabel}`, { matchCase: false })
283
+ .click()
284
+ .should('not.have.class', 'Mui-selected');
285
+ editCategoryFlyout.categoryCharacters()
286
+ .contains('[aria-label]', `${equationEditorCategoriesAndSymbols.keypad.symbols.one.ariaLabel}`, { matchCase: false })
287
+ .click();
288
+ editCategoryFlyout.categoryCharacters()
289
+ .contains('[aria-label]', `${equationEditorCategoriesAndSymbols.keypad.symbols.two.ariaLabel}`, { matchCase: false })
290
+ .click();
291
+ editCategoryFlyout.buttonReset()
292
+ .should('be.disabled');
293
+ });
294
+
295
+ it('When user edits and saves the category then on opening the same Edit category flyout the \'Reset\' button should be disabled and the previously Saved changes should be displayed', () => {
296
+ editCategoryFlyout.categoryCharacters()
297
+ .contains('[aria-label]', `${equationEditorCategoriesAndSymbols.keypad.symbols.one.ariaLabel}`, { matchCase: false })
298
+ .click()
299
+ .should('not.have.class', 'Mui-selected');
300
+ editCategoryFlyout.categoryCharacters()
301
+ .contains('[aria-label]', `${equationEditorCategoriesAndSymbols.keypad.symbols.two.ariaLabel}`, { matchCase: false })
302
+ .click()
303
+ .should('not.have.class', 'Mui-selected');
304
+ editCategoryFlyout.buttonSave()
305
+ .click();
306
+ editCategoryFlyout.dialogBox()
307
+ .should('not.exist');
308
+ editCategoryFlyout.steps.openEditCategoryFlyout();
309
+ editCategoryFlyout.buttonReset()
310
+ .should('be.disabled');
311
+ editCategoryFlyout.categoryCharacters()
312
+ .contains('[aria-label]', `${equationEditorCategoriesAndSymbols.keypad.symbols.one.ariaLabel}`, { matchCase: false })
313
+ .should('not.have.class', 'Mui-selected');
314
+ editCategoryFlyout.categoryCharacters()
315
+ .contains('[aria-label]', `${equationEditorCategoriesAndSymbols.keypad.symbols.one.ariaLabel}`, { matchCase: false })
316
+ .should('not.have.class', 'Mui-selected');
317
+ editCategoryFlyout.categoryCharacters()
318
+ .then(($symbols) => {
319
+ for (let i = 0; i < $symbols.length - 2; i++) {
320
+ editCategoryFlyout.categoryCharacters()
321
+ .eq(i)
322
+ .should('have.class', 'Mui-selected');
323
+ }
324
+ });
325
+ });
326
+ });
327
+
328
+ describe('Save a edited category', () => {
329
+ abortEarlySetup();
330
+ before(() => {
331
+ essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
332
+ essayResponsePage.steps.expandCustomizeFormattingOptionsAccordion();
333
+ essayResponsePage.steps.selectCustomizedFormattingOption(['Equation Editor']);
334
+ editCategoryFlyout.steps.openEditCategoryFlyout()
335
+ });
336
+
337
+ it('When user edits a category and clicks on Cancel button then the flyout should close and the changes should not be saved', () => {
338
+ editCategoryFlyout.categoryCharacters()
339
+ .contains('[aria-label]', `${equationEditorCategoriesAndSymbols.keypad.symbols.one.ariaLabel}`, { matchCase: false })
340
+ .click()
341
+ .should('not.have.class', 'Mui-selected');
342
+ editCategoryFlyout.categoryCharacters()
343
+ .contains('[aria-label]', `${equationEditorCategoriesAndSymbols.keypad.symbols.two.ariaLabel}`, { matchCase: false })
344
+ .click()
345
+ .should('not.have.class', 'Mui-selected');
346
+ editCategoryFlyout.buttonCancel()
347
+ .click();
348
+ editCategoryFlyout.dialogBox()
349
+ .should('not.exist');
350
+ editCategoryFlyout.steps.openEditCategoryFlyout()
351
+ editCategoryFlyout.categoryCharacters()
352
+ .each(($el) => {
353
+ cy.wrap($el)
354
+ .should('have.class', 'Mui-selected');
355
+ });
356
+ });
357
+
358
+ it('When user edits a category and saves it then the changes should be displayed in the Equation editor flyout', () => {
359
+ const symbolsArray = Object.values(equationEditorCategoriesAndSymbols['keypad'].symbols)
360
+ editCategoryFlyout.categoryCharacters()
361
+ .contains('[aria-label]', `${equationEditorCategoriesAndSymbols.keypad.symbols.one.ariaLabel}`, { matchCase: false })
362
+ .click()
363
+ .should('not.have.class', 'Mui-selected');
364
+ editCategoryFlyout.buttonSave()
365
+ .click();
366
+ editCategoryFlyout.dialogBox()
367
+ .should('not.exist');
368
+ essayResponsePage.steps.switchToPreviewTab()
369
+ essayResponsePage.previewTabToolbarOption('Equation Editor')
370
+ .click();
371
+ equationEditorFlyout.categoryCharacters()
372
+ .each(($el, index) => {
373
+ cy.wrap($el)
374
+ .should('have.attr', 'aria-label', symbolsArray[index + 1].ariaLabel)
375
+ });
376
+ equationEditorFlyout.buttonCancel()
377
+ .click();
378
+ });
379
+
380
+ it('When user re-visits the Edit category flyout the changes should be displayed', () => {
381
+ const symbolsArray = Object.values(equationEditorCategoriesAndSymbols['keypad'].symbols)
382
+ essayResponsePage.steps.switchToEditTab()
383
+ editCategoryFlyout.steps.openEditCategoryFlyout();
384
+ editCategoryFlyout.categoryCharacters()
385
+ .contains('[aria-label]', `${equationEditorCategoriesAndSymbols.keypad.symbols.one.ariaLabel}`, { matchCase: false })
386
+ .should('not.have.class', 'Mui-selected')
387
+ editCategoryFlyout.categoryCharacters()
388
+ .then(($symbols) => {
389
+ for (let index = 0; index < $symbols.length - 1; index++) {
390
+ editCategoryFlyout.categoryCharacters()
391
+ .eq(index)
392
+ .should('have.class', 'Mui-selected')
393
+ .invoke('attr', 'aria-label')
394
+ .then((ariaLabel) => {
395
+ const expectedValue = `${symbolsArray[index + 1].ariaLabel} selected`;
396
+ expect(ariaLabel.toLowerCase()).to.equal(expectedValue.toLowerCase())
397
+ });
398
+ }
399
+ });
400
+ });
401
+ });
402
+ });