itemengine-cypress-automation 1.0.165-migrationScripts-e27d6f2.0 → 1.0.166

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/cypress/e2e/ILC/BrainingCampManipulative/additionalSettings.js +83 -0
  2. package/cypress/e2e/ILC/BrainingCampManipulative/editTabBasicSection.js +200 -0
  3. package/cypress/e2e/ILC/BrainingCampManipulative/editTabScoringSection.js +56 -0
  4. package/cypress/e2e/ILC/BrainingCampManipulative/gradingViewAndCorrectAnswerViewContents.smoke.js +95 -0
  5. package/cypress/e2e/ILC/BrainingCampManipulative/headerSection.js +71 -0
  6. package/cypress/e2e/ILC/BrainingCampManipulative/previewTabContent.smoke.js +72 -0
  7. package/cypress/e2e/ILC/BrainingCampManipulative/toolSettings.js +71 -0
  8. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/allOrNothingBasicForAllViews.smoke.js +2 -2
  9. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/clickAndDrop.js +22 -11
  10. package/cypress/e2e/ILC/EssayResponse/essayResponseAdditionalSettings.js +432 -0
  11. package/cypress/e2e/ILC/EssayResponse/essayResponseAdditionalSettingsBasic.js +134 -0
  12. package/cypress/e2e/ILC/FeedbackScaleNew/feedbackScaleStylePreviewTab.js +161 -0
  13. package/cypress/e2e/ILC/FeedbackScaleNew/numbersFeedbackScaleStyle.js +308 -0
  14. package/cypress/e2e/ILC/FeedbackScaleNew/previewContentsForAllViews.smoke.js +216 -0
  15. package/cypress/e2e/ILC/FeedbackScaleNew/starsHeartsFeedbackScaleStyle.js +336 -0
  16. package/cypress/e2e/ILC/FeedbackScaleNew/textFeedbackScaleStyle.js +570 -0
  17. package/cypress/e2e/ILC/FeedbackScaleNew/thumbsFeedbackScaleStyle.js +214 -0
  18. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropAdditionalSettings.js +356 -0
  19. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropAdditionalSettingsResponseAccordion.js +299 -0
  20. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/clickAndDrop.js +18 -7
  21. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/clickAndDrop.js +11 -6
  22. package/cypress/e2e/ILC/Graphing/Scoring/allOrNothingWithCorrectPointsEqualToAlternatePoints.js +355 -0
  23. package/cypress/e2e/ILC/Graphing/previewContentsForAllViews.smoke.js +0 -1
  24. package/cypress/e2e/ILC/Graphing/toolsControlsAndBackgroundSection.js +2 -36
  25. package/cypress/e2e/ILC/GridFill/allOrNothingBasicForAllViews.smoke.js +22 -34
  26. package/cypress/e2e/ILC/GridFill/checkAnswerFunctionalityForAllViews.smoke.js +8 -24
  27. package/cypress/e2e/ILC/GridFill/previewContentsForAllViews.smoke.js +5 -25
  28. package/cypress/e2e/ILC/GridFill/scoring/allOrNothingAlternativePointsGreaterThanCorrectPoints.js +68 -114
  29. package/cypress/e2e/ILC/GridFill/scoring/allOrNothingCorrectPointsEqualToAlternativePoints.js +67 -111
  30. package/cypress/e2e/ILC/GridFill/scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +71 -123
  31. package/cypress/e2e/ILC/GridFill/scoring/allOrNothingScoringCellShadeCount.js +41 -63
  32. package/cypress/e2e/ILC/GridFill/scoring/manuallyAndNonScored.js +21 -25
  33. package/cypress/e2e/ILC/GridFill/scoring/partialEqualWeightsBasic.js +50 -85
  34. package/cypress/e2e/ILC/GridFill/scoring/partialEqualWeightsWithAlternativePointsGreaterThanCorrectPoints.js +68 -115
  35. package/cypress/e2e/ILC/GridFill/scoring/partialEqualWeightsWithCorrectPointsEqualToAlternativePoints.js +54 -98
  36. package/cypress/e2e/ILC/GridFill/scoring/partialEqualWeightsWithCorrectPointsGreaterThanAlternativePoints.js +72 -120
  37. package/cypress/e2e/ILC/GridFill/studentViewSettingsSection.js +3 -3
  38. package/cypress/e2e/ILC/Matching/maximumCapacityPerDropzoneSection.js +309 -0
  39. package/cypress/e2e/ILC/Matching/specifyCorrectAnswerSection.js +1 -1
  40. package/cypress/e2e/ILC/Matching/toolSettings.js +72 -0
  41. package/cypress/e2e/ILC/MultipleSelectionGridNew/editTabBasicSection.js +1033 -0
  42. package/cypress/e2e/ILC/MultipleSelectionGridNew/test.js +28 -0
  43. package/cypress/e2e/ILC/NumberLine/Scoring/allOrNothingWithAlternatePointsGreaterThanCorrectPoints.js +236 -0
  44. package/cypress/e2e/ILC/NumberLine/Scoring/allOrNothingWithCorrectPointsEqualToAlternatePoints.js +239 -0
  45. package/cypress/e2e/ILC/NumberLine/Scoring/allOrNothingWithCorrectPointsGreaterThanAlternativePoints.js +278 -0
  46. package/cypress/e2e/ILC/NumberLine/Scoring/manualAndNonScoredScoring.js +178 -0
  47. package/cypress/e2e/ILC/NumberLine/Scoring/partialEqualWeightsBasic.js +407 -0
  48. package/cypress/e2e/ILC/NumberLine/Scoring/partialEqualWeightsWithAlternatePointsGreaterThanCorrectPoints.js +273 -0
  49. package/cypress/e2e/ILC/NumberLine/Scoring/partialEqualWeightsWithCorrectPointsGreaterThanAlternatePoints.js +278 -0
  50. package/cypress/e2e/ILC/NumberLine/Scoring/partialEqualWeigtsWithCorrectPointsEqualToAlternatePoints.js +228 -0
  51. package/cypress/e2e/ILC/NumberLine/additionalSettings.js +120 -0
  52. package/cypress/e2e/ILC/NumberLine/allOrNothingScoringForAllViews.smoke.js +659 -0
  53. package/cypress/e2e/ILC/NumberLine/checkAnswerFunctionalityForAllViews.smoke.js +149 -0
  54. package/cypress/e2e/ILC/NumberLine/editTabScoringSection.js +151 -0
  55. package/cypress/e2e/ILC/NumberLine/gradingViewAndCorrectAnswerView.smoke.js +171 -0
  56. package/cypress/e2e/ILC/NumberLine/headerSection.js +76 -0
  57. package/cypress/e2e/ILC/NumberLine/minimumScoringPenaltyPointsAndRoundingDropdown.js +54 -0
  58. package/cypress/e2e/ILC/NumberLine/previewTabContentsForAllViews.smoke.js +200 -0
  59. package/cypress/e2e/ILC/NumberLine/specifyCorrectAnswerSection.js +67 -0
  60. package/cypress/e2e/ILC/NumberLine/studentViewSettings.js +135 -0
  61. package/cypress/e2e/ILC/NumberLine/toolSettings.js +73 -0
  62. package/cypress/e2e/ILC/NumberLine/toolsAndControls.js +372 -0
  63. package/cypress/e2e/ILC/SingleSelectionGridNew/editTabBasicSection.js +1014 -0
  64. package/cypress/e2e/ILC/TextSelection/Scoring/allOrNothingAlternatePointsMoreThanCorrectPoints.js +235 -0
  65. package/cypress/e2e/ILC/TextSelection/Scoring/allOrNothingCorrectPointsEqualToAlternatePoints.js +235 -0
  66. package/cypress/e2e/ILC/TextSelection/Scoring/allOrNothingCorrectPointsMoreThanAlternatePoints.js +235 -0
  67. package/cypress/e2e/ILC/TextSelection/Scoring/partialDifferentWeightsBasic.js +457 -0
  68. package/cypress/e2e/ILC/TextSelection/Scoring/partialDifferentWeightsWithAlternativePointsGreaterThanCorrectPoints.js +342 -0
  69. package/cypress/e2e/ILC/TextSelection/Scoring/partialDifferentWeightsWithCorrectPointsEqualToAlternativePoints.js +342 -0
  70. package/cypress/e2e/ILC/TextSelection/Scoring/partialDifferentWeightsWithCorrectPointsGreaterThanAlternativePoints.js +342 -0
  71. package/cypress/e2e/ILC/TextSelection/Scoring/partialEqualWeightsBasic.js +155 -0
  72. package/cypress/e2e/ILC/TextSelection/Scoring/partialEqualWeightsWithAlternativePointsGreaterThanCorrectPoints.js +314 -0
  73. package/cypress/e2e/ILC/TextSelection/Scoring/partialEqualWeightsWithCorrectPointsEqualToAlternativePoints.js +275 -0
  74. package/cypress/e2e/ILC/TextSelection/Scoring/partialEqualWeightsWithCorrectPointsGreaterThanAlternativePoints.js +314 -0
  75. package/cypress/e2e/ILC/TextSelection/allOrNothingScoringForAllViews.smoke.js +290 -0
  76. package/cypress/e2e/ILC/TextSelection/checkAnswerFunctionalityForAllViews.smoke.js +142 -0
  77. package/cypress/e2e/ILC/TextSelection/previewContentsForAllViews.js +137 -0
  78. package/cypress/e2e/ILC/ToolSettings/toolSettingsContent.js +4 -4
  79. package/cypress/fixtures/theme/ilc.json +14 -26
  80. package/cypress/pages/brainingCampManipulativePage.js +122 -0
  81. package/cypress/pages/components/autoScoredScoringSectionMultiResponseType.js +1 -1
  82. package/cypress/pages/components/autoScoredSpecifyCorrectAnswerSection.js +3 -0
  83. package/cypress/pages/components/autoScoredStudentViewSettings.js +1 -1
  84. package/cypress/pages/components/colorPopupComponent.js +2 -2
  85. package/cypress/pages/components/defaultToolDropdown.js +77 -0
  86. package/cypress/pages/components/gridQuestionCommonComponent.js +629 -2
  87. package/cypress/pages/components/index.js +3 -0
  88. package/cypress/pages/components/maximumCapacityPerDropzoneComponent.js +1 -1
  89. package/cypress/pages/components/measuringToolComponent.js +2 -2
  90. package/cypress/pages/components/resetPopupComponent.js +74 -0
  91. package/cypress/pages/components/scoringSectionBaseEditTab.js +1 -1
  92. package/cypress/pages/components/setPointsPopupBase.js +6 -4
  93. package/cypress/pages/components/specifyRowsAndColumnsComponent.js +60 -3
  94. package/cypress/pages/components/toolSettingsComponent.js +80 -12
  95. package/cypress/pages/components/toolsAndControlsComponent.js +69 -0
  96. package/cypress/pages/dragAndDropIntoCategoriesPage.js +0 -8
  97. package/cypress/pages/feedbackScalePage copy.js +716 -0
  98. package/cypress/pages/feedbackScalePage.js +591 -449
  99. package/cypress/pages/fillInTheGapsOverImageDragAndDropPage.js +3 -1
  100. package/cypress/pages/graphingPage.js +9 -145
  101. package/cypress/pages/gridFillPage.js +135 -120
  102. package/cypress/pages/highlightPage.js +0 -394
  103. package/cypress/pages/index.js +5 -2
  104. package/cypress/pages/matchingPage.js +78 -20
  105. package/cypress/pages/multipleSelectionGridPage.js +88 -1
  106. package/cypress/pages/numberLinePage.js +723 -0
  107. package/cypress/pages/singleSelectionGridPage.js +86 -0
  108. package/cypress/pages/textSelectionPage.js +582 -0
  109. package/package.json +2 -2
@@ -0,0 +1,716 @@
1
+ import { additionalSettingsPanel, commonComponents, createQuestionBasePage, questionInstructionsComponent, autoScoredScoringPreviewTab } from "./components"
2
+ import utilities from "../support/helpers/utilities";
3
+ const css = Cypress.env('css');
4
+
5
+ const selectors = {
6
+ ...questionInstructionsComponent,
7
+ ...commonComponents,
8
+ specifyFeedbackScaleOptionsLabel: () => cy.get('[class*="FeedbackScalestyles__SpecifyFeedbackLabel"]'),
9
+ feedbackScaleStyleDropdownLabel: () => cy.get('#feedback-scale-style-dropdown-label'),
10
+ feedbackScaleStyleDropdown: () => cy.get('#feedback-scale-style-select'),
11
+ feedbackScaleStyleDropdownListOptions: (ariaLabel = null) => {
12
+ if (ariaLabel) {
13
+ return cy.get(`[aria-labelledby*="feedback-scale-style-dropdown-label"] [role="option"][aria-label*="${ariaLabel}"]`)
14
+ } else {
15
+ return cy.get('[aria-labelledby*="feedback-scale-style-dropdown-label"] [role="option"]')
16
+ }
17
+ },
18
+ optionsLabel: () => cy.get('.input-stepper-label'),
19
+ optionsStepperInputField: () => cy.get('.input-stepper-textfield'),
20
+ optionsStepperDecreaseButton: () => cy.get('.input-stepper-button[aria-label="Decrease count"]'),
21
+ optionsStepperIncreaseButton: () => cy.get('.input-stepper-button[aria-label="Increase count"]'),
22
+ defaultTextDropdownLabel: () => cy.get('#Default-text-dropdown-label'),
23
+ defaultTextDropdown: () => cy.get('#Default-text-select'),
24
+ defaultTextDropdownListOptions: (ariaLabel = null) => {
25
+ if (ariaLabel) {
26
+ return cy.get(`[aria-labelledby*="Default-text-dropdown-label"] [role="option"][aria-label*="${ariaLabel}"]`)
27
+ } else {
28
+ return cy.get('[aria-labelledby*="Default-text-dropdown-label"] [role="option"]')
29
+ }
30
+ },
31
+ colorSectionLabel: () => cy.get('[class*="FeedbackScalestyles__ColorLabelWrapper"]'),
32
+ defaultColorSchemeRadioButton: () => cy.get('[type="radio"][aria-label="Default color scheme"]'),
33
+ defaultColorSchemeRadioButtonLabel: () => cy.get('label[aria-label="Default color scheme"]'),
34
+ customColorsRadioButton: () => cy.get('[type="radio"][aria-label="Custom colors"]'),
35
+ customColorsRadioButtonLabel: () => cy.get('label[aria-label="Custom colors"]'),
36
+ colorLabel: () => cy.get('[class*="FeedbackScalestyles__RightHeader"]'),
37
+ optionLabel: () => cy.get('[class*="FeedbackScalestyles__LeftHeader"]'),
38
+ colorItemLabel: () => cy.get('.feedback-left-wrapper'),
39
+ colorSectionListItem: () => cy.get('.feedback-color-row'),
40
+ feedbackButton: () => cy.get('.feedback-scale-label-btn'),
41
+ feedbackButtonLabelText: () => cy.get('[class*="FeedbackScalestyles__LabelText"]'),
42
+ feedbackButtonNumberText: () => cy.get('[class*="FeedbackScalestyles__NumberBox"]'),
43
+ optionAccordion: () => cy.get('.feedback-scale-panel .ngie-accordion-summary'),
44
+ optionAccordionWrapper: () => cy.get('.feedback-scale-panel'),
45
+ optionAccordionLabel: () => cy.get('.feedback-scale-panel-label'),
46
+ optionAccordionPointsLabel: () => cy.get('.feedback-scale-points'),
47
+ deleteOptionAccordionButton: () => cy.get('[aria-label*="Delete Option"]'),
48
+ legendTextLabel: () => cy.get('.legend-wrapper [class*="LabelWrapper"]'),
49
+ legendTextInputField: () => cy.get('.legend-wrapper input'),
50
+ optionsTextLabel: () => cy.get('[class*="FeedbackScaleOptionWrapper"] [class*="LabelWrapper"]'),
51
+ optionTextInputField: () => cy.get('input[aria-label="Option text"]'),
52
+ addOptionButton: () => cy.get('.feedback-scale-add-option button'),
53
+ colorPickerBlock: () => cy.get('.color-picker-block'),
54
+ feedbackButtonColorBlock: () => cy.get('[class*="FeedbackScalestyles__ColorBlock"]'),
55
+ legendTextOptionsList: () => cy.get('.more-info-wrapper .options-list-item'),
56
+ legendAccordion: () => cy.get('.more-info-wrapper .ngie-accordion-summary'),
57
+ legendTextFeedbackButtonLabel: () => cy.get('[class*="MoreInfostyles__OptionText"]'),
58
+ legendTextColorBlock: () => cy.get('[class*="ColorDiv"]'),
59
+ legendTextPreviewTab: () => cy.get('[class*="MoreInfostyles__LegendText"]'),
60
+ legendTextNumberBlock: () => cy.get('[class*="MoreInfostyles__NumberBox"]'),
61
+ legendTextStarIcon: () => cy.get('[class*="MoreInfostyles__StarWrapper"] svg'),
62
+ legendTextHeartIcon: () => cy.get('[class*="MoreInfostyles__StarWrapper"] svg'),
63
+ editColorButton: () => cy.get('.icon-pencil'),
64
+ thumbsUpFeedbackButton: () => cy.get('[role="button"][aria-label="Thumbs-Up"]'),
65
+ thumbsDownFeedbackButton: () => cy.get('[role="button"][aria-label="Thumbs-Down"]'),
66
+ thumbsUpButtonIcon: () => cy.get('[data-name="Thumbs up button"]'),
67
+ thumbsDownButtonIcon: () => cy.get('[data-name="Thumbs down button"]'),
68
+ feedbackScaleUILabel: () => cy.get('.feedback-scale-ui .options-label'),
69
+ starsFeedbackScaleUIButton: () => cy.get('[data-ngie-testid="stars-toggle-button"]'),
70
+ heartsFeedbackScaleUIButton: () => cy.get('[data-ngie-testid="hearts-toggle-button"]'),
71
+ feedbackStarButton: () => cy.get('.feedback-scale-label-star-btn'),
72
+ feedbackHeartButton: () => cy.get('.feedback-scale-label-star-btn'),
73
+ }
74
+
75
+ const steps = {
76
+ ...createQuestionBasePage.steps,
77
+ ...questionInstructionsComponent.steps,
78
+ ...commonComponents.steps,
79
+ ...additionalSettingsPanel.steps,
80
+ ...questionInstructionsComponent.steps,
81
+ ...autoScoredScoringPreviewTab.steps,
82
+ /**
83
+ * Adds legend text to a specific option in the Legend Text accordion.
84
+ * @param {number} optionIndex - The index of the option in the Legend Text accordion.
85
+ * @param {string} text - The legend text to be added.
86
+ */
87
+ addLegendText: (optionIndex, text) => {
88
+ utilities.getNthElement(feedbackScalePage.legendTextInputField(), optionIndex)
89
+ .type(text)
90
+ .blur();
91
+ },
92
+
93
+ clearLegendTextInputField: (optionIndex) => {
94
+ utilities.getNthElement(feedbackScalePage.legendTextInputField(), optionIndex)
95
+ .clear();
96
+ },
97
+
98
+ /**
99
+ * @param {number} buttonIndex index of the feedback button
100
+ * @param {string} buttonText text content of the feedback button
101
+ * @description this function verifies the visibility and text content of a feedback button in the preview tab
102
+ */
103
+ verifyFeedbackButtonInPreviewTab: (buttonIndex, buttonText) => {
104
+ utilities.verifyInnerText(utilities.getNthElement(feedbackScalePage.feedbackButton(), buttonIndex), buttonText);
105
+ utilities.verifyElementVisibilityState(utilities.getNthElement(feedbackScalePage.feedbackButton(), buttonIndex), 'visible');
106
+ },
107
+
108
+ /**
109
+ * Verifies the color block of a feedback button in the preview tab.
110
+ * @param {number} buttonIndex - The index of the feedback button.
111
+ * @param {string} colorBlock - The expected background color of the color block.
112
+ */
113
+ verifyFeedbackButtonColorBlockPreviewTab: (buttonIndex, colorBlock) => {
114
+ utilities.getNthElement(feedbackScalePage.feedbackButtonColorBlock(), buttonIndex)
115
+ .should('have.css', 'background-color', colorBlock);
116
+ },
117
+
118
+ /**
119
+ * @param {number} optionAccordionIndex index of the option accordion
120
+ * @description this function expands an option accordion
121
+ */
122
+ expandOptionAccordion: (optionAccordionIndex) => {
123
+ utilities.getNthElement(feedbackScalePage.optionAccordion(), optionAccordionIndex)
124
+ .click()
125
+ .should('have.attr', 'aria-expanded', 'true');
126
+ },
127
+
128
+ verifyLegendTextAccordionExpandedState: () => {
129
+ feedbackScalePage.legendAccordion()
130
+ .should('have.attr', 'aria-expanded', 'true');
131
+ },
132
+
133
+ verifyLegendTextAccordionCollapsedState: () => {
134
+ feedbackScalePage.legendAccordion()
135
+ .should('have.attr', 'aria-expanded', 'false');
136
+ },
137
+
138
+ /**
139
+ * @param {number} buttonIndex index of the feedback button
140
+ * @description this function is used to click on a feedback button
141
+ */
142
+ clickOnFeedbackButton: (buttonIndex) => {
143
+ utilities.getNthElement(feedbackScalePage.feedbackButton(), buttonIndex)
144
+ .click();
145
+ },
146
+
147
+ /**
148
+ * @param {number} buttonIndex index of the feedback button
149
+ * @description this function verifies the selected state of a feedback button
150
+ */
151
+ verifyFeedbackButtonSelectedState: (buttonIndex) => {
152
+ utilities.getNthElement(feedbackScalePage.feedbackButton(), buttonIndex)
153
+ .should('have.class', 'selected-button');
154
+ },
155
+
156
+ /**
157
+ * @param {number} buttonIndex index of the feedback button
158
+ * @description this function verifies the unselected state of a feedback button
159
+ */
160
+ verifyFeedbackButtonUnselectedState: (buttonIndex) => {
161
+ utilities.getNthElement(feedbackScalePage.feedbackButton(), buttonIndex)
162
+ .should('not.have.class', 'selected-button');
163
+ },
164
+
165
+ /**
166
+ * Verifies the disabled state of a feedback button.
167
+ * @param {number} buttonIndex - The index of the feedback button.
168
+ */
169
+ verifyFeedbackButtonDisabledState: (buttonIndex) => {
170
+ utilities.verifyElementDisabledClass(utilities.getNthElement(feedbackScalePage.feedbackButton(), buttonIndex));
171
+ },
172
+
173
+ /**
174
+ * Verifies the color block, feedback button label, and legend text in the Legend Text accordion.
175
+ * @param {number} itemIndex - The index of the item in the Legend Text accordion.
176
+ * @param {Object} options - An object containing properties for colorBlock, buttonText, and legendText.
177
+ * @param {string} options.colorBlock - The expected background color of the color block.
178
+ * @param {string} options.buttonText - The expected text of the feedback button label.
179
+ * @param {string} options.legendText - The expected text of the legend text.
180
+ */
181
+ verifyColorBlockFeedbackButtonLabelLegendTextInLegendTextAccordion: (itemIndex, { colorBlock, buttonText, legendText }) => {
182
+ utilities.getNthElement(feedbackScalePage.legendTextOptionsList(), itemIndex)
183
+ .within(() => {
184
+ feedbackScalePage.legendTextColorBlock()
185
+ .should('have.css', 'background-color', colorBlock);
186
+ utilities.verifyInnerText(feedbackScalePage.legendTextFeedbackButtonLabel(), `${buttonText}:`);
187
+ utilities.verifyInnerText(feedbackScalePage.legendTextPreviewTab(), legendText);
188
+ });
189
+ },
190
+
191
+ expandFeedbackScaleStyleDropdown: () => {
192
+ feedbackScalePage.feedbackScaleStyleDropdown()
193
+ .click();
194
+ },
195
+
196
+ /**
197
+ * @param {("Text" | "Numbers" | "Thumbs"| "Stars / Hearts")} dropdownOption aria-label of dropdown options
198
+ * @description this function selects dropdown option from feedback scale style dropdown
199
+ */
200
+ selectOptionFromFeedbackScaleStyleDropdown: (dropdownOption) => {
201
+ feedbackScalePage.feedbackScaleStyleDropdownListOptions(dropdownOption)
202
+ .click();
203
+ },
204
+
205
+ expandDefaultTextDropdown: () => {
206
+ feedbackScalePage.defaultTextDropdown()
207
+ .click();
208
+ },
209
+
210
+ /**
211
+ * Selects an option from the default text dropdown list.
212
+ * @param {string} dropdownOption - The option to be selected from the dropdown list.
213
+ * @example - selectOptionFromDefaultTextDropdown('Uncomfortable / Need some support / Comfortable');
214
+ */
215
+ selectOptionFromDefaultTextDropdown: (dropdownOption) => {
216
+ feedbackScalePage.defaultTextDropdownListOptions(dropdownOption)
217
+ .click();
218
+ },
219
+
220
+ /**
221
+ * Verifies the count displayed in the options stepper input field.
222
+ * @param {number} value - The expected value to be displayed in the input field.
223
+ */
224
+ verifyCountInOptionsStepperInputField: (value) => {
225
+ utilities.verifyInputFieldValue(feedbackScalePage.optionsStepperInputField(), value)
226
+ },
227
+
228
+ /**
229
+ * @description Decrease option input stepper count
230
+ * @param {number} increaseValue The value by which the option input stepper count is to be decreased
231
+ */
232
+ decreaseOptionsInputStepperCount: (increaseValue) => {
233
+ for (let index = 0; index < increaseValue; index++) {
234
+ feedbackScalePage.optionsStepperDecreaseButton()
235
+ .click();
236
+ };
237
+ },
238
+
239
+ /**
240
+ * @description Increase option input stepper count
241
+ * @param {number} increaseValue The value by which the option input stepper count is to be increased
242
+ */
243
+ increaseOptionsInputStepperCount: (increaseValue) => {
244
+ for (let index = 0; index < increaseValue; index++) {
245
+ feedbackScalePage.optionsStepperIncreaseButton()
246
+ .click();
247
+ };
248
+ },
249
+
250
+ addInputToOptionStepperInputField: (value) => {
251
+ feedbackScalePage.optionsStepperInputField()
252
+ .clear()
253
+ .type(value)
254
+ .blur();
255
+ },
256
+
257
+ /**
258
+ * Verifies the properties of an options accordion.
259
+ * @param {number} optionAccordionIndex - The index of the options accordion.
260
+ * @param {Object} properties - An object containing properties for the options accordion.
261
+ * @param {string} properties.optionLabel - The expected label of the options accordion.
262
+ * @param {number} properties.Points - The expected points associated with the options accordion.
263
+ */
264
+ verifyOptionsAccordionProperties: (optionAccordionIndex, { optionLabel, Points }) => {
265
+ utilities.getNthElement(feedbackScalePage.optionAccordion(), optionAccordionIndex)
266
+ .within(() => {
267
+ utilities.verifyInnerText(feedbackScalePage.optionAccordionLabel(), optionLabel);
268
+ utilities.verifyInnerText(feedbackScalePage.optionAccordionPointsLabel(), `Points:\n${Points}`);
269
+ utilities.verifyElementVisibilityState(feedbackScalePage.deleteOptionAccordionButton(), 'visible');
270
+ });
271
+ },
272
+
273
+ /**
274
+ * Verifies the collapsed state of an options accordion.
275
+ * @param {number} optionAccordionIndex - The index of the options accordion.
276
+ */
277
+ verifyOptionAccordionCollapsedState: (optionAccordionIndex) => {
278
+ utilities.getNthElement(feedbackScalePage.optionAccordion(), optionAccordionIndex)
279
+ .should('have.attr', 'aria-expanded', 'false');
280
+ },
281
+
282
+ /**
283
+ * Verifies the expanded state of an options accordion.
284
+ * @param {number} optionAccordionIndex - The index of the options accordion.
285
+ */
286
+ verifyOptionAccordionExpandedState: (optionAccordionIndex) => {
287
+ utilities.getNthElement(feedbackScalePage.optionAccordion(), optionAccordionIndex)
288
+ .should('have.attr', 'aria-expanded', 'true');
289
+ },
290
+
291
+ /**
292
+ * Verifies the placeholder of the legend text input field in an options accordion.
293
+ * @param {number} optionAccordionIndex - The index of the options accordion.
294
+ */
295
+ verifyLegendTextInputFieldPlaceholder: (optionAccordionIndex) => {
296
+ utilities.getNthElement(feedbackScalePage.legendTextInputField(), optionAccordionIndex)
297
+ .should('have.attr', 'placeholder', 'Enter legend text');
298
+ },
299
+
300
+ /**
301
+ * Verifies that the placeholder of the legend text input field in an options accordion does not exist.
302
+ * @param {number} optionAccordionIndex - The index of the options accordion.
303
+ */
304
+ verifyLegendTextInputFieldPlaceholderNotExists: (optionAccordionIndex) => {
305
+ utilities.getNthElement(feedbackScalePage.legendTextInputField(), optionAccordionIndex)
306
+ .should('not.have.attr', 'placeholder');
307
+ },
308
+
309
+ /**
310
+ * Verifies the count of options accordions.
311
+ * @param {number} count - The expected count of options accordions.
312
+ */
313
+ verifyOptionsAccordionCount: (count) => {
314
+ utilities.verifyElementCount(feedbackScalePage.optionAccordion(), count);
315
+ },
316
+
317
+ addOption: () => {
318
+ feedbackScalePage.addOptionButton()
319
+ .click();
320
+ },
321
+
322
+ /**
323
+ * @param {number} optionAccordionIndex index of the option accordion
324
+ * @description this function is used to delete an option accordion
325
+ */
326
+ deleteOptionAccordion: (optionAccordionIndex) => {
327
+ utilities.getNthElement(feedbackScalePage.deleteOptionAccordionButton(), optionAccordionIndex)
328
+ .click();
329
+ },
330
+
331
+ /**
332
+ * Verifies the color of a color picker block.
333
+ *
334
+ * @param {number} blockIndex - The index of the color picker block.
335
+ * @param {string} color - The expected background color of the color picker block.
336
+ */
337
+ verifyColorPickerBlockColor: (blockIndex, color) => {
338
+ utilities.verifyCSS(utilities.getNthElement(feedbackScalePage.colorPickerBlock(), blockIndex), {
339
+ 'background-color': color
340
+ });
341
+ },
342
+
343
+ /**
344
+ * Verifies the number block, feedback button label, and legend text in the Legend Text accordion.
345
+ *
346
+ * @param {number} buttonIndex - The index of the button in the Legend Text accordion.
347
+ * @param {string} legendText - The expected text of the legend text.
348
+ */
349
+ verifyNumberBlockFeedbackButtonLabelLegendTextInLegendTextAccordion: (buttonIndex, legendText) => {
350
+ utilities.getNthElement(feedbackScalePage.legendTextOptionsList(), buttonIndex)
351
+ .within(() => {
352
+ utilities.verifyInnerText(feedbackScalePage.legendTextNumberBlock(), `${buttonIndex + 1}`);
353
+ utilities.verifyInnerText(feedbackScalePage.legendTextPreviewTab(), legendText);
354
+ });
355
+ },
356
+
357
+ /**
358
+ * Clicks on the edit color button.
359
+ * @param {number} buttonIndex - The index of the edit color button.
360
+ */
361
+ editColor: (buttonIndex) => {
362
+ utilities.getNthElement(feedbackScalePage.editColorButton(), buttonIndex)
363
+ .click();
364
+ },
365
+
366
+ /**
367
+ * Verifies the selected state color of a feedback button.
368
+ * @param {number} buttonIndex - The index of the feedback button.
369
+ * @param {string} colorBlock - The expected background color of the feedback button.
370
+ */
371
+ verifyFeedbackButtonSelectedStateColor: (buttonIndex, colorBlock) => {
372
+ utilities.getNthElement(feedbackScalePage.feedbackButton(), buttonIndex)
373
+ .should('have.css', 'background-color', colorBlock);
374
+ },
375
+
376
+ /**
377
+ * Verifies the number blocks in the Legend Text accordion.
378
+ * @param {number} itemIndex - The index of the item in the Legend Text accordion.
379
+ */
380
+ verifyNumberBlocksInLegendTextAccordion: (itemIndex) => {
381
+ utilities.getNthElement(feedbackScalePage.legendTextOptionsList(), itemIndex)
382
+ .within(() => {
383
+ utilities.verifyInnerText(feedbackScalePage.legendTextNumberBlock(), `${itemIndex + 1}`);
384
+ });
385
+ },
386
+
387
+ /**
388
+ * Verifies the text label of an option in the feedback scale options accordion.
389
+ * @param {number} optionAccordionIndex - The index of the option accordion.
390
+ * @returns {void}
391
+ */
392
+ verifyOptionsTextLabel: (optionAccordionIndex) => {
393
+ utilities.getNthElement(feedbackScalePage.optionAccordionWrapper(), optionAccordionIndex)
394
+ .within(() => {
395
+ utilities.verifyInnerText(utilities.getNthElement(feedbackScalePage.optionsTextLabel(), 0), 'Option text');
396
+ });
397
+ },
398
+
399
+ /**
400
+ * Verifies the text label of the legend in the feedback scale options accordion.
401
+ * @param {number} optionAccordionIndex - The index of the option accordion.
402
+ * @returns {void}
403
+ */
404
+ verifyLegendTextLabel: (optionAccordionIndex) => {
405
+ utilities.getNthElement(feedbackScalePage.optionAccordionWrapper(), optionAccordionIndex)
406
+ .within(() => {
407
+ utilities.verifyInnerText(feedbackScalePage.legendTextLabel(), 'Legend text');
408
+ });
409
+ },
410
+
411
+ /**
412
+ * Verifies the input field text value of an option in the feedback scale options accordion.
413
+ * @param {number} optionAccordionIndex - The index of the option accordion.
414
+ * @param {string} text - The expected text value of the input field.
415
+ * @returns {void}
416
+ */
417
+ verifyOptionInputFieldText: (optionAccordionIndex, text) => {
418
+ utilities.getNthElement(feedbackScalePage.optionAccordionWrapper(), optionAccordionIndex)
419
+ .within(() => {
420
+ utilities.verifyInputFieldValue(feedbackScalePage.optionTextInputField(), text)
421
+ });
422
+ },
423
+
424
+ /**
425
+ * Verifies the properties of an options accordion for thumbs feedback scale style.
426
+ * @param {number} optionAccordionIndex - The index of the options accordion.
427
+ * @param {Object} properties - An object containing properties for the options accordion.
428
+ * @param {string} properties.optionLabel - The expected label of the options accordion.
429
+ * @param {number} properties.Points - The expected points associated with the options accordion.
430
+ */
431
+ verifyOptionsAccordionPropertiesForThumbsScale: (optionAccordionIndex, { optionLabel, Points }) => {
432
+ utilities.getNthElement(feedbackScalePage.optionAccordion(), optionAccordionIndex)
433
+ .within(() => {
434
+ utilities.verifyInnerText(feedbackScalePage.optionAccordionLabel(), optionLabel);
435
+ utilities.verifyInnerText(feedbackScalePage.optionAccordionPointsLabel(), `Points:\n${Points}`);
436
+ utilities.verifyElementVisibilityState(feedbackScalePage.deleteOptionAccordionButton(), 'notExist');
437
+ });
438
+ },
439
+
440
+ /**
441
+ * Verifies the thumbs down button in the legend text accordion.
442
+ * @param {string} buttonText - The expected text of the thumbs down button.
443
+ * @returns {void}
444
+ */
445
+ verifyThumbsDownButtonInLegendTextAccordion: (buttonText) => {
446
+ utilities.getNthElement(feedbackScalePage.legendTextOptionsList(), 0)
447
+ .within(() => {
448
+ utilities.verifyElementVisibilityState(feedbackScalePage.thumbsDownButtonIcon(), 'visible')
449
+ utilities.verifyInnerText(feedbackScalePage.legendTextFeedbackButtonLabel(), buttonText);
450
+ });
451
+ },
452
+
453
+ /**
454
+ * Verifies the thumbs up button in the legend text accordion.
455
+ * @param {string} buttonText - The expected text of the thumbs up button.
456
+ * @returns {void}
457
+ */
458
+ verifyThumbsUpButtonInLegendTextAccordion: (buttonText) => {
459
+ utilities.getNthElement(feedbackScalePage.legendTextOptionsList(), 1)
460
+ .within(() => {
461
+ utilities.verifyElementVisibilityState(feedbackScalePage.thumbsUpButtonIcon(), 'visible')
462
+ utilities.verifyInnerText(feedbackScalePage.legendTextFeedbackButtonLabel(), buttonText);
463
+ });
464
+ },
465
+
466
+ /**
467
+ * Verifies the legend text in the legend text accordion.
468
+ * @param {number} buttonIndex - The index of the legend text accordion.
469
+ * @param {string} legendText - The expected text of the legend text.
470
+ * @returns {void}
471
+ */
472
+ verifyLegendTextInLegendTextAccordion: (buttonIndex, legendText) => {
473
+ utilities.getNthElement(feedbackScalePage.legendTextOptionsList(), buttonIndex)
474
+ .within(() => {
475
+ utilities.verifyInnerText(feedbackScalePage.legendTextPreviewTab(), legendText);
476
+ });
477
+ },
478
+
479
+ clickOnThumbsUpButton: () => {
480
+ feedbackScalePage.thumbsUpFeedbackButton()
481
+ .click();
482
+ },
483
+
484
+ verifyThumbsUpButtonSelectedState: () => {
485
+ feedbackScalePage.thumbsUpFeedbackButton()
486
+ .should('have.attr', 'aria-pressed', 'true');
487
+ },
488
+
489
+ /**
490
+ * Verifies the selected state color of the thumbs up button.
491
+ * @param {string} color - The expected color of the selected state of the thumbs up button.
492
+ * @returns {void}
493
+ */
494
+ verifyThumbsUpButtonSelectedStateColor: (color) => {
495
+ feedbackScalePage.thumbsUpFeedbackButton().find('circle').eq(1)
496
+ .should('have.css', 'fill', color);
497
+ },
498
+
499
+ verifyStarsFeedbackScaleUIButtonSelectedState: () => {
500
+ feedbackScalePage.starsFeedbackScaleUIButton()
501
+ .should('have.attr', 'aria-pressed', 'true');
502
+ },
503
+
504
+ /**
505
+ * Selects a feedback scale UI button.
506
+ * @param {('Stars' | 'Hearts')} button - The type of feedback scale UI button to select .
507
+ * @throws {Error} Thrown if an invalid feedback scale style is provided.
508
+ */
509
+ selectFeedbackScaleUIButton: (button) => {
510
+ switch (button) {
511
+ case 'Stars':
512
+ feedbackScalePage.starsFeedbackScaleUIButton()
513
+ .click()
514
+ .should('have.attr', 'aria-pressed', 'true');
515
+ break;
516
+ case 'Hearts':
517
+ feedbackScalePage.heartsFeedbackScaleUIButton()
518
+ .click()
519
+ .should('have.attr', 'aria-pressed', 'true');
520
+ break;
521
+ default:
522
+ throw new Error('Invalid feedback scale style');
523
+ }
524
+ },
525
+
526
+ /**
527
+ * Verifies the highlighted stars and un-highlighted stars in the legend text item specified by buttonIndex.
528
+ * @param {number} buttonIndex - The index of the legend text item in the list.
529
+ * @returns {void}
530
+ */
531
+ verifyHighlightedStarsInLegendTextListItem: (buttonIndex) => {
532
+ utilities.getNthElement(feedbackScalePage.legendTextOptionsList(), buttonIndex)
533
+ .within(() => {
534
+ feedbackScalePage.legendTextStarIcon()
535
+ .then(($stars) => {
536
+ const totalStars = $stars.length;
537
+ for (let index = 0; index < buttonIndex + 1; index++) {
538
+ expect($stars.eq(index)).to.have.css('fill', 'rgb(102, 102, 102)');
539
+ }
540
+ for (let index = buttonIndex + 1; index < totalStars; index++) {
541
+ expect($stars.eq(index)).to.have.css('fill', 'none');
542
+ }
543
+ });
544
+ });
545
+ },
546
+
547
+ /**
548
+ * @param {number} buttonIndex index of the feedback star button
549
+ * @description this function is used to click on a feedback star button
550
+ */
551
+ clickOnFeedbackStarButton: (buttonIndex) => {
552
+ utilities.getNthElement(feedbackScalePage.feedbackStarButton(), buttonIndex)
553
+ .click();
554
+ },
555
+
556
+ /**
557
+ * Verifies the highlighted stars and un-highlighted stars in the feedback scale up to the specified buttonIndex.
558
+ * @param {number} buttonIndex - The index of the last highlighted star in the feedback scale.
559
+ * @param {string} fillColor - The expected fill color of the highlighted stars.
560
+ * @returns {void}
561
+ */
562
+ verifyHighlightedStarsInFeedbackScale: (buttonIndex, fillColor) => {
563
+ feedbackScalePage.feedbackStarButton()
564
+ .then(($stars) => {
565
+ const totalStars = $stars.length;
566
+ for (let index = 0; index <= buttonIndex; index++) {
567
+ expect($stars.find('g g g').eq(index)).to.have.css('fill', fillColor);
568
+ }
569
+ for (let index = buttonIndex + 1; index < totalStars; index++) {
570
+ expect($stars.find('g g g').eq(index)).to.have.css('fill', 'none');
571
+ }
572
+ });
573
+ },
574
+
575
+ /**
576
+ * Verifies the highlighted hearts and un-highlighted hearts in the legend text item specified by buttonIndex.
577
+ * @param {number} buttonIndex - The index of the legend text item in the list.
578
+ * @returns {void}
579
+ */
580
+ verifyHighlightedHeartsInLegendTextListItem: (buttonIndex) => {
581
+ utilities.getNthElement(feedbackScalePage.legendTextOptionsList(), buttonIndex)
582
+ .within(() => {
583
+ feedbackScalePage.legendTextHeartIcon()
584
+ .then(($hearts) => {
585
+ const totalHearts = $hearts.length;
586
+ for (let index = 0; index < buttonIndex + 1; index++) {
587
+ expect($hearts.find('g').eq(index)).to.have.css('fill', 'rgb(102, 102, 102)');
588
+ }
589
+ for (let index = buttonIndex + 1; index < totalHearts; index++) {
590
+ expect($hearts.find('g').eq(index)).to.have.css('fill', 'none');
591
+ }
592
+ });
593
+ });
594
+ },
595
+
596
+ /**
597
+ * @param {number} buttonIndex index of the feedback star button
598
+ * @description this function is used to click on a feedback star button
599
+ */
600
+ clickOnFeedbackHeartButton: (buttonIndex) => {
601
+ utilities.getNthElement(feedbackScalePage.feedbackHeartButton(), buttonIndex)
602
+ .click();
603
+ },
604
+
605
+ /**
606
+ * Verifies the highlighted hearts and un-highlighted hearts in the feedback scale up to the specified buttonIndex.
607
+ * @param {number} buttonIndex - The index of the last highlighted heart in the feedback scale.
608
+ * @param {string} fillColor - The expected fill color of the highlighted hearts.
609
+ * @returns {void}
610
+ */
611
+ verifyHighlightedHeartsInFeedbackScale: (buttonIndex, fillColor) => {
612
+ feedbackScalePage.feedbackHeartButton()
613
+ .then(($hearts) => {
614
+ const totalHearts = $hearts.length;
615
+ for (let index = 0; index <= buttonIndex; index++) {
616
+ expect($hearts.find('g').eq(index)).to.have.css('fill', fillColor);
617
+ }
618
+ for (let index = buttonIndex + 1; index < totalHearts; index++) {
619
+ expect($hearts.find('g').eq(index)).to.have.css('fill', 'none');
620
+ }
621
+ });
622
+ },
623
+
624
+ enterTextInOptionTextInputField: (optionIndex, text) => {
625
+ utilities.getNthElement(feedbackScalePage.optionTextInputField(), optionIndex)
626
+ .type(text)
627
+ .blur();
628
+ },
629
+
630
+ clearOptionTextInputField: (optionIndex) => {
631
+ utilities.getNthElement(feedbackScalePage.optionTextInputField(), optionIndex)
632
+ .clear()
633
+ },
634
+
635
+ verifyTextInOptionTextInputField: (optionIndex, text) => {
636
+ utilities.verifyInputFieldValue(utilities.getNthElement(feedbackScalePage.optionTextInputField(), optionIndex), text)
637
+ },
638
+
639
+ /**
640
+ * Verifies the placeholder of the option text input field in an options accordion.
641
+ * @param {number} optionAccordionIndex - The index of the options accordion.
642
+ */
643
+ verifyOptionTextInputFieldPlaceholder: (optionAccordionIndex) => {
644
+ utilities.getNthElement(feedbackScalePage.optionTextInputField(), optionAccordionIndex)
645
+ .should('have.attr', 'placeholder', 'Enter option text');
646
+ },
647
+
648
+ /**
649
+ * Verifies that the placeholder of the option text input field in an options accordion does not exist.
650
+ * @param {number} optionAccordionIndex - The index of the options accordion.
651
+ */
652
+ verifyOptionTextInputFieldPlaceholderNotExists: (optionAccordionIndex) => {
653
+ utilities.getNthElement(feedbackScalePage.optionTextInputField(), optionAccordionIndex)
654
+ .should('not.have.attr', 'placeholder');
655
+ },
656
+
657
+ verifyDefaultColorSchemeRadioButtonCheckedState: () => {
658
+ feedbackScalePage.defaultColorSchemeRadioButton()
659
+ .should('be.checked');
660
+ },
661
+
662
+ verifyCustomColorsRadioButtonCheckedState: () => {
663
+ feedbackScalePage.customColorsRadioButton()
664
+ .should('be.checked');
665
+ },
666
+
667
+ /**
668
+ * Selects a color section button.
669
+ * @param {('Default color scheme' | 'Custom colors')} option - The type of color scheme to select .
670
+ * @throws {Error} Thrown if an invalid radio button is provided.
671
+ */
672
+ selectColorSectionRadioButton: (option) => {
673
+ switch (option) {
674
+ case 'Default color scheme':
675
+ feedbackScalePage.defaultColorSchemeRadioButton()
676
+ .click()
677
+ .should('be.checked');
678
+ break;
679
+ case 'Custom colors':
680
+ feedbackScalePage.customColorsRadioButton()
681
+ .click()
682
+ .should('be.checked');
683
+ break;
684
+ default:
685
+ throw new Error('Invalid radio button');
686
+ }
687
+ },
688
+
689
+ verifyColorSectionListItemContents: (itemIndex, { label, colorBlock }) => {
690
+ utilities.getNthElement(feedbackScalePage.colorSectionListItem(), itemIndex)
691
+ .within(() => {
692
+ utilities.verifyInnerText(feedbackScalePage.colorItemLabel(), label);
693
+ utilities.verifyElementVisibilityState(feedbackScalePage.editColorButton(), 'visible');
694
+ })
695
+ steps.verifyColorPickerBlockColor(itemIndex, colorBlock);
696
+ },
697
+ }
698
+
699
+ const tests = {
700
+ ...questionInstructionsComponent.tests,
701
+ ...additionalSettingsPanel.tests,
702
+ ...createQuestionBasePage.tests,
703
+ ...commonComponents.tests,
704
+ verifyLegendTextAccordionDefaultState: () => {
705
+ it('A \'Legend\' accordion should be present and by default it should be in expanded state', () => {
706
+ utilities.verifyInnerText(feedbackScalePage.legendAccordion(), 'Legend');
707
+ feedbackScalePage.steps.verifyLegendTextAccordionExpandedState();
708
+ });
709
+ }
710
+ }
711
+
712
+ export const feedbackScalePage = {
713
+ ...selectors,
714
+ steps,
715
+ tests
716
+ }