itemengine-cypress-automation 1.0.19 → 1.0.20
Sign up to get free protection for your applications and to get access to all the features.
- package/cypress/e2e/ILC/EssayResponse/essayResponseAdditionalSettings.js +555 -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 +1346 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponseHeaderSection.js +80 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponseMathCharacters.js +38 -0
- package/cypress/e2e/ILC/EssayResponse/essayResponseMathCreateItem.js +243 -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/package.json +1 -1
@@ -0,0 +1,659 @@
|
|
1
|
+
import { essayResponsePage } from "../../../pages";
|
2
|
+
import abortEarlySetup from "../../../support/helpers/abortEarly";
|
3
|
+
const css = Cypress.env('css');
|
4
|
+
|
5
|
+
describe('Essay Response Preview: Edit Table functionality', () => {
|
6
|
+
before(() => {
|
7
|
+
cy.loginAs('admin');
|
8
|
+
});
|
9
|
+
|
10
|
+
describe('Edit Table flyout contents', () => {
|
11
|
+
abortEarlySetup();
|
12
|
+
before(() => {
|
13
|
+
cy.log('Navigating to Essay Response, switching to preview tab and adding table to response field.');
|
14
|
+
essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
|
15
|
+
essayResponsePage.steps.switchToPreviewTab();
|
16
|
+
essayResponsePage.previewTabToolbarOption('Insert Table')
|
17
|
+
.click();
|
18
|
+
essayResponsePage.addTableDialogBoxAddHeaderRowCheckbox()
|
19
|
+
.check({ force: true });
|
20
|
+
essayResponsePage.addTableDialogBoxButtonAddTable()
|
21
|
+
.click();
|
22
|
+
});
|
23
|
+
|
24
|
+
it('When user right clicks on the added table, then Edit Table flyout should appear.', () => {
|
25
|
+
essayResponsePage.previewInputFieldTable()
|
26
|
+
.rightclick();
|
27
|
+
essayResponsePage.editTableDialogBox()
|
28
|
+
.should('be.visible');
|
29
|
+
});
|
30
|
+
|
31
|
+
it('CSS of Edit table flyout', { tags: 'css' }, () => {
|
32
|
+
const buttonSelectors = [essayResponsePage.editTableDialogBoxInsertBeforeButton, essayResponsePage.editTableDialogBoxInsertAfterButton, essayResponsePage.editTableDialogBoxDeleteColumnButton, essayResponsePage.editTableDialogBoxInsertAboveButton, essayResponsePage.editTableDialogBoxInsertBelowButton, essayResponsePage.editTableDialogBoxDeleteRowButton];
|
33
|
+
const buttonLabelSelectors = [essayResponsePage.editTableDialogBoxColumnsLabel, essayResponsePage.editTableDialogBoxRowsLabel];
|
34
|
+
const customizationLabelSelectors = [essayResponsePage.editTableDialogBoxAddHeaderRowLabel, essayResponsePage.editTableDialogBoxHighlightFirstColumnLabel];
|
35
|
+
essayResponsePage.addTableDialogBoxTitle()
|
36
|
+
.verifyCSS(css.color.flyoutTitle, css.fontSize.heading, css.fontWeight.semibold);
|
37
|
+
buttonLabelSelectors.forEach((label) => {
|
38
|
+
label()
|
39
|
+
.verifyCSS(css.color.labels, css.fontSize.normal, css.fontWeight.semibold);
|
40
|
+
});
|
41
|
+
buttonSelectors.forEach((button) => {
|
42
|
+
button()
|
43
|
+
.find('span')
|
44
|
+
.verifyCSS(css.color.secondaryBtn, css.fontSize.normal, css.fontWeight.regular)
|
45
|
+
.should('have.css', 'background-color', css.color.transparent);
|
46
|
+
});
|
47
|
+
customizationLabelSelectors.forEach((label) => {
|
48
|
+
label()
|
49
|
+
.find('label')
|
50
|
+
.verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.semibold);
|
51
|
+
});
|
52
|
+
essayResponsePage.addTableDialogBoxButtonCancel()
|
53
|
+
.should('have.css', 'background-color', css.color.secondaryBtnBg)
|
54
|
+
.find('span')
|
55
|
+
.verifyCSS(css.color.secondaryBtn, css.fontSize.default, css.fontWeight.regular)
|
56
|
+
essayResponsePage.editTableDialogBoxButtonDelete()
|
57
|
+
.should('have.css', 'background-color', css.color.editTableDeleteButton)
|
58
|
+
.find('span')
|
59
|
+
.verifyCSS(css.color.primaryBtn, css.fontSize.default, css.fontWeight.regular)
|
60
|
+
essayResponsePage.editTableDialogBoxButtonSave()
|
61
|
+
.should('have.css', 'background-color', css.color.primaryBtnBg)
|
62
|
+
.find('span')
|
63
|
+
.verifyCSS(css.color.primaryBtn, css.fontSize.default, css.fontWeight.regular)
|
64
|
+
//need to add css of checkbox
|
65
|
+
});
|
66
|
+
|
67
|
+
it('Accessibility of Edit Table flyout.', { tags: 'a11y' }, () => {
|
68
|
+
cy.checkAccessibility(essayResponsePage.editTableDialogBox());
|
69
|
+
});
|
70
|
+
|
71
|
+
it('Title of the flyout should be \'Table\'.', () => {
|
72
|
+
essayResponsePage.addTableDialogBoxTitle()
|
73
|
+
.verifyInnerText('CloseTable');
|
74
|
+
//TODO- Need to change this after DOM structure is updated.
|
75
|
+
});
|
76
|
+
|
77
|
+
it('\'Add Header Row\' and \'Highlight First Column\' label should be displayed in the flyout with a checkbox beside it.', () => { //File will fail here as these labels are not in sentence casing.
|
78
|
+
essayResponsePage.editTableDialogBoxAddHeaderRowLabel()
|
79
|
+
.verifyInnerText('Add header row')
|
80
|
+
.and('be.visible');
|
81
|
+
essayResponsePage.editTableDialogBoxHighlightFirstColumnLabel()
|
82
|
+
.verifyInnerText('Highlight first column')
|
83
|
+
.and('be.visible');
|
84
|
+
});
|
85
|
+
|
86
|
+
it('State of the checkboxes in the Add table flyout while adding the table should persist in Edit Table flyout.', () => {
|
87
|
+
essayResponsePage.editTableDialogBoxAddHeaderRowCheckbox()
|
88
|
+
.should('be.checked');
|
89
|
+
essayResponsePage.editTableDialogBoxHighlightFirstColumnCheckbox()
|
90
|
+
.should('not.be.checked');
|
91
|
+
});
|
92
|
+
|
93
|
+
it('The labels \'Columns\' and \'Rows\' should be displayed in the flyout along with their buttons \'Insert Before\', \'Insert Above\', \'Insert After\', \'Insert Below\', \'Delete Column\' and \'Delete Row\'.', () => {
|
94
|
+
essayResponsePage.editTableDialogBoxColumnsLabel()
|
95
|
+
.verifyInnerText('Columns')
|
96
|
+
.and('be.visible');
|
97
|
+
essayResponsePage.editTableDialogBoxInsertBeforeButton()
|
98
|
+
.verifyInnerText('Insert before')
|
99
|
+
.and('be.visible');
|
100
|
+
essayResponsePage.editTableDialogBoxInsertAfterButton()
|
101
|
+
.verifyInnerText('Insert after')
|
102
|
+
.and('be.visible');
|
103
|
+
essayResponsePage.editTableDialogBoxDeleteColumnButton()
|
104
|
+
.verifyInnerText('Delete column')
|
105
|
+
.and('be.visible');
|
106
|
+
essayResponsePage.editTableDialogBoxRowsLabel()
|
107
|
+
.verifyInnerText('Rows')
|
108
|
+
.and('be.visible');
|
109
|
+
essayResponsePage.editTableDialogBoxInsertAboveButton()
|
110
|
+
.verifyInnerText('Insert above')
|
111
|
+
.and('be.visible');
|
112
|
+
essayResponsePage.editTableDialogBoxInsertBelowButton()
|
113
|
+
.verifyInnerText('Insert below')
|
114
|
+
.and('be.visible');
|
115
|
+
essayResponsePage.editTableDialogBoxDeleteRowButton()
|
116
|
+
.verifyInnerText('Delete row')
|
117
|
+
.and('be.visible');
|
118
|
+
});
|
119
|
+
|
120
|
+
it('\'Delete\' button should be displayed in the flyout.', () => {
|
121
|
+
essayResponsePage.editTableDialogBoxButtonDelete()
|
122
|
+
.verifyInnerText('Delete')
|
123
|
+
.and('be.visible');
|
124
|
+
});
|
125
|
+
|
126
|
+
it('\'Save\' button should be displayed in the flyout.', () => {
|
127
|
+
essayResponsePage.editTableDialogBoxButtonSave()
|
128
|
+
.verifyInnerText('Save')
|
129
|
+
.and('be.visible');
|
130
|
+
});
|
131
|
+
|
132
|
+
it('\'Cancel\' button should be displayed in the flyout and when user clicks on \'Cancel\' button, then the flyout should close.', () => {
|
133
|
+
essayResponsePage.editTableDialogBoxButtonCancel()
|
134
|
+
.verifyInnerText('Cancel')
|
135
|
+
.and('be.visible')
|
136
|
+
.click();
|
137
|
+
essayResponsePage.editTableDialogBox()
|
138
|
+
.should('not.be.visible');
|
139
|
+
});
|
140
|
+
});
|
141
|
+
|
142
|
+
describe('Columns section \'Insert Before\', \'Insert After\' and \'Delete Column\' button functionality.', () => {
|
143
|
+
abortEarlySetup();
|
144
|
+
before(() => {
|
145
|
+
cy.log('Navigating to Essay Response and switching to preview tab.');
|
146
|
+
essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
|
147
|
+
essayResponsePage.steps.switchToPreviewTab();
|
148
|
+
});
|
149
|
+
|
150
|
+
beforeEach(() => {
|
151
|
+
cy.log('Pre-step: Selecting the table and pressing backspace to delete the table.');
|
152
|
+
essayResponsePage.responseField()
|
153
|
+
.type('{selectAll}{backspace}');
|
154
|
+
cy.log('Adding table to response field, clicking on \'Add heder row\' and \'Highlight first column\' checkboxes and adding input to the table.');
|
155
|
+
essayResponsePage.previewTabToolbarOption('Insert Table')
|
156
|
+
.click();
|
157
|
+
essayResponsePage.addTableDialogBoxAddHeaderRowCheckbox()
|
158
|
+
.check({ force: true });
|
159
|
+
essayResponsePage.addTableDialogBoxHighlightFirstColumnCheckbox()
|
160
|
+
.check({ force: true });
|
161
|
+
essayResponsePage.addTableDialogBoxButtonAddTable()
|
162
|
+
.click();
|
163
|
+
essayResponsePage.previewInputFieldTable()
|
164
|
+
.within(() => {
|
165
|
+
cy.get('th')
|
166
|
+
.eq(0)
|
167
|
+
.type('Header cell');
|
168
|
+
cy.get('td')
|
169
|
+
.last()
|
170
|
+
.type('Standard cell');
|
171
|
+
});
|
172
|
+
});
|
173
|
+
|
174
|
+
it('When user clicks on \'Insert Before\' button, then a new column should be inserted to the left of the column in which the user had focused. Also the newly inserted column should be identical to the column in which user had focused.', () => {
|
175
|
+
cy.log('Pre-step: Right click in the required cell to open edit table flyout.');
|
176
|
+
essayResponsePage.previewInputFieldTable()
|
177
|
+
.find('th')
|
178
|
+
.eq(0)
|
179
|
+
.rightclick();
|
180
|
+
essayResponsePage.editTableDialogBox() //Added this to prevent clicking on the Insert button before the flyout is properly loaded, else script fails.
|
181
|
+
.should('be.visible');
|
182
|
+
essayResponsePage.editTableDialogBoxInsertBeforeButton()
|
183
|
+
.click();
|
184
|
+
essayResponsePage.previewInputFieldTable()
|
185
|
+
.find('td')
|
186
|
+
.last()
|
187
|
+
.rightclick();
|
188
|
+
essayResponsePage.editTableDialogBoxInsertBeforeButton()
|
189
|
+
.click();
|
190
|
+
essayResponsePage.previewInputFieldTable()
|
191
|
+
.within(() => {
|
192
|
+
cy.get('tr')
|
193
|
+
.eq(0)
|
194
|
+
.within(() => {
|
195
|
+
cy.get('th')
|
196
|
+
.should('have.length', '5');
|
197
|
+
cy.get('th')
|
198
|
+
.eq(1)
|
199
|
+
.verifyInnerText('Header cell');
|
200
|
+
});
|
201
|
+
cy.get('tr')
|
202
|
+
.eq(1)
|
203
|
+
.within(() => {
|
204
|
+
cy.get('th')
|
205
|
+
.should('have.length', '2');
|
206
|
+
cy.get('td')
|
207
|
+
.should('have.length', '3');
|
208
|
+
cy.get('td')
|
209
|
+
.eq(2)
|
210
|
+
.verifyInnerText('Standard cell');
|
211
|
+
});
|
212
|
+
});
|
213
|
+
});
|
214
|
+
|
215
|
+
it('When user clicks on \'Insert After\' button, then a new column should be inserted to the right of the column in which the user had focused. Also the newly inserted column should be identical to the column in which user had focused.', () => {
|
216
|
+
cy.log('Pre-step: Right click in the required cell to open edit table flyout.');
|
217
|
+
essayResponsePage.previewInputFieldTable()
|
218
|
+
.find('th')
|
219
|
+
.eq(0)
|
220
|
+
.rightclick();
|
221
|
+
essayResponsePage.editTableDialogBoxInsertAfterButton()
|
222
|
+
.click();
|
223
|
+
essayResponsePage.previewInputFieldTable()
|
224
|
+
.find('td')
|
225
|
+
.last()
|
226
|
+
.rightclick();
|
227
|
+
essayResponsePage.editTableDialogBoxInsertAfterButton()
|
228
|
+
.click();
|
229
|
+
essayResponsePage.previewInputFieldTable()
|
230
|
+
.within(() => {
|
231
|
+
cy.get('tr')
|
232
|
+
.eq(0)
|
233
|
+
.within(() => {
|
234
|
+
cy.get('th')
|
235
|
+
.should('have.length', '5');
|
236
|
+
cy.get('th')
|
237
|
+
.eq(0)
|
238
|
+
.verifyInnerText('Header cell');
|
239
|
+
});
|
240
|
+
cy.get('tr')
|
241
|
+
.eq(1)
|
242
|
+
.within(() => {
|
243
|
+
cy.get('th')
|
244
|
+
.should('have.length', '2');
|
245
|
+
cy.get('td')
|
246
|
+
.should('have.length', '3');
|
247
|
+
cy.get('td')
|
248
|
+
.eq(1)
|
249
|
+
.verifyInnerText('Standard cell');
|
250
|
+
});
|
251
|
+
});
|
252
|
+
});
|
253
|
+
|
254
|
+
it('When a new column is inserted in the table, the column width of all the columns should decrease to fit the table width accordingly.', () => {
|
255
|
+
let cellWidth;
|
256
|
+
essayResponsePage.previewInputFieldTable()
|
257
|
+
.find('th')
|
258
|
+
.eq(1)
|
259
|
+
.then(($originalCellWidth) => {
|
260
|
+
cellWidth = $originalCellWidth.width(); //Storing original column width
|
261
|
+
});
|
262
|
+
cy.log('Right click in the required cell to open edit table flyout and then click on Insert After button.');
|
263
|
+
essayResponsePage.previewInputFieldTable()
|
264
|
+
.find('th')
|
265
|
+
.eq(1)
|
266
|
+
.rightclick();
|
267
|
+
essayResponsePage.editTableDialogBoxInsertAfterButton()
|
268
|
+
.click();
|
269
|
+
essayResponsePage.previewInputFieldTable()
|
270
|
+
.find('th')
|
271
|
+
.eq(1)
|
272
|
+
.then(($modifiedCellWidth) => {
|
273
|
+
let modifiedCellWidth = $modifiedCellWidth.width();
|
274
|
+
expect(modifiedCellWidth).to.be.lt(cellWidth); //Comparing modified and original column width
|
275
|
+
});
|
276
|
+
});
|
277
|
+
|
278
|
+
it('When user clicks on \'Delete Column\' button then, the column in which it had focused should be deleted. Also the width of the remaining columns should increase to fit the table width accordingly.', () => {
|
279
|
+
let cellWidth;
|
280
|
+
essayResponsePage.previewInputFieldTable()
|
281
|
+
.find('th')
|
282
|
+
.eq(0)
|
283
|
+
.then(($originalCellWidth) => {
|
284
|
+
cellWidth = $originalCellWidth.width(); //Storing original column width
|
285
|
+
});
|
286
|
+
cy.log('Right click in the required cell to open edit table flyout and then click on Delete Column button.');
|
287
|
+
essayResponsePage.previewInputFieldTable()
|
288
|
+
.find('td')
|
289
|
+
.eq(0)
|
290
|
+
.rightclick();
|
291
|
+
essayResponsePage.editTableDialogBoxDeleteColumnButton()
|
292
|
+
.click();
|
293
|
+
essayResponsePage.previewInputFieldTable()
|
294
|
+
.within(() => {
|
295
|
+
cy.get('th')
|
296
|
+
.eq(0)
|
297
|
+
.then(($modifiedCellWidth) => {
|
298
|
+
let modifiedCellWidth = $modifiedCellWidth.width();
|
299
|
+
expect(modifiedCellWidth).to.be.gt(cellWidth); //Comparing modified and original column width
|
300
|
+
});
|
301
|
+
cy.get('tr')
|
302
|
+
.eq(0)
|
303
|
+
.find('th')
|
304
|
+
.should('have.length', '2');
|
305
|
+
cy.get('tr')
|
306
|
+
.eq(1)
|
307
|
+
.within(() => {
|
308
|
+
cy.get('th')
|
309
|
+
.should('have.length', '1');
|
310
|
+
cy.get('td')
|
311
|
+
.should('have.length', '1')
|
312
|
+
.verifyInnerText('Standard cell');
|
313
|
+
});
|
314
|
+
});
|
315
|
+
|
316
|
+
});
|
317
|
+
|
318
|
+
it('When user deletes the first highlighted column by clicking on the \'Delete Column\' button, then in edit table flyout the \'Highlight First Column\' checkbox should be unchecked.', () => {
|
319
|
+
cy.log('Pre-step: Right click in the required cell to open edit table flyout and then click on Delete Column button.');
|
320
|
+
essayResponsePage.previewInputFieldTable()
|
321
|
+
.find('th')
|
322
|
+
.eq(0)
|
323
|
+
.rightclick();
|
324
|
+
essayResponsePage.editTableDialogBoxDeleteColumnButton()
|
325
|
+
.click();
|
326
|
+
essayResponsePage.previewInputFieldTable()
|
327
|
+
.rightclick();
|
328
|
+
essayResponsePage.editTableDialogBoxHighlightFirstColumnCheckbox()
|
329
|
+
.should('not.be.checked');
|
330
|
+
});
|
331
|
+
});
|
332
|
+
|
333
|
+
describe('Rows section \'Insert Above\', \'Insert Below\' and \'Delete Row\' button functionality.', () => {
|
334
|
+
abortEarlySetup();
|
335
|
+
before(() => {
|
336
|
+
cy.log('Navigating to Essay Response and switching to preview tab.');
|
337
|
+
essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
|
338
|
+
essayResponsePage.steps.switchToPreviewTab();
|
339
|
+
});
|
340
|
+
|
341
|
+
beforeEach(() => {
|
342
|
+
cy.log('pre-step: Selecting the table and pressing backspace to delete the table.');
|
343
|
+
essayResponsePage.responseField()
|
344
|
+
.type('{selectAll}{backspace}');
|
345
|
+
cy.log('Adding table to response field, clicking on \'Add heder row\' and \'Highlight first column\' checkboxes and adding input to the table.');
|
346
|
+
essayResponsePage.previewTabToolbarOption('Insert Table')
|
347
|
+
.click();
|
348
|
+
essayResponsePage.addTableDialogBoxAddHeaderRowCheckbox()
|
349
|
+
.check({ force: true });
|
350
|
+
essayResponsePage.addTableDialogBoxHighlightFirstColumnCheckbox()
|
351
|
+
.check({ force: true });
|
352
|
+
essayResponsePage.addTableDialogBoxButtonAddTable()
|
353
|
+
.click();
|
354
|
+
essayResponsePage.previewInputFieldTable()
|
355
|
+
.within(() => {
|
356
|
+
cy.get('th')
|
357
|
+
.eq(3)
|
358
|
+
.type('Header cell');
|
359
|
+
cy.get('td')
|
360
|
+
.last()
|
361
|
+
.type('Standard cell');
|
362
|
+
});
|
363
|
+
});
|
364
|
+
|
365
|
+
it('When user clicks on \'Insert Above\' button, then a new row should be inserted above the row in which the user had focused. Also the newly inserted row should be identical to the row in which user had focused.', () => {
|
366
|
+
cy.log('Pre-step: Right click in the required cell to open edit table flyout.');
|
367
|
+
essayResponsePage.previewInputFieldTable()
|
368
|
+
.find('th')
|
369
|
+
.eq(0)
|
370
|
+
.rightclick();
|
371
|
+
essayResponsePage.editTableDialogBoxInsertAboveButton()
|
372
|
+
.click();
|
373
|
+
essayResponsePage.previewInputFieldTable()
|
374
|
+
.find('td')
|
375
|
+
.last()
|
376
|
+
.rightclick();
|
377
|
+
essayResponsePage.editTableDialogBox()
|
378
|
+
.should('be.visible');
|
379
|
+
essayResponsePage.editTableDialogBoxInsertAboveButton()
|
380
|
+
.click();
|
381
|
+
essayResponsePage.previewInputFieldTable()
|
382
|
+
.within(() => {
|
383
|
+
cy.get('tr')
|
384
|
+
.eq(0)
|
385
|
+
.find('th')
|
386
|
+
.should('have.length', '3');
|
387
|
+
cy.get('tr')
|
388
|
+
.eq(1)
|
389
|
+
.find('th')
|
390
|
+
.should('have.length', '3');
|
391
|
+
cy.get('tr')
|
392
|
+
.eq(2)
|
393
|
+
.within(() => {
|
394
|
+
cy.get('th')
|
395
|
+
.should('have.length', '1');
|
396
|
+
cy.get('td')
|
397
|
+
.should('have.length', '2');
|
398
|
+
});
|
399
|
+
cy.get('tr')
|
400
|
+
.eq(3)
|
401
|
+
.within(() => {
|
402
|
+
cy.get('th')
|
403
|
+
.should('have.length', '1')
|
404
|
+
.verifyInnerText('Header cell');
|
405
|
+
cy.get('td')
|
406
|
+
.should('have.length', '2')
|
407
|
+
.eq(1)
|
408
|
+
.verifyInnerText('Standard cell');
|
409
|
+
});
|
410
|
+
});
|
411
|
+
});
|
412
|
+
|
413
|
+
it('When user clicks on \'Insert Below\' button, then a new row should be inserted below the row in which the user had focused. Also the newly inserted row should be identical to the row in which user had focused.', () => {
|
414
|
+
cy.log('Pre-step: Right click in the required cell to open edit table flyout.');
|
415
|
+
essayResponsePage.previewInputFieldTable()
|
416
|
+
.find('th')
|
417
|
+
.eq(0)
|
418
|
+
.rightclick();
|
419
|
+
essayResponsePage.editTableDialogBoxInsertBelowButton()
|
420
|
+
.click();
|
421
|
+
essayResponsePage.previewInputFieldTable()
|
422
|
+
.find('td')
|
423
|
+
.last()
|
424
|
+
.rightclick();
|
425
|
+
essayResponsePage.editTableDialogBoxInsertBelowButton()
|
426
|
+
.click();
|
427
|
+
essayResponsePage.previewInputFieldTable()
|
428
|
+
.within(() => {
|
429
|
+
cy.get('tr')
|
430
|
+
.eq(0)
|
431
|
+
.find('th')
|
432
|
+
.should('have.length', '3');
|
433
|
+
cy.get('tr')
|
434
|
+
.eq(1)
|
435
|
+
.find('th')
|
436
|
+
.should('have.length', '3');
|
437
|
+
cy.get('tr')
|
438
|
+
.eq(2)
|
439
|
+
.within(() => {
|
440
|
+
cy.get('th')
|
441
|
+
.should('have.length', '1')
|
442
|
+
.verifyInnerText('Header cell');
|
443
|
+
cy.get('td')
|
444
|
+
.should('have.length', '2')
|
445
|
+
.eq(1)
|
446
|
+
.verifyInnerText('Standard cell');
|
447
|
+
});
|
448
|
+
cy.get('tr')
|
449
|
+
.eq(3)
|
450
|
+
.within(() => {
|
451
|
+
cy.get('th')
|
452
|
+
.should('have.length', '1');
|
453
|
+
cy.get('td')
|
454
|
+
.should('have.length', '2');
|
455
|
+
});
|
456
|
+
});
|
457
|
+
});
|
458
|
+
|
459
|
+
it('When user clicks on \'Delete Row\' button then, the row in which it had focused should be deleted.', () => {
|
460
|
+
cy.log('Pre-step: Right click in the required cell to open edit table flyout.');
|
461
|
+
essayResponsePage.previewInputFieldTable()
|
462
|
+
.find('th')
|
463
|
+
.first()
|
464
|
+
.rightclick();
|
465
|
+
essayResponsePage.editTableDialogBoxDeleteRowButton()
|
466
|
+
.click();
|
467
|
+
essayResponsePage.previewInputFieldTable()
|
468
|
+
.find('tr')
|
469
|
+
.should('have.length', '1')
|
470
|
+
.within(() => {
|
471
|
+
cy.get('th')
|
472
|
+
.should('have.length', '1')
|
473
|
+
.verifyInnerText('Header cell');
|
474
|
+
cy.get('td')
|
475
|
+
.should('have.length', '2')
|
476
|
+
.eq('1')
|
477
|
+
.verifyInnerText('Standard cell');
|
478
|
+
});
|
479
|
+
});
|
480
|
+
|
481
|
+
it('When user deletes the header row by clicking on the \'Delete Row\' button, then in edit table flyout the \'Add Header Row\' checkbox should be unchecked.', () => {
|
482
|
+
cy.log('Pre-step: Right click in the required cell to open edit table flyout and click on Delete Row button..');
|
483
|
+
essayResponsePage.previewInputFieldTable()
|
484
|
+
.find('th')
|
485
|
+
.eq(0)
|
486
|
+
.rightclick();
|
487
|
+
essayResponsePage.editTableDialogBoxDeleteRowButton()
|
488
|
+
.click();
|
489
|
+
essayResponsePage.previewInputFieldTable()
|
490
|
+
.rightclick();
|
491
|
+
essayResponsePage.editTableDialogBoxAddHeaderRowCheckbox()
|
492
|
+
.should('not.be.checked');
|
493
|
+
});
|
494
|
+
});
|
495
|
+
|
496
|
+
describe('Edit \'Add header row\' and \'Highlight first column\' checkboxes.', () => {
|
497
|
+
abortEarlySetup();
|
498
|
+
before(() => {
|
499
|
+
cy.log('Navigating to Essay Response and switching to preview tab.');
|
500
|
+
essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
|
501
|
+
essayResponsePage.steps.switchToPreviewTab();
|
502
|
+
});
|
503
|
+
|
504
|
+
beforeEach(() => {
|
505
|
+
cy.log('Adding table to response field and opening edit table flyout.');
|
506
|
+
essayResponsePage.previewTabToolbarOption('Insert Table')
|
507
|
+
.click();
|
508
|
+
essayResponsePage.addTableDialogBoxButtonAddTable()
|
509
|
+
.click();
|
510
|
+
essayResponsePage.previewInputFieldTable()
|
511
|
+
.rightclick();
|
512
|
+
});
|
513
|
+
|
514
|
+
afterEach(() => {
|
515
|
+
cy.log('Selecting the table and pressing backspace to delete the table.');
|
516
|
+
essayResponsePage.responseField()
|
517
|
+
.type('{selectAll}{backspace}');
|
518
|
+
});
|
519
|
+
|
520
|
+
it('When user checks the \'Add header row\' and \'Highlight first column\' checkboxes, and then clicks on Cancel button, then the flyout should close and no changes should be applied to the table.', () => {
|
521
|
+
essayResponsePage.editTableDialogBoxAddHeaderRowCheckbox()
|
522
|
+
.click({ force: true });
|
523
|
+
essayResponsePage.editTableDialogBoxHighlightFirstColumnCheckbox()
|
524
|
+
.click({ force: true });
|
525
|
+
essayResponsePage.editTableDialogBoxButtonCancel()
|
526
|
+
.click();
|
527
|
+
essayResponsePage.editTableDialogBox()
|
528
|
+
.should('not.be.visible');
|
529
|
+
essayResponsePage.previewInputFieldTable()
|
530
|
+
.find('th')
|
531
|
+
.should('not.exist');
|
532
|
+
});
|
533
|
+
|
534
|
+
it('When user checks the \'Add header row\' checkbox, and then clicks on Save button, then the flyout should close and first row of the table should be highlighted as header.', () => {
|
535
|
+
essayResponsePage.editTableDialogBoxAddHeaderRowCheckbox()
|
536
|
+
.click({ force: true });
|
537
|
+
essayResponsePage.editTableDialogBoxButtonSave()
|
538
|
+
.click();
|
539
|
+
essayResponsePage.editTableDialogBox()
|
540
|
+
.should('not.be.visible');
|
541
|
+
essayResponsePage.previewInputFieldTable()
|
542
|
+
.find('tr')
|
543
|
+
.eq(0)
|
544
|
+
.find('th')
|
545
|
+
.should('have.length', '3')
|
546
|
+
.each(($element) => {
|
547
|
+
cy.wrap($element)
|
548
|
+
.verifyCSS(css.color.whiteText, css.fontSize.default, css.fontWeight.bold) //Verifying CSS of highlighted cells
|
549
|
+
.and('have.css', 'background-color', css.color.highlightedTableCell);
|
550
|
+
});
|
551
|
+
});
|
552
|
+
|
553
|
+
it('When user checks the \'Highlight first column\' checkbox, and then clicks on Save button, then the flyout should close and first column of the table should be highlighted as header.', () => {
|
554
|
+
essayResponsePage.editTableDialogBoxHighlightFirstColumnCheckbox()
|
555
|
+
.click({ force: true });
|
556
|
+
essayResponsePage.editTableDialogBoxButtonSave()
|
557
|
+
.click();
|
558
|
+
essayResponsePage.editTableDialogBox()
|
559
|
+
.should('not.be.visible');
|
560
|
+
essayResponsePage.previewInputFieldTable()
|
561
|
+
.find('tr')
|
562
|
+
.each(($element) => {
|
563
|
+
cy.wrap($element)
|
564
|
+
.find('th')
|
565
|
+
.eq(0)
|
566
|
+
.verifyCSS(css.color.whiteText, css.fontSize.default, css.fontWeight.bold) //Verifying CSS of highlighted cells
|
567
|
+
.and('have.css', 'background-color', css.color.highlightedTableCell);
|
568
|
+
});
|
569
|
+
});
|
570
|
+
|
571
|
+
it('When there are multiple header rows in the table, and the user unchecks the previously checked \'Add header row\' checkbox and clicks on Save, then all the previous header rows in the table should not be highlighted.', () => {
|
572
|
+
cy.log('Pre-step: Add multiple header rows to the table.');
|
573
|
+
essayResponsePage.editTableDialogBoxAddHeaderRowCheckbox()
|
574
|
+
.click({ force: true });
|
575
|
+
essayResponsePage.editTableDialogBoxButtonSave()
|
576
|
+
.click();
|
577
|
+
essayResponsePage.previewInputFieldTable()
|
578
|
+
.find('th')
|
579
|
+
.eq(0)
|
580
|
+
.rightclick();
|
581
|
+
essayResponsePage.editTableDialogBoxInsertAboveButton()
|
582
|
+
.click();
|
583
|
+
essayResponsePage.previewInputFieldTable()
|
584
|
+
.rightclick();
|
585
|
+
essayResponsePage.editTableDialogBoxAddHeaderRowCheckbox()
|
586
|
+
.click({ force: true });
|
587
|
+
essayResponsePage.editTableDialogBoxButtonSave()
|
588
|
+
.click();
|
589
|
+
essayResponsePage.previewInputFieldTable()
|
590
|
+
.find('th')
|
591
|
+
.should('not.exist');
|
592
|
+
});
|
593
|
+
|
594
|
+
it('When there are multiple highlighted columns in the table, and the user unchecks the previously checked \'Highlight first column\' checkbox and clicks on Save, then only the first column in the table should not be highlighted.', () => {
|
595
|
+
cy.log('Pre-step: Add multiple header rows to the table.');
|
596
|
+
essayResponsePage.editTableDialogBoxHighlightFirstColumnCheckbox()
|
597
|
+
.click({ force: true });
|
598
|
+
essayResponsePage.editTableDialogBoxButtonSave()
|
599
|
+
.click();
|
600
|
+
essayResponsePage.previewInputFieldTable()
|
601
|
+
.find('th')
|
602
|
+
.eq(0)
|
603
|
+
.rightclick();
|
604
|
+
essayResponsePage.editTableDialogBox() //Added this to prevent clicking on the Insert button before the flyout is properly loaded, else script fails.
|
605
|
+
.should('be.visible');
|
606
|
+
essayResponsePage.editTableDialogBoxInsertBeforeButton()
|
607
|
+
.click();
|
608
|
+
essayResponsePage.previewInputFieldTable()
|
609
|
+
.rightclick();
|
610
|
+
essayResponsePage.editTableDialogBoxHighlightFirstColumnCheckbox()
|
611
|
+
.click({ force: true });
|
612
|
+
essayResponsePage.editTableDialogBoxButtonSave()
|
613
|
+
.click();
|
614
|
+
essayResponsePage.previewInputFieldTable()
|
615
|
+
.find('tr')
|
616
|
+
.each(($element) => {
|
617
|
+
cy.wrap($element)
|
618
|
+
.find('th')
|
619
|
+
.should('have.length', '1');
|
620
|
+
});
|
621
|
+
});
|
622
|
+
});
|
623
|
+
|
624
|
+
describe('Delete Table', () => {
|
625
|
+
abortEarlySetup();
|
626
|
+
before(() => {
|
627
|
+
cy.log('Navigating to essay response, switching to preview tab, adding a table to the response field and opening edit table flyout.');
|
628
|
+
essayResponsePage.steps.navigateToCreateQuestion('essay response - rich text');
|
629
|
+
essayResponsePage.steps.switchToPreviewTab();
|
630
|
+
essayResponsePage.previewTabToolbarOption('Insert Table')
|
631
|
+
.click();
|
632
|
+
essayResponsePage.addTableDialogBoxButtonAddTable()
|
633
|
+
.click();
|
634
|
+
essayResponsePage.previewInputFieldTable()
|
635
|
+
.rightclick();
|
636
|
+
});
|
637
|
+
|
638
|
+
it('When user clicks on \'Delete\' button, then the flyout should close and the table should be deleted.', () => {
|
639
|
+
essayResponsePage.editTableDialogBoxButtonDelete()
|
640
|
+
.click();
|
641
|
+
essayResponsePage.editTableDialogBox()
|
642
|
+
.should('not.be.visible');
|
643
|
+
essayResponsePage.previewInputFieldTable()
|
644
|
+
.should('not.exist');
|
645
|
+
});
|
646
|
+
|
647
|
+
it('When the user selects the table in the response field and presses backspace then the table should get deleted.', () => {
|
648
|
+
cy.log('Pre-step: Adding a table to the response field.');
|
649
|
+
essayResponsePage.previewTabToolbarOption('Insert Table')
|
650
|
+
.click();
|
651
|
+
essayResponsePage.addTableDialogBoxButtonAddTable()
|
652
|
+
.click();
|
653
|
+
essayResponsePage.previewInputFieldTable()
|
654
|
+
.type('{selectAll}{backspace}');
|
655
|
+
essayResponsePage.previewInputFieldTable()
|
656
|
+
.should('not.exist');
|
657
|
+
});
|
658
|
+
});
|
659
|
+
});
|