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,698 @@
1
+ import constants from "../fixtures/constants";
2
+ import { additionalSettingsPanel, ckEditorToolbar, colorPopupComponent, commonComponents, createQuestionBasePage, questionInstructionsComponent } from "./components"
3
+ import { dialogBoxBase } from "./dialogBoxBase";
4
+ import utilities from "../support/helpers/utilities";
5
+ import { selectQuestionResourceToolPage } from "./selectQuestionResourceToolPage";
6
+ const css = Cypress.env('css');
7
+
8
+ const selectors = {
9
+ ...questionInstructionsComponent,
10
+ ...commonComponents,
11
+ ...ckEditorToolbar,
12
+ ...additionalSettingsPanel,
13
+ ...dialogBoxBase,
14
+ ...createQuestionBasePage,
15
+ feedbackLayoutStyleLabel: () => cy.get('#feedback-layout-style-dropdown-label'),
16
+ feedbackLayoutStyleDropdown: () => cy.get('#feedback-layout-style-select'),
17
+ feedbackLayoutStyleDropdownOptions: (ariaLabel = null) => {
18
+ if (ariaLabel) {
19
+ return cy.get(`[aria-labelledby*="feedback-layout-style-dropdown-label"] [role="option"][aria-label*="${ariaLabel}"]`)
20
+ } else {
21
+ return cy.get('[aria-labelledby*="feedback-layout-style-dropdown-label"] [role="option"]')
22
+ }
23
+ },
24
+ feedbackScaleLabel: () => cy.get('.feedback-scale-panel-heading'),
25
+ optionAccordion: () => cy.get('.feedback-scale-panel .ngie-accordion-summary'),
26
+ optionAccordionLabel: () => cy.get('.feedback-scale-panel-label'),
27
+ deleteOptionAccordionButton: () => cy.get('[aria-label*="Delete Option"]'),
28
+ labelsLabel: () => cy.get('[class*="InlineTextFieldWithDebouncestyles__PropertyLabel"]'),
29
+ labelsInputField: () => cy.get('input[aria-label="Label"]'),
30
+ colorLabel: () => cy.get('[class*="FeedbackScalePanelstyle__ColorPickerWrapper"][class*="text-label"]'),
31
+ tooltipLabel: () => cy.get('[class*="FeedbackScalePanelstyle__FeedbackScaleOptionWrapper"] [class*="InlineRichTextComponentstyles__LabelWarpper"]').eq(0),
32
+ tooltipInputField: () => cy.get('[role="textbox"][aria-label*="tooltip"]'),
33
+ descriptionLabel: () => cy.get('[class*="FeedbackScalePanelstyle__FeedbackScaleOptionWrapper"] [class*="InlineRichTextComponentstyles__LabelWarpper"]').eq(1),
34
+ descriptionInputField: () => cy.get('[role="textbox"][aria-label*="description"]'),
35
+ addOptionButton: () => cy.get('.feedback-scale-add-option button'),
36
+ optionAccordionPanel: () => cy.get('.feedback-scale-panel'),
37
+ //Preview tab
38
+ feedbackButton: () => cy.get('.feedback-scale-label-btn'),
39
+ previewTabColorBlock: () => cy.get('[class*="ColorDiv"]'),
40
+ moreInfoOptionsList: () => cy.get('.options-list-item'),
41
+ moreInfoButton: () => cy.get('.feedback-layout-accordion .ngie-accordion-summary'),
42
+ moreInfoFeedbackLabel: () => cy.get('[class*="MoreInfostyles__LabelDiv"]'),
43
+ moreInfoTooltipText: () => cy.get('.tooltip-text'),
44
+ moreInfoDescriptionText: () => cy.get('.description-text'),
45
+ feedbackStarButton: () => cy.get('.feedback-scale-label-star-btn'),
46
+ moreInfoStarIcon: () => cy.get('[class*="MoreInfostyles__IconWrapper"] svg'),
47
+ studentResponseAreaAndLayoutLabel: () => cy.get('[class*="AdditionalOptionstyles__LayoutText"]'),
48
+ displayAdditionalInformationCheckboxLabel: () => cy.get('[data-ngie-testid="display-additional-information-checkbox"] .MuiFormControlLabel-label'),
49
+ displayAdditionalInformationCheckbox: () => cy.get('[data-ngie-testid="display-additional-information-checkbox"] input'),
50
+ allowStudentsToAddCommentCheckboxLabel: () => cy.get('[data-ngie-testid="allow-students-to-add-comment-checkbox"] .MuiFormControlLabel-label'),
51
+ allowStudentsToAddCommentCheckbox: () => cy.get('[data-ngie-testid="allow-students-to-add-comment-checkbox"] input'),
52
+ describeYourExperienceLabel: () => cy.get('.describe-your-experience .inline-text-property-label'),
53
+ describeYourExperienceInputField: () => cy.get('.describe-your-experience input')
54
+ }
55
+
56
+ const steps = {
57
+ ...createQuestionBasePage.steps,
58
+ ...questionInstructionsComponent.steps,
59
+ ...commonComponents.steps,
60
+ ...additionalSettingsPanel.steps,
61
+ ...ckEditorToolbar.steps,
62
+ ...additionalSettingsPanel.steps,
63
+ ...dialogBoxBase.steps,
64
+ clickOnFeedbackStyleLayoutDropdown: () => {
65
+ feedbackScalePage.feedbackLayoutStyleDropdown()
66
+ .click();
67
+ },
68
+
69
+ /**
70
+ * @param {string} dropdownOptionName option from the feedback layout style dropdown. Should be one of 'Button' or 'Star'
71
+ * @description this function selects an option from the feedback layout style dropdown
72
+ */
73
+ selectFeedbackStyleLayoutDropdown: (dropdownOptionName) => {
74
+ feedbackScalePage.feedbackLayoutStyleDropdownOptions(dropdownOptionName)
75
+ .click();
76
+ },
77
+
78
+ /**
79
+ * @param {string[]} dropdownOptions array of options of the feedback layout style dropdown
80
+ * @description this function verifies the list options of the feedback layout style dropdown
81
+ */
82
+ verifyFeedbackStyleLayoutOptions: (dropdownOptions) => {
83
+ dropdownOptions.forEach((option, count) => {
84
+ feedbackScalePage.feedbackLayoutStyleDropdownOptions()
85
+ .eq(count)
86
+ .verifyInnerText(option);
87
+ });
88
+ },
89
+
90
+ /**
91
+ * @param {number} optionAccordionIndex index of the option accordion
92
+ * @description this function verifies if an option accordion is in expanded state
93
+ */
94
+ verifyOptionAccordionInExpandedState: (optionAccordionIndex) => {
95
+ feedbackScalePage.optionAccordion()
96
+ .eq(optionAccordionIndex)
97
+ .should('have.attr', 'aria-expanded', 'true');
98
+ },
99
+
100
+ /**
101
+ * @param {number} optionAccordionIndex index of the option accordion
102
+ * @description this function verifies if an option accordion is in collapsed state
103
+ */
104
+ verifyOptionAccordionInCollapsedState: (optionAccordionIndex) => {
105
+ feedbackScalePage.optionAccordion()
106
+ .eq(optionAccordionIndex)
107
+ .should('have.attr', 'aria-expanded', 'false');
108
+ },
109
+
110
+ /**
111
+ * @param {number} optionAccordionIndex index of the option accordion
112
+ * @param {string} optionAccordionLabelText label of the option accordion. for example: Option 1
113
+ * @description this function verifies the contents that appear on an option accordion
114
+ */
115
+ verifyOptionAccordionPanelContents: (optionAccordionIndex, optionAccordionLabelText) => {
116
+ feedbackScalePage.optionAccordion()
117
+ .eq(optionAccordionIndex)
118
+ .within(($element) => {
119
+ feedbackScalePage.optionAccordionLabel()
120
+ .verifyInnerText(optionAccordionLabelText);
121
+ feedbackScalePage.deleteOptionAccordionButton()
122
+ .should('be.visible');
123
+ cy.wrap($element)
124
+ .find('svg')
125
+ .should('be.visible');
126
+ });
127
+ },
128
+
129
+ /**
130
+ * @param {number} optionAccordionIndex index of the option accordion
131
+ * @description this function expands an option accordion
132
+ */
133
+ expandOptionAccordion: (optionAccordionIndex) => {
134
+ feedbackScalePage.optionAccordion()
135
+ .eq(optionAccordionIndex)
136
+ .click()
137
+ .should('have.attr', 'aria-expanded', 'true');
138
+ },
139
+
140
+ /**
141
+ * @param {number} optionAccordionIndex index of the option accordion
142
+ * @description this function collapses an option accordion
143
+ */
144
+ collapseOptionAccordion: (optionAccordionIndex) => {
145
+ feedbackScalePage.optionAccordion()
146
+ .eq(optionAccordionIndex)
147
+ .click()
148
+ .should('have.attr', 'aria-expanded', 'false');
149
+ },
150
+
151
+ /**
152
+ * @param {number} optionAccordionIndex index of the option accordion
153
+ * @param {string[]} contents array of labels, color, tooltip and description of an option accordion
154
+ * @description this function verifies the contents in the input fields of an option accordion
155
+ * @example verifyOptionAccordionInputFieldContents(0, {'labels': 'Comfortable', 'color': 'rgba(9, 179, 33, 1)', 'tooltip': 'I\'m feeling confident.', 'description': 'I am comfortable with the learning target.'})
156
+ */
157
+ verifyOptionAccordionInputFieldContents: (optionAccordionIndex, contents) => {
158
+ feedbackScalePage.optionAccordionPanel()
159
+ .eq(optionAccordionIndex)
160
+ .within(() => {
161
+ feedbackScalePage.labelsInputField()
162
+ .should('have.value', contents['labels']);
163
+ utilities.verifyCSS(colorPopupComponent.colorBlock(), {
164
+ 'background-color': contents['color']
165
+ });
166
+ feedbackScalePage.tooltipInputField()
167
+ .should('have.text', contents['tooltip']);
168
+ feedbackScalePage.descriptionInputField()
169
+ .should('have.text', contents['description']);
170
+ });
171
+ },
172
+
173
+ /**
174
+ * @param {number} buttonIndex index of the feedback button
175
+ * @param {string} buttonText text content of the feedback button
176
+ * @description this function verifies the visibility and text content of a feedback button in the preview tab
177
+ */
178
+ verifyFeedbackButtonInPreviewTab: (buttonIndex, buttonText) => {
179
+ feedbackScalePage.feedbackButton()
180
+ .eq(buttonIndex)
181
+ .should('have.text', buttonText)
182
+ .and('be.visible');
183
+ },
184
+
185
+ /**
186
+ * @param {number} buttonIndex index of the feedback button
187
+ * @param {string} tooltipText text that appears on tooltip of the feedback button
188
+ * @description this function verifies the tooltip text of a feedback button in the preview tab
189
+ */
190
+ verifyTooltipFeedbackButton: (buttonIndex, tooltipText) => {
191
+ feedbackScalePage.feedbackButton()
192
+ .eq(buttonIndex)
193
+ .trigger('mouseover')
194
+ commonComponents.tooltipText()
195
+ .should('have.text', tooltipText)
196
+ .and('be.visible')
197
+ .within(() => {
198
+ feedbackScalePage.previewTabColorBlock()
199
+ .should('be.visible');
200
+ });
201
+ feedbackScalePage.feedbackButton()
202
+ .eq(buttonIndex)
203
+ .trigger('mouseout')
204
+ commonComponents.tooltipText()
205
+ .should('not.exist')
206
+ },
207
+
208
+ verifyMoreInfoAccordionInCollapsedState: () => {
209
+ feedbackScalePage.moreInfoButton()
210
+ .should('have.attr', 'aria-expanded', 'false');
211
+ },
212
+
213
+ verifyMoreInfoAccordionInExpandedState: () => {
214
+ feedbackScalePage.moreInfoButton()
215
+ .should('have.attr', 'aria-expanded', 'true');
216
+ },
217
+
218
+ expandMoreInfoAccordion: () => {
219
+ feedbackScalePage.moreInfoButton()
220
+ .click()
221
+ .should('have.attr', 'aria-expanded', 'true');
222
+ },
223
+
224
+ /**
225
+ * @param {number} itemIndex index of the more info list of a feedback button
226
+ * @param {string[]} contents array of labels, tooltip and description of the more info list of a feedback button
227
+ * @description this function verifies the label, tooltip and description texts of the more info accordion option list for a feedback button
228
+ */
229
+ verifyMoreInfoAccordionOptionsListLabelTooltipAndDescription: (itemIndex, contentsArray) => {
230
+ feedbackScalePage.moreInfoOptionsList()
231
+ .eq(itemIndex)
232
+ .within(() => {
233
+ feedbackScalePage.moreInfoFeedbackLabel()
234
+ .should('have.text', contentsArray[0]);
235
+ feedbackScalePage.moreInfoTooltipText()
236
+ .should('have.text', contentsArray[1]);
237
+ feedbackScalePage.moreInfoDescriptionText()
238
+ .should('have.text', contentsArray[2]);
239
+ });
240
+ },
241
+
242
+ /**
243
+ * @param {number} buttonIndex index of the feedback button
244
+ * @description this function is used to click on a feedback button
245
+ */
246
+ clickOnFeedbackButton: (buttonIndex) => {
247
+ feedbackScalePage.feedbackButton()
248
+ .eq(buttonIndex)
249
+ .click();
250
+ },
251
+
252
+ /**
253
+ * @param {number} buttonIndex index of the feedback button
254
+ * @description this function verifies the selected state of a feedback button
255
+ */
256
+ verifyFeedbackButtonSelectedState: (buttonIndex) => {
257
+ feedbackScalePage.feedbackButton()
258
+ .eq(buttonIndex)
259
+ .should('have.class', 'selected-button');
260
+ },
261
+
262
+ /**
263
+ * @param {number} buttonIndex index of the feedback button
264
+ * @description this function verifies the unselected state of a feedback button
265
+ */
266
+ verifyFeedbackButtonUnselectedState: (buttonIndex) => {
267
+ feedbackScalePage.feedbackButton()
268
+ .eq(buttonIndex)
269
+ .should('not.have.class', 'selected-button');
270
+ },
271
+
272
+ /**
273
+ * @param {number} itemIndex index of the more info list of a feedback button/star
274
+ * @description this function verifies the highlighted state of the more info list of a feedback button/star
275
+ */
276
+ verifyMoreInfoOptionListHighlightedState: (itemIndex) => {
277
+ feedbackScalePage.moreInfoOptionsList()
278
+ .eq(itemIndex)
279
+ .should('have.css', 'border', `1px solid ${css.color.activeComponentBorder}`);
280
+ },
281
+
282
+ /**
283
+ * @param {number} itemIndex index of the more info list of a feedback button/star
284
+ * @description this function verifies that the more info list of a feedback button/star is not in the highlighted state
285
+ */
286
+ verifyMoreInfoOptionListHighlightedStateNotExists: (itemIndex) => {
287
+ feedbackScalePage.moreInfoOptionsList()
288
+ .eq(itemIndex)
289
+ .should('not.have.css', 'border', `1px solid ${css.color.activeComponentBorder}`);
290
+ },
291
+
292
+ /**
293
+ * @param {number} buttonIndex index of the feedback star button
294
+ * @param {string} tooltipText text that appears on tooltip of the feedback button
295
+ * @description this function verifies the tooltip text of a feedback star button in the preview tab
296
+ */
297
+ verifyTooltipFeedbackStarButton: (buttonIndex, tooltipText) => {
298
+ feedbackScalePage.feedbackStarButton()
299
+ .eq(buttonIndex)
300
+ .trigger('mouseover')
301
+ commonComponents.tooltipText()
302
+ .should('have.text', tooltipText)
303
+ .and('be.visible')
304
+ .within(() => {
305
+ utilities.verifyElementVisibilityState(feedbackScalePage.previewTabColorBlock(), 'notExist');
306
+ });
307
+ feedbackScalePage.feedbackStarButton()
308
+ .eq(buttonIndex)
309
+ .trigger('mouseout')
310
+ utilities.verifyElementVisibilityState(commonComponents.tooltipText(), 'notExist');
311
+ },
312
+
313
+ /**
314
+ * @param {number} buttonIndex index of the feedback star button
315
+ * @description this function is used to click on a feedback star button
316
+ */
317
+ clickOnFeedbackStarButton: (buttonIndex) => {
318
+ feedbackScalePage.feedbackStarButton()
319
+ .eq(buttonIndex)
320
+ .click();
321
+ },
322
+
323
+ /**
324
+ * @param {number} buttonIndex index of the feedback button
325
+ * @description this function verifies the selected state of a feedback star button
326
+ */
327
+ verifyFeedbackStarButtonSelectedState: (buttonIndexArray, color) => {
328
+ buttonIndexArray.forEach((button) => {
329
+ feedbackScalePage.feedbackStarButton()
330
+ .eq(button)
331
+ .find('svg')
332
+ .should('have.css', 'fill', color);
333
+ });
334
+ },
335
+
336
+ /**
337
+ * @param {number} buttonIndex index of the feedback button
338
+ * @description this function verifies the unselected state of a feedback star button
339
+ */
340
+ verifyFeedbackStarButtonUnselectedState: (buttonIndexArray) => {
341
+ buttonIndexArray.forEach((button) => {
342
+ feedbackScalePage.feedbackStarButton()
343
+ .eq(button)
344
+ .find('svg')
345
+ .should('have.css', 'fill', css.color.defaultBackground);
346
+ });
347
+ },
348
+
349
+ addOption: () => {
350
+ feedbackScalePage.addOptionButton()
351
+ .click();
352
+ },
353
+
354
+ /**
355
+ * @param {number} optionAccordionIndex index of the option accordion
356
+ * @description this function is used to delete an option accordion
357
+ */
358
+ deleteOptionAccordion: (optionAccordionIndex) => {
359
+ feedbackScalePage.deleteOptionAccordionButton()
360
+ .eq(optionAccordionIndex)
361
+ .click();
362
+ },
363
+
364
+ /**
365
+ * @param {number} optionAccordionIndex index of the option accordion
366
+ * @description this function is used to focus in a tooltip input field of an option accordion
367
+ */
368
+ focusInTooltipInputField: (optionAccordionIndex) => {
369
+ feedbackScalePage.optionAccordionPanel()
370
+ .eq(optionAccordionIndex)
371
+ .within(() => {
372
+ feedbackScalePage.tooltipInputField()
373
+ .focus();
374
+ });
375
+ },
376
+
377
+ /**
378
+ * @param {number} optionAccordionIndex index of the option accordion
379
+ * @description this function is used to focus in a description input field of an option accordion
380
+ */
381
+ focusInDescriptionInputField: (optionAccordionIndex) => {
382
+ feedbackScalePage.optionAccordionPanel()
383
+ .eq(optionAccordionIndex)
384
+ .within(() => {
385
+ feedbackScalePage.descriptionInputField()
386
+ .focus();
387
+ });
388
+ },
389
+
390
+ /**
391
+ * @param {number} optionAccordionIndex index of the option accordion
392
+ * @description this function is used to add input to the tooltip input field of an option accordion
393
+ */
394
+ addInputToTooltipInputField: (optionAccordionIndex, textContent) => {
395
+ feedbackScalePage.optionAccordionPanel()
396
+ .eq(optionAccordionIndex)
397
+ .within(() => {
398
+ feedbackScalePage.tooltipInputField()
399
+ .type(textContent);
400
+ });
401
+ },
402
+
403
+ /**
404
+ * @param {number} optionAccordionIndex index of the option accordion
405
+ * @description this function is used to add input to the labels input field of an option accordion
406
+ */
407
+ addInputToLabelsInputField: (optionAccordionIndex, textContent) => {
408
+ feedbackScalePage.optionAccordionPanel()
409
+ .eq(optionAccordionIndex)
410
+ .within(() => {
411
+ feedbackScalePage.labelsInputField()
412
+ .type(textContent)
413
+ .blur();
414
+ });
415
+ },
416
+
417
+ /**
418
+ * @param {number} optionAccordionIndex index of the option accordion
419
+ * @description this function verifies image in tooltip input field of an option accordion
420
+ */
421
+ verifyImageAndAltTextInTooltipInputField: (optionAccordionIndex) => {
422
+ feedbackScalePage.optionAccordionPanel()
423
+ .eq(optionAccordionIndex)
424
+ .within(() => {
425
+ feedbackScalePage.tooltipInputField()
426
+ .find('img')
427
+ .should('have.attr', 'src', constants.foxImageLink)
428
+ .and('have.attr', 'alt', constants.foxImageAltText);
429
+ });
430
+ },
431
+
432
+ /**
433
+ * @param {number} optionAccordionIndex index of the option accordion
434
+ * @description this function is used to add bold text to the description input field of an option accordion
435
+ */
436
+ addInputToDescriptionInputField: (optionAccordionIndex, textContent) => {
437
+ feedbackScalePage.optionAccordionPanel()
438
+ .eq(optionAccordionIndex)
439
+ .within(() => {
440
+ feedbackScalePage.descriptionInputField()
441
+ .type(textContent);
442
+ });
443
+ },
444
+
445
+ /**
446
+ * @param {number} optionAccordionIndex index of the option accordion
447
+ * @description this function is used to clear the tooltip input field of an option accordion
448
+ */
449
+ clearTooltipInputField: (optionAccordionIndex) => {
450
+ feedbackScalePage.optionAccordionPanel()
451
+ .eq(optionAccordionIndex)
452
+ .within(() => {
453
+ feedbackScalePage.tooltipInputField()
454
+ .clear();
455
+ });
456
+ },
457
+
458
+ /**
459
+ * @param {number} optionAccordionIndex index of the option accordion
460
+ * @description this function is used to clear the description input field of an option accordion
461
+ */
462
+ clearDescriptionInputField: (optionAccordionIndex) => {
463
+ feedbackScalePage.optionAccordionPanel()
464
+ .eq(optionAccordionIndex)
465
+ .within(() => {
466
+ feedbackScalePage.descriptionInputField()
467
+ .clear();
468
+ });
469
+ },
470
+
471
+ /**
472
+ * @param {number} optionAccordionIndex index of the option accordion
473
+ * @description this function is used to verify bold text in the description input field of an option accordion
474
+ */
475
+ verifyBoldTextInDescriptionInputField: (optionAccordionIndex, textContent) => {
476
+ feedbackScalePage.optionAccordionPanel()
477
+ .eq(optionAccordionIndex)
478
+ .within(() => {
479
+ feedbackScalePage.descriptionInputField()
480
+ .find('strong')
481
+ .should('exist')
482
+ .should('have.text', textContent);
483
+ });
484
+ },
485
+
486
+ /**
487
+ * @param {number} buttonIndex index of the feedback button
488
+ * @description this function is used to verify an image in tooltip of a feedback button
489
+ */
490
+ verifyTooltipImageFeedbackButton: (buttonIndex) => {
491
+ feedbackScalePage.feedbackButton()
492
+ .eq(buttonIndex)
493
+ .trigger('mouseover');
494
+ commonComponents.tooltipText()
495
+ .and('be.visible')
496
+ .find('img')
497
+ .should('have.attr', 'src', constants.foxImageLink)
498
+ .and('have.attr', 'alt', constants.foxImageAltText);
499
+ feedbackScalePage.feedbackButton()
500
+ .eq(buttonIndex)
501
+ .trigger('mouseout')
502
+ commonComponents.tooltipText()
503
+ .should('not.exist');
504
+ },
505
+
506
+ /**
507
+ * @param {number} buttonIndex index of the feedback star button
508
+ * @param {string} textContent is the text that appears on the tooltip
509
+ * @description this function is used to verify bold text on a tooltip of a feedback star button
510
+ */
511
+ verifyTooltipBoldTextFeedbackStarButton: (buttonIndex, textContent) => {
512
+ feedbackScalePage.feedbackStarButton()
513
+ .eq(buttonIndex)
514
+ .trigger('mouseover');
515
+ commonComponents.tooltipText()
516
+ .and('be.visible')
517
+ .find('strong')
518
+ .should('exist')
519
+ .should('have.text', textContent);
520
+ feedbackScalePage.feedbackStarButton()
521
+ .eq(buttonIndex)
522
+ .trigger('mouseout')
523
+ commonComponents.tooltipText()
524
+ .should('not.exist');
525
+ },
526
+
527
+ /**
528
+ * @param {number} itemIndex index of the more info list item
529
+ * @description this function is used to verify color block in more info list item for button layout
530
+ */
531
+ verifyMoreInfoAccordionColorBlock: (itemIndex, color) => {
532
+ feedbackScalePage.moreInfoOptionsList()
533
+ .eq(itemIndex)
534
+ .within(() => {
535
+ feedbackScalePage.previewTabColorBlock()
536
+ .should('have.css', 'background-color', color);
537
+ });
538
+ },
539
+
540
+ /**
541
+ * @param {number} itemIndex index of the more info list item
542
+ * @description this function is used to verify the number of stars in more info list item for star layout
543
+ */
544
+ verifyMoreInfoAccordionStarIcons: (itemIndex) => {
545
+ feedbackScalePage.moreInfoOptionsList()
546
+ .eq(itemIndex)
547
+ .within(() => {
548
+ feedbackScalePage.moreInfoStarIcon()
549
+ .should('have.length', itemIndex + 1);
550
+ });
551
+ },
552
+
553
+ /**
554
+ * @param {number} itemIndex index of the more info list item
555
+ * @description this function is used to verify the label, image tooltip and bold description text in more info list item
556
+ */
557
+ verifyMoreInfoOptionListLabelTooltipAndDescriptionForImageTooltipAndBoldDescription: (itemIndex) => {
558
+ feedbackScalePage.moreInfoOptionsList()
559
+ .eq(itemIndex)
560
+ .within(() => {
561
+ feedbackScalePage.moreInfoFeedbackLabel()
562
+ .should('have.text', 'Comfortable');
563
+ feedbackScalePage.moreInfoTooltipText()
564
+ .find('img')
565
+ .should('have.attr', 'src', constants.foxImageLink)
566
+ .and('have.attr', 'alt', constants.foxImageAltText);
567
+ feedbackScalePage.moreInfoDescriptionText()
568
+ .find('strong')
569
+ .should('exist')
570
+ .should('have.text', 'I\'m very comfortable with the learning target');
571
+ });
572
+ },
573
+
574
+ /**
575
+ * @param {number} itemIndex index of the more info list item
576
+ * @description this function is used to verify the label, bold tooltip text and image description in more info list item
577
+ */
578
+ verifyMoreInfoOptionListLabelTooltipAndDescriptionForBoldTooltipAndImageDescription: (itemIndex) => {
579
+ feedbackScalePage.moreInfoOptionsList()
580
+ .eq(itemIndex)
581
+ .within(() => {
582
+ feedbackScalePage.moreInfoFeedbackLabel()
583
+ .should('have.text', '100%');
584
+ feedbackScalePage.moreInfoTooltipText()
585
+ .find('strong')
586
+ .should('exist')
587
+ .should('have.text', 'Keep up the good work!');
588
+ feedbackScalePage.moreInfoDescriptionText()
589
+ .find('img')
590
+ .should('have.attr', 'src', constants.foxImageLink)
591
+ .and('have.attr', 'alt', constants.foxImageAltText);
592
+ });
593
+ },
594
+
595
+ verifyDisplayAdditionalInformationCheckboxCheckedState: () => {
596
+ feedbackScalePage.displayAdditionalInformationCheckbox()
597
+ .should('be.checked');
598
+ },
599
+
600
+ verifyDisplayAdditionalInformationCheckboxUncheckedState: () => {
601
+ feedbackScalePage.displayAdditionalInformationCheckbox()
602
+ .should('not.be.checked');
603
+ },
604
+
605
+ verifyAllowStudentsToAddCommentCheckboxCheckedState: () => {
606
+ feedbackScalePage.allowStudentsToAddCommentCheckbox()
607
+ .should('be.checked');
608
+ },
609
+
610
+ verifyAllowStudentsToAddCommentCheckboxUncheckedState: () => {
611
+ feedbackScalePage.allowStudentsToAddCommentCheckbox()
612
+ .should('not.be.checked');
613
+ },
614
+
615
+ uncheckDisplayAdditionalInformationCheckbox: () => {
616
+ feedbackScalePage.displayAdditionalInformationCheckbox()
617
+ .click()
618
+ .should('not.be.checked');
619
+ },
620
+
621
+ checkAllowStudentsToAddCommentCheckbox: () => {
622
+ feedbackScalePage.allowStudentsToAddCommentCheckbox()
623
+ .click()
624
+ .should('be.checked');
625
+ },
626
+
627
+ /**
628
+ * @param {string} textContent text to be entered in describe your experience input field
629
+ * @description this function is used to add input to the describe your experience input field
630
+ */
631
+ addInputToDescribeYourExperienceInputField: (textContent) => {
632
+ feedbackScalePage.describeYourExperienceInputField()
633
+ .type(textContent, { delay: 0 })
634
+ .blur()
635
+ .focus()
636
+ .should('have.value', textContent)
637
+ },
638
+
639
+ hoverOnFeedBackButton: () => {
640
+ feedbackScalePage.feedbackButton().eq(0)
641
+ .trigger('mouseover')
642
+ },
643
+
644
+ hoverAwayFromFeedbackButton: () => {
645
+ feedbackScalePage.feedbackButton().eq(0)
646
+ .trigger('mouseout')
647
+ },
648
+
649
+ /**
650
+ * @param {number} buttonIndex index of the feedback button
651
+ * @param {string} color to be verified present on the tooltip of a feedback button in rgb format
652
+ */
653
+ verifyColorBlockOnFeedbackButtonTooltip: (buttonIndex, color) => {
654
+ feedbackScalePage.feedbackButton()
655
+ .eq(buttonIndex)
656
+ .trigger('mouseover')
657
+ commonComponents.tooltipText()
658
+ .and('be.visible')
659
+ .within(() => {
660
+ utilities.verifyCSS(feedbackScalePage.previewTabColorBlock(), {
661
+ 'background-color': color
662
+ });
663
+ });
664
+ feedbackScalePage.feedbackButton()
665
+ .eq(buttonIndex)
666
+ .trigger('mouseout')
667
+ commonComponents.tooltipText()
668
+ .should('not.exist')
669
+ },
670
+
671
+ /**
672
+ * @param {number} itemIndex index of the more info list item
673
+ * @param {string} color to be verified present in more info list item in rgb format
674
+ * @description this function is used to verify the color of stars in more info list item for star layout
675
+ */
676
+ verifyMoreInfoAccordionStarIconsColor: (itemIndex, color) => {
677
+ feedbackScalePage.moreInfoOptionsList()
678
+ .eq(itemIndex)
679
+ .within(() => {
680
+ utilities.verifyCSS(feedbackScalePage.moreInfoStarIcon(), {
681
+ 'fill': color
682
+ });
683
+ });
684
+ },
685
+ }
686
+
687
+ const tests = {
688
+ ...questionInstructionsComponent.tests,
689
+ ...additionalSettingsPanel.tests,
690
+ ...createQuestionBasePage.tests,
691
+ ...commonComponents.tests
692
+ }
693
+
694
+ export const feedbackScalePage = {
695
+ ...selectors,
696
+ steps,
697
+ tests
698
+ }