itemengine-cypress-automation 1.0.86 → 1.0.87

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. package/cypress/e2e/ILC/DrawingResponse/drawingResponseCustomizeAdditionalOptions.js +30 -30
  2. package/cypress/e2e/ILC/DrawingResponse/drawingResponseGradingViewAndCorrectAnswerViewContents.smoke.js +1 -1
  3. package/cypress/e2e/ILC/EssayResponse/createCustomCategory.smoke.js +568 -0
  4. package/cypress/e2e/ILC/EssayResponse/editAndPreviewTabScoringSection.js +86 -0
  5. package/cypress/e2e/ILC/EssayResponse/editTabBasicSections.js +389 -0
  6. package/cypress/e2e/ILC/EssayResponse/gradingViewAndCorrectAnswerViewContents.smoke.js +112 -0
  7. package/cypress/e2e/ILC/EssayResponse/headerSection.js +68 -0
  8. package/cypress/e2e/ILC/EssayResponse/previewAddTable.js +290 -0
  9. package/cypress/e2e/ILC/EssayResponse/previewContentsForAllViews.smoke.js +79 -0
  10. package/cypress/e2e/ILC/EssayResponse/previewEditTable.js +379 -0
  11. package/cypress/e2e/ILC/EssayResponseBasic/essayResponseBasicCustomizeFormattingOptions.js +207 -0
  12. package/cypress/e2e/ILC/EssayResponseBasic/gradingViewAndCorrectAnswerViewContents.smoke.js +115 -0
  13. package/cypress/e2e/ILC/EssayResponseBasic/previewContentsForAllViews.smoke.js +79 -0
  14. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/FillInTheGapsOverImageDragAndDropScoring/partialDifferentWeightsBasic.js +159 -0
  15. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/backgroundImageAndCanvasProperties.js +507 -29
  16. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/previewContentsForAllViews.smoke.js +6 -0
  17. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/responseAnswersAndAcceptedStudentInput.js +272 -0
  18. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/specialCharactersSection.js +300 -0
  19. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/specifyCorrectAnswerSection.js +3 -3
  20. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/studentViewSettings.js +204 -0
  21. package/cypress/e2e/ILC/Protractor/protractorEditTabBasicsSection.js +4 -4
  22. package/cypress/e2e/ILC/Protractor/protractorEditTabFunctionality.js +1 -1
  23. package/cypress/e2e/ILC/Ruler/rulerEditTabBasicsSection.js +4 -4
  24. package/cypress/e2e/ILC/Ruler/rulerEditTabFunctionality.js +1 -1
  25. package/cypress/e2e/ILC/SingleSelection/editTabScoringSection.js +1 -3
  26. package/cypress/e2e/ILC/TextEntryMath/editTabBasicSection.js +205 -0
  27. package/cypress/e2e/ILC/TextEntryMath/editTabScoringSection.js +259 -0
  28. package/cypress/e2e/ILC/TextEntryMath/evaluationMethods2.js +217 -0
  29. package/cypress/e2e/ILC/TextEntryMath/minimumScoringPenaltyPointsAndRoundingDropdown.js +202 -0
  30. package/cypress/e2e/ILC/TextEntryMath/responseEvaluationMethodsAndCustomSettings.js +613 -0
  31. package/cypress/e2e/ILC/TextEntryMath/specifyCorrectAnswerSection.js +71 -0
  32. package/cypress/fixtures/equationEditorCategoriesAndSymbols .js +318 -318
  33. package/cypress/fixtures/theme/ilc.json +3 -0
  34. package/cypress/pages/components/backgroundImageUploadComponent.js +1 -2
  35. package/cypress/pages/components/colorPopupComponent.js +26 -3
  36. package/cypress/pages/components/createCustomCategoryFlyout.js +351 -46
  37. package/cypress/pages/components/customizeSpecialCharacterComponent.js +165 -0
  38. package/cypress/pages/components/equationEditorFlyout.js +124 -0
  39. package/cypress/pages/components/essayResponseCommonComponents.js +3 -0
  40. package/cypress/pages/components/figOverImageCanvasComponent.js +316 -7
  41. package/cypress/pages/components/index.js +3 -1
  42. package/cypress/pages/components/opacityComponent.js +31 -4
  43. package/cypress/pages/components/specialAndCustomSpecialCharactersComponent.js +1 -0
  44. package/cypress/pages/components/specialCharactersFlyoutComponent.js +1 -0
  45. package/cypress/pages/drawingResponsePage.js +33 -138
  46. package/cypress/pages/essayResponsePage.js +612 -26
  47. package/cypress/pages/fillInTheGapsOverImageDragAndDropPage.js +48 -7
  48. package/cypress/pages/fillInTheGapsOverImageTextPage.js +267 -13
  49. package/package.json +1 -1
@@ -1,8 +1,9 @@
1
1
  import { equationEditorCategoriesAndSymbols } from "../fixtures/equationEditorCategoriesAndSymbols ";
2
- import { questionInstructionsComponent, scoringSectionBaseEditTab, createQuestionBasePage, additionalSettingsPanel, autoScoredScoringPreviewTab, commonComponents } from "./components";
2
+ import { questionInstructionsComponent, scoringSectionBaseEditTab, createQuestionBasePage, additionalSettingsPanel, autoScoredScoringPreviewTab, commonComponents, createCustomCategoryFlyout } from "./components";
3
3
  import { equationEditorFlyout } from "./components/equationEditorFlyout";
4
4
  import { essayResponseCommonComponents } from "./components/essayResponseCommonComponents";
5
5
  import { specialOrMathCharacters } from "../fixtures/specialAndMathCharacters";
6
+ import utilities from "../support/helpers/utilities";
6
7
  const css = Cypress.env('css');
7
8
 
8
9
  let originalText;
@@ -23,6 +24,15 @@ const selectors = {
23
24
  allowSubmissionOverWordLimitCheckbox: () => cy.get('[data-ngie-testid="allow-submission-over-word-limit-checkbox"] input'),
24
25
  showWordCountLabel: () => cy.get('[data-ngie-testid="show-word-count-checkbox"] .MuiFormControlLabel-label'),
25
26
  showWordCountCheckbox: () => cy.get('[data-ngie-testid="show-word-count-checkbox"] input'),
27
+
28
+ //Table in preview tab
29
+ tableGrid: () => cy.get('tbody'),
30
+ tableRow: () => cy.get('tr'),
31
+ tableCell: () => cy.get('td'),
32
+ tableHeaderRow: () => cy.get('thead'),
33
+ tableHeaderCell: () => cy.get('th'),
34
+
35
+ ///Old
26
36
  //Customize Formatting Options
27
37
  customizeFormattingOptionsAccordion: () => cy.get('.customize-formatting-option-wrapper .ngie-accordion-summary'),
28
38
  customizeFormattingOptionsAccordionLabel: () => cy.get('.customize-formatting-options-label'),
@@ -48,33 +58,36 @@ const selectors = {
48
58
  equationEditorSectionCategoriesEditIcon: () => cy.get('.edit-icon-button button'),
49
59
  equationEditorSectionTickIcon: () => cy.get('.tick-icon-wrapper'),
50
60
  selectACategoryErrorMessage: () => cy.get('[class*="ErrorBlock"]'),
51
- createCustomCategoryButton: () => cy.get('.equation-editor-wrapper button'),
52
61
  equationEditorSectionCategoryIcon: () => cy.get('.equation-editor-icon'),
53
62
  equationEditorSectionDeleteCustomCategoryIcon: () => cy.get('.delete-button-icon button')
54
63
  }
55
64
 
56
- const tableDialogBox = { //TODO: Once redmine issue is fixed the selectors will get changed to this: editTableDialogboxAddHeaderRowLabel: () => cy.get('.add-table-dialog .chk_box_add_header_row')
65
+ const tableDialogBox = { //TODO: Once redmine issue is fixed the selectors will get changed to this: editTableDialogBoxAddRowHeaderLabel: () => cy.get('.add-table-dialog .chk_box_add_header_row')
57
66
  //Add table dialog box
58
- addTableDialogBox: () => cy.get('a[title="Add Table"]').parents('.cke_dialog_body'),
59
- addTableDialogBoxTitle: () => essayResponsePage.addTableDialogBox().find('.cke_dialog_title'),
60
- addTableDialogBoxAddHeaderRowLabel: () => essayResponsePage.addTableDialogBox().find('.chk_box_add_header_row'),
61
- addTableDialogBoxHighlightFirstColumnLabel: () => cy.get('.cke_dialog_ui_checkbox_input').eq(1).parent().find('label'), //TODO- Need to update. No unique property available.
62
- addTableDialogBoxAddHeaderRowCheckbox: () => essayResponsePage.addTableDialogBox().find('[class*="cke_dialog_ui_checkbox_input"]').eq(0),
63
- addTableDialogBoxHighlightFirstColumnCheckbox: () => essayResponsePage.addTableDialogBox().find('[class*="cke_dialog_ui_checkbox_input"]').eq(1),
67
+ addTableDialogBox: () => cy.get('.cke_dialog_body'),
68
+ addTableDialogBoxTitle: () => cy.get('.cke_dialog_title'),
69
+ addTableDialogBoxAddRowHeaderLabel: () => cy.get('.chk_box_add_header_row label'),
70
+ addTableDialogBoxHighlightFirstColumnLabel: () => cy.get('[class="cke_dialog_ui_checkbox custom-table-title-casing"] label'),
71
+ addTableDialogBoxAddHeaderRowCheckbox: () => cy.get('.chk_box_add_header_row input').eq(0),
72
+ addTableDialogBoxHighlightFirstColumnCheckbox: () => cy.get('[class="cke_dialog_ui_checkbox custom-table-title-casing"] input').eq(0),
64
73
  addTableDialogBoxButtonAddTable: () => cy.get('a[title="Add Table"]'),
65
- addTableDialogBoxButtonCancel: () => essayResponsePage.addTableDialogBox().find('a[class*="cancel-button"]'),
66
- addTableDialogBoxColumnsLabel: () => essayResponsePage.addTableDialogBox().find('.cke_dialog_ui_labeled_label').eq(0),
67
- addTableDialogBoxRowsLabel: () => essayResponsePage.addTableDialogBox().find('.cke_dialog_ui_labeled_label').eq(1),
68
- addTableDialogBoxColumnsInputField: () => essayResponsePage.addTableDialogBox().find('input[class="cke_dialog_ui_input_text"][type="number"]').eq(0),
69
- addTableDialogBoxRowsInputField: () => essayResponsePage.addTableDialogBox().find('input[class="cke_dialog_ui_input_text"][type="number"]').eq(1),
74
+ addTableDialogBoxButtonCancel: () => cy.get('a[class*="cancel-button"]'),
75
+ addTableDialogBoxColumnsLabel: () => cy.get('.cke_dialog_ui_labeled_label').eq(0),
76
+ addTableDialogBoxRowsLabel: () => cy.get('.cke_dialog_ui_labeled_label').eq(1),
77
+ addTableDialogBoxColumnsInputField: () => cy.get('input[class="cke_dialog_ui_input_text"][type="number"]').eq(0),
78
+ addTableDialogBoxRowsInputField: () => cy.get('input[class="cke_dialog_ui_input_text"][type="number"]').eq(1),
79
+ addTableColumnsInputFieldIncrementButton: () => cy.get('#incrementColButton'),
80
+ addTableColumnsInputFieldDecrementButton: () => cy.get('#decrementColButton'),
81
+ addTableRowsInputFieldIncrementButton: () => cy.get('#incrementRowButton'),
82
+ addTableRowsInputFieldDecrementButton: () => cy.get('#decrementRowButton'),
70
83
  previewInputFieldTable: () => cy.get('.ngcke_custom_table'),
71
- previewTabToolbarDialogboxIconClose: () => essayResponsePage.addTableDialogBox().find('a[title="Close"]'),
72
84
  //Edit Table Dialog Box
73
- editTableDialogBox: () => cy.get('[title="Save"]').parents('.cke_dialog_body'),
74
- editTableDialogBoxAddHeaderRowLabel: () => essayResponsePage.editTableDialogBox().find('.chk_box_add_header_row').eq(0),
75
- editTableDialogBoxHighlightFirstColumnLabel: () => essayResponsePage.editTableDialogBox().find('.chk_box_highlight_first_column').eq(0),
76
- editTableDialogBoxAddHeaderRowCheckbox: () => essayResponsePage.editTableDialogBox().find('[class*="cke_dialog_ui_checkbox_input"]').eq(0),
77
- editTableDialogBoxHighlightFirstColumnCheckbox: () => essayResponsePage.editTableDialogBox().find('[class*="cke_dialog_ui_checkbox_input"]').eq(1),
85
+ editTableDialogBox: () => cy.get('.cke_dialog_body').eq(1),
86
+ editTableDialogBoxTitle: () => cy.get('.cke_dialog_title').eq(1),
87
+ editTableDialogBoxAddRowHeaderLabel: () => cy.get('.chk_box_add_header_row label').eq(1),
88
+ editTableDialogBoxHighlightFirstColumnLabel: () => cy.get('.chk_box_highlight_first_column label'),
89
+ editTableDialogBoxAddRowHeaderCheckbox: () => cy.get('.chk_box_add_header_row input').eq(1),
90
+ editTableDialogBoxHighlightFirstColumnCheckbox: () => cy.get('.chk_box_highlight_first_column input'),
78
91
  editTableDialogBoxColumnsLabel: () => essayResponsePage.editTableDialogBox().find('.cke_dialog_ui_labeled_label').eq(0),
79
92
  editTableDialogBoxRowsLabel: () => essayResponsePage.editTableDialogBox().find('.cke_dialog_ui_labeled_label').eq(1),
80
93
  editTableDialogBoxInsertBeforeButton: () => cy.get('[title="Insert Before"]'),
@@ -115,6 +128,575 @@ const steps = {
115
128
  ...scoringSectionBaseEditTab.steps,
116
129
  ...additionalSettingsPanel.steps,
117
130
  ...essayResponseCommonComponents.steps,
131
+
132
+ /**
133
+ * Verify newly added custom category container is displayed
134
+ * @param {string} customCategoryName Custom category name
135
+ * @param {string} customCategoryIcon Custom category icon
136
+ */
137
+ verifyAddedCustomCategoryContainerIsDisplayed: (customCategoryName, customCategoryIcon) => {
138
+ essayResponsePage.equationEditorSectionCategories()
139
+ .last()
140
+ .should('have.attr', 'aria-label', `${customCategoryName}`)
141
+ .within(() => {
142
+ utilities.verifyInnerText(essayResponsePage.equationEditorSectionCategoryLabel(), `${customCategoryName}`);
143
+ utilities.verifyInnerText(essayResponsePage.equationEditorSectionCategoryIcon(), `${customCategoryIcon}`);
144
+ });
145
+ utilities.verifyElementVisibilityState(essayResponsePage.equationEditorSectionCategories().last(), 'visible');
146
+ },
147
+
148
+ createCustomCategoryWithMultipleCategoryCharacters: () => {
149
+ cy.log('Creating a custom category by selecting \'Keypad\' category, partially selecting \'Basic\' and \'Greek\' categories')
150
+ createCustomCategoryFlyout.steps.openCreateCustomCategoryFlyout();
151
+ createCustomCategoryFlyout.steps.checkCategoryAccordionCheckbox(`${equationEditorCategoriesAndSymbols['keypad'].displayName}`);
152
+ createCustomCategoryFlyout.steps.verifyPartiallyCheckedStateOfCategoryAccordionCheckbox(`${equationEditorCategoriesAndSymbols['basic'].displayName}`);
153
+ createCustomCategoryFlyout.steps.expandCategoryAccordion(`${equationEditorCategoriesAndSymbols['greek'].displayName}`);
154
+ createCustomCategoryFlyout.steps.selectASymbolInCreateCustomCategoryFlyout(`${equationEditorCategoriesAndSymbols['greek'].displayName}`, `${equationEditorCategoriesAndSymbols.greek.symbols.gamma.ariaLabel}`);
155
+ createCustomCategoryFlyout.steps.selectASymbolInCreateCustomCategoryFlyout(`${equationEditorCategoriesAndSymbols['greek'].displayName}`, `${equationEditorCategoriesAndSymbols.greek.symbols.delta.ariaLabel}`);
156
+ createCustomCategoryFlyout.steps.addInputToCustomCategoryNameInputField('Custom category with name.');
157
+ createCustomCategoryFlyout.steps.saveCustomCategory();
158
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'notExist');
159
+ },
160
+
161
+ /**
162
+ * @description verify added custom category container is displayed with edit and delete button
163
+ * @param {string} customCategoryName Name of custom category
164
+ */
165
+ verifyAddedCustomCategoryContainerEditAndDeleteButtonDisplayed: (customCategoryName) => {
166
+ essayResponsePage.equationEditorSectionCategories()
167
+ .contains(`${customCategoryName}`)
168
+ .parents('[id*="DraggableItem"]')
169
+ .within(() => {
170
+ utilities.verifyElementVisibilityState(essayResponsePage.equationEditorSectionCategoriesEditIcon, ('visible'));
171
+ utilities.verifyElementVisibilityState(essayResponsePage.equationEditorSectionDeleteCustomCategoryIcon, ('visible'));
172
+ });
173
+ },
174
+
175
+ /**
176
+ * @description deselect category in equation editor section in edit tab
177
+ * @param {string} categoryName Name of category
178
+ */
179
+ deselectCategoryInEquationEditorSectionEditTab: (categoryName) => {
180
+ essayResponsePage.equationEditorSectionCategories()
181
+ .contains(`${categoryName}`)
182
+ .click();
183
+ },
184
+
185
+ /**
186
+ * @description delete category in equation editor section in edit tab
187
+ * @param {string} categoryName Name of category
188
+ */
189
+ deleteCustomCategoryInEquationEditorSectionEditTab: (categoryName) => {
190
+ essayResponsePage.equationEditorSectionCategories()
191
+ .contains(`${categoryName}`)
192
+ .parents('[id*="DraggableItem"]')
193
+ .within(() => {
194
+ essayResponsePage.equationEditorSectionDeleteCustomCategoryIcon()
195
+ .click();
196
+ });
197
+ utilities.verifyElementVisibilityState(essayResponsePage.equationEditorSectionCategories().contains(`${categoryName}`), 'notExist');
198
+ },
199
+
200
+ /**
201
+ * @description edit category in equation editor section in edit tab
202
+ * @param {string} categoryName Name of category
203
+ */
204
+ editCategoryInEquationEditorSectionEditTab: (categoryName) => {
205
+ essayResponsePage.equationEditorSectionCategories()
206
+ .contains(`${categoryName}`)
207
+ .parents('[id*="DraggableItem"]')
208
+ .within(() => {
209
+ essayResponsePage.equationEditorSectionCategoriesEditIcon()
210
+ .click();
211
+ });
212
+ },
213
+
214
+ verifyCSSOfSelectedSymbols: () => {
215
+ utilities.getNthElement(createCustomCategoryFlyout.selectedSymbols(), 0)
216
+ .within(() => {
217
+ utilities.verifyCSS(essayResponsePage.equationEditorSectionTickIcon().find('[data-name*="Icon"]'), {
218
+ 'fill': css.color.activeButtons
219
+ });
220
+ utilities.verifyCSS(essayResponsePage.equationEditorSectionTickIcon().find('path'), {
221
+ 'fill': css.color.activeButtons
222
+ });
223
+ });
224
+ },
225
+
226
+ /**
227
+ * @description verify the value of columns input field in table flyout
228
+ * @param {number} numberOfColumns
229
+ */
230
+ verifyTableFlyoutColumnsInputFieldValue: (numberOfColumns) => {
231
+ essayResponsePage.addTableDialogBoxColumnsInputField()
232
+ .should('have.value', `${numberOfColumns}`)
233
+ },
234
+
235
+ /**
236
+ * @description edit columns input field in table flyout
237
+ * @param {number} numberOfColumns
238
+ */
239
+ editTableFlyoutColumnsInputField: (numberOfColumns) => {
240
+ essayResponsePage.addTableDialogBoxColumnsInputField()
241
+ .clear()
242
+ .type(`${numberOfColumns}`)
243
+ .should('have.value', `${numberOfColumns}`);
244
+ },
245
+
246
+ /**
247
+ * @description increment columns input field in table flyout
248
+ * @param {number} numberOfIncrement The number by which columns input field should be incremented
249
+ */
250
+ incrementTableFlyoutColumnsInputField: (numberOfIncrement) => {
251
+ for (let i = 0; i < numberOfIncrement; i++) {
252
+ essayResponsePage.addTableColumnsInputFieldIncrementButton()
253
+ .click();
254
+ }
255
+ },
256
+
257
+ /**
258
+ * @description decrement columns input field in table flyout
259
+ * @param {number} numberOfDecrement The number by which columns input field should be decremented
260
+ */
261
+ decrementTableFlyoutColumnsInputField: (numberOfDecrement) => {
262
+ for (let i = 0; i < numberOfDecrement; i++) {
263
+ essayResponsePage.addTableColumnsInputFieldDecrementButton()
264
+ .click();
265
+ }
266
+ },
267
+
268
+ /**
269
+ * @description verify the value of rows input field in table flyout
270
+ * @param {number} numberOfRows
271
+ */
272
+ verifyTableFlyoutRowsInputFieldValue: (numberOfRows) => {
273
+ essayResponsePage.addTableDialogBoxRowsInputField()
274
+ .should('have.value', `${numberOfRows}`)
275
+ },
276
+
277
+ /**
278
+ * @description edit rows input field in table flyout
279
+ * @param {number} numberOfRows
280
+ */
281
+ editTableFlyoutRowsInputField: (numberOfRows) => {
282
+ essayResponsePage.addTableDialogBoxRowsInputField()
283
+ .clear()
284
+ .type(`${numberOfRows}`)
285
+ .should('have.value', `${numberOfRows}`);
286
+ },
287
+
288
+ /**
289
+ * @description increment rows input field in table flyout
290
+ * @param {number} numberOfIncrement The number by which rows input field should be incremented
291
+ */
292
+ incrementTableFlyoutRowsInputField: (numberOfIncrement) => {
293
+ for (let i = 0; i < numberOfIncrement; i++) {
294
+ essayResponsePage.addTableRowsInputFieldIncrementButton()
295
+ .click();
296
+ }
297
+ },
298
+
299
+ /**
300
+ * @description decrement rows input field in table flyout
301
+ * @param {number} numberOfDecrement The number by which rows input field should be decremented
302
+ */
303
+ decrementTableFlyoutRowsInputField: (numberOfDecrement) => {
304
+ for (let i = 0; i < numberOfDecrement; i++) {
305
+ essayResponsePage.addTableRowsInputFieldDecrementButton()
306
+ .click();
307
+ }
308
+ },
309
+
310
+ verifyMinimumAndMaximumValueOfTableFlyoutColumnsAndRowsInputField: () => {
311
+ essayResponsePage.addTableDialogBoxColumnsInputField()
312
+ .should('have.attr', 'min', '1')
313
+ .and('have.attr', 'max', '999');
314
+ essayResponsePage.addTableDialogBoxRowsInputField()
315
+ .should('have.attr', 'min', '1')
316
+ .and('have.attr', 'max', '999');
317
+ },
318
+
319
+ verifyUncheckedStateOfAddRowHeaderHighlightFirstColumnCheckbox: () => {
320
+ essayResponsePage.addTableDialogBoxAddHeaderRowCheckbox()
321
+ .should('not.be.checked');
322
+ essayResponsePage.addTableDialogBoxHighlightFirstColumnCheckbox()
323
+ .should('not.be.checked');
324
+ },
325
+
326
+ clickOnTableFlyoutCancelButton: () => {
327
+ essayResponsePage.addTableDialogBoxButtonCancel()
328
+ .click();
329
+ },
330
+
331
+ addTable: () => {
332
+ essayResponsePage.addTableDialogBoxButtonAddTable()
333
+ .click();
334
+ },
335
+
336
+ checkAddRowHeaderCheckbox: () => {
337
+ essayResponsePage.addTableDialogBoxAddHeaderRowCheckbox()
338
+ .click({ force: true });
339
+ },
340
+
341
+ clickOnEditTableAddRowHeaderCheckbox: () => {
342
+ essayResponsePage.editTableDialogBoxAddRowHeaderCheckbox()
343
+ .click({ force: true });
344
+ },
345
+
346
+ checkHighlightFirstColumnCheckbox: () => {
347
+ essayResponsePage.addTableDialogBoxHighlightFirstColumnCheckbox()
348
+ .click({ force: true });
349
+ },
350
+
351
+ clickOnEditTableHighlightFirstColumnCheckbox: () => {
352
+ essayResponsePage.editTableDialogBoxHighlightFirstColumnCheckbox()
353
+ .click({ force: true });
354
+ },
355
+
356
+ /**
357
+ * Verify the table properties of the added table in preview tab
358
+ * @param {number} numberOfRows number of rows in the added table
359
+ * @param {number} numberOfStandardCells number of standard cells in the added table
360
+ * @param {number} numberOfHeaderCells number of header cells in the added table
361
+ */
362
+ verifyTableProperties: (numberOfRows, numberOfStandardCells, numberOfHeaderCells=null) => {
363
+ essayResponsePage.previewInputFieldTable()
364
+ .within(() => {
365
+ utilities.verifyElementCount(essayResponsePage.tableRow(), numberOfRows);
366
+ utilities.verifyElementCount(essayResponsePage.tableCell(), numberOfStandardCells);
367
+ if (numberOfHeaderCells) {
368
+ utilities.verifyElementCount(essayResponsePage.tableHeaderCell(), numberOfHeaderCells);
369
+ }
370
+ });
371
+ },
372
+
373
+ /**
374
+ * Verify the count of header cell in table header row
375
+ * @param {number} numberOfHeaderRowCells number of header cells in table header row
376
+ */
377
+ verifyTableHeaderRowCellCount: (numberOfHeaderRowCells) => {
378
+ essayResponsePage.previewInputFieldTable()
379
+ .within(() => {
380
+ essayResponsePage.tableHeaderRow()
381
+ .within(() => {
382
+ utilities.verifyElementCount(essayResponsePage.tableHeaderCell(), numberOfHeaderRowCells);
383
+ });
384
+ });
385
+ },
386
+
387
+ /**
388
+ * Verify the count of header cells in table row
389
+ * @param {number} numberOfHeaderCells number of header cells in table row
390
+ * @param {number} rowIndex index of table row
391
+ */
392
+ verifyTableRowHeaderCellCount: (rowIndex, numberOfHeaderCells) => {
393
+ essayResponsePage.previewInputFieldTable()
394
+ .within(() => {
395
+ utilities.getNthElement(essayResponsePage.tableRow(), rowIndex)
396
+ .within(() => {
397
+ utilities.verifyElementCount(essayResponsePage.tableHeaderCell(), numberOfHeaderCells);
398
+ });
399
+ });
400
+ },
401
+
402
+ /**
403
+ * Verify the count of standard cells in table row
404
+ * @param {number} numberOfStandardCells number of standard cells in table row
405
+ * @param {number} rowIndex index of table row
406
+ */
407
+ verifyTableRowStandardCellCount: (rowIndex, numberOfStandardCells) => {
408
+ essayResponsePage.previewInputFieldTable()
409
+ .within(() => {
410
+ utilities.getNthElement(essayResponsePage.tableRow(), rowIndex)
411
+ .within(() => {
412
+ utilities.verifyElementCount(essayResponsePage.tableCell(), numberOfStandardCells);
413
+ });
414
+ });
415
+ },
416
+
417
+ /**
418
+ * @description verify the count of rows in table
419
+ * @param {number} numberOfRows
420
+ */
421
+ verifyTableRowCount: (numberOfRows) => {
422
+ essayResponsePage.previewInputFieldTable()
423
+ .within(() => {
424
+ utilities.verifyElementCount(essayResponsePage.tableRow(), numberOfRows);
425
+ });
426
+ },
427
+
428
+ /**
429
+ * Verify first column is highlighted in the table
430
+ * @param {number} numberOfTableCellsPerRow number of normal table cells per row
431
+ */
432
+ verifyFirstColumnsIsHighlighted: (numberOfTableCellsPerRow) => {
433
+ essayResponsePage.previewInputFieldTable()
434
+ .within(() => {
435
+ essayResponsePage.tableGrid()
436
+ .within(() => {
437
+ essayResponsePage.tableRow()
438
+ .each(($element) => {
439
+ cy.wrap($element)
440
+ .within(() => {
441
+ utilities.verifyElementCount(essayResponsePage.tableHeaderCell(), 1);
442
+ utilities.verifyElementCount(essayResponsePage.tableCell(), numberOfTableCellsPerRow);
443
+ });
444
+ });
445
+ });
446
+ });
447
+ },
448
+
449
+ verifyTableHeaderCellsAreHighlighted: () => {
450
+ essayResponsePage.previewInputFieldTable()
451
+ .within(() => {
452
+ essayResponsePage.tableHeaderCell()
453
+ .each(($element) => {
454
+ expect($element).to.have.css('background-color', css.color.highlightedTableCell);
455
+ });
456
+ });
457
+ },
458
+
459
+ verifyTableNormalCellsAreNotHighlighted: () => {
460
+ essayResponsePage.previewInputFieldTable()
461
+ .within(() => {
462
+ essayResponsePage.tableCell()
463
+ .each(($element) => {
464
+ expect($element).to.have.css('background-color', css.color.transparent); //To check that td cells are standard cells
465
+ });
466
+ });
467
+ },
468
+
469
+ /**
470
+ * Add input to table header cell
471
+ * @param {number} headerCellIndex index of header cell in the table
472
+ * @param {string} cellInput Input to be given in header cell
473
+ */
474
+ addInputToTableHeaderCell: (headerCellIndex, cellInput) => {
475
+ utilities.getNthElement(essayResponsePage.tableHeaderCell(), headerCellIndex)
476
+ .type(`${cellInput}`);
477
+ },
478
+
479
+ /**
480
+ * Verify input added in table header cell
481
+ * @param {number} headerCellIndex index of header cell in the table
482
+ * @param {string} cellContent Input in header cell
483
+ */
484
+ verifyContentOfTableHeaderCell: (headerCellIndex, cellContent) => {
485
+ utilities.verifyInnerText(utilities.getNthElement(essayResponsePage.tableHeaderCell(), headerCellIndex), `${cellContent}`);
486
+ },
487
+
488
+ /**
489
+ * Add input to normal table cell
490
+ * @param {number} headerCellIndex index of normal cell in the table
491
+ * @param {string} cellInput Input to be given in normal table cell
492
+ */
493
+ addInputToTableCell: (cellIndex, cellInput) => {
494
+ utilities.getNthElement(essayResponsePage.tableCell(), cellIndex)
495
+ .type(`${cellInput}`);
496
+ },
497
+
498
+ /**
499
+ * Verify input added in table standard cell
500
+ * @param {number} cellIndex index of standard cell in the table
501
+ * @param {string} cellContent Input in standard cell
502
+ */
503
+ verifyContentOfTableStandardCell: (cellIndex, cellContent) => {
504
+ utilities.verifyInnerText(utilities.getNthElement(essayResponsePage.tableCell(), cellIndex), `${cellContent}`);
505
+ },
506
+
507
+ compareColumnWidthsWhenInputIsAddedInACell: () => {
508
+ let cellWidth
509
+ essayResponsePage.previewInputFieldTable()
510
+ .within(() => {
511
+ utilities.getNthElement(essayResponsePage.tableCell(), 0)
512
+ .then(($originalCellWidth) => {
513
+ cellWidth = $originalCellWidth.width(); //Storing original column width
514
+ });
515
+ essayResponsePage.steps.addInputToTableCell(0, 'lorem');
516
+ utilities.getNthElement(essayResponsePage.tableCell(), 0)
517
+ .then(($modifiedCellWidth) => {
518
+ let modifiedCellWidth = $modifiedCellWidth.width();
519
+ expect(modifiedCellWidth).to.be.gt(cellWidth); //Comparing modified and original column width
520
+ });
521
+ utilities.getNthElement(essayResponsePage.tableCell(), 2)
522
+ .then(($modifiedCellWidth) => {
523
+ let modifiedCellWidth = $modifiedCellWidth.width();
524
+ expect(modifiedCellWidth).to.be.lt(cellWidth); //Comparing new and original width of other columns
525
+ });
526
+ });
527
+ },
528
+
529
+ compareColumnWidthsWhenInputIsRemovedInACell: () => {
530
+ let cellWidth
531
+ essayResponsePage.previewInputFieldTable()
532
+ .within(() => {
533
+ utilities.getNthElement(essayResponsePage.tableCell(), 0)
534
+ .then(($originalCellWidth) => {
535
+ cellWidth = $originalCellWidth.width();
536
+ });
537
+ essayResponsePage.steps.addInputToTableCell(0, '{backspace}{backspace}{backspace}{backspace}{backspace}')
538
+ utilities.getNthElement(essayResponsePage.tableCell(), 0)
539
+ .then(($modifiedCellWidth) => {
540
+ let modifiedCellWidth = $modifiedCellWidth.width();
541
+ expect(modifiedCellWidth).to.be.lt(cellWidth);
542
+ cellWidth = modifiedCellWidth;
543
+ });
544
+ utilities.getNthElement(essayResponsePage.tableCell(), 2)
545
+ .then(($modifiedCellWidth) => {
546
+ let modifiedCellWidth = $modifiedCellWidth.width();
547
+ expect(modifiedCellWidth).to.be.eq(cellWidth); //Cell width increases again to match the original cell width
548
+ });
549
+ });
550
+ },
551
+
552
+ compareRowHeightWhenMultilineInputIsGivenInACell: () => {
553
+ let cellHeight;
554
+ essayResponsePage.previewInputFieldTable()
555
+ .within(() => {
556
+ utilities.getNthElement(essayResponsePage.tableCell(), 0)
557
+ .then(($originalCellHeight) => {
558
+ cellHeight = $originalCellHeight.height();
559
+ });
560
+ essayResponsePage.steps.addInputToTableCell(0, 'lorem{Enter}ipsum');
561
+ utilities.getNthElement(essayResponsePage.tableCell(), 0)
562
+ .then(($modifiedCellHeight) => {
563
+ let modifiedCellHeight = $modifiedCellHeight.height();
564
+ expect(modifiedCellHeight).to.be.gt(cellHeight);
565
+ });
566
+ });
567
+ },
568
+
569
+ /**
570
+ * Right click on header cell to open edit table popup
571
+ * @param {number} headerCellIndex index of header cell
572
+ */
573
+ openEditTablePopupThroughHeaderCell: (headerCellIndex) => {
574
+ essayResponsePage.previewInputFieldTable()
575
+ .within(() => {
576
+ utilities.getNthElement(essayResponsePage.tableHeaderCell(), headerCellIndex)
577
+ .rightclick();
578
+ });
579
+ utilities.verifyElementVisibilityState(essayResponsePage.editTableDialogBox(), 'visible');
580
+ },
581
+
582
+ /**
583
+ * Right click on normal cell to open edit table popup
584
+ * @param {number} cellIndex index of cell
585
+ */
586
+ openEditTablePopupThroughNormalCell: (cellIndex) => {
587
+ essayResponsePage.previewInputFieldTable()
588
+ .within(() => {
589
+ utilities.getNthElement(essayResponsePage.tableCell(), cellIndex)
590
+ .rightclick();
591
+ });
592
+ utilities.verifyElementVisibilityState(essayResponsePage.editTableDialogBox(), 'visible');
593
+ },
594
+
595
+ verifyCheckedStateOfEditTableAddRowHeaderCheckbox: () => {
596
+ essayResponsePage.editTableDialogBoxAddRowHeaderCheckbox()
597
+ .should('be.checked');
598
+ },
599
+
600
+ verifyUncheckedStateOfEditTableHighlightFirstColumnCheckbox: () => {
601
+ essayResponsePage.editTableDialogBoxHighlightFirstColumnCheckbox()
602
+ .should('not.be.checked');
603
+ },
604
+
605
+ verifyUncheckedStateOfEditTableAddRowHeaderCheckbox: () => {
606
+ essayResponsePage.editTableDialogBoxAddRowHeaderCheckbox()
607
+ .should('not.be.checked');
608
+ },
609
+
610
+ clickOnEditTableFlyoutCancelButton: () => {
611
+ essayResponsePage.editTableDialogBoxButtonCancel()
612
+ .click();
613
+ },
614
+
615
+ clickOnEditTableFlyoutSaveButton: () => {
616
+ essayResponsePage.editTableDialogBoxButtonSave()
617
+ .click();
618
+ },
619
+
620
+ clickOnEditTableFlyoutDeleteButton: () => {
621
+ essayResponsePage.editTableDialogBoxButtonDelete()
622
+ .click();
623
+ },
624
+
625
+ clickOnEditTableInsertBeforeButton: () => {
626
+ essayResponsePage.editTableDialogBoxInsertBeforeButton()
627
+ .click();
628
+ },
629
+
630
+ clickOnEditTableInsertAfterButton: () => {
631
+ essayResponsePage.editTableDialogBoxInsertAfterButton()
632
+ .click();
633
+ },
634
+
635
+ clickOnEditTableDeleteColumnButton: () => {
636
+ essayResponsePage.editTableDialogBoxDeleteColumnButton()
637
+ .click();
638
+ },
639
+
640
+ clickOnEditTableInsertAboveButton: () => {
641
+ essayResponsePage.editTableDialogBoxInsertAboveButton()
642
+ .click();
643
+ },
644
+
645
+ clickOnEditTableInsertBelowButton: () => {
646
+ essayResponsePage.editTableDialogBoxInsertBelowButton()
647
+ .click();
648
+ },
649
+
650
+ clickOnEditTableDeleteRowButton: () => {
651
+ essayResponsePage.editTableDialogBoxDeleteRowButton()
652
+ .click();
653
+ },
654
+
655
+ compareColumnWidthWhenNewColumnIsAddedToTheTable: () => {
656
+ let cellWidth;
657
+ essayResponsePage.previewInputFieldTable()
658
+ .within(() => {
659
+ utilities.getNthElement(essayResponsePage.tableHeaderCell(), 1)
660
+ .then(($originalCellWidth) => {
661
+ cellWidth = $originalCellWidth.width(); //Storing original column width
662
+ });
663
+ });
664
+ cy.log('Right click in the required cell to open edit table flyout and then click on Insert After button.');
665
+ essayResponsePage.steps.openEditTablePopupThroughHeaderCell(1);
666
+ essayResponsePage.steps.clickOnEditTableInsertAfterButton();
667
+ essayResponsePage.previewInputFieldTable()
668
+ .within(() => {
669
+ utilities.getNthElement(essayResponsePage.tableHeaderCell(), 1)
670
+ .then(($modifiedCellWidth) => {
671
+ let modifiedCellWidth = $modifiedCellWidth.width();
672
+ expect(modifiedCellWidth).to.be.lt(cellWidth); //Comparing modified and original column width
673
+ });
674
+ });
675
+ },
676
+
677
+ compareColumnWidthWhenColumnIsDeletedFromTheTable: () => {
678
+ let cellWidth;
679
+ essayResponsePage.previewInputFieldTable()
680
+ .within(() => {
681
+ utilities.getNthElement(essayResponsePage.tableHeaderCell(), 0)
682
+ .then(($originalCellWidth) => {
683
+ cellWidth = $originalCellWidth.width(); //Storing original column width
684
+ });
685
+ });
686
+ cy.log('Right click in the required cell to open edit table flyout and then click on Delete Column button.');
687
+ essayResponsePage.steps.openEditTablePopupThroughNormalCell(0);
688
+ essayResponsePage.steps.clickOnEditTableDeleteColumnButton();
689
+ essayResponsePage.previewInputFieldTable()
690
+ .within(() => {
691
+ utilities.getNthElement(essayResponsePage.tableHeaderCell(), 0)
692
+ .then(($modifiedCellWidth) => {
693
+ let modifiedCellWidth = $modifiedCellWidth.width();
694
+ expect(modifiedCellWidth).to.be.gt(cellWidth); //Comparing modified and original column width
695
+ });
696
+ });
697
+ },
698
+
699
+ ///Old
118
700
  expandCustomizeFormattingOptionsAccordion: () => {
119
701
  essayResponsePage.customizeFormattingOptionsAccordion()
120
702
  .click()
@@ -132,7 +714,8 @@ const steps = {
132
714
  selectCustomizedFormattingOption: (formattingOptionArray) => {
133
715
  formattingOptionArray.forEach((formattingOption) => {
134
716
  essayResponsePage.customizeFormattingOptionsTiles(formattingOption)
135
- .click()
717
+ .click();
718
+ essayResponsePage.customizeFormattingOptionsTiles(formattingOption)
136
719
  .should('have.attr', 'data-aria-pressed', 'true');
137
720
  });
138
721
  },
@@ -191,13 +774,16 @@ const tests = {
191
774
  ...scoringSectionBaseEditTab.tests,
192
775
  ...autoScoredScoringPreviewTab.tests,
193
776
  ...commonComponents.tests,
777
+
778
+ /**
779
+ * insert equation and verify input field content and word count
780
+ * @param {string} expectedOutput equation text
781
+ * @param {string} wordCount word limit as set in the set limit section
782
+ */
194
783
  insertEquationAndVerifyInputFieldContentsAndWordCount: (expectedOutput, wordCount) => {
195
784
  it(`On clicking the Ok button the symbols/equation entered should be displayed in the preview tab input field and the Word count should increase to ${wordCount}`, () => {
196
- equationEditorFlyout.buttonOk()
197
- .click();
198
- essayResponsePage.responseField()
199
- .find('.cke_widget_element')
200
- .should('have.text', `${expectedOutput}`);
785
+ equationEditorFlyout.steps.clickOnOkButton()
786
+ utilities.verifyTextContent(essayResponsePage.responseField().find('.ngie_latex'), `${expectedOutput}`);
201
787
  essayResponsePage.steps.verifyResponseFieldWordCount(wordCount);
202
788
  });
203
789
  },