itemengine-cypress-automation 1.0.181-figDropdown-5a8309d.0 → 1.0.181

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. package/cypress/e2e/ILC/AudioPlayerNew/previewContents.smoke.js +162 -0
  2. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/clickAndDrop.js +1 -1
  3. package/cypress/e2e/ILC/DrawingResponse/drawingResponseGradingViewAndCorrectAnswerViewContents.smoke.js +4 -5
  4. package/cypress/e2e/ILC/EditTabSettingPage/itemPreviewSettingsTabFunctionality.js +64 -3
  5. package/cypress/e2e/ILC/EssayResponse/editCategoryFlyout.js +1 -1
  6. package/cypress/e2e/ILC/FeedbackScaleNew/headerSection.js +29 -1
  7. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/previewContentsForAllViews.smoke.js +2 -2
  8. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/studentViewSettings.js +1 -1
  9. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/studentViewSettings.js +1 -1
  10. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/editTabScoring.js +1 -0
  11. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/previewContentsForAllViews.smoke.js +2 -2
  12. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/studentViewSettings.js +1 -1
  13. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/studentViewSettings.js +1 -1
  14. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/Scoring/partialDifferentWeightsWithCorrectPointsEqualToAlternativePoints.js +4 -4
  15. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/Scoring/partialEqualWeightsWithAlternativePointsGreaterThanCorrectPoints.js +1 -1
  16. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/studentViewSettings.js +1 -1
  17. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsAlternativePointsGreaterThanCorrectPoints.js +5 -5
  18. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsWithCorrectPointsEqualToAlternativePoints.js +3 -4
  19. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialEqualWeightsWithAlternativePointsGreaterThanCorrectPoints.js +1 -1
  20. package/cypress/e2e/ILC/FillInTheGapsTextNew/headerSection.js +1 -0
  21. package/cypress/e2e/ILC/FillInTheGapsTextNew/studentViewSettings.js +1 -1
  22. package/cypress/e2e/ILC/Graphing/Scoring/allOrNothingWithAlternativePointsGreaterThanCorrectPoints.js +2 -2
  23. package/cypress/e2e/ILC/Graphing/Scoring/allOrNothingWithCorrectPointsEqualToAlternatePoints.js +2 -2
  24. package/cypress/e2e/ILC/Graphing/Scoring/allOrNothingWithCorrectPointsGreaterThanAlternativePoints.js +2 -2
  25. package/cypress/e2e/ILC/Graphing/addBackgroundShapesSection.js +2 -2
  26. package/cypress/e2e/ILC/Graphing/studentViewSettings.js +1 -1
  27. package/cypress/e2e/ILC/GridFill/previewContentsForAllViews.smoke.js +3 -3
  28. package/cypress/e2e/ILC/GridFill/studentViewSettingsSection.js +1 -1
  29. package/cypress/e2e/ILC/ListOrderingNew/Scoring/allOrNothingAlternativePointsGreaterThanCorrectPoints.js +216 -0
  30. package/cypress/e2e/ILC/ListOrderingNew/Scoring/allOrNothingCorrectPointsEqualToAlternativePoints.js +214 -0
  31. package/cypress/e2e/ILC/ListOrderingNew/Scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +251 -0
  32. package/cypress/e2e/ILC/ListOrderingNew/Scoring/allOrNothingPenaltyScoring.js +52 -0
  33. package/cypress/e2e/ILC/ListOrderingNew/allOrNothingForAllViews.smoke.js +243 -0
  34. package/cypress/e2e/ILC/ListOrderingNew/checkAnswerFunctionalityForAllViews.smoke.js +128 -0
  35. package/cypress/e2e/ILC/ListOrderingNew/previewContentsForAllViews.smoke.js +176 -0
  36. package/cypress/e2e/ILC/Matching/studentViewSettings.js +1 -1
  37. package/cypress/e2e/ILC/MultipleSelection/allOrNothingWithAlternativeAnswer.js +1 -0
  38. package/cypress/e2e/ILC/MultipleSelectionGridNew/studentViewSettings.js +1 -1
  39. package/cypress/e2e/ILC/NumberLine/LayoutSection.js +530 -0
  40. package/cypress/e2e/ILC/NumberLine/Scoring/allOrNothingWithCorrectPointsGreaterThanAlternativePoints.js +3 -3
  41. package/cypress/e2e/ILC/NumberLine/lineSettingsSection.js +119 -0
  42. package/cypress/e2e/ILC/NumberLine/numberLineSection.js +263 -0
  43. package/cypress/e2e/ILC/NumberLine/previewTabContentsForAllViews.smoke.js +1 -1
  44. package/cypress/e2e/ILC/NumberLine/studentViewSettings.js +1 -1
  45. package/cypress/e2e/ILC/NumberLine/toolSettings.js +2 -1
  46. package/cypress/e2e/ILC/Protractor/protractorPreviewContents.smoke.js +1 -1
  47. package/cypress/e2e/ILC/ReadingRuler/readingRulerEditTabBasicsSection.js +49 -1
  48. package/cypress/e2e/ILC/ShortTextResponseNew/studentViewSettings.js +1 -1
  49. package/cypress/e2e/ILC/SingleSelectionGridNew/studentViewSettings.js +1 -1
  50. package/cypress/e2e/ILC/TextEntryMath/responseEvaluationMethodsAndCustomSettings.js +2 -2
  51. package/cypress/e2e/ILC/TextSelection/Scoring/allOrNothingAlternatePointsMoreThanCorrectPoints.js +0 -1
  52. package/cypress/e2e/ILC/TextSelection/Scoring/allOrNothingCorrectPointsEqualToAlternatePoints.js +0 -1
  53. package/cypress/e2e/ILC/TextSelection/Scoring/allOrNothingCorrectPointsMoreThanAlternatePoints.js +0 -1
  54. package/cypress/e2e/ILC/TextSelection/Scoring/basicScoringForAllTextSelectionTypes.smoke.js +0 -1
  55. package/cypress/e2e/ILC/TextSelection/additionalSettings.js +125 -0
  56. package/cypress/e2e/ILC/TextSelection/allOrNothingScoringForAllViews.smoke.js +0 -1
  57. package/cypress/e2e/ILC/TextSelection/checkAnswerFunctionalityForAllViews.smoke.js +0 -1
  58. package/cypress/e2e/ILC/TextSelection/editTabScoringSection.js +5 -4
  59. package/cypress/e2e/ILC/TextSelection/headerSection.js +73 -0
  60. package/cypress/e2e/ILC/TextSelection/previewContentsForAllViews.smoke.js +2 -2
  61. package/cypress/e2e/ILC/TextSelection/questionInstructionsAndQuestion.smoke.js +179 -0
  62. package/cypress/e2e/ILC/TextSelection/specifyCorrectAnswerSection.js +89 -0
  63. package/cypress/e2e/ILC/TextSelection/studentViewSettings.js +436 -0
  64. package/cypress/e2e/ILC/TextSelection/styleAndLayoutCustomizationAccordion.js +277 -0
  65. package/cypress/e2e/ILC/TextSelection/textSelectionModesInPreviewTab.js +222 -0
  66. package/cypress/e2e/ILC/TextSelection/textSelectionModesInSpecifyCorrectAnswerSection.js +260 -0
  67. package/cypress/e2e/ILC/TextSelection/textSelectionModesInSpecifyPossibleOptionsSection.js +380 -0
  68. package/cypress/e2e/ILC/ToolSettings/toolSettingsContent.js +5 -5
  69. package/cypress/fixtures/constants.js +1 -1
  70. package/cypress/fixtures/equationEditorCategoriesAndSymbols .js +20 -20
  71. package/cypress/fixtures/theme/ilc.json +16 -16
  72. package/cypress/pages/audioPlayerPage.js +55 -543
  73. package/cypress/pages/brainingCampManipulativePage.js +1 -1
  74. package/cypress/pages/components/autoScoredSpecifyCorrectAnswerSection.js +3 -3
  75. package/cypress/pages/components/autoScoredStudentViewSettings.js +4 -4
  76. package/cypress/pages/components/commonComponents.js +1 -0
  77. package/cypress/pages/components/draggableOptionContainer.js +1 -0
  78. package/cypress/pages/components/equationEditorFlyout.js +3 -2
  79. package/cypress/pages/components/essayResponseCommonComponents.js +8 -2
  80. package/cypress/pages/components/fillInTheGapsDropdownCommonComponent.js +1 -0
  81. package/cypress/pages/components/imageCanvasComponent.js +2 -1
  82. package/cypress/pages/components/index.js +1 -0
  83. package/cypress/pages/components/optionsWrapperComponent.js +11 -0
  84. package/cypress/pages/components/styleAndLayoutCustomizationAccordionComponent.js +46 -0
  85. package/cypress/pages/components/toolSettingsComponent.js +6 -0
  86. package/cypress/pages/contentBlocksPage.js +2 -2
  87. package/cypress/pages/createItemPage.js +29 -0
  88. package/cypress/pages/dialogBoxBase.js +2 -2
  89. package/cypress/pages/drawingResponsePage.js +23 -4
  90. package/cypress/pages/feedbackScalePage.js +3 -0
  91. package/cypress/pages/graphingPage.js +18 -0
  92. package/cypress/pages/gridFillPage.js +18 -2
  93. package/cypress/pages/index.js +1 -1
  94. package/cypress/pages/itemPreviewSettingsPage.js +4 -0
  95. package/cypress/pages/listOrderingPage.js +122 -647
  96. package/cypress/pages/matchingPage.js +1 -1
  97. package/cypress/pages/multipleSelectionPage.js +23 -1
  98. package/cypress/pages/numberLinePage.js +1196 -59
  99. package/cypress/pages/rulerPage.js +6 -2
  100. package/cypress/pages/textSelectionPage.js +460 -22
  101. package/cypress/support/migrationHelpers/extractLrnQuestionData.js +3 -107
  102. package/cypress/support/migrationHelpers/lrnQestionTypesENUM.js +1 -2
  103. package/cypress/support/migrationHelpers/migrationScript.js +0 -13
  104. package/cypress/support/migrationHelpers/verifyIeQuestionData.js +6 -106
  105. package/package.json +2 -2
  106. package/cypress/e2e/ILC/EssayResponse/essayResponseAdditionalSettings.js +0 -432
  107. package/cypress/e2e/ILC/EssayResponse/essayResponseAdditionalSettingsBasic.js +0 -134
@@ -1,373 +1,116 @@
1
1
  import constants from "../fixtures/constants";
2
2
  import utilities from "../support/helpers/utilities";
3
- import { additionalSettingsPanel, autoScoredAdditionalSettings, autoScoredPreviewBase, autoScoredScoringSection, autoScoredScoringSectionMultipleResponsesType, autoScoredSetCorrectAnswerSection, ckEditorToolbar, commonComponents, createQuestionBasePage, equationEditorFlyout, optionsWrapperComponent, previewScoringAndShowCorrectAnswerComponent, questionInstructionsComponent, scoringSectionBase } from "./components"
4
- import { answerNumerationComponent } from "./components/answerNumerationComponent";
5
- import { listSortingAndOrderingBase } from "./components/listSortingAndOrderingBase";
6
- import { setPointsPopupBase } from "./components/setPointsPopupBase";
7
- import { studentResponseAndLayoutComponent } from "./components/studentResponseAreaAndLayoutComponent";
8
- const css = Cypress.env('css');
3
+ import { autoScoredScoringPreviewTab, autoScoredScoringSectionMultiResponseType, autoScoredSpecifyCorrectAnswerSection, autoScoredStudentViewSettings, commonComponents, correctIncorrectAnswerLabelComponent, createQuestionBasePage, optionsWrapperComponent, questionInstructionsComponent, scoringSectionBaseEditTab } from "./components"
9
4
 
10
5
  const selectors = {
11
- ...commonComponents,
12
6
  ...optionsWrapperComponent,
13
- ...scoringSectionBase,
14
- ...autoScoredScoringSectionMultipleResponsesType,
15
- ...autoScoredSetCorrectAnswerSection,
16
- ...autoScoredAdditionalSettings,
17
- ...previewScoringAndShowCorrectAnswerComponent,
18
- ...autoScoredPreviewBase,
19
- ...additionalSettingsPanel,
20
7
  ...questionInstructionsComponent,
21
- ...answerNumerationComponent,
22
- ...setPointsPopupBase,
23
- ...listSortingAndOrderingBase,
24
- //Set correct answer section
25
- setCorrectAnswerSectionOption: () => cy.get('.list-ordering-set-correct-answer .draggable-item-wrapper[role="button"]'),
26
- setCorrectAnswerSectionOptionsWrapper: () => cy.get('[class*="ListOrderingResponsestyles__DroppableWrapper"]'),
8
+ ...commonComponents,
9
+ //Specify correct answer section
10
+ optionSpecifyCorrectAnswerSection: () => cy.get('.list-ordering-set-correct-answer .draggable-item-wrapper[role="button"]'),
11
+ optionWrapperSpecifyCorrectAnswerSection: () => cy.get('[class*="ListOrderingResponsestyles__DroppableWrapper"]'),
27
12
  //Preview Tab
28
- pointsPerResponseLabel: () => cy.get('.list-ordering-points-text'),
29
- previewTabOption: () => cy.get('.edit-question-preview-wrapper .draggable-item-wrapper[role="button"]'),
30
- previewTabOptionsWrapper: () => cy.get('.edit-question-preview-wrapper [class*="ListOrderingResponsestyles__DroppableWrapper"]'),
31
- partialEqualWeightsPointsPerResponseScore: () => cy.get('.orderlist-points-wrapper'),
32
- partialDifferentWeightsPointsInputField: () => cy.get('.orderlist-points-wrapper input'),
33
- partialDifferentWeightsPointsPerResponseLabel: () => cy.get('.list-ordering-points-wrapper'),
34
- //Additional Settings
35
- optionNumeration: () => cy.get('[class*="__IndexWrapper"]'),
36
- setCorrectAnswerSectionTopLabel: () => cy.get('[class*="TopLabelWrapper"].top-bottom-label'),
37
- setCorrectAnswerSectionBottomLabel: () => cy.get('[class*="BottomLabelWrapper"].top-bottom-label'),
38
- previewTabTopLabel: () => cy.get('.edit-question-preview-wrapper [class*="TopLabelWrapper"].top-bottom-label'),
39
- previewTabBottomLabel: () => cy.get('.edit-question-preview-wrapper [class*="BottomLabelWrapper"].top-bottom-label'),
40
- pointsPerResponseLabelForInlineOption: () => cy.get('[class*="ListOrderingstyles__EqualPointsWrapper"]'),
41
- pointsPerResponseScoreForInlineOption: () => cy.get('[class*="ListOrderingstyles__EqualPointsWrapper"] span'),
42
- //Set points popup
43
- buttonSetPoints: () => cy.get('[class*="SetPointsstyle__Button"]'),
44
- setPointsIcon: () => cy.get('[class*="SetPointsstyle__Button"] svg'),
45
- //Remove after https://redmine.zeuslearning.com/issues/518498 is fixed
46
- dragHandleButton: () => cy.get('[class*="DragIcon"]')
13
+ optionPreviewTab: () => cy.get('[class*="question-preview-wrapper"] .draggable-item-wrapper[role="button"]'),
14
+ optionWrapperPreviewTab: () => cy.get('[class*="question-preview-wrapper"] .orderlist-option-wrapper'),
15
+ correctAnswersLabel: () => cy.get('.check-answer-and-status-wrapper [class*="CorrectAnswerLabel"]'),
16
+ correctAnswerSectionAnswerWrapper: () => cy.get('[class*="CorrectAnswers"] [class*="__OptionsWrapper"]'),
17
+ correctAnswerSectionAnswerText: () => cy.get('.question-text-wrapper'),
18
+ //grading view and correct answer view
19
+ optionGradingView: () => cy.get('[class*="DraggableItemsWrapper"] [class*="OptionTextWrapper"]'),
20
+ optionWrapperGradingView: () => cy.get('[class*="DraggableItemsWrapper"] [class*="OptionsWrapper"]'),
47
21
  }
48
22
 
49
23
  const steps = {
50
24
  ...createQuestionBasePage.steps,
51
25
  ...questionInstructionsComponent.steps,
52
- ...scoringSectionBase.steps,
53
- ...autoScoredSetCorrectAnswerSection.steps,
54
- ...commonComponents.steps,
26
+ ...scoringSectionBaseEditTab.steps,
55
27
  ...optionsWrapperComponent.steps,
56
- ...ckEditorToolbar.steps,
57
- ...equationEditorFlyout.steps,
58
- ...autoScoredScoringSectionMultipleResponsesType.steps,
59
- ...additionalSettingsPanel.steps,
60
- ...previewScoringAndShowCorrectAnswerComponent.steps,
61
- ...autoScoredPreviewBase.steps,
62
- ...autoScoredAdditionalSettings.steps,
63
- ...autoScoredScoringSection.steps,
64
- ...answerNumerationComponent.steps,
65
- ...setPointsPopupBase.steps,
66
- ...listSortingAndOrderingBase.steps,
67
- /**
68
- * @param {number} index set correct answer option index
69
- * @description this function verfies contents of options
70
- */
71
- verifyDragHandleButtonOfOptionInSetCorrectAnswerSection: (index) => {
72
- listOrderingPage.setCorrectAnswerSectionOption()
73
- .eq(index)
74
- .within(() => {
75
- listOrderingPage.dragHandleButton()
76
- .should('exist');
77
- });
78
- },
79
-
28
+ ...autoScoredScoringPreviewTab.steps,
29
+ ...correctIncorrectAnswerLabelComponent.steps,
30
+ ...autoScoredStudentViewSettings.steps,
31
+ ...autoScoredScoringSectionMultiResponseType.steps,
32
+ ...autoScoredSpecifyCorrectAnswerSection.steps,
80
33
  /**
81
- * @param {string[]} optionsTextArray options array for set correct answer option
82
- * @description this function verifies options text content
83
- */
84
- verifyOptionsTextContentInSetCorrectAnswerSection: (optionsTextArray) => {
85
- optionsTextArray.forEach((optionsText, index) => {
86
- listOrderingPage.setCorrectAnswerSectionOption()
87
- .eq(index)
88
- .should('have.text', optionsText);
89
- });
90
- },
91
-
92
- /**
93
- * @param {number} index of option
94
- * @description this function verifies image in set correct answer option input field
95
- */
96
- verifyImageAddedToOptionInSetCorrectAnswerSection: (index) => {
97
- listOrderingPage.setCorrectAnswerSectionOption()
98
- .eq(index)
99
- .find('img')
100
- .should('have.attr', 'src', constants.foxImageLink)
101
- .and('have.attr', 'alt', constants.foxImageAltText);
102
- },
103
-
104
- /**
105
- * @param {number} index of option
106
- * @description this function verifies equation in set correct answer option input field
107
- */
108
- verifyEquationAddedToOptionInSetCorrectAnswerSection: (index) => {
109
- listOrderingPage.setCorrectAnswerSectionOption()
110
- .eq(index)
111
- .contains(constants.CKEditorInputFieldEnteredEquationText)
112
- listOrderingPage.setCorrectAnswerSectionOption()
113
- .find('[role="math"]')
114
- .should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
115
- },
116
-
117
- /**
118
- * @param {number} index of option
119
- * @description this function link in set correct answer option input field
120
- */
121
- verifyLinkAddedToOptionInSetCorrectAnswerSection: (index) => {
122
- listOrderingPage.setCorrectAnswerSectionOption()
123
- .eq(index)
124
- .should('have.text', 'lorem')
125
- .find('a')
126
- .should('have.attr', 'href', `${Cypress.config().baseUrl}`)
127
- },
128
-
129
- /**
130
- * @param {number} index of option
131
- * @description this function bold text in set correct answer option input field
132
- */
133
- verifyBoldTextAddedToOptionInSetCorrectAnswerSection: (index) => {
134
- listOrderingPage.setCorrectAnswerSectionOption()
135
- .eq(index)
136
- .find('strong')
137
- .eq(0)
138
- .should('have.text', 'This is a bold option');
139
- },
140
-
141
- verifyDefaultAndActiveStateOfOptionInSetCorrectAnswerSection: () => {
142
- listOrderingPage.setCorrectAnswerSectionOption()
143
- .eq(0)
144
- .realHover()
145
- .should('have.css', 'border', `2px solid ${css.color.activeButtons}`)
146
- .find('.question-text-wrapper')
147
- .and('have.css', 'color', css.color.activeButtons);
148
- listOrderingPage.setCorrectAnswerSectionOption()
149
- .eq(0)
150
- .realHover({ position: 'topLeft' })
151
- .should('have.css', 'border', `1px solid ${css.color.figDefaultComponentBorder}`)
152
- .find('.question-text-wrapper')
153
- .and('have.css', 'color', css.color.text)
154
- },
155
-
156
- /**
157
- *
158
34
  * @param {string} optionsText text content of the option
159
- * @param {number} index the position at which the options is being dropped
160
- * @description click and drop a option into a position in the set correct answer section
35
+ * @param {number} targetIndex the position at which the options is being dropped
36
+ * @description click and drop a option into a position in the specify correct answer section
161
37
  */
162
- clickAndReorderOptionInSetCorrectAnswerSection: (optionsText, index) => {
163
- listOrderingPage.setCorrectAnswerSectionOption()
38
+ clickAndReorderOptionInSpecifyCorrectAnswerSection: (optionsText, targetIndex) => {
39
+ listOrderingPage.optionSpecifyCorrectAnswerSection()
164
40
  .contains(optionsText)
165
41
  .click();
166
- listOrderingPage.setCorrectAnswerSectionOption()
167
- .eq(index)
42
+ listOrderingPage.optionSpecifyCorrectAnswerSection()
43
+ .eq(targetIndex)
168
44
  .click();
169
45
  },
170
46
 
171
- verifyPointsInputFieldErrorMessage: () => {
172
- commonComponents.errorMessage()
173
- .eq(0)
174
- .should('have.text', 'Error: Please enter points.');
175
- },
176
-
177
- //Preview tab
178
- /**
179
- * @param {number} index set correct answer option index
180
- * @description this function verfies contents of options
181
- */
182
- verifyDragHandleButtonOfOptionInPreviewTab: (index) => {
183
- listOrderingPage.previewTabOption()
184
- .eq(index)
185
- .within(() => {
186
- listOrderingPage.dragHandleButton()
187
- .should('exist');
188
- });
189
- },
190
-
191
47
  /**
192
- * @param {string[]} optionsTextArray options array for set correct answer option
193
- * @description this function verifies options text content
48
+ * @param {string} optionsText text content of the option
49
+ * @param {number} targetIndex the position at which the options is being dropped
50
+ * @description click and drop a option into a position in the preview tab
194
51
  */
195
- verifyTextContentOfOptionsInPreviewTab: (optionsTextArray) => {
196
- optionsTextArray.forEach((optionsText, index) => {
197
- listOrderingPage.previewTabOption()
198
- .eq(index)
199
- .should('have.text', optionsText);
200
- });
52
+ clickAndReorderOptionInPreviewTab: (optionsText, targetIndex) => {
53
+ listOrderingPage.optionPreviewTab()
54
+ .contains(optionsText)
55
+ .click();
56
+ listOrderingPage.optionPreviewTab()
57
+ .eq(targetIndex)
58
+ .click();
201
59
  },
202
60
 
203
61
  /**
204
- * @param {number} index of option
205
- * @description this function verifies image text in preview tab options
62
+ * @description Verifies that the image in the Preview tab has the correct source and alt text.
63
+ * @param {number} optionIndex - The index of the option in the Preview tab.
206
64
  */
207
- verifyImageAddedToOptionInPreviewTab: (index) => {
208
- listOrderingPage.previewTabOption()
209
- .eq(index)
65
+ verifyOptionWithImageInPreviewTab: (optionIndex) => {
66
+ listOrderingPage.optionPreviewTab()
67
+ .eq(optionIndex)
210
68
  .find('img')
211
69
  .should('have.attr', 'src', constants.foxImageLink)
212
70
  .and('have.attr', 'alt', constants.foxImageAltText);
213
71
  },
214
72
 
215
73
  /**
216
- * @param {number} index of option
217
- * @description this function verifies equation text in preview tab options
218
- */
219
- verifyEquationAddedToOptionInPreviewTab: (index) => {
220
- listOrderingPage.previewTabOption()
221
- .eq(index)
222
- .contains(constants.CKEditorInputFieldEnteredEquationText)
223
- listOrderingPage.previewTabOption()
224
- .find('[role="math"]')
225
- .should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
226
- },
227
-
228
- /**
229
- * @param {number} index of option
230
- * @description this function verifies link in preview tab options
231
- */
232
- verifyLinkAddedToOptionInPreviewTab: (index) => {
233
- listOrderingPage.previewTabOption()
234
- .eq(index)
235
- .should('have.text', 'lorem')
236
- .find('a')
237
- .should('have.attr', 'href', `${Cypress.config().baseUrl}`)
238
- },
239
-
240
- /**
241
- * @param {number} index of option
242
- * @description this function verifies bold text in preview tab options
243
- */
244
- verifyBoldTextAddedToOptionInPreviewTab: (index) => {
245
- listOrderingPage.previewTabOption()
246
- .eq(index)
247
- .find('strong')
248
- .should('exist')
249
- .should('have.text', 'This is a bold option')
250
- },
251
-
252
- verifyDefaultAndActiveStateOfOptionInPreviewTab: () => {
253
- listOrderingPage.previewTabOption()
254
- .eq(0)
255
- .realHover()
256
- .should('have.css', 'border', `2px solid ${css.color.activeButtons}`)
257
- .find('.question-text-wrapper')
258
- .and('have.css', 'color', css.color.activeButtons);
259
- listOrderingPage.previewTabOption()
260
- .eq(0)
261
- .realHover({ position: 'topLeft' })
262
- .should('have.css', 'border', `1px solid ${css.color.figDefaultComponentBorder}`)
263
- .find('.question-text-wrapper')
264
- .and('have.css', 'color', css.color.text)
265
- },
266
-
267
- //Scoring
268
- /**
269
- * @param {number} points the points to be displayed in the partial equal weights points field
270
- * @description this function checks the points per response in partial equal weights
271
- */
272
- verifyPartialEqualWeightsPointsPerResponseScore: (points) => {
273
- listOrderingPage.partialEqualWeightsPointsPerResponseScore()
274
- .each(($element) => {
275
- cy.wrap($element)
276
- .verifyInnerText(points);
277
- });
278
- },
279
-
280
- /**
281
- * @description this function checks if the partial different weights points field is empty and visible
282
- */
283
- verifyPartialDifferentWeightsPointsInputFieldIsEmptyAndEnabled: () => {
284
- listOrderingPage.partialDifferentWeightsPointsInputField()
285
- .each(($element) => {
286
- cy.wrap($element)
287
- .should('have.value', '')
288
- .and('be.visible')
289
- .and('be.enabled');
290
- });
291
- },
292
-
293
- /**
294
- * @param {number[]} pointsArray the array of points to be alloted to each option
295
- * @description this function allots points to all the options
74
+ * @description Verifies that the bold text in the Preview tab is correct.
75
+ * @param {number} optionIndex - The index of the option in the Preview tab.
296
76
  */
297
- allotPartialDifferentWeightsToAllPointsFields: (pointsArray) => {
298
- pointsArray.forEach((points, columnIndex) => {
299
- listOrderingPage.partialDifferentWeightsPointsInputField()
300
- .eq(columnIndex)
301
- .clear()
302
- .type(points, { delay: 0 })
303
- .should('have.value', points);
304
- });
305
- },
306
-
307
- verifyPartialDifferentWeightsPointsPerResponseLabel: () => {
308
- listOrderingPage.partialDifferentWeightsPointsPerResponseLabel()
309
- .verifyInnerText('Points per response')
310
- .should('be.visible');
311
- },
312
-
313
- verifyPointsPerResponseLabel: () => {
314
- listOrderingPage.pointsPerResponseLabel()
315
- .verifyInnerText('Points per response')
316
- .should('be.visible');
77
+ verifyOptionWithBoldTextInPreviewTab: (optionIndex) => {
78
+ listOrderingPage.optionPreviewTab()
79
+ .eq(optionIndex)
80
+ .find('strong')
81
+ .should('have.text', 'This is a bold option');
317
82
  },
318
83
 
319
84
  /**
320
- *
321
- * @param {string} optionsText text content of the option
322
- * @param {number} index the position at which the options is being dropped
323
- * @description click and drop a option into a position in the set correct answer section
85
+ * @description Verifies that the equation text in the Preview tab is correct.
86
+ * @param {number} optionIndex - The index of the option in the Preview tab.
324
87
  */
325
- clickAndReorderOptionInPrevewTab: (optionsText, index) => {
326
- listOrderingPage.previewTabOption()
327
- .contains(optionsText)
328
- .click();
329
- listOrderingPage.previewTabOption()
330
- .eq(index)
331
- .click();
88
+ verifyOptionWithEquationTextInPreviewTab: (optionIndex) => {
89
+ listOrderingPage.optionPreviewTab()
90
+ .eq(optionIndex)
91
+ .find('[role="math"]')
92
+ .should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
93
+ .contains(constants.CKEditorInputFieldEnteredEquationText);
332
94
  },
333
95
 
334
96
  /**
335
- *
336
- * @param {string[]} optionsArray array of options set in options section
337
- * @description this function resets the question preview
97
+ * @param {string[]} optionsTextArray options array for set correct answer option
98
+ * @description this function verifies options text content
338
99
  */
339
- resetQuestionPreview: (optionsArray) => {
340
- createQuestionBasePage.steps.switchToEditTab();
341
- createQuestionBasePage.steps.switchToPreviewTab();
342
- listOrderingPage.steps.verifyTextContentOfOptionsInPreviewTab(optionsArray);
343
- },
344
-
345
- /**
346
- * @param {string[]} numerationArray array of numeration numbers, lowercase, uppercase
347
- * @description this function verifies the numeration of options
348
- */
349
- verifyOptionsNumeration: (numerationArray) => {
350
- numerationArray.forEach((optionNumeration, index) => {
351
- listOrderingPage.previewTabOption()
352
- .eq(index)
353
- .within(() => {
354
- listOrderingPage.optionNumeration()
355
- .should('have.text', optionNumeration);
356
- });
357
- });
100
+ verifyTextContentOfOptionInPreviewTab: (optionsText, index) => {
101
+ utilities.verifyTextContent(utilities.getNthElement(listOrderingPage.optionPreviewTab(), index), optionsText);
358
102
  },
359
103
 
360
104
  /**
361
105
  * @param {string} optionsText option to be checked for the correct icon
362
106
  * @description This function verifies the correct icon in the preview tab
363
107
  */
364
- verifyCorrectOptionsCheckmarkIcon: (optionsText) => {
365
- listOrderingPage.previewTabOption()
108
+ verifyCorrectOptionIcon: (optionsText) => {
109
+ listOrderingPage.optionWrapperPreviewTab()
366
110
  .contains(optionsText)
367
111
  .parents('.orderlist-option-wrapper')
368
112
  .within(() => {
369
- autoScoredPreviewBase.correctIcon()
370
- .and('be.visible');
113
+ utilities.verifyElementVisibilityState(autoScoredScoringPreviewTab.correctIcon(), 'exist');
371
114
  });
372
115
  },
373
116
 
@@ -375,383 +118,115 @@ const steps = {
375
118
  * @param {string} optionsText option to be checked for the correct icon
376
119
  * @description This function verifies the correct icon in the preview tab
377
120
  */
378
- verifyIncorrectOptionsCrossmarkIcon: (optionsText) => {
379
- listOrderingPage.previewTabOption()
121
+ verifyIncorrectOptionIcon: (optionsText) => {
122
+ listOrderingPage.optionWrapperPreviewTab()
380
123
  .contains(optionsText)
381
124
  .parents('.orderlist-option-wrapper')
382
125
  .within(() => {
383
- autoScoredPreviewBase.incorrectIcon()
384
- .and('be.visible');
126
+ utilities.verifyElementVisibilityState(autoScoredScoringPreviewTab.incorrectIcon(), 'exist');
385
127
  });
386
128
  },
387
129
 
388
- verifyQuestionPreviewStateWhenShowCorrectAnswerIsUnchecked: () => {
389
- cy.log('After deselecting Show correct answer checkbox, the question preview should return to the previous state');
390
- previewScoringAndShowCorrectAnswerComponent.steps.uncheckShowCorrectAnswerCheckbox();
391
- autoScoredPreviewBase.correctIcon()
392
- .should('not.exist');
393
- autoScoredPreviewBase.incorrectIcon()
394
- .should('not.exist');
395
- autoScoredPreviewBase.correctIncorrectAnswerLabel()
396
- .should('not.exist');
397
- autoScoredPreviewBase.steps.verifyCorrectIncorrectBorderNotVisible()
398
- },
399
-
400
- getOptionsArray: () => {
401
- const optionsArray = []
402
- listOrderingPage.previewTabOption()
403
- .each(($el) => {
404
- cy.wrap($el)
405
- .invoke('text')
406
- .then((text) => {
407
- optionsArray.push(text);
408
- });
409
- });
410
- return optionsArray;
130
+ verifyCorrectAnswerSectionNotExists: () => {
131
+ utilities.verifyElementVisibilityState(listOrderingPage.correctAnswersLabel(), 'notExist');
132
+ utilities.verifyElementVisibilityState(listOrderingPage.correctAnswerSectionAnswerWrapper(), 'notExist');
411
133
  },
412
134
 
413
135
  /**
414
- * @param {string[]} optionsArray array of options set in the options section
415
- * @description this function verifies if the options are Randomized in the preview tab
136
+ * @param {string[]} optionsTextArray array of options in the correct answer section
137
+ * @description this function verifies the correct order of options in correct answer section
416
138
  */
417
- verifyRandomizeOptionOrder: (optionsArray) => {
418
- let currentOptionsArray = [...optionsArray]
419
- for (let index = 0; index < currentOptionsArray.length; index++) {
420
- listOrderingPage.previewTabOption()
421
- .eq(index)
422
- .then(($element) => {
423
- expect($element.text()).to.be.oneOf(currentOptionsArray);
424
- currentOptionsArray = currentOptionsArray.filter((value) => value !== $element.text())
139
+ verifyOptionsInCorrectAnswerSection: (optionsTextArray) => {
140
+ optionsTextArray.forEach((optionsText, index) => {
141
+ utilities.getNthElement(listOrderingPage.correctAnswerSectionAnswerWrapper(), index)
142
+ .within(() => {
143
+ utilities.verifyTextContent(listOrderingPage.correctAnswerSectionAnswerText(), optionsText);
425
144
  });
426
- };
427
- listOrderingPage.steps.verifyOptionsAreRerandomized(optionsArray)
428
- },
429
-
430
- /**
431
- * @param {string[]} previousOrderOfOptionsArray array of previous order of options
432
- * @description this function verifies that the order of the options is different from the previous order
433
- */
434
- verifyOptionsAreRerandomized: (previousOrderOfOptionsArray) => {
435
- listOrderingPage.previewTabOption()
436
- .should('not.have.text', '')
437
- .and('not.have.text', previousOrderOfOptionsArray.join(''));
438
- },
439
-
440
- /**
441
- * @param {number} index set correct answer option index
442
- * @description this function verfies drag handle of options does not exist
443
- */
444
- verifyDragHandleButtonDoesNotExistInSetCorrectAnswerSection: (index) => {
445
- listOrderingPage.setCorrectAnswerSectionOption()
446
- .eq(index)
447
- .within(() => {
448
- listOrderingPage.dragHandleButton()
449
- .should('not.exist');
450
- });
145
+ });
451
146
  },
452
147
 
453
148
  /**
454
- * @param {number} index set correct answer option index
455
- * @description this function verfies drag handle of options does not exist
149
+ * @description Verifies that the image in the Preview tab has the correct source and alt text.
150
+ * @param {number} optionIndex - The index of the option in the Preview tab.
456
151
  */
457
- verifyDragHandleButtonDoesNotExistInPreviewTab: (index) => {
458
- listOrderingPage.previewTabOption()
459
- .eq(index)
460
- .within(() => {
461
- listOrderingPage.dragHandleButton()
462
- .should('not.exist');
463
- });
464
- },
465
-
466
- //Additional settings
467
-
468
- verifyNoBorderForSetCorrectAnswerOption: () => {
469
- listOrderingPage.setCorrectAnswerSectionOption()
470
- .eq(0)
471
- .should('have.css', 'border')
472
- .and('match', /0px none/);
473
- },
474
-
475
- verifyNoBorderForPreviewTabOption: () => {
476
- listOrderingPage.previewTabOption()
477
- .eq(0)
478
- .should('have.css', 'border')
479
- .and('match', /0px none/);
480
- },
481
-
482
- clickOnSetPointsButton: () => {
483
- listOrderingPage.buttonSetPoints()
484
- .click();
485
- },
486
-
487
- verifySetPointsButton: () => {
488
- utilities.verifyInnerText(listOrderingPage.buttonSetPoints(), 'Set points');
489
- utilities.verifyElementVisibilityState(listOrderingPage.setPointsIcon(), 'visible');
490
- },
491
-
492
- /**
493
- * @param {number} index of option
494
- * @description this function verifies image in set points popup
495
- */
496
- verifyImageAddedToOptionInSetPointsPopup: (index) => {
497
- setPointsPopupBase.setPointsPopupOptions()
498
- .eq(index)
152
+ verifyOptionWithImageInGradingView: (optionIndex) => {
153
+ listOrderingPage.optionGradingView()
154
+ .eq(optionIndex)
499
155
  .find('img')
500
156
  .should('have.attr', 'src', constants.foxImageLink)
501
157
  .and('have.attr', 'alt', constants.foxImageAltText);
502
158
  },
503
159
 
504
160
  /**
505
- * @param {number} index of option
506
- * @description this function verifies equation text in set points popup
507
- */
508
- verifyEquationAddedToOptionInSetPointsPopup: (index) => {
509
- setPointsPopupBase.setPointsPopupOptions()
510
- .eq(index)
511
- .contains(constants.CKEditorInputFieldEnteredEquationText)
512
- setPointsPopupBase.setPointsPopupOptions()
513
- .find('[role="math"]')
514
- .should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
515
- },
516
-
517
- /**
518
- * @param {number} index of option
519
- * @description this function link in set points popup
161
+ * @description Verifies that the bold text in the Preview tab is correct.
162
+ * @param {number} optionIndex - The index of the option in the Preview tab.
520
163
  */
521
- verifyLinkAddedToOptionInSetPointsPopup: (index) => {
522
- setPointsPopupBase.setPointsPopupOptions()
523
- .eq(index)
524
- .should('have.text', 'lorem')
525
- .find('a')
526
- .should('have.attr', 'href', `${Cypress.config().baseUrl}`)
527
- },
528
-
529
- /**
530
- * @param {number} index of option
531
- * @description this function bold text in in set points popup
532
- */
533
- verifyBoldTextAddedToOptionInSetPointsPopup: (index) => {
534
- setPointsPopupBase.setPointsPopupOptions()
535
- .eq(index)
164
+ verifyOptionWithBoldTextInGradingView: (optionIndex) => {
165
+ listOrderingPage.optionGradingView()
166
+ .eq(optionIndex)
536
167
  .find('strong')
537
- .eq(0)
538
168
  .should('have.text', 'This is a bold option');
539
169
  },
540
170
 
541
171
  /**
542
- * @param {number[]} numerationArray numeration array for the option
543
- * @description this function checks the numeration of options in set points popup
172
+ * @description Verifies that the equation text in the Preview tab is correct.
173
+ * @param {number} optionIndex - The index of the option in the Preview tab.
544
174
  */
545
- verifySetPointsPopupOptionNumeration: (numerationArray) => {
546
- numerationArray.forEach((optionNumeration, index) => {
547
- setPointsPopupBase.dialogBox()
548
- .within(() => {
549
- listOrderingPage.optionNumeration()
550
- .eq(index)
551
- .should('have.text', optionNumeration);
552
- });
553
- });
554
- },
555
-
556
- verifyCorrectIncorrectAnswerLabel: (labelText) => {
557
- autoScoredPreviewBase.correctIncorrectAnswerLabel()
558
- .should('be.visible')
559
- .verifyInnerText(`${labelText} answer`)
560
- .parents('[class*="__AnswerStatusWrapper"]')
561
- .find('[class*="__AnswerStatusIcon"]')
562
- .should('be.visible')
563
- .should('have.text', `${labelText}-Icon`)
564
- }
565
- }
566
-
567
- const tests = {
568
- ...createQuestionBasePage.tests,
569
- ...commonComponents.tests,
570
- ...questionInstructionsComponent.tests,
571
- ...autoScoredScoringSection.tests,
572
- ...scoringSectionBase.tests,
573
- ...autoScoredSetCorrectAnswerSection.tests,
574
- ...previewScoringAndShowCorrectAnswerComponent.tests,
575
- ...additionalSettingsPanel.tests,
576
- ...autoScoredAdditionalSettings.tests,
577
- ...answerNumerationComponent.tests,
578
- ...studentResponseAndLayoutComponent.tests,
579
- ...listSortingAndOrderingBase.tests,
580
- verifyAllContentsOfSetCorrectAnswerSectionForScoringType: (scoringType, optionsArray) => {
581
- it(`When user has selected ${scoringType} scoring type then added options should be displayed in the set correct answer section`, () => {
582
- listOrderingPage.steps.verifyOptionsTextContentInSetCorrectAnswerSection(optionsArray);
583
- for (let index = 0; index < 4; index++) {
584
- listOrderingPage.steps.verifyDragHandleButtonOfOptionInSetCorrectAnswerSection(index);
585
- }
586
- });
175
+ verifyOptionWithEquationTextInGradingView: (optionIndex) => {
176
+ listOrderingPage.optionGradingView()
177
+ .eq(optionIndex)
178
+ .find('[role="math"]')
179
+ .should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
180
+ .contains(constants.CKEditorInputFieldEnteredEquationText);
587
181
  },
588
182
 
589
183
  /**
590
- * @param {number} totalPoints the maximum points that can be scored by the user
591
- * @description this function verifies the functionality of minimum points when penalty points are not set and user attempts incorrect answer
184
+ * @param {string[]} optionsTextArray options array for set correct answer option
185
+ * @description this function verifies options text content
592
186
  */
593
- verifyMinimumScoreAwardedIfAttemptedFunctionalityForIncorrectAnswer: (totalPoints) => {
594
- it('When user has provided minimum score awarded (if attempted) points, then in Preview tab on entering incorrect answer, minimum score should be provided for the question', () => {
595
- cy.log('Switch to edit tab and set minimum score if attempted points')
596
- createQuestionBasePage.steps.switchToEditTab();
597
- scoringSectionBase.steps.expandMinimumScoringDropdown();
598
- scoringSectionBase.steps.selectMinimumScoringTypeListOption('Award minimum score only if attempted');
599
- scoringSectionBase.steps.allotMinimumScoreAwardedIfAttempted('1')
600
- createQuestionBasePage.steps.switchToPreviewTab()
601
- listOrderingPage.steps.clickAndReorderOptionInPrevewTab('plant', 0);
602
- listOrderingPage.steps.clickAndReorderOptionInPrevewTab('seed', 1);
603
- listOrderingPage.steps.clickAndReorderOptionInPrevewTab('flower', 2);
604
- listOrderingPage.steps.verifyTextContentOfOptionsInPreviewTab(['plant', 'seed', 'flower', 'sprout']);
605
- listOrderingPage.previewScoreText()
606
- .verifyInnerText(`1/${totalPoints}`);
607
- });
608
-
609
- it('When user removes minimum score awarded (if attempted) points, then in Preview tab on selecting any options other than correct answers, points should not be provided', () => {
610
- cy.log('Switch to edit tab and remove minimum score if attempted points')
611
- createQuestionBasePage.steps.switchToEditTab();
612
- scoringSectionBase.steps.clearMinimumScoreIfAttemptedPointsField();
613
- createQuestionBasePage.steps.switchToPreviewTab()
614
- listOrderingPage.steps.clickAndReorderOptionInPrevewTab('plant', 0);
615
- listOrderingPage.steps.clickAndReorderOptionInPrevewTab('seed', 1);
616
- listOrderingPage.steps.clickAndReorderOptionInPrevewTab('flower', 2);
617
- listOrderingPage.steps.verifyTextContentOfOptionsInPreviewTab(['plant', 'seed', 'flower', 'sprout']);
618
- listOrderingPage.previewScoreText()
619
- .verifyInnerText(`0/${totalPoints}`);
620
- });
187
+ verifyTextContentOfOptionInGradingView: (optionsText, index) => {
188
+ utilities.verifyTextContent(utilities.getNthElement(listOrderingPage.optionGradingView(), index), optionsText);
621
189
  },
622
190
 
623
191
  /**
624
- *
625
- * @param {number} scoredPoints the points scored by the user when penalty points are reduced
626
- * @param {number} totalPoints the maximum points that can be scored by the user
627
- * @description this function verifies the functionality of Penalty points when minimum points are not set and user attempts incorrect answer
192
+ * @param {string} optionsText text content of the option
193
+ * @param {number} index the position at which the options is being dropped
194
+ * @description click and drop a option into a position in the set correct answer section
628
195
  */
629
- verifyPenaltyPointsFunctionalityForIncorrectAnswer: (scoredPoints, totalPoints) => {
630
- it('When user has defined penalty points', () => {
631
- cy.log('Pre-step: Switch to edit tab and set penalty points');
632
- createQuestionBasePage.steps.switchToEditTab();
633
- autoScoredScoringSectionMultipleResponsesType.steps.allotPenaltyPoints(3)
634
-
635
- cy.log('After switching to preview tab, when user adds an incorrect answer input, then 0 points should be awarded(no negative points)');
636
- createQuestionBasePage.steps.switchToPreviewTab();
637
- listOrderingPage.steps.clickAndReorderOptionInPrevewTab('plant', 1);
638
- listOrderingPage.steps.verifyTextContentOfOptionsInPreviewTab(['sprout', 'plant', 'flower', 'seed']);
639
- listOrderingPage.previewScoreText()
640
- .verifyInnerText(`0/${totalPoints}`);
641
-
642
- cy.log('When user adds a partially correct answer input, the points should be updated accordingly with deducted penalty points');
643
- listOrderingPage.steps.resetQuestionPreview(['sprout', 'plant', 'flower', 'seed'])
644
- listOrderingPage.steps.clickAndReorderOptionInPrevewTab('seed', 0);
645
- listOrderingPage.steps.clickAndReorderOptionInPrevewTab('plant', 1);
646
- listOrderingPage.steps.verifyTextContentOfOptionsInPreviewTab(['seed', 'plant', 'sprout', 'flower']);
647
- listOrderingPage.previewScoreText()
648
- .verifyInnerText(`${scoredPoints}/${totalPoints}`);
649
-
650
- cy.log('Post step: Clearing the Penalty points field')
651
- createQuestionBasePage.steps.switchToEditTab();
652
- autoScoredScoringSectionMultipleResponsesType.penaltyPointsInputField()
653
- .clear();
654
- });
655
- },
656
-
657
- /**
658
- * @param {*} totalPointsScored the maximum points that can be achieved by the user
659
- * @description this function verifies the functionality of penalty points when penalty points are set and user attempts alternate tab answers
660
- */
661
- verifyPenaltyPointsFunctionalityForAlternateTabAnswers: (totalPointsScored) => {
662
- it('When the user has alloted penalty points and attempts the question according to the alternate tab then user should be awarded with full points of the alternate tab and penalty points should not be deducted', () => {
663
- listOrderingPage.steps.switchToEditTab()
664
- listOrderingPage.steps.allotPenaltyPoints(3);
665
- listOrderingPage.steps.switchToPreviewTab();
666
- listOrderingPage.steps.clickAndReorderOptionInPrevewTab('seed', 0);
667
- listOrderingPage.steps.clickAndReorderOptionInPrevewTab('plant', 3);
668
- listOrderingPage.steps.clickAndReorderOptionInPrevewTab('flower', 1);
669
- listOrderingPage.steps.verifyTextContentOfOptionsInPreviewTab(['seed', 'flower', 'sprout', 'plant']);
670
- listOrderingPage.steps.verifyPreviewTabScoreText(`${totalPointsScored}`, `${totalPointsScored}`);
671
- cy.log('Post step: Clearing the Penalty points field')
672
- createQuestionBasePage.steps.switchToEditTab();
673
- autoScoredScoringSectionMultipleResponsesType.penaltyPointsInputField()
674
- .clear();
675
- });
196
+ clickAndReorderOptionInGradingView: (optionsText, index) => {
197
+ listOrderingPage.optionGradingView()
198
+ .contains(optionsText)
199
+ .click();
200
+ listOrderingPage.optionGradingView()
201
+ .eq(index)
202
+ .click();
676
203
  },
677
204
 
678
205
  /**
679
- * @param {number[]} scoredPointsArray An array of numbers representing points scored in different cases.
680
- * - The first element represents points scored for incorrect answers.
681
- * - The second element represents points scored for partially correct answers.
682
- * - The third element represents points scored when minimum score awarded (if attempted) points is greater than the points achieved by attempting the question partially correct
683
- * @param {number} minimumPointsForPartialCorrectAnswers minimum score awarded (if attempted) points on attempting the question partially correct
684
- * @param {number} totalPoints the maximum points that can be achieved by the user
685
- * @description this function verifies the functionality of Minimum score if attempted points when penalty points are set and user attempts incorrect answer
686
- * - For all incorrect responses
687
- * - For partially correct responses, when points scored > minimum score awarded(if attempted) points
688
- * - For partially correct responses, when minimum score awarded(if attempted) points > points scored
206
+ * Verifies the order of options in the "Specify Correct Answer" section.
207
+ * @param {string[]} optionsTextArray - An array containing the text of options in the expected order.
689
208
  */
690
- verifyMinimumScoreIfAttemptedAndPenaltyPointsFunctionalityForIncorrectAnswer: (scoredPointsArray, minimumPointsForPartialCorrectAnswers, totalPoints) => {
691
- it('When user has defined both penalty points and minimum score awarded (if attempted) points', () => {
692
- cy.log('Pre-step: Switch to edit tab and set minimum score awarded (if attempted) points and Penalty points');
693
- createQuestionBasePage.steps.switchToEditTab();
694
- scoringSectionBase.steps.allotMinimumScoreAwardedIfAttempted(1);
695
- autoScoredScoringSectionMultipleResponsesType.steps.allotPenaltyPoints(3);
696
-
697
- cy.log('Switch to preview tab and give incorrect answer input to check that minimum points are displayed');
698
- createQuestionBasePage.steps.switchToPreviewTab();
699
- listOrderingPage.steps.clickAndReorderOptionInPrevewTab('flower', 0);
700
- listOrderingPage.steps.clickAndReorderOptionInPrevewTab('sprout', 3);
701
- listOrderingPage.steps.verifyTextContentOfOptionsInPreviewTab(['flower', 'plant', 'seed', 'sprout']);
702
- listOrderingPage.previewScoreText()
703
- .verifyInnerText(`${scoredPointsArray[0]}/${totalPoints}`);
704
-
705
- cy.log('When user adds a partially correct answer such that the points of the attempt(with penalty points deducted) is more than the minimum score awarded(if attempted) points');
706
- listOrderingPage.steps.resetQuestionPreview(['sprout', 'plant', 'flower', 'seed']);
707
- listOrderingPage.steps.clickAndReorderOptionInPrevewTab('seed', 0);
708
- listOrderingPage.steps.clickAndReorderOptionInPrevewTab('plant', 1);
709
- listOrderingPage.steps.verifyTextContentOfOptionsInPreviewTab(['seed', 'plant', 'sprout', 'flower']);
710
- listOrderingPage.previewScoreText()
711
- .verifyInnerText(`${scoredPointsArray[1]}/${totalPoints}`);
712
-
713
- cy.log('When user switches to edit tab and increases the minimum score awarded (if attempted) points to check the case for an attempt in which points of the attempt is less than minimum score awarded (if attempted) points, then the minimum score awarded (if attempted) points should be displayed to the user');
714
- createQuestionBasePage.steps.switchToEditTab();
715
- scoringSectionBase.steps.clearMinimumScoreIfAttemptedPointsField()
716
- scoringSectionBase.steps.allotMinimumScoreAwardedIfAttempted(minimumPointsForPartialCorrectAnswers)
717
- cy.log('Switching to preview tab');
718
- createQuestionBasePage.steps.switchToPreviewTab();
719
- listOrderingPage.steps.clickAndReorderOptionInPrevewTab('seed', 0);
720
- listOrderingPage.steps.clickAndReorderOptionInPrevewTab('plant', 1);
721
- listOrderingPage.steps.clickAndReorderOptionInPrevewTab('flower', 2);
722
- listOrderingPage.steps.verifyTextContentOfOptionsInPreviewTab(['seed', 'plant', 'flower', 'sprout']);
723
- listOrderingPage.previewScoreText()
724
- .verifyInnerText(`${scoredPointsArray[2]}/${totalPoints}`);
209
+ verifyOptionsOrderInSpecifyCorrectAnswerSection: (optionsTextArray) => {
210
+ optionsTextArray.forEach((option, index) => {
211
+ utilities.verifyTextContent(utilities.getNthElement(listOrderingPage.optionSpecifyCorrectAnswerSection(), index), option);
725
212
  });
726
213
  },
727
214
 
728
- //Additional settings
729
215
  /**
730
- * @param {string[]} numerationArray array of the numeration displayed with options numbers| lowercase| uppercase
731
- * @description this function checks the numeration displayed for the options and correct answer container options when Show correct answer is checked
216
+ * Verifies the order of options in the preview tab
217
+ * @param {string[]} optionsTextArray - An array containing the text of options in the expected order.
732
218
  */
733
- verifyOptionsAndCorrectAnswerContainerNumerationWhenShowCorrectAnswerCheckboxIsChecked: (numerationArray) => {
734
- it('When user clicks on \'Show correct answer\' checkbox then the numeration should be displayed on the options as well as \'Correct answers:\' section', () => {
735
- listOrderingPage.steps.checkShowCorrectAnswerCheckbox()
736
- steps.verifyOptionsNumeration(numerationArray)
737
- steps.verifyCorrectAnswerContainerNumeration(numerationArray)
738
- cy.log('Post step: Uncheck \'Show correct answer\' checkbox')
739
- listOrderingPage.steps.uncheckShowCorrectAnswerCheckbox()
740
- });
741
- },
742
-
743
- /**
744
- * @param {string[]} numerationArray array of the numeration displayed with options numbers| lowercase| uppercase
745
- * @description this function checks the numeration displayed for the options and correct answer container options when check answer is selected
746
- */
747
- verifyOptionsNumerationWhenCheckAnswerIsSelected: (numerationArray) => {
748
- it('When user clicks on \'Check answer\' button then the numeration should be displayed in the options', () => {
749
- listOrderingPage.steps.checkAnswer()
750
- steps.verifyOptionsNumeration(numerationArray)
219
+ verifyOptionsOrderInPreviewTab: (optionsTextArray) => {
220
+ optionsTextArray.forEach((option, index) => {
221
+ utilities.verifyTextContent(utilities.getNthElement(listOrderingPage.optionPreviewTab(), index), option);
751
222
  });
752
223
  }
753
224
  }
754
225
 
226
+ const tests = {
227
+ ...autoScoredScoringPreviewTab.tests
228
+ }
229
+
755
230
  export const listOrderingPage = {
756
231
  ...selectors,
757
232
  steps,