itemengine-cypress-automation 1.0.86 → 1.0.88

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) 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/minimumScoringPenaltyPointsAndRoundingDropdown.js +202 -0
  29. package/cypress/e2e/ILC/TextEntryMath/responseEvaluationMethodsAndCustomSettings.js +613 -0
  30. package/cypress/e2e/ILC/TextEntryMath/specifyCorrectAnswerSection.js +71 -0
  31. package/cypress/fixtures/equationEditorCategoriesAndSymbols .js +318 -318
  32. package/cypress/fixtures/theme/ilc.json +3 -0
  33. package/cypress/pages/components/backgroundImageUploadComponent.js +1 -2
  34. package/cypress/pages/components/colorPopupComponent.js +26 -3
  35. package/cypress/pages/components/createCustomCategoryFlyout.js +351 -46
  36. package/cypress/pages/components/customizeSpecialCharacterComponent.js +165 -0
  37. package/cypress/pages/components/equationEditorFlyout.js +124 -0
  38. package/cypress/pages/components/essayResponseCommonComponents.js +3 -0
  39. package/cypress/pages/components/figOverImageCanvasComponent.js +316 -7
  40. package/cypress/pages/components/index.js +3 -1
  41. package/cypress/pages/components/opacityComponent.js +31 -4
  42. package/cypress/pages/components/specialAndCustomSpecialCharactersComponent.js +1 -0
  43. package/cypress/pages/components/specialCharactersFlyoutComponent.js +1 -0
  44. package/cypress/pages/drawingResponsePage.js +33 -138
  45. package/cypress/pages/essayResponsePage.js +612 -26
  46. package/cypress/pages/fillInTheGapsOverImageDragAndDropPage.js +48 -7
  47. package/cypress/pages/fillInTheGapsOverImageTextPage.js +267 -13
  48. package/package.json +1 -1
@@ -0,0 +1,290 @@
1
+ import { essayResponsePage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ import utilities from "../../../support/helpers/utilities";
4
+ const css = Cypress.env('css');
5
+
6
+ describe('Essay Response Preview: Add Table Functionality', () => {
7
+ before(() => {
8
+ cy.loginAs('admin');
9
+ });
10
+
11
+ describe('Add Table flyout contents', () => {
12
+ abortEarlySetup();
13
+ before(() => {
14
+ cy.log('Navigate to Essay Response question type and switching to preview tab.');
15
+ essayResponsePage.steps.navigateToCreateQuestion('essay response');
16
+ cy.barsPreLoaderWait();
17
+ essayResponsePage.steps.switchToPreviewTab();
18
+ });
19
+
20
+ it('\'Table\' option should be present in the preview tab toolbar', () => {
21
+ utilities.verifyElementVisibilityState(essayResponsePage.previewTabToolbarOption('Insert Table'), 'visible');
22
+ });
23
+
24
+ it('When user clicks on Table option in the toolbar, then the Table flyout should appear.', () => {
25
+ essayResponsePage.steps.selectPreviewTabToolbarOption('Insert Table');
26
+ utilities.verifyElementVisibilityState(essayResponsePage.addTableDialogBox(), 'visible');
27
+ });
28
+
29
+ it('Title of the flyout should be \'Table\'.', () => {
30
+ utilities.verifyInnerText(essayResponsePage.addTableDialogBoxTitle(), 'Table');
31
+ });
32
+
33
+ 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.', () => {
34
+ utilities.verifyElementVisibilityState(essayResponsePage.addTableDialogBoxColumnsLabel(), 'visible');
35
+ utilities.verifyInnerText(essayResponsePage.addTableDialogBoxColumnsLabel(), 'Columns');
36
+ essayResponsePage.steps.verifyTableFlyoutColumnsInputFieldValue(3);
37
+ utilities.verifyElementVisibilityState(essayResponsePage.addTableDialogBoxRowsLabel(), 'visible');
38
+ utilities.verifyInnerText(essayResponsePage.addTableDialogBoxRowsLabel(), 'Rows');
39
+ essayResponsePage.steps.verifyTableFlyoutRowsInputFieldValue(2);
40
+ });
41
+
42
+ 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.', () => {
43
+ utilities.verifyElementVisibilityState(essayResponsePage.addTableDialogBoxAddRowHeaderLabel(), 'visible');
44
+ utilities.verifyInnerText(essayResponsePage.addTableDialogBoxAddRowHeaderLabel(), 'Add row header');
45
+ essayResponsePage.steps.verifyUncheckedStateOfAddRowHeaderHighlightFirstColumnCheckbox();
46
+ utilities.verifyElementVisibilityState(essayResponsePage.addTableDialogBoxHighlightFirstColumnLabel(), 'visible');
47
+ utilities.verifyInnerText(essayResponsePage.addTableDialogBoxHighlightFirstColumnLabel(), 'Highlight first column');
48
+ });
49
+
50
+ it('Maximum and minimum input that the user can give in \'Columns\' and \'Rows\' input fields should be \'999\' and \'1\'.', () => {
51
+ essayResponsePage.steps.verifyMinimumAndMaximumValueOfTableFlyoutColumnsAndRowsInputField();
52
+ });
53
+
54
+ it('User should be able to change the value of \'Columns\' and \'Rows\' input fields by directly giving an input in them', () => {
55
+ essayResponsePage.steps.editTableFlyoutColumnsInputField(5);
56
+ essayResponsePage.steps.editTableFlyoutRowsInputField(10);
57
+ });
58
+
59
+ it('User should be able to change the value of \'Columns\' and \'Rows\' input fields by using increment and decrement buttons', () => {
60
+ essayResponsePage.steps.incrementTableFlyoutColumnsInputField(2);
61
+ essayResponsePage.steps.verifyTableFlyoutColumnsInputFieldValue(7);
62
+ essayResponsePage.steps.decrementTableFlyoutColumnsInputField(3);
63
+ essayResponsePage.steps.verifyTableFlyoutColumnsInputFieldValue(4);
64
+ essayResponsePage.steps.decrementTableFlyoutRowsInputField(4);
65
+ essayResponsePage.steps.verifyTableFlyoutRowsInputFieldValue(6);
66
+ essayResponsePage.steps.incrementTableFlyoutRowsInputField(2);
67
+ essayResponsePage.steps.verifyTableFlyoutRowsInputFieldValue(8);
68
+ });
69
+
70
+ it('When user inputs a value which exceeds the maximum and minimum value of \'Columns\' and \'Rows\' input fields, then \'Add table\' button should be disabled and when value is restored to the allowed range, then \'Add table\' button should be enabled again', () => {
71
+ essayResponsePage.steps.editTableFlyoutColumnsInputField(0);
72
+ utilities.verifyElementDisabledClass(essayResponsePage.addTableDialogBoxButtonAddTable());
73
+ essayResponsePage.steps.incrementTableFlyoutColumnsInputField(2);
74
+ utilities.verifyElementNotDisabled(essayResponsePage.addTableDialogBoxButtonAddTable());
75
+ essayResponsePage.steps.editTableFlyoutRowsInputField(1001);
76
+ utilities.verifyElementDisabledClass(essayResponsePage.addTableDialogBoxButtonAddTable());
77
+ essayResponsePage.steps.decrementTableFlyoutRowsInputField(5);
78
+ utilities.verifyElementNotDisabled(essayResponsePage.addTableDialogBoxButtonAddTable());
79
+ });
80
+
81
+ it('\'Add table\' button should be displayed in the flyout', () => {
82
+ utilities.verifyElementVisibilityState(essayResponsePage.addTableDialogBoxButtonAddTable(), 'visible');
83
+ utilities.verifyInnerText(essayResponsePage.addTableDialogBoxButtonAddTable(), 'Add table');
84
+ });
85
+
86
+ it('CSS of table flyout', { tags: 'css' }, () => {
87
+ utilities.verifyCSS(essayResponsePage.addTableDialogBoxTitle(), {
88
+ 'color': css.color.flyoutTitle,
89
+ 'font-size': css.fontSize.heading,
90
+ 'font-weight': css.fontWeight.semibold
91
+ });
92
+ utilities.verifyCSS(essayResponsePage.addTableDialogBoxColumnsLabel(), {
93
+ 'color': css.color.labels,
94
+ 'font-size': css.fontSize.normal,
95
+ 'font-weight': css.fontWeight.semibold,
96
+ });
97
+ utilities.verifyCSS(essayResponsePage.addTableDialogBoxRowsLabel(), {
98
+ 'color': css.color.labels,
99
+ 'font-size': css.fontSize.normal,
100
+ 'font-weight': css.fontWeight.semibold,
101
+ });
102
+ utilities.verifyCSS(essayResponsePage.addTableDialogBoxColumnsInputField(), {
103
+ 'color': css.color.labels,
104
+ 'font-size': css.fontSize.normal,
105
+ 'font-weight': css.fontWeight.semibold,
106
+ });
107
+ utilities.verifyCSS(essayResponsePage.addTableDialogBoxRowsInputField(), {
108
+ 'color': css.color.text,
109
+ 'font-size': css.fontSize.default,
110
+ 'font-weight': css.fontWeight.regular,
111
+ });
112
+ utilities.verifyCSS(essayResponsePage.addTableDialogBoxAddRowHeaderLabel(), {
113
+ 'color': css.color.text,
114
+ 'font-size': css.fontSize.default,
115
+ 'font-weight': css.fontWeight.regular,
116
+ });
117
+ utilities.verifyCSS(essayResponsePage.addTableDialogBoxHighlightFirstColumnLabel(), {
118
+ 'color': css.color.labelText,
119
+ 'font-size': css.fontSize.normal,
120
+ 'font-weight': css.fontWeight.regular
121
+ });
122
+ utilities.verifyCSS(essayResponsePage.addTableDialogBoxButtonAddTable(), {
123
+ 'color': css.color.whiteText,
124
+ 'font-size': css.fontSize.default,
125
+ 'font-weight': css.fontWeight.regular,
126
+ 'background-color': css.color.primaryBtnBg
127
+ });
128
+ utilities.verifyCSS(essayResponsePage.addTableDialogBoxButtonCancel(), {
129
+ 'color': css.color.secondaryBtn,
130
+ 'font-size': css.fontSize.default,
131
+ 'font-weight': css.fontWeight.regular
132
+ });
133
+ });
134
+
135
+ it('Accessibility of \'Add Table\' flyout.', { tags: 'a11y' }, () => {
136
+ cy.checkAccessibility(essayResponsePage.addTableDialogBox());
137
+ });
138
+
139
+ it('\'Cancel\' button should be displayed in the flyout and when user clicks on it then the flyout should close.', () => {
140
+ utilities.verifyElementVisibilityState(essayResponsePage.addTableDialogBoxButtonCancel(), 'visible');
141
+ utilities.verifyInnerText(essayResponsePage.addTableDialogBoxButtonCancel(), 'Cancel');
142
+ essayResponsePage.steps.clickOnTableFlyoutCancelButton();
143
+ utilities.verifyElementVisibilityState(essayResponsePage.addTableDialogBox(), 'notExist');
144
+ });
145
+ });
146
+
147
+ describe('Add table and enter input into the table.', () => {
148
+ abortEarlySetup();
149
+ before(() => {
150
+ 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.');
151
+ essayResponsePage.steps.navigateToCreateQuestion('essay response');
152
+ cy.barsPreLoaderWait();
153
+ essayResponsePage.steps.switchToPreviewTab();
154
+ essayResponsePage.steps.selectPreviewTabToolbarOption('Insert Table');
155
+ essayResponsePage.steps.editTableFlyoutColumnsInputField(4);
156
+ essayResponsePage.steps.editTableFlyoutRowsInputField(4);
157
+ });
158
+
159
+ it('When user clicks on \'Add Table\' button, table with the set properties should be displayed in the response field.', () => {
160
+ essayResponsePage.steps.addTable();
161
+ utilities.verifyElementVisibilityState(essayResponsePage.previewInputFieldTable(), 'visible');
162
+ essayResponsePage.steps.verifyTableProperties(4, 16);
163
+ });
164
+
165
+ it('When cursor is focused is inside a table cell, the Table option from the toolbar should be disabled.', () => {
166
+ utilities.verifyElementDisabledClass(essayResponsePage.previewTabToolbarOption('Insert Table'));
167
+ });
168
+
169
+ it('User should be able to enter and clear text in the table cell', () => {
170
+ essayResponsePage.steps.addInputToTableCell(1, 'lorem');
171
+ utilities.verifyInnerText(utilities.getNthElement(essayResponsePage.tableCell(), 1), 'lorem');
172
+ essayResponsePage.steps.addInputToTableCell(1, '{backspace}'.repeat(5), { delay: 500 });
173
+ });
174
+
175
+ it('When user enters text in any cell, the column width of that cell should increase and the width of other columns should decrease.', () => {
176
+ essayResponsePage.steps.compareColumnWidthsWhenInputIsAddedInACell();
177
+ });
178
+
179
+ 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.', () => {
180
+ essayResponsePage.steps.compareColumnWidthsWhenInputIsRemovedInACell();
181
+ });
182
+
183
+ it('When user enters multi-line text in any table cell, the height of that cell and its row should increase.', () => {
184
+ essayResponsePage.steps.compareRowHeightWhenMultilineInputIsGivenInACell();
185
+ });
186
+
187
+ it('When the cursor focus is changed to outside the table, the Table option in the toolbar should be enabled again.', () => {
188
+ cy.log('Pre-step: Shifting the focus outside the table in the response field.');
189
+ essayResponsePage.steps.addInputToTableCell(15, '{rightArrow}{rightArrow}');
190
+ utilities.verifyElementNotDisabled(essayResponsePage.previewTabToolbarOption('Insert Table'));
191
+ });
192
+
193
+ it('When user clicks on Table option in the toolbar, then add table flyout should again appear in its default state.', () => {
194
+ essayResponsePage.steps.selectPreviewTabToolbarOption('Insert Table');
195
+ utilities.verifyElementVisibilityState(essayResponsePage.addTableDialogBox(), 'visible');
196
+ essayResponsePage.steps.verifyTableFlyoutColumnsInputFieldValue(3);
197
+ essayResponsePage.steps.verifyTableFlyoutRowsInputFieldValue(2);
198
+ essayResponsePage.steps.verifyUncheckedStateOfAddRowHeaderHighlightFirstColumnCheckbox();
199
+ });
200
+
201
+ it('When user clicks on \'Add Table\' button, then another table should be added in the response field.', () => {
202
+ essayResponsePage.steps.addTable();
203
+ utilities.verifyElementCount(essayResponsePage.previewInputFieldTable(), 2);
204
+ });
205
+
206
+ it('CSS of the table and text inside table cells.', { tags: 'css' }, () => {
207
+ utilities.getNthElement(essayResponsePage.previewInputFieldTable(), 0)
208
+ .within(() => {
209
+ utilities.verifyCSS(utilities.getNthElement(essayResponsePage.tableCell(), 0), {
210
+ 'color': css.color.text,
211
+ 'font-size': css.fontSize.default,
212
+ 'font-weight': css.fontWeight.regular,
213
+ 'border': `1px solid ${css.color.secondaryBtnBorder}`,
214
+ 'background-color': css.color.transparent
215
+ });
216
+ });
217
+ });
218
+
219
+ it('Accessibility of the table.', { tags: 'a11y' }, () => {
220
+ cy.checkAccessibility(essayResponsePage.previewInputFieldTable());
221
+ });
222
+ });
223
+
224
+ describe('Add table with header row, highlighted column.', () => {
225
+ abortEarlySetup();
226
+ before(() => {
227
+ cy.log('Navigating to Essay Response question type and switching to preview tab.');
228
+ essayResponsePage.steps.navigateToCreateQuestion('essay response');
229
+ cy.barsPreLoaderWait();
230
+ essayResponsePage.steps.switchToPreviewTab();
231
+ });
232
+
233
+ beforeEach(() => {
234
+ essayResponsePage.steps.enterInputInResponseField('{selectAll}{backspace}');
235
+ essayResponsePage.steps.selectPreviewTabToolbarOption('Insert Table');
236
+ });
237
+
238
+ 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', () => {
239
+ cy.log('Check the \'Add header row\' checkbox.');
240
+ essayResponsePage.steps.checkAddRowHeaderCheckbox();
241
+ essayResponsePage.steps.addTable();
242
+ essayResponsePage.steps.verifyTableHeaderRowCellCount(3);
243
+ essayResponsePage.steps.verifyTableProperties(2, 3, 3);
244
+ essayResponsePage.steps.verifyTableHeaderCellsAreHighlighted();
245
+ essayResponsePage.steps.verifyTableNormalCellsAreNotHighlighted();
246
+ });
247
+
248
+ 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.', () => {
249
+ cy.log('Check the \'Highlight first column\' checkbox.');
250
+ essayResponsePage.steps.checkHighlightFirstColumnCheckbox();
251
+ essayResponsePage.steps.addTable();
252
+ essayResponsePage.steps.verifyFirstColumnsIsHighlighted(2);
253
+ essayResponsePage.steps.verifyTableProperties(2, 4, 2);
254
+ essayResponsePage.steps.verifyTableHeaderCellsAreHighlighted();
255
+ essayResponsePage.steps.verifyTableNormalCellsAreNotHighlighted();
256
+ });
257
+
258
+ 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.', () => {
259
+ cy.log('Check both \'Add header row\' and \'Highlight first column\' checkboxes.');
260
+ essayResponsePage.steps.checkAddRowHeaderCheckbox();
261
+ essayResponsePage.steps.checkHighlightFirstColumnCheckbox();
262
+ essayResponsePage.steps.addTable();
263
+ essayResponsePage.steps.verifyTableHeaderRowCellCount(3);
264
+ essayResponsePage.steps.verifyFirstColumnsIsHighlighted(2);
265
+ essayResponsePage.steps.verifyTableProperties(2, 2, 4);
266
+ essayResponsePage.steps.verifyTableHeaderCellsAreHighlighted();
267
+ essayResponsePage.steps.verifyTableNormalCellsAreNotHighlighted();
268
+ });
269
+
270
+ it('CSS of table contents', { tags: 'css' }, () => {
271
+ cy.log('Check the \'Add header row\' checkbox.');
272
+ essayResponsePage.steps.checkAddRowHeaderCheckbox();
273
+ essayResponsePage.steps.addTable();
274
+ essayResponsePage.steps.addInputToTableHeaderCell(0, 'lorem');
275
+ utilities.getNthElement(essayResponsePage.previewInputFieldTable(), 0)
276
+ .within(() => {
277
+ utilities.verifyCSS(utilities.getNthElement(essayResponsePage.tableHeaderCell(), 0), {
278
+ 'color': css.color.whiteText,
279
+ 'font-size': css.fontSize.default,
280
+ 'font-weight': css.fontWeight.bold,
281
+ 'background-color': css.color.highlightedTableCell
282
+ });
283
+ });
284
+ });
285
+
286
+ it('Accessibility of the table.', { tags: 'a11y' }, () => {
287
+ cy.checkAccessibility(essayResponsePage.previewInputFieldTable());
288
+ });
289
+ });
290
+ });
@@ -0,0 +1,79 @@
1
+ import { essayResponsePage, itemPreviewPage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ import utilities from "../../../support/helpers/utilities";
4
+ const css = Cypress.env('css');
5
+ let previewContentViews = ['Question preview', 'Item preview', 'Student view'];
6
+ const views = utilities.getViews(previewContentViews);
7
+ var itemReferenceID = "";
8
+
9
+ const defaultFormattingOptionsPreviewTab = ['Bold (Ctrl+B)', 'Italic (Ctrl+I)', 'Underline (Ctrl+U)', 'Insert/Remove Bulleted List', 'Insert/Remove Numbered List', 'Insert Table', 'Increase Indent', 'Decrease Indent', 'Undo (Ctrl+Z)', 'Redo (Ctrl+Y)'];
10
+
11
+ //Failing due to https://redmine.zeuslearning.com/issues/553382
12
+ describe('Create item page - Essay response: Preview contents', () => {
13
+ before(() => {
14
+ cy.loginAs('admin');
15
+ });
16
+
17
+ views.forEach((view) => {
18
+ describe(`Preview tab contents - ${view}`, { tags: 'smoke' }, () => {
19
+ abortEarlySetup();
20
+ before(() => {
21
+ switch (view) {
22
+ case 'Question preview':
23
+ cy.log('Navigating to Essay response question type');
24
+ essayResponsePage.steps.navigateToCreateQuestion('essay response');
25
+ cy.barsPreLoaderWait();
26
+ essayResponsePage.steps.addQuestionInstructions();
27
+ essayResponsePage.steps.allotPoints(10);
28
+ essayResponsePage.steps.switchToPreviewTab();
29
+ break;
30
+ case 'Item view':
31
+ cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID[0])}`);
32
+ break;
33
+ case 'Item preview':
34
+ cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID[0])}`);
35
+ itemPreviewPage.steps.switchToPreviewTab();
36
+ break;
37
+ case 'Student view':
38
+ cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID[0])}`);
39
+ break;
40
+ };
41
+ });
42
+
43
+ if (view === 'Question preview') {
44
+ after(() => {
45
+ essayResponsePage.steps.clickOnSaveQuestionButton();
46
+ utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
47
+ itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
48
+ });
49
+ };
50
+
51
+ it(`When the user switches to Preview tab, then the following options should be displayed in the response field toolbar - ${defaultFormattingOptionsPreviewTab.join('')} along with a separator after ${defaultFormattingOptionsPreviewTab[7]} option`, () => {
52
+ essayResponsePage.steps.verifyDefaultToolbarOptions(defaultFormattingOptionsPreviewTab, defaultFormattingOptionsPreviewTab[7]);
53
+ });
54
+
55
+ it('Word count should be displayed in the format \'Maximum 1000 words\'', () => {
56
+ essayResponsePage.steps.verifyResponseFieldWordCount(1000);
57
+ });
58
+
59
+ it('When the user updates the formatting options and types something in the response field', () => {
60
+ essayResponsePage.steps.selectPreviewTabToolbarOption('Bold (Ctrl+B)');
61
+ essayResponsePage.steps.selectPreviewTabToolbarOption('Italic (Ctrl+I)');
62
+ essayResponsePage.steps.selectPreviewTabToolbarOption('Underline (Ctrl+U)');
63
+ essayResponsePage.steps.enterInputInResponseField('This is a test for grading view preview contents');
64
+ essayResponsePage.responseField()
65
+ .verifyInnerHTML('<p><strong><em><u>​​​​​​​This is a test for grading view preview contents</u></em></strong><br></p>');
66
+ });
67
+
68
+ it('CSS of formatting options in Preview tab', { tags: 'css' }, () => {
69
+ utilities.verifyCSS(essayResponsePage.previewTabToolbarOption('Bold (Ctrl+B)').find('.cke_button_icon'), {
70
+ 'color': css.color.activeButtons
71
+ });
72
+ });
73
+
74
+ it('Accessibility of formatting options in Preview tab', { tags: 'a11y' }, () => {
75
+ cy.checkAccessibility(essayResponsePage.previewTabToolbarWrapper());
76
+ });
77
+ });
78
+ });
79
+ });