itemengine-cypress-automation 1.0.19 → 1.0.21
Sign up to get free protection for your applications and to get access to all the features.
- package/cypress/e2e/ILC/EssayResponse/essayResponseAdditionalSettings.js +432 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponseAdditionalSettingsBasic.js +134 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponseCreateCustomCategory.js +932 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponseCustomizeFormattingOptions1.js +333 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponseCustomizeFormattingOptions2.js +332 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponseCustomizeFormattingOptions3.js +522 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponseEditCategoryFlyout.js +402 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponseEditTabBasicSections.js +558 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponseEquationEditor.js +572 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponseEquationEditorCategories1.js +290 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponseEquationEditorCategories2.js +514 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponseHeaderSection.js +80 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponsePreviewAddTable.js +412 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponsePreviewEditTable.js +659 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponsePreviewHyperlink.js +318 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponseScoringSection.js +59 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponseSpecialCharacters.js +33 -0
- package/cypress/e2e/ILC/EssayResponseBasic/essayResponseBasicCustomizeFormattingOptions.js +207 -0
- package/cypress/e2e/ILC/EssayResponseMath/essayResponseMathCharacters.js +38 -0
- package/cypress/e2e/ILC/EssayResponseMath/essayResponseMathCreateItem.js +243 -0
- package/package.json +1 -1
@@ -0,0 +1,412 @@
|
|
1
|
+
import { essayResponsePage } from "../../../pages";
|
2
|
+
import abortEarlySetup from "../../../support/helpers/abortEarly";
|
3
|
+
const css = Cypress.env('css');
|
4
|
+
|
5
|
+
describe('Essay Response Preview: Add Table Functionality', () => {
|
6
|
+
before(() => {
|
7
|
+
cy.loginAs('admin');
|
8
|
+
});
|
9
|
+
|
10
|
+
describe('Add Table flyout contents', () => {
|
11
|
+
abortEarlySetup();
|
12
|
+
before(() => {
|
13
|
+
cy.log('Navigate to Essay Response question type and switching to preview tab.');
|
14
|
+
essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
|
15
|
+
essayResponsePage.steps.switchToPreviewTab();
|
16
|
+
});
|
17
|
+
|
18
|
+
it('\'Table\' option should be present in the preview tab toolbar', () => {
|
19
|
+
essayResponsePage.previewTabToolbarOption('Insert Table')
|
20
|
+
.should('be.visible');
|
21
|
+
});
|
22
|
+
|
23
|
+
it('When user clicks on Table option in the toolbar, then the Table flyout should appear.', () => {
|
24
|
+
essayResponsePage.previewTabToolbarOption('Insert Table')
|
25
|
+
.click();
|
26
|
+
essayResponsePage.addTableDialogBox()
|
27
|
+
.should('be.visible');
|
28
|
+
});
|
29
|
+
|
30
|
+
it('CSS of table flyout', { tags: 'css' }, () => {
|
31
|
+
//ILC theme is not implemented in Essay Response Table flyout.
|
32
|
+
});
|
33
|
+
|
34
|
+
it('Accessibility of Add Table flyout.', { tags: 'a11y' }, () => {
|
35
|
+
cy.checkAccessibility(essayResponsePage.addTableDialogBox());
|
36
|
+
});
|
37
|
+
|
38
|
+
it('Title of the flyout should be \'Table\'.', () => {
|
39
|
+
essayResponsePage.addTableDialogBoxTitle()
|
40
|
+
.verifyInnerText('Table');
|
41
|
+
});
|
42
|
+
|
43
|
+
it('\'Columns\' and \'Rows\' label should be displayed in the flyout along with their input fields, and the input fields should have values \'3\' and \'2\' by default.', () => {
|
44
|
+
essayResponsePage.addTableDialogBoxColumnsLabel()
|
45
|
+
.verifyInnerText('Columns')
|
46
|
+
.and('be.visible');
|
47
|
+
essayResponsePage.addTableDialogBoxColumnsInputField()
|
48
|
+
.should('have.value', '3');
|
49
|
+
essayResponsePage.addTableDialogBoxRowsLabel()
|
50
|
+
.verifyInnerText('Rows')
|
51
|
+
.and('be.visible');
|
52
|
+
essayResponsePage.addTableDialogBoxRowsInputField()
|
53
|
+
.should('have.value', '2');
|
54
|
+
});
|
55
|
+
|
56
|
+
it('User should be able to modify the values of \'Columns\' and \'Rows\' input fields. Also maximum and minimum input that the user can give in \'Columns\' and \'Rows\' input fields should be \'999\' and \'1\'.', () => { //TODO- Need to implement browser alerts: https://www.tutorialspoint.com/cypress/cypress_alerts.htm#:~:text=Cypress%20can%20work%20with%20alerts,to%20fire%20the%20browser%20events.
|
57
|
+
essayResponsePage.addTableDialogBoxColumnsInputField()
|
58
|
+
.should('have.attr', 'min', '1')
|
59
|
+
.and('have.attr', 'max', '999');
|
60
|
+
essayResponsePage.addTableDialogBoxRowsInputField()
|
61
|
+
.should('have.attr', 'min', '1')
|
62
|
+
.and('have.attr', 'max', '999');
|
63
|
+
});
|
64
|
+
|
65
|
+
it('\'Add Header Row\' and \'Highlight First Column\' label should be displayed in the flyout with a checkbox beside them and the checkboxes should be unchecked by default.', () => {
|
66
|
+
essayResponsePage.addTableDialogBoxAddHeaderRowLabel()
|
67
|
+
.verifyInnerText('Add header row')
|
68
|
+
.and('be.visible');
|
69
|
+
essayResponsePage.addTableDialogBoxAddHeaderRowCheckbox()
|
70
|
+
.should('not.be.checked');
|
71
|
+
essayResponsePage.addTableDialogBoxHighlightFirstColumnLabel()
|
72
|
+
.verifyInnerText('Highlight first column')
|
73
|
+
.and('be.visible');
|
74
|
+
essayResponsePage.addTableDialogBoxHighlightFirstColumnCheckbox()
|
75
|
+
.should('not.be.checked');
|
76
|
+
});
|
77
|
+
|
78
|
+
it('\'Cancel\' button should be displayed in the flyout and when user clicks on it then the flyout should close.', () => {
|
79
|
+
essayResponsePage.addTableDialogBoxButtonCancel()
|
80
|
+
.should('be.visible')
|
81
|
+
.click();
|
82
|
+
essayResponsePage.addTableDialogBox()
|
83
|
+
.should('not.be.visible');
|
84
|
+
});
|
85
|
+
});
|
86
|
+
|
87
|
+
describe('Add table and enter input into the table.', () => {
|
88
|
+
abortEarlySetup();
|
89
|
+
before(() => {
|
90
|
+
cy.log('Navigate to Essay Response question type and switching to preview tab. Open Table flyout, modify columns and rows input field and check both the checkboxes.');
|
91
|
+
essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
|
92
|
+
essayResponsePage.steps.switchToPreviewTab();
|
93
|
+
essayResponsePage.previewTabToolbarOption('Insert Table')
|
94
|
+
.click();
|
95
|
+
essayResponsePage.addTableDialogBoxColumnsInputField()
|
96
|
+
.clear()
|
97
|
+
.type('4')
|
98
|
+
essayResponsePage.addTableDialogBoxRowsInputField()
|
99
|
+
.clear()
|
100
|
+
.type('4');
|
101
|
+
essayResponsePage.addTableDialogBoxAddHeaderRowCheckbox()
|
102
|
+
.click({ force: true });
|
103
|
+
essayResponsePage.addTableDialogBoxHighlightFirstColumnCheckbox()
|
104
|
+
.click({ force: true });
|
105
|
+
});
|
106
|
+
|
107
|
+
it('When user clicks on \'Add Table\' button, table with the set properties should be displayed in the response field.', () => {
|
108
|
+
essayResponsePage.addTableDialogBoxButtonAddTable()
|
109
|
+
.click();
|
110
|
+
essayResponsePage.previewInputFieldTable()
|
111
|
+
.should('be.visible')
|
112
|
+
.within(() => {
|
113
|
+
cy.get('tr')
|
114
|
+
.should('have.length', 4);
|
115
|
+
cy.get('td')
|
116
|
+
.should('have.length', 9);
|
117
|
+
cy.get('thead')
|
118
|
+
.find('th')
|
119
|
+
.should('have.length', 4); //To check header row
|
120
|
+
cy.get('tbody')
|
121
|
+
.find('tr')
|
122
|
+
.each(($element) => {
|
123
|
+
cy.wrap($element)
|
124
|
+
.within(() => {
|
125
|
+
cy.get('th')
|
126
|
+
.should('have.length', 1);
|
127
|
+
cy.get('td')
|
128
|
+
.should('have.length', 3);
|
129
|
+
});
|
130
|
+
});
|
131
|
+
});
|
132
|
+
});
|
133
|
+
|
134
|
+
it.skip('When user adds a table to the response field, then the cursor should be focused inside a table cell by default.', () => {
|
135
|
+
//proper class for the cursor is not implemented.
|
136
|
+
});
|
137
|
+
|
138
|
+
it('When cursor is focused is inside a table cell, the Table option from the toolbar should be disabled.', () => {
|
139
|
+
essayResponsePage.previewTabToolbarOption('Insert Table')
|
140
|
+
.should('have.attr', 'aria-disabled', 'true');
|
141
|
+
});
|
142
|
+
|
143
|
+
it('When user gives input to the table, then the word count should be increased accordingly', () => {
|
144
|
+
essayResponsePage.previewInputFieldTable()
|
145
|
+
.find('th')
|
146
|
+
.eq(1)
|
147
|
+
.type('lorem ipsum');
|
148
|
+
essayResponsePage.responseFieldWordCount()
|
149
|
+
.verifyInnerText('2/10000');
|
150
|
+
});
|
151
|
+
|
152
|
+
it('When user removes the given input in the table, then the word count should be decreased accordingly', () => { //Failing due to bug https://redmine.zeuslearning.com/issues/525610
|
153
|
+
essayResponsePage.previewInputFieldTable()
|
154
|
+
.find('th')
|
155
|
+
.eq(1)
|
156
|
+
.type('{backspace}'.repeat(13), { delay: 500 })
|
157
|
+
essayResponsePage.responseFieldWordCount()
|
158
|
+
.verifyInnerText('0/10000');
|
159
|
+
});
|
160
|
+
|
161
|
+
it('When user enters text in any cell, the column width of that cell should increase and the width of other columns should decrease.', () => {
|
162
|
+
let cellWidth
|
163
|
+
essayResponsePage.previewInputFieldTable()
|
164
|
+
.within(() => {
|
165
|
+
cy.get('th')
|
166
|
+
.eq(1)
|
167
|
+
.then(($originalCellWidth) => {
|
168
|
+
cellWidth = $originalCellWidth.width(); //Storing original column width
|
169
|
+
});
|
170
|
+
cy.get('th')
|
171
|
+
.eq(1)
|
172
|
+
.type('lorem')
|
173
|
+
.verifyInnerText('lorem')
|
174
|
+
.then(($modifiedCellWidth) => {
|
175
|
+
let modifiedCellWidth = $modifiedCellWidth.width();
|
176
|
+
expect(modifiedCellWidth).to.be.gt(cellWidth); //Comparing modified and original column width
|
177
|
+
});
|
178
|
+
cy.get('th')
|
179
|
+
.eq(2)
|
180
|
+
.then(($modifiedCellWidth) => {
|
181
|
+
let modifiedCellWidth = $modifiedCellWidth.width();
|
182
|
+
expect(modifiedCellWidth).to.be.lt(cellWidth); //Comparing new and original width of other columns
|
183
|
+
});
|
184
|
+
});
|
185
|
+
});
|
186
|
+
|
187
|
+
it('When user removes the text in any table cell, the column width of that cell should decrease and the width of other columns should simultaneously increase.', () => {
|
188
|
+
let cellWidth
|
189
|
+
essayResponsePage.previewInputFieldTable()
|
190
|
+
.within(() => {
|
191
|
+
cy.get('th')
|
192
|
+
.eq(1)
|
193
|
+
.then(($originalCellWidth) => {
|
194
|
+
cellWidth = $originalCellWidth.width();
|
195
|
+
});
|
196
|
+
cy.get('th')
|
197
|
+
.eq(1)
|
198
|
+
.type('{backspace}{backspace}{backspace}{backspace}{backspace}')
|
199
|
+
.then(($modifiedCellWidth) => {
|
200
|
+
let modifiedCellWidth = $modifiedCellWidth.width();
|
201
|
+
expect(modifiedCellWidth).to.be.lt(cellWidth);
|
202
|
+
cellWidth = modifiedCellWidth;
|
203
|
+
});
|
204
|
+
cy.get('th')
|
205
|
+
.eq(1)
|
206
|
+
.then(($modifiedCellWidth) => {
|
207
|
+
let modifiedCellWidth = $modifiedCellWidth.width();
|
208
|
+
expect(modifiedCellWidth).to.be.eq(cellWidth); //Cell width increases again to match the original cell width
|
209
|
+
});
|
210
|
+
});
|
211
|
+
});
|
212
|
+
|
213
|
+
it('When user enters multi-line text in any table cell, the height of that cell and its row should increase.', () => {
|
214
|
+
let cellHeight;
|
215
|
+
essayResponsePage.previewInputFieldTable()
|
216
|
+
.within(() => {
|
217
|
+
cy.get('td')
|
218
|
+
.eq(1)
|
219
|
+
.then(($originalCellHeight) => {
|
220
|
+
cellHeight = $originalCellHeight.height();
|
221
|
+
});
|
222
|
+
cy.get('td')
|
223
|
+
.eq(1)
|
224
|
+
.type('lo{Enter}rem')
|
225
|
+
.verifyInnerText('lo\n\n\nrem')
|
226
|
+
.then(($modifiedCellHeight) => {
|
227
|
+
let modifiedCellHeight = $modifiedCellHeight.height();
|
228
|
+
expect(modifiedCellHeight).to.be.gt(cellHeight);
|
229
|
+
});
|
230
|
+
});
|
231
|
+
});
|
232
|
+
|
233
|
+
it('CSS of the table and text inside table cells.', { tags: 'css' }, () => {
|
234
|
+
cy.log('Pre-step: Adding input to all table cells.');
|
235
|
+
essayResponsePage.previewInputFieldTable()
|
236
|
+
.within(() => {
|
237
|
+
cy.get('th')
|
238
|
+
.each(($element) => {
|
239
|
+
cy.wrap($element)
|
240
|
+
.type('Header cell');
|
241
|
+
});
|
242
|
+
cy.get('td')
|
243
|
+
.each(($element) => {
|
244
|
+
cy.wrap($element)
|
245
|
+
.type('Standard cell');
|
246
|
+
});
|
247
|
+
});
|
248
|
+
essayResponsePage.previewInputFieldTable()
|
249
|
+
.should('have.attr', 'border', '1')
|
250
|
+
.and('have.css', 'border-color', css.color.secondaryBtnBorder)
|
251
|
+
.within(() => {
|
252
|
+
cy.get('th')
|
253
|
+
.each(($element) => {
|
254
|
+
cy.wrap($element)
|
255
|
+
.verifyCSS(css.color.whiteText, css.fontSize.default, css.fontWeight.bold) //Verifying CSS of highlighted cells
|
256
|
+
.and('have.css', 'background-color', css.color.highlightedTableCell);
|
257
|
+
});
|
258
|
+
cy.get('td')
|
259
|
+
.each(($element) => {
|
260
|
+
cy.wrap($element)
|
261
|
+
.verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular) //Verifying CSS of standard cells.
|
262
|
+
.and('have.css', 'background-color', css.color.transparent);
|
263
|
+
});
|
264
|
+
cy.get('th')
|
265
|
+
.eq(0)
|
266
|
+
.should('have.css', 'border-bottom', `1px solid ${css.color.highlightedTableCellBorder}`) //Verifying different coloured border for a highlighted cell.
|
267
|
+
.and('have.css', 'border-right', `1px solid ${css.color.secondaryBtnBorder}`);
|
268
|
+
cy.get('td')
|
269
|
+
.last()
|
270
|
+
.should('have.css', 'border-color', css.color.secondaryBtnBorder); //Verifying border-color for a standard cell.
|
271
|
+
});
|
272
|
+
});
|
273
|
+
|
274
|
+
it('Accessibility of the table.', { tags: 'a11y' }, () => {
|
275
|
+
cy.checkAccessibility(essayResponsePage.previewInputFieldTable());
|
276
|
+
});
|
277
|
+
|
278
|
+
it('When the cursor focus is changed to outside the table, the Table option in the toolbar should be enabled again.', () => {
|
279
|
+
cy.log('Pre-step: Shifting the focus outside the table in the response field.');
|
280
|
+
essayResponsePage.previewInputFieldTable()
|
281
|
+
.find('td')
|
282
|
+
.last()
|
283
|
+
.type('{rightArrow}{rightArrow}');
|
284
|
+
essayResponsePage.previewTabToolbarOption('Insert Table')
|
285
|
+
.should('have.attr', 'aria-disabled', 'false');
|
286
|
+
});
|
287
|
+
|
288
|
+
it('When user clicks on Table option in the toolbar, then add table flyout should again appear in its default state.', () => {
|
289
|
+
essayResponsePage.previewTabToolbarOption('Insert Table')
|
290
|
+
.click();
|
291
|
+
essayResponsePage.addTableDialogBox()
|
292
|
+
.should('be.visible');
|
293
|
+
essayResponsePage.addTableDialogBoxColumnsInputField()
|
294
|
+
.should('have.value', '3');
|
295
|
+
essayResponsePage.addTableDialogBoxRowsInputField()
|
296
|
+
.should('have.value', '2');
|
297
|
+
essayResponsePage.addTableDialogBoxAddHeaderRowCheckbox()
|
298
|
+
.should('not.be.checked');
|
299
|
+
essayResponsePage.addTableDialogBoxHighlightFirstColumnCheckbox()
|
300
|
+
.should('not.be.checked');
|
301
|
+
});
|
302
|
+
|
303
|
+
it('When user clicks on \'Add Table\' button, then another table should be added in the response field.', () => {
|
304
|
+
essayResponsePage.addTableDialogBoxButtonAddTable()
|
305
|
+
.click();
|
306
|
+
essayResponsePage.previewInputFieldTable()
|
307
|
+
.eq(1)
|
308
|
+
.should('be.visible')
|
309
|
+
.within(() => {
|
310
|
+
cy.get('tr')
|
311
|
+
.should('have.length', 2);
|
312
|
+
cy.get('td')
|
313
|
+
.should('have.length', 6);
|
314
|
+
});
|
315
|
+
});
|
316
|
+
});
|
317
|
+
|
318
|
+
describe('Add table with header row, highlighted column.', () => {
|
319
|
+
abortEarlySetup();
|
320
|
+
before(() => {
|
321
|
+
cy.log('Navigating to Essay Response question type and switching to preview tab.');
|
322
|
+
essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
|
323
|
+
essayResponsePage.steps.switchToPreviewTab();
|
324
|
+
});
|
325
|
+
|
326
|
+
beforeEach(() => {
|
327
|
+
essayResponsePage.responseField()
|
328
|
+
.type('{selectAll}{backspace}');
|
329
|
+
essayResponsePage.previewTabToolbarOption('Insert Table')
|
330
|
+
.click();
|
331
|
+
});
|
332
|
+
|
333
|
+
it('When user checks the \'Add header row\' checkbox and then clicks on \'Add table\' button, the first row of the added table should be highlighted as table header', () => {
|
334
|
+
cy.log('Check the \'Add header row\' checkbox.');
|
335
|
+
essayResponsePage.addTableDialogBoxAddHeaderRowCheckbox()
|
336
|
+
.click({ force: true });
|
337
|
+
essayResponsePage.addTableDialogBoxButtonAddTable()
|
338
|
+
.click();
|
339
|
+
essayResponsePage.previewInputFieldTable()
|
340
|
+
.within(() => {
|
341
|
+
cy.get('thead')
|
342
|
+
.find('th')
|
343
|
+
.should('have.length', 3)
|
344
|
+
.each(($element) => {
|
345
|
+
expect($element).to.have.css('background-color', css.color.highlightedTableCell); //To check that header row th cells are highlighted cells
|
346
|
+
});
|
347
|
+
cy.get('tbody')
|
348
|
+
.find('td')
|
349
|
+
.should('have.length', 3)
|
350
|
+
.each(($element) => {
|
351
|
+
expect($element).to.have.css('background-color', css.color.transparent); //To check that td cells are standard cells
|
352
|
+
});
|
353
|
+
});
|
354
|
+
});
|
355
|
+
|
356
|
+
it('When user checks the \'Highlight first column\' checkbox and then clicks on \'Add table\' button, the first column of the added table should be highlighted.', () => {
|
357
|
+
cy.log('Check the \'Highlight first column\' checkbox.');
|
358
|
+
essayResponsePage.addTableDialogBoxHighlightFirstColumnCheckbox()
|
359
|
+
.click({ force: true });
|
360
|
+
essayResponsePage.addTableDialogBoxButtonAddTable()
|
361
|
+
.click();
|
362
|
+
essayResponsePage.previewInputFieldTable()
|
363
|
+
.within(() => {
|
364
|
+
cy.get('tr')
|
365
|
+
.each(($element) => {
|
366
|
+
cy.wrap($element)
|
367
|
+
.within(() => {
|
368
|
+
cy.get('th')
|
369
|
+
.should('have.length', 1)
|
370
|
+
.and('have.css', 'background-color', css.color.highlightedTableCell);
|
371
|
+
cy.get('td')
|
372
|
+
.should('have.length', 2)
|
373
|
+
.each(($element) => {
|
374
|
+
cy.wrap($element)
|
375
|
+
.should('have.css', 'background-color', css.color.transparent);
|
376
|
+
});
|
377
|
+
});
|
378
|
+
});
|
379
|
+
});
|
380
|
+
});
|
381
|
+
|
382
|
+
it('When user checks both \'Add header row\' and \'Highlight first column\' checkboxes and then clicks on \'Add table\' button, the first column and first row of the added table should be highlighted.', () => {
|
383
|
+
cy.log('Check both \'Add header row\' and \'Highlight first column\' checkboxes.');
|
384
|
+
essayResponsePage.addTableDialogBoxAddHeaderRowCheckbox()
|
385
|
+
.click({ force: true });
|
386
|
+
essayResponsePage.addTableDialogBoxHighlightFirstColumnCheckbox()
|
387
|
+
.click({ force: true });
|
388
|
+
essayResponsePage.addTableDialogBoxButtonAddTable()
|
389
|
+
.click();
|
390
|
+
essayResponsePage.previewInputFieldTable()
|
391
|
+
.within(() => {
|
392
|
+
cy.get('thead')
|
393
|
+
.find('th')
|
394
|
+
.should('have.length', 3)
|
395
|
+
.each(($element) => {
|
396
|
+
expect($element).to.have.css('background-color', css.color.highlightedTableCell);
|
397
|
+
});
|
398
|
+
cy.get('tbody')
|
399
|
+
.within(() => {
|
400
|
+
cy.get('th')
|
401
|
+
.should('have.length', 1)
|
402
|
+
.and('have.css', 'background-color', css.color.highlightedTableCell);
|
403
|
+
cy.get('td')
|
404
|
+
.should('have.length', 2)
|
405
|
+
.each(($element) => {
|
406
|
+
expect($element).to.have.css('background-color', css.color.transparent);
|
407
|
+
});
|
408
|
+
});
|
409
|
+
});
|
410
|
+
});
|
411
|
+
});
|
412
|
+
});
|