itemengine-cypress-automation 1.0.174-uploadResponseMigrationScript-45ca862.0 → 1.0.174

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. package/cypress/e2e/ILC/DrawingResponse/drawingResponseCustomizeAdditionalOptions.js +0 -18
  2. package/cypress/e2e/ILC/DrawingResponse/drawingResponseEditTabBasicSection.js +1 -1
  3. package/cypress/e2e/ILC/EssayResponse/createCustomCategory.smoke.js +10 -7
  4. package/cypress/e2e/ILC/FeedbackScaleNew/additionalSettings.js +111 -0
  5. package/cypress/e2e/ILC/FeedbackScaleNew/colorPopup.js +206 -0
  6. package/cypress/e2e/ILC/FeedbackScaleNew/editTabBasicSection.js +262 -0
  7. package/cypress/e2e/ILC/FeedbackScaleNew/headerSection.js +51 -0
  8. package/cypress/e2e/ILC/FeedbackScaleNew/numbersFeedbackScaleStyle.js +17 -17
  9. package/cypress/e2e/ILC/FeedbackScaleNew/thumbsFeedbackScaleStyle.js +1 -1
  10. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/additionalSettings.js +2 -2
  11. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/clickAndDrop.js +3 -3
  12. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/conditionalCheckboxScoring.js +1 -0
  13. package/cypress/e2e/ILC/Graphing/addBackgroundShapesSection.js +6 -7
  14. package/cypress/e2e/ILC/Graphing/additionalSettingsBasic.js +3 -3
  15. package/cypress/e2e/ILC/Graphing/allOrNothingForAllViews.smoke.js +0 -1
  16. package/cypress/e2e/ILC/Graphing/checkAnswerFunctionalityForAllViews.smoke.js +0 -1
  17. package/cypress/e2e/ILC/Graphing/toolsControlsAndBackgroundSection.js +0 -1
  18. package/cypress/e2e/ILC/GridFill/checkAnswerFunctionalityForAllViews.smoke.js +2 -0
  19. package/cypress/e2e/ILC/GridFill/gridLayoutContents.js +3 -4
  20. package/cypress/e2e/ILC/GridFill/gridLayoutEditTabFunctionality.js +2 -2
  21. package/cypress/e2e/ILC/GridFill/previewContentsForAllViews.smoke.js +12 -12
  22. package/cypress/e2e/ILC/NumberLine/Scoring/allOrNothingWithAlternatePointsGreaterThanCorrectPoints.js +91 -90
  23. package/cypress/e2e/ILC/NumberLine/Scoring/allOrNothingWithCorrectPointsEqualToAlternatePoints.js +93 -92
  24. package/cypress/e2e/ILC/NumberLine/Scoring/allOrNothingWithCorrectPointsGreaterThanAlternativePoints.js +97 -95
  25. package/cypress/e2e/ILC/NumberLine/Scoring/manualAndNonScoredScoring.js +62 -62
  26. package/cypress/e2e/ILC/NumberLine/Scoring/partialEqualWeightsBasic.js +118 -117
  27. package/cypress/e2e/ILC/NumberLine/Scoring/partialEqualWeightsWithAlternatePointsGreaterThanCorrectPoints.js +124 -120
  28. package/cypress/e2e/ILC/NumberLine/Scoring/partialEqualWeightsWithCorrectPointsGreaterThanAlternatePoints.js +128 -125
  29. package/cypress/e2e/ILC/NumberLine/Scoring/partialEqualWeigtsWithCorrectPointsEqualToAlternatePoints.js +97 -96
  30. package/cypress/e2e/ILC/NumberLine/allOrNothingScoringForAllViews.smoke.js +222 -196
  31. package/cypress/e2e/ILC/NumberLine/checkAnswerFunctionalityForAllViews.smoke.js +34 -34
  32. package/cypress/e2e/ILC/NumberLine/editTabScoringSection.js +20 -20
  33. package/cypress/e2e/ILC/NumberLine/gradingViewAndCorrectAnswerView.smoke.js +29 -29
  34. package/cypress/e2e/ILC/NumberLine/headerSection.js +3 -2
  35. package/cypress/e2e/ILC/NumberLine/previewTabContentsForAllViews.smoke.js +40 -37
  36. package/cypress/e2e/ILC/NumberLine/specifyCorrectAnswerSection.js +7 -4
  37. package/cypress/e2e/ILC/NumberLine/studentViewSettings.js +14 -12
  38. package/cypress/e2e/ILC/NumberLine/toolsAndControls.js +24 -23
  39. package/cypress/e2e/ILC/ShortTextResponseNew/studentViewSettings.js +2 -2
  40. package/cypress/e2e/ILC/SimpleCalculator/previewContents.smoke.js +1 -1
  41. package/cypress/e2e/ILC/TextEntryMath/evaluationMethodEquivalentStructures.js +2 -0
  42. package/cypress/e2e/ILC/TextEntryMath/evaluationMethodMatchExact.js +1 -0
  43. package/cypress/e2e/ILC/TextEntryMath/evaluationMethodMatchValue.js +1 -0
  44. package/cypress/e2e/ILC/TextEntryMath/evaluationMethodSymbolsAreEquivalent.js +1 -0
  45. package/cypress/e2e/ILC/TextEntryMath/evaluationMethodValueIsEquivalent.js +1 -0
  46. package/cypress/e2e/ILC/TextEntryMath/evaluationMethodsWithoutSetResponse.js +4 -0
  47. package/cypress/e2e/ILC/TextEntryMath/responseEvaluationMethodsAndCustomSettings.js +8 -15
  48. package/cypress/e2e/ILC/TextEntryMath/specifyCorrectAnswerSection.js +1 -0
  49. package/cypress/e2e/ILC/TextEntryMathWithImage/allOrNothingScoringForAllViews.smoke.js +1 -0
  50. package/cypress/e2e/ILC/TextEntryMathWithImage/backgroundImageAndCanvasProperties.js +1 -1
  51. package/cypress/e2e/ILC/TextSelection/Scoring/basicScoringForAllTextSelectionTypes.smoke.js +332 -0
  52. package/cypress/e2e/ILC/TextSelection/Scoring/manuallyAndNonScored.js +149 -0
  53. package/cypress/e2e/ILC/TextSelection/Scoring/partialDifferentWeightsBasic.js +0 -1
  54. package/cypress/e2e/ILC/TextSelection/Scoring/partialEqualWeightsBasic.js +0 -1
  55. package/cypress/e2e/ILC/TextSelection/allOrNothingScoringForAllViews.smoke.js +11 -11
  56. package/cypress/e2e/ILC/TextSelection/checkAnswerFunctionalityForAllViews.smoke.js +3 -3
  57. package/cypress/e2e/ILC/TextSelection/editTabScoringSection.js +337 -0
  58. package/cypress/e2e/ILC/TextSelection/minimumScoringPenaltyPointsAndRoundingDropdown.js +206 -0
  59. package/cypress/e2e/ILC/TextSelection/{previewContentsForAllViews.js → previewContentsForAllViews.smoke.js} +3 -3
  60. package/cypress/e2e/ILC/UploadResponse/uplodResponsePreviewUploadedFileProperties.js +87 -87
  61. package/cypress/fixtures/equationEditorCategoriesAndSymbols .js +5 -5
  62. package/cypress/pages/audioResponsePage.js +1 -0
  63. package/cypress/pages/components/autoScoredScoringSectionMultiResponseType.js +2 -1
  64. package/cypress/pages/components/autoScoredStudentViewSettings.js +1 -1
  65. package/cypress/pages/components/backgroundImageUploadComponent.js +1 -4
  66. package/cypress/pages/components/colorPopupComponent.js +11 -0
  67. package/cypress/pages/components/createCustomCategoryFlyout.js +13 -9
  68. package/cypress/pages/components/draggableOptionContainer.js +1 -0
  69. package/cypress/pages/components/equationEditorFlyout.js +0 -1
  70. package/cypress/pages/components/essayResponseCommonComponents.js +1 -1
  71. package/cypress/pages/components/imageCanvasComponent.js +1 -1
  72. package/cypress/pages/components/index.js +2 -1
  73. package/cypress/pages/components/optionsWrapperComponent.js +2 -1
  74. package/cypress/pages/components/questionInputFieldComponent.js +1 -1
  75. package/cypress/pages/components/questionInstructionsComponent.js +19 -7
  76. package/cypress/pages/components/setPointsPopupBase.js +17 -4
  77. package/cypress/pages/components/studentViewSettingsLabelComponent.js +2 -2
  78. package/cypress/pages/drawingResponsePage.js +2 -3
  79. package/cypress/pages/feedbackScalePage.js +143 -2
  80. package/cypress/pages/fillInTheGapsDragAndDropPage.js +1 -1
  81. package/cypress/pages/fillInTheGapsOverImageDragAndDropPage.js +12 -12
  82. package/cypress/pages/graphingPage.js +6 -6
  83. package/cypress/pages/gridFillPage.js +64 -7
  84. package/cypress/pages/matchingPage.js +3 -3
  85. package/cypress/pages/numberLinePage.js +342 -215
  86. package/cypress/pages/readingRulerPage.js +1 -1
  87. package/cypress/pages/textEntryMathPage.js +9 -0
  88. package/cypress/pages/textEntryMathWithImagePage.js +11 -11
  89. package/cypress/pages/textSelectionPage.js +125 -57
  90. package/package.json +2 -2
  91. package/cypress/e2e/ILC/FeedbackScaleNew/feedbackScaleStylePreviewTab.js +0 -161
  92. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropAdditionalSettings.js +0 -356
  93. package/cypress/e2e/ILC/FillInTheGapsDragAndDrop/fillInTheGapsDragAndDropAdditionalSettingsResponseAccordion.js +0 -299
  94. package/cypress/e2e/ILC/Graphing/Scoring/allOrNothingWithCorrectPointsEqualToCorrectPoints.js +0 -355
  95. package/cypress/e2e/ILC/MultipleSelectionGridNew/test.js +0 -28
  96. package/cypress/pages/feedbackScalePage copy.js +0 -716
@@ -1,716 +0,0 @@
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
- }