itemengine-cypress-automation 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. package/.build_wna +4 -0
  2. package/README.md +3 -0
  3. package/currents.config.js +6 -0
  4. package/cypress/API/createItem/toggleItemMode.js +15 -0
  5. package/cypress/config-files/ildev.json +15 -0
  6. package/cypress/config-files/ilprod.json +15 -0
  7. package/cypress/config-files/ilqa.json +15 -0
  8. package/cypress/config-files/ilstage.json +15 -0
  9. package/cypress/e2e/ILC/sorry-cypress-test/spec1.js +18 -0
  10. package/cypress/e2e/ILC/sorry-cypress-test/spec2.js +18 -0
  11. package/cypress/e2e/ILC/sorry-cypress-test/spec3.js +18 -0
  12. package/cypress/fixtures/accessibilityConfig.json +6 -0
  13. package/cypress/fixtures/constants.js +18 -0
  14. package/cypress/fixtures/equationEditorCategoriesAndSymbols .js +2271 -0
  15. package/cypress/fixtures/specialAndMathCharacters.js +118 -0
  16. package/cypress/fixtures/theme/ilc.json +150 -0
  17. package/cypress/fixtures/theme/ngie.json +26 -0
  18. package/cypress/fixtures/uploads/20mbFile.png +0 -0
  19. package/cypress/fixtures/uploads/80mbFile.pdf +0 -0
  20. package/cypress/fixtures/uploads/highlightImage.jpg +0 -0
  21. package/cypress/fixtures/uploads/image.png +0 -0
  22. package/cypress/fixtures/uploads/sample.aac +0 -0
  23. package/cypress/fixtures/uploads/sample.accdb +0 -0
  24. package/cypress/fixtures/uploads/sample.csv +100 -0
  25. package/cypress/fixtures/uploads/sample.doc +0 -0
  26. package/cypress/fixtures/uploads/sample.gif +0 -0
  27. package/cypress/fixtures/uploads/sample.heic +0 -0
  28. package/cypress/fixtures/uploads/sample.heif +0 -0
  29. package/cypress/fixtures/uploads/sample.hevc +0 -0
  30. package/cypress/fixtures/uploads/sample.jpeg +0 -0
  31. package/cypress/fixtures/uploads/sample.jpg +0 -0
  32. package/cypress/fixtures/uploads/sample.mp3 +0 -0
  33. package/cypress/fixtures/uploads/sample.mp4 +0 -0
  34. package/cypress/fixtures/uploads/sample.pdf +0 -0
  35. package/cypress/fixtures/uploads/sample.ppt +0 -0
  36. package/cypress/fixtures/uploads/sample.pub +0 -0
  37. package/cypress/fixtures/uploads/sample.rtf +7902 -0
  38. package/cypress/fixtures/uploads/sample.svg +10 -0
  39. package/cypress/fixtures/uploads/sample.txt +1 -0
  40. package/cypress/fixtures/uploads/sample.wav +0 -0
  41. package/cypress/fixtures/uploads/sample.xlsx +0 -0
  42. package/cypress/fixtures/uploads/sample.xps +0 -0
  43. package/cypress/fixtures/uploads/sample.zip +0 -0
  44. package/cypress/fixtures/uploads/sample1.jpg +0 -0
  45. package/cypress/fixtures/uploads/sample1.mp3 +0 -0
  46. package/cypress/fixtures/uploads/sample1.zip +0 -0
  47. package/cypress/fixtures/uploads/sample10Sec.mp3 +0 -0
  48. package/cypress/fixtures/uploads/sample2.jpg +0 -0
  49. package/cypress/fixtures/uploads/sample2.mp3 +0 -0
  50. package/cypress/fixtures/uploads/sampleVirus.zip +0 -0
  51. package/cypress/pages/audioPlayerPage.js +628 -0
  52. package/cypress/pages/audioResponsePage.js +264 -0
  53. package/cypress/pages/components/additionalSettingsPanel.js +174 -0
  54. package/cypress/pages/components/answerNumerationComponent.js +109 -0
  55. package/cypress/pages/components/autoScoredAdditionalSettings.js +183 -0
  56. package/cypress/pages/components/autoScoredPreviewBase.js +94 -0
  57. package/cypress/pages/components/autoScoredScoringSection.js +195 -0
  58. package/cypress/pages/components/autoScoredScoringSectionMultipleResponsesType.js +268 -0
  59. package/cypress/pages/components/autoScoredSetCorrectAnswerSection.js +291 -0
  60. package/cypress/pages/components/ckEditorToolbar.js +64 -0
  61. package/cypress/pages/components/colorPopupComponent.js +293 -0
  62. package/cypress/pages/components/commonComponents.js +93 -0
  63. package/cypress/pages/components/componentsFlowChart/figFlowChart.png +0 -0
  64. package/cypress/pages/components/createCustomCategoryFlyout.js +138 -0
  65. package/cypress/pages/components/createQuestionBasePage.js +225 -0
  66. package/cypress/pages/components/customizeHighlightPropertiesComponent.js +318 -0
  67. package/cypress/pages/components/dragAndDropResponseOptions.js +738 -0
  68. package/cypress/pages/components/dragAndDropSetCorrectAnswerCheckboxComponents.js +124 -0
  69. package/cypress/pages/components/draggableOptionsContainer.js +857 -0
  70. package/cypress/pages/components/editCategoryFlyout.js +40 -0
  71. package/cypress/pages/components/equationEditorFlyout.js +158 -0
  72. package/cypress/pages/components/essayResponseCommonComponents.js +86 -0
  73. package/cypress/pages/components/figOverImageCommonComponent.js +924 -0
  74. package/cypress/pages/components/fillInTheGapsCommonComponents.js +687 -0
  75. package/cypress/pages/components/fillInTheGapsDropdownCommonComponent.js +442 -0
  76. package/cypress/pages/components/fillInTheGapsTextCommonComponent.js +884 -0
  77. package/cypress/pages/components/gridCommonComponents.js +951 -0
  78. package/cypress/pages/components/index.js +38 -0
  79. package/cypress/pages/components/listSortingAndOrderingBase.js +401 -0
  80. package/cypress/pages/components/maximumRecorderLengthComponent.js +116 -0
  81. package/cypress/pages/components/mcqAdditionalSettingsBase.js +390 -0
  82. package/cypress/pages/components/mcqOptionsComponent.js +263 -0
  83. package/cypress/pages/components/mcqPreviewComponents.js +78 -0
  84. package/cypress/pages/components/mcqQuestionCommonComponents.js +265 -0
  85. package/cypress/pages/components/mcqScoringComponent.js +120 -0
  86. package/cypress/pages/components/mcqSetCorrectAnswerSection.js +143 -0
  87. package/cypress/pages/components/optionsWrapperComponent.js +221 -0
  88. package/cypress/pages/components/playbackControlsBaseComponent.js +163 -0
  89. package/cypress/pages/components/previewScoringAndShowCorrectAnswerComponent.js +90 -0
  90. package/cypress/pages/components/questionInstructionsComponent.js +112 -0
  91. package/cypress/pages/components/scoringSectionBase.js +308 -0
  92. package/cypress/pages/components/setPointsPopupBase.js +79 -0
  93. package/cypress/pages/components/specialAndCustomSpecialCharactersComponent.js +79 -0
  94. package/cypress/pages/components/specialCharactersFlyoutComponent.js +58 -0
  95. package/cypress/pages/components/studentResponseAreaAndLayoutComponent.js +28 -0
  96. package/cypress/pages/components/uploadImageSectionComponent.js +594 -0
  97. package/cypress/pages/createItemPage.js +28 -0
  98. package/cypress/pages/dialogBoxBase.js +111 -0
  99. package/cypress/pages/dragAndDropIntoCategoriesAllOrNothingScoring.js +1161 -0
  100. package/cypress/pages/dragAndDropIntoCategoriesCellsScoring.js +1559 -0
  101. package/cypress/pages/dragAndDropIntoCategoriesPage.js +1556 -0
  102. package/cypress/pages/dragAndDropIntoCategoriesResponseScoring.js +1396 -0
  103. package/cypress/pages/essayResponseBasicPage.js +57 -0
  104. package/cypress/pages/essayResponseMathPage.js +47 -0
  105. package/cypress/pages/essayResponsePage.js +385 -0
  106. package/cypress/pages/feedbackScalePage.js +698 -0
  107. package/cypress/pages/fillInTheGapsDragAndDropPage.js +742 -0
  108. package/cypress/pages/fillInTheGapsDropdownPage.js +99 -0
  109. package/cypress/pages/fillInTheGapsOverImageDropdownPage.js +232 -0
  110. package/cypress/pages/fillInTheGapsOverImageTextPage.js +135 -0
  111. package/cypress/pages/fillInTheGapsScoring.js +5974 -0
  112. package/cypress/pages/fillInTheGapsSetCorrectAnswerSection.js +260 -0
  113. package/cypress/pages/fillInTheGapsTextPage.js +225 -0
  114. package/cypress/pages/highlightImagePage.js +1316 -0
  115. package/cypress/pages/highlightPage.js +870 -0
  116. package/cypress/pages/index.js +30 -0
  117. package/cypress/pages/listMatchingPage.js +1330 -0
  118. package/cypress/pages/listMatchingScoring.js +2635 -0
  119. package/cypress/pages/listOrderingPage.js +751 -0
  120. package/cypress/pages/listSortingPage.js +1201 -0
  121. package/cypress/pages/multipleSelectionGridPage.js +359 -0
  122. package/cypress/pages/multipleSelectionPage.js +88 -0
  123. package/cypress/pages/passagePage.js +426 -0
  124. package/cypress/pages/readingRulerPage.js +302 -0
  125. package/cypress/pages/selectQuestionResourceToolPage.js +64 -0
  126. package/cypress/pages/shortTextResponsePage.js +197 -0
  127. package/cypress/pages/singleSelectionGridPage.js +370 -0
  128. package/cypress/pages/singleSelectionPage.js +65 -0
  129. package/cypress/pages/uploadResponsePage.js +110 -0
  130. package/cypress/pages/videoResponsePage.js +375 -0
  131. package/cypress/support/commands.js +140 -0
  132. package/cypress/support/e2e.js +14 -0
  133. package/cypress/support/helpers/abortEarly.js +19 -0
  134. package/cypress/support/helpers/accessibility.js +34 -0
  135. package/cypress/support/helpers/cypressUtilities.js +64 -0
  136. package/cypress/support/helpers/localStorage.js +13 -0
  137. package/cypress/support/helpers/selectText.js +77 -0
  138. package/cypress/support/helpers/utilities.js +126 -0
  139. package/cypress.config.js +76 -0
  140. package/il.yaml +14 -0
  141. package/language +1 -0
  142. package/package.json +26 -0
@@ -0,0 +1,57 @@
1
+ import { createQuestionBasePage, scoringSectionBase, additionalSettingsPanel, essayResponseCommonComponents } from "./components";
2
+ import { questionInstructionsComponent } from "./components/questionInstructionsComponent";
3
+
4
+ const selectors = {
5
+ ...createQuestionBasePage,
6
+ ...questionInstructionsComponent,
7
+ ...additionalSettingsPanel,
8
+ ...scoringSectionBase,
9
+ ...essayResponseCommonComponents,
10
+ //Customize Formatting options section
11
+ customizeFormattingOptionsSectionLabel: () => cy.get('.customize-essay-formatting-options .ngie-toggle-button-title'),
12
+ cutCustomizeFormattingOption: () => cy.get(`[data-ngie-testid="cut-toggle-button"]`),
13
+ copyCustomizeFormattingOption: () => cy.get(`[data-ngie-testid="copy-toggle-button"]`),
14
+ pasteCustomizeFormattingOption: () => cy.get(`[data-ngie-testid="paste-toggle-button"]`),
15
+ specialCharacterCustomizeFormattingOption: () => cy.get(`[data-ngie-testid="special-characters-toggle-button"]`),
16
+ customizeFormattingOptionsLabel: () => cy.get('.customized_button_label'),
17
+ customizeFormattingOptionsIcon: () => cy.get('.audio_icon_wrapper'),
18
+ customizeFormattingOptionsWrapper: () => cy.get('.customize-essay-formatting-options'),
19
+ };
20
+
21
+ const steps = {
22
+ ...createQuestionBasePage.steps,
23
+ ...questionInstructionsComponent.steps,
24
+ ...additionalSettingsPanel.steps,
25
+ ...scoringSectionBase.steps,
26
+ ...essayResponseCommonComponents.steps,
27
+
28
+ cutTextFromResponseField: () => {
29
+ essayResponseBasicPage.responseField()
30
+ .type('{selectAll}');
31
+ essayResponseBasicPage.previewTabToolbarOption('Cut')
32
+ .click();
33
+ },
34
+
35
+ copyTextFromResponseField: () => {
36
+ essayResponseBasicPage.responseField()
37
+ .type('{selectAll}');
38
+ essayResponseBasicPage.previewTabToolbarOption('Copy')
39
+ .click();
40
+ essayResponseBasicPage.responseField()
41
+ .click();
42
+ },
43
+ };
44
+
45
+ const tests = {
46
+ ...createQuestionBasePage.tests,
47
+ ...questionInstructionsComponent.tests,
48
+ ...additionalSettingsPanel.tests,
49
+ ...scoringSectionBase.tests,
50
+ ...essayResponseCommonComponents.tests
51
+ };
52
+
53
+ export const essayResponseBasicPage = {
54
+ ...selectors,
55
+ tests,
56
+ steps
57
+ };
@@ -0,0 +1,47 @@
1
+ import { questionInstructionsComponent, scoringSectionBase, createQuestionBasePage, additionalSettingsPanel, essayResponseCommonComponents } from "./components";
2
+ import { essayResponsePage } from ".";
3
+
4
+ const selectors = {
5
+ ...scoringSectionBase,
6
+ ...createQuestionBasePage,
7
+ ...additionalSettingsPanel,
8
+ ...questionInstructionsComponent,
9
+ ...essayResponsePage,
10
+ ...essayResponseCommonComponents,
11
+ textToNotBeRenderedAsLaTexLabel: () => cy.get('.text-not-latex-wrapper .text-label'),
12
+ textToNotBeRenderedAsLaTextInputFieldWrapper: (inputfieldNumber) => cy.get('.text-not-to-be-rendered-input').eq(inputfieldNumber),
13
+ textToNotBeRenderedAsLaTextInputField: () => cy.get('[aria-label="Text to not be rendered as LaTex"]'),
14
+ textToNotBeRenderedAsLaTextInputFieldCount: () => cy.get('.start-adornment'),
15
+ addTextButton: () => cy.get('.text-not-latex-wrapper .add-option'),
16
+ inputFieldLatexCharacter: () => cy.get('var[mathquill-command-id]')
17
+ }
18
+
19
+ const steps = {
20
+ ...createQuestionBasePage.steps,
21
+ ...questionInstructionsComponent.steps,
22
+ ...scoringSectionBase.steps,
23
+ ...additionalSettingsPanel.steps,
24
+ ...essayResponsePage.steps,
25
+ ...essayResponseCommonComponents.steps,
26
+ addTextToNotBeRenderedAsLatexEditTab: (inputFieldIndex, textContent) => {
27
+ essayResponseMathPage.textToNotBeRenderedAsLaTextInputFieldWrapper(inputFieldIndex)
28
+ .within(() => {
29
+ essayResponseMathPage.textToNotBeRenderedAsLaTextInputField()
30
+ .type(textContent)
31
+ .should('have.value', textContent);
32
+ });
33
+ }
34
+ }
35
+
36
+ const tests = {
37
+ ...createQuestionBasePage.tests,
38
+ ...questionInstructionsComponent.tests,
39
+ ...additionalSettingsPanel.tests,
40
+ ...scoringSectionBase.tests
41
+ }
42
+
43
+ export const essayResponseMathPage = {
44
+ ...selectors,
45
+ steps,
46
+ tests,
47
+ }
@@ -0,0 +1,385 @@
1
+ import { equationEditorCategoriesAndSymbols } from "../fixtures/equationEditorCategoriesAndSymbols ";
2
+ import { questionInstructionsComponent, scoringSectionBase, createQuestionBasePage, additionalSettingsPanel, previewScoringAndShowCorrectAnswerComponent, commonComponents } from "./components";
3
+ import { equationEditorFlyout } from "./components/equationEditorFlyout";
4
+ import { essayResponseCommonComponents } from "./components/essayResponseCommonComponents";
5
+ import { specialOrMathCharacters } from "../fixtures/specialAndMathCharacters";
6
+ const css = Cypress.env('css');
7
+
8
+ let originalText;
9
+ let formattedText;
10
+
11
+ const selectors = {
12
+ ...scoringSectionBase,
13
+ ...createQuestionBasePage,
14
+ ...additionalSettingsPanel,
15
+ ...questionInstructionsComponent,
16
+ ...essayResponseCommonComponents,
17
+ //Basic section
18
+ setWordLimitLabel: () => cy.get('[class*="EssayResponseComponentstyles__PropertyLabel"]'),
19
+ setWordLimitInputField: () => cy.get('.essay-response-question-word-limit-setting-wrapper input[type="text"]'),
20
+ displayWordLimitLabel: () => cy.get('#Display-word-limit-dropdown-label'),
21
+ displayWordLimitDropdown: () => cy.get('#Display-word-limit-select'),
22
+ displayWordLimitDropdownListOptions: (optionIndex) => cy.get('.dropdown-list-ul [role="option"]').eq(optionIndex),
23
+ allowSubmissionOverWordLimitLabel: () => cy.get('[data-ngie-testid="allow-submission-over-word-limit-checkbox"] .MuiFormControlLabel-label'),
24
+ allowSubmissionOverWordLimitCheckbox: () => cy.get('[data-ngie-testid="allow-submission-over-word-limit-checkbox"] input'),
25
+ showWordCountLabel: () => cy.get('[data-ngie-testid="show-word-count-checkbox"] .MuiFormControlLabel-label'),
26
+ showWordCountCheckbox: () => cy.get('[data-ngie-testid="show-word-count-checkbox"] input'),
27
+ //Customize Formatting Options
28
+ customizeFormattingOptionsAccordion: () => cy.get('.customize-formatting-option-wrapper .ngie-accordion-summary'),
29
+ customizeFormattingOptionsAccordionLabel: () => cy.get('.customize-formatting-options-label'),
30
+ customizeFormattingOptionsTiles: (toolbarOption) => cy.get(`.icon-button-custom-format[title="${toolbarOption}"]`),
31
+ customizeFormattingOptionsWrapper: () => cy.get('.essay-response-grid-wrapper'),
32
+ equationEditorOptionsWrapper: () => cy.get('[class*="EssayResponseComponentstyles__EquationEditorOptionsWrapper"]'),
33
+ //Todo: need to remove this and use common component drag handle
34
+ customizeFormattingOptionsdragHandleButton: () => cy.get('[class*="drag-icon-"]'),
35
+ equationEditorLabel: () => cy.get('.equation-editor-text-title'),
36
+ disableCutCopyPasteLabel: () => cy.get('[data-ngie-testid="disable-cut,-copy-and-paste-checkbox"] .MuiFormControlLabel-label'),
37
+ disableCutCopyPasteCheckbox: () => cy.get('[data-ngie-testid="disable-cut,-copy-and-paste-checkbox"] input'),
38
+ //Preview tab
39
+ previewTabColorPalettePopup: () => cy.get('.cke_panel_frame'),
40
+ previewTabToolbarSeperator: () => cy.get('.essay-preview-wrapper span[class="cke_toolbar_separator"]'),
41
+ specialCharacterFlyoutIcon: (characterIndex) => cy.get('.img_special_char').eq(characterIndex), //need to update and change this
42
+ //Equation Editor section
43
+ equationEditorSectionCategories: () => cy.get('[class*="DraggableItemsGrid"] .icon-button-custom-format'),
44
+ equationEditorSectionCategoryLabel: () => cy.get('.equation-editor-label-wrapper'),
45
+ equationEditorSection: () => cy.get('[class*="EquationEditorOptionsWrapper"]'),
46
+ equationEditorSectionTitle: () => cy.get('.equation-editor-text-title'),
47
+ equationEditorSectionHelperText: () => cy.get('.equation-editor-description-text'),
48
+ equationEditorSectionCategoriesDragIcon: () => cy.get('.drag-icon-equation-editor-button'),
49
+ equationEditorSectionCategoriesEditIcon: () => cy.get('.edit-icon-button button'),
50
+ equationEditorSectionTickIcon: () => cy.get('.tick-icon-wrapper'),
51
+ selectACategoryErrorMessage: () => cy.get('[class*="ErrorBlock"]'),
52
+ createCustomCategoryButton: () => cy.get('.equation-editor-wrapper button'),
53
+ equationEditorSectionCategoryIcon: () => cy.get('.equation-editor-icon'),
54
+ equationEditorSectionDeleteCustomCategoryIcon: () => cy.get('.delete-button-icon button')
55
+ }
56
+
57
+ 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')
58
+ //Add table dialog box
59
+ addTableDialogBox: () => cy.get('a[title="Add Table"]').parents('.cke_dialog_body'),
60
+ addTableDialogBoxTitle: () => essayResponsePage.addTableDialogBox().find('.cke_dialog_title'),
61
+ addTableDialogBoxAddHeaderRowLabel: () => essayResponsePage.addTableDialogBox().find('.chk_box_add_header_row'),
62
+ addTableDialogBoxHighlightFirstColumnLabel: () => cy.get('.cke_dialog_ui_checkbox_input').eq(1).parent().find('label'), //TODO- Need to update. No unique property available.
63
+ addTableDialogBoxAddHeaderRowCheckbox: () => essayResponsePage.addTableDialogBox().find('[class*="cke_dialog_ui_checkbox_input"]').eq(0),
64
+ addTableDialogBoxHighlightFirstColumnCheckbox: () => essayResponsePage.addTableDialogBox().find('[class*="cke_dialog_ui_checkbox_input"]').eq(1),
65
+ addTableDialogBoxButtonAddTable: () => cy.get('a[title="Add Table"]'),
66
+ addTableDialogBoxButtonCancel: () => essayResponsePage.addTableDialogBox().find('a[class*="cancel-button"]'),
67
+ addTableDialogBoxColumnsLabel: () => essayResponsePage.addTableDialogBox().find('.cke_dialog_ui_labeled_label').eq(0),
68
+ addTableDialogBoxRowsLabel: () => essayResponsePage.addTableDialogBox().find('.cke_dialog_ui_labeled_label').eq(1),
69
+ addTableDialogBoxColumnsInputField: () => essayResponsePage.addTableDialogBox().find('input[class="cke_dialog_ui_input_text"][type="number"]').eq(0),
70
+ addTableDialogBoxRowsInputField: () => essayResponsePage.addTableDialogBox().find('input[class="cke_dialog_ui_input_text"][type="number"]').eq(1),
71
+ previewInputFieldTable: () => cy.get('.ngcke_custom_table'),
72
+ previewTabToolbarDialogboxIconClose: () => essayResponsePage.addTableDialogBox().find('a[title="Close"]'),
73
+ //Edit Table Dialog Box
74
+ editTableDialogBox: () => cy.get('[title="Save"]').parents('.cke_dialog_body'),
75
+ editTableDialogBoxAddHeaderRowLabel: () => essayResponsePage.editTableDialogBox().find('.chk_box_add_header_row').eq(0),
76
+ editTableDialogBoxHighlightFirstColumnLabel: () => essayResponsePage.editTableDialogBox().find('.chk_box_highlight_first_column').eq(0),
77
+ editTableDialogBoxAddHeaderRowCheckbox: () => essayResponsePage.editTableDialogBox().find('[class*="cke_dialog_ui_checkbox_input"]').eq(0),
78
+ editTableDialogBoxHighlightFirstColumnCheckbox: () => essayResponsePage.editTableDialogBox().find('[class*="cke_dialog_ui_checkbox_input"]').eq(1),
79
+ editTableDialogBoxColumnsLabel: () => essayResponsePage.editTableDialogBox().find('.cke_dialog_ui_labeled_label').eq(0),
80
+ editTableDialogBoxRowsLabel: () => essayResponsePage.editTableDialogBox().find('.cke_dialog_ui_labeled_label').eq(1),
81
+ editTableDialogBoxInsertBeforeButton: () => cy.get('[title="Insert Before"]'),
82
+ editTableDialogBoxInsertAfterButton: () => cy.get('[title="Insert After"]'),
83
+ editTableDialogBoxDeleteColumnButton: () => cy.get('[title="Delete Column"]'),
84
+ editTableDialogBoxInsertAboveButton: () => cy.get('[title="Insert Above"]'),
85
+ editTableDialogBoxInsertBelowButton: () => cy.get('[title="Insert Below"]'),
86
+ editTableDialogBoxDeleteRowButton: () => cy.get('[title="Delete Row"]'),
87
+ editTableDialogBoxButtonClose: () => essayResponsePage.editTableDialogBox().find('a[title="Close"]'),
88
+ editTableDialogBoxButtonSave: () => cy.get('a[title="Save"]'),
89
+ editTableDialogBoxButtonCancel: () => essayResponsePage.editTableDialogBox().find('a[class*="cancel-button"]'),
90
+ editTableDialogBoxButtonDelete: () => cy.get('a[title="Delete"]')
91
+ }
92
+
93
+ const hyperlinkDialogBox = {
94
+ hyperlinkDialogBox: () => cy.get('.cke_dialog_body').contains('Hyperlink').parents('.cke_dialog_body'),
95
+ hyperlinkDialogBoxTitle: () => essayResponsePage.hyperlinkDialogBox().find('.cke_dialog_title'),
96
+ hyperlinkDialogboxDisplayTextLabel: () => essayResponsePage.hyperlinkDialogBox().find('.cke_dialog_ui_labeled_label').eq(0),
97
+ hyperlinkDialogboxURLLabel: () => essayResponsePage.hyperlinkDialogBox().find('.cke_dialog_ui_labeled_label').eq(1),
98
+ hyperlinkDialogboxDisplayTextInputField: () => essayResponsePage.hyperlinkDialogBox().find('input[class*="cke_dialog_ui_input_text"]').eq(0),
99
+ hyperlinkDialogboxURLInputField: () => essayResponsePage.hyperlinkDialogBox().find('input[class*="cke_dialog_ui_input_text"]').eq(1),
100
+ hyperlinkDialogboxButtonOk: () => essayResponsePage.hyperlinkDialogBox().find('a[title="OK"]'),
101
+ hyperlinkDialogboxButtonCancel: () => essayResponsePage.hyperlinkDialogBox().find('a[title="Cancel"]'),
102
+ previewInputFieldHyperlinkText: () => cy.get('div[title="Enter your response to the question here."] a'),
103
+ }
104
+
105
+ const specialAndMathCharacters = {
106
+ specialAndMathCharacterPopup: () => cy.get('.cke_dialog_body').contains(/Special characters|Math characters/).parents('.cke_dialog_body'),
107
+ specialAndMathCharacterPopupSymbolsWrapper: () => essayResponsePage.specialAndMathCharacterPopup().find('.special_char_td'),
108
+ specialAndMathCharacterPopupSymbols: () => essayResponsePage.specialAndMathCharacterPopup().find('.special_char_td a[role="option"]'),
109
+ specialAndMathCharacterPopupTitle: () => essayResponsePage.specialAndMathCharacterPopup().find('.cke_dialog_title '),
110
+ specialAndMathCharacterPopupCloseButton: () => essayResponsePage.specialAndMathCharacterPopup().find('a[title="Close"]')
111
+ }
112
+
113
+ const steps = {
114
+ ...createQuestionBasePage.steps,
115
+ ...questionInstructionsComponent.steps,
116
+ ...scoringSectionBase.steps,
117
+ ...additionalSettingsPanel.steps,
118
+ ...essayResponseCommonComponents.steps,
119
+ expandCustomizeFormattingOptionsAccordion: () => {
120
+ essayResponsePage.customizeFormattingOptionsAccordion()
121
+ .click()
122
+ .should('have.attr', 'aria-expanded', 'true');
123
+ },
124
+
125
+ selectingCategories: (categoriesArray) => {
126
+ categoriesArray.forEach((categoryName) => {
127
+ essayResponsePage.equationEditorSectionCategories()
128
+ .contains(categoryName, { matchCase: false })
129
+ .click();
130
+ });
131
+ },
132
+
133
+ selectCustomizedFormattingOption: (formattingOptionArray) => {
134
+ formattingOptionArray.forEach((formattingOption) => {
135
+ essayResponsePage.customizeFormattingOptionsTiles(formattingOption)
136
+ .click()
137
+ .should('have.attr', 'data-aria-pressed', 'true');
138
+ });
139
+ },
140
+
141
+ selectPreviewTabToolbarOption: (toolbarOption) => {
142
+ if (toolbarOption == 'Insert Horizontal Line' || toolbarOption == 'Code Editor' || toolbarOption == 'Increase Indent' || toolbarOption == 'Decrease Indent' || toolbarOption == 'Remove Format') {
143
+ essayResponsePage.previewTabToolbarOption(toolbarOption)
144
+ .click()
145
+ .should('have.attr', 'aria-pressed', 'false');
146
+ } else {
147
+ essayResponsePage.previewTabToolbarOption(toolbarOption)
148
+ .click()
149
+ .should('have.attr', 'aria-pressed', 'true');
150
+ }
151
+ },
152
+
153
+ deselectPreviewTabToolbarOption: (toolbarOption) => {
154
+ essayResponsePage.previewTabToolbarOption(toolbarOption)
155
+ .click()
156
+ .should('have.attr', 'aria-pressed', 'false');
157
+ },
158
+
159
+ selectColorFromPopup: (color) => {
160
+ essayResponsePage.previewTabColorPalettePopup()
161
+ .its('0.contentDocument.body').should('not.be.empty')
162
+ .within(() => {
163
+ cy.get('div[title="Colors"]')
164
+ .last()
165
+ .find(`[title="${color}"]`)
166
+ .last()
167
+ .click();
168
+ });
169
+ },
170
+
171
+ verifyUndoAndRedoFunctionality: (toolbarOption, orignalText, formattedText) => {
172
+ essayResponsePage.previewTabToolbarOption('Undo (Ctrl+Z)')
173
+ .click();
174
+ if (toolbarOption == 'Background Color' || toolbarOption == 'Text Color') {
175
+ essayResponsePage.previewTabToolbarOption(toolbarOption)
176
+ .should('have.attr', 'aria-expanded', 'false');
177
+ } else {
178
+ essayResponsePage.previewTabToolbarOption(toolbarOption)
179
+ .should('have.attr', 'aria-pressed', 'false');
180
+ };
181
+ essayResponsePage.responseField()
182
+ .verifyInnerHTML(orignalText);
183
+ essayResponsePage.previewTabToolbarOption('Redo (Ctrl+Y)')
184
+ .click();
185
+ if (toolbarOption == 'Background Color' || toolbarOption == 'Text Color') {
186
+ essayResponsePage.previewTabToolbarOption(toolbarOption)
187
+ .should('have.attr', 'aria-expanded', 'true');
188
+ } else if (toolbarOption == 'Insert Horizontal Line' || toolbarOption == 'Code Editor' || toolbarOption == 'Increase Indent' || toolbarOption == 'Decrease Indent' || toolbarOption == 'Remove Format') {
189
+ essayResponsePage.previewTabToolbarOption(toolbarOption)
190
+ .should('have.attr', 'aria-pressed', 'false');
191
+ } else {
192
+ essayResponsePage.previewTabToolbarOption(toolbarOption)
193
+ .should('have.attr', 'aria-pressed', 'true');
194
+ };
195
+ essayResponsePage.responseField()
196
+ .verifyInnerHTML(formattedText);
197
+ }
198
+ }
199
+
200
+ const tests = {
201
+ ...createQuestionBasePage.tests,
202
+ ...questionInstructionsComponent.tests,
203
+ ...additionalSettingsPanel.tests,
204
+ ...scoringSectionBase.tests,
205
+ ...previewScoringAndShowCorrectAnswerComponent.tests,
206
+ ...commonComponents.tests,
207
+ insertEquationAndVerifyInputFieldContentsAndWordCount: (expectedOutput, wordCount) => {
208
+ 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}`, () => {
209
+ equationEditorFlyout.buttonOk()
210
+ .click();
211
+ essayResponsePage.responseField()
212
+ .find('.cke_widget_element')
213
+ .should('have.text', `${expectedOutput}`);
214
+ essayResponsePage.steps.verifyResponseFieldWordCount(wordCount);
215
+ });
216
+ },
217
+
218
+ verifyUndoAndRedoFunctionalityForPreviewTabToolbarOption: (toolbarOption) => {
219
+ it(`When the user enters text in the response field, selects the text and selects the ${toolbarOption} toolbar option and clicks on the \'Undo\' toolbar option, then it should undo the latest action and when the user clicks on the \'Redo\' toolbar option, then it should redo the latest action`, () => {
220
+ essayResponsePage.steps.resetPreviewTabResponseField();
221
+ essayResponsePage.responseField()
222
+ .type('Lorem Ipsum');
223
+ if (toolbarOption == 'Decrease Indent') {
224
+ essayResponsePage.previewTabToolbarOption('Increase Indent')
225
+ .click();
226
+ } else if (toolbarOption == 'Remove Format') {
227
+ essayResponsePage.responseField()
228
+ .type('{selectAll}');
229
+ essayResponsePage.steps.selectPreviewTabToolbarOption('Bold (Ctrl+B)');
230
+ };
231
+ essayResponsePage.responseField()
232
+ .then(($originalText) => {
233
+ originalText = $originalText[0].innerHTML
234
+ essayResponsePage.responseField()
235
+ .type('{selectAll}');
236
+ if (toolbarOption == 'Background Color' || toolbarOption == 'Text Color') {
237
+ essayResponsePage.previewTabToolbarOption(toolbarOption)
238
+ .click();
239
+ essayResponsePage.steps.selectColorFromPopup('Strong Cyan');
240
+ } else {
241
+ essayResponsePage.steps.selectPreviewTabToolbarOption(toolbarOption);
242
+ };
243
+ essayResponsePage.responseField()
244
+ .then(($formattedText) => {
245
+ formattedText = $formattedText[0].innerHTML
246
+ essayResponsePage.steps.verifyUndoAndRedoFunctionality(toolbarOption, originalText, formattedText);
247
+ });
248
+ });
249
+ });
250
+ },
251
+
252
+ verifySpecialOrMathCharactersPopup: (popupType) => {
253
+ it(`${specialOrMathCharacters[popupType].popupTitle} option should be displayed in the preview tab toolbar`, () => {
254
+ essayResponsePage.previewTabToolbarOption(`${specialOrMathCharacters[popupType].popupTitle}`)
255
+ .should('be.visible');
256
+ });
257
+
258
+ it(`When user clicks on ${specialOrMathCharacters[popupType].popupTitle} option in the toolbar, then the ${specialOrMathCharacters[popupType].popupTitle} popup should appear`, () => {
259
+ essayResponsePage.previewTabToolbarOption(`${specialOrMathCharacters[popupType].popupTitle}`)
260
+ .click();
261
+ essayResponsePage.specialAndMathCharacterPopup()
262
+ .should('be.visible');
263
+ });
264
+
265
+ it(`When the ${specialOrMathCharacters[popupType].popupTitle} popup has appeared, the first symbol should be in focus`, () => {
266
+ essayResponsePage.specialAndMathCharacterPopupSymbolsWrapper()
267
+ .eq(0)
268
+ .should('have.css', 'background-color', css.color.focusedSpecialCharacterSymbol);
269
+ });
270
+
271
+ it(`CSS of ${specialOrMathCharacters[popupType].popupTitle} popup`, { tags: 'css' }, () => {
272
+ essayResponsePage.specialAndMathCharacterPopupTitle()
273
+ .verifyCSS(css.color.questionHeading, css.fontSize.heading, css.fontWeight.bold);
274
+ essayResponsePage.specialAndMathCharacterPopupSymbols()
275
+ .each(($element) => {
276
+ cy.wrap($element)
277
+ .find('.img_special_char')
278
+ .verifyPseudoClassBeforeProperty('color', css.color.specialCharacterSymbol);
279
+ });
280
+ });
281
+
282
+ it(`Accessibility of ${specialOrMathCharacters[popupType].popupTitle} popup`, { tags: 'a11y' }, () => {
283
+ cy.checkAccessibility(essayResponsePage.specialAndMathCharacterPopup());
284
+ });
285
+
286
+ it(`Title of the popup should be ${specialOrMathCharacters[popupType].popupTitle}`, () => { //TODO: Need to update this after DOM structure update.
287
+ essayResponsePage.specialAndMathCharacterPopupTitle()
288
+ .then(($title) => {
289
+ const fullTitle = $title.text()
290
+ const properTitle = fullTitle.replace('Close', '');
291
+ expect(specialOrMathCharacters[popupType].popupTitle).to.deep.eq(properTitle);
292
+ });
293
+ });
294
+
295
+ it(`All the ${specialOrMathCharacters[popupType].popupTitle} symbols should be displayed in the popup`, () => {
296
+ let symbolsArray = Object.values(specialOrMathCharacters[popupType].characters);
297
+ essayResponsePage.specialAndMathCharacterPopupSymbolsWrapper()
298
+ .each(($element, count) => {
299
+ cy.wrap($element)
300
+ .should('be.visible')
301
+ .find('.img_special_char span')
302
+ .verifyInnerText(symbolsArray[count].symbol);
303
+ });
304
+ essayResponsePage.specialAndMathCharacterPopupSymbols()
305
+ .each(($element, count) => {
306
+ cy.wrap($element)
307
+ .should('have.attr', 'Title', symbolsArray[count].title);
308
+ });
309
+ });
310
+
311
+ it('\'Close\' button should be displayed in the popup and when user clicks on it then the popup should close.', () => {
312
+ essayResponsePage.specialAndMathCharacterPopupCloseButton()
313
+ .should('be.visible')
314
+ .click();
315
+ essayResponsePage.specialAndMathCharacterPopup()
316
+ .should('not.be.visible');
317
+ });
318
+ },
319
+
320
+ addSpecialOrMathCharactersToResponseField: (popupType) => {
321
+ it(`When user clicks on a symbol in the ${specialOrMathCharacters[popupType].popupTitle} popup, then that symbol should be inserted in the response field`, () => {
322
+ cy.log('Clicking on all symbols.');
323
+ let symbolsString = specialOrMathCharacters[popupType].characters.map((icon) => icon.symbol);
324
+ symbolsString = symbolsString.join('');
325
+ symbolsString = symbolsString.concat('\n');
326
+ essayResponsePage.specialAndMathCharacterPopupSymbols()
327
+ .each(($element) => {
328
+ cy.wrap($element)
329
+ .click();
330
+ });
331
+ essayResponsePage.specialAndMathCharacterPopupCloseButton()
332
+ .click();
333
+ essayResponsePage.responseField()
334
+ .verifyInnerText(symbolsString);
335
+ });
336
+
337
+ it(`When the user selects the added ${specialOrMathCharacters[popupType].popupTitle} symbols and clicks on any formatting option, then the formatting should be applied to the displayed special characters`, () => {
338
+ let symbolsString = specialOrMathCharacters[popupType].characters.map((icon) => icon.symbol);
339
+ symbolsString = symbolsString.join('');
340
+ essayResponsePage.responseField()
341
+ .type('{selectAll}');
342
+ essayResponsePage.previewTabToolbarOption('Bold (Ctrl+B)')
343
+ .click();
344
+ essayResponsePage.responseField()
345
+ .verifyInnerHTML(`<p><strong>${symbolsString}</strong><br></p>`);
346
+ });
347
+
348
+ it(`When user adds ${specialOrMathCharacters[popupType].popupTitle} symbols to the response field, then the word count should increase accordingly`, () => {
349
+ essayResponsePage.responseFieldWordCount()
350
+ .verifyInnerText('1/10000');
351
+ cy.log('Adding a space and inserting more symbols in the response field.');
352
+ essayResponsePage.responseField()
353
+ .click()
354
+ .type(' ');
355
+ essayResponsePage.previewTabToolbarOption(`${specialOrMathCharacters[popupType].popupTitle}`)
356
+ .click();
357
+ essayResponsePage.specialAndMathCharacterPopupSymbols()
358
+ .eq(0)
359
+ .click();
360
+ essayResponsePage.specialAndMathCharacterPopupCloseButton()
361
+ .click();
362
+ essayResponsePage.responseFieldWordCount()
363
+ .verifyInnerText('2/10000');
364
+ });
365
+
366
+ it(`CSS of the added ${specialOrMathCharacters[popupType].popupTitle} symbols`, { tags: 'css' }, () => {
367
+ essayResponsePage.responseField()
368
+ .find('p')
369
+ .verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
370
+ });
371
+
372
+ it(`Accessibility of the added ${specialOrMathCharacters[popupType].popupTitle} symbols`, { tags: 'a11y' }, () => {
373
+ cy.checkAccessibility(essayResponsePage.responseField());
374
+ });
375
+ }
376
+ }
377
+
378
+ export const essayResponsePage = {
379
+ ...selectors,
380
+ ...tableDialogBox,
381
+ ...hyperlinkDialogBox,
382
+ ...specialAndMathCharacters,
383
+ steps,
384
+ tests
385
+ }