itemengine-cypress-automation 1.0.119 → 1.0.121

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. package/cypress/e2e/ILC/AudioResponseNew/editTabBasicSection.js +13 -1
  2. package/cypress/e2e/ILC/AudioResponseNew/gradingViewAndCorrectAnswerViewContents.smoke.js +2 -0
  3. package/cypress/e2e/ILC/AudioResponseNew/previewContentsForAllViews.smoke.js +1 -0
  4. package/cypress/e2e/ILC/AudioResponseNew/standardRecorderStyle.smoke.js +2 -0
  5. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/Scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +1 -1
  6. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/clickAndDrop.js +2 -2
  7. package/cypress/e2e/ILC/DragAndDropIntoCategoriesNew/studentViewSettings.js +1 -4
  8. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/allOrNothingForAllViews.smoke.js +273 -0
  9. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/checkAnswerFunctionalityForAllViews.smoke.js +116 -0
  10. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/previewContentsForAllViews.smoke.js +136 -0
  11. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/allOrNothingForAllView.smoke.js +224 -0
  12. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/checkAnswerFunctionalityForAllViews.smoke.js +120 -0
  13. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/previewContentsForAllViews.smoke.js +158 -0
  14. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/backgroundImageAndCanvasProperties.js +1 -1
  15. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/studentViewSettings.js +1 -4
  16. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/dropdownAndDropdownMenuSection.js +246 -0
  17. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/dropdownOptionsSection.js +332 -0
  18. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/editTabBasicSection.js +409 -0
  19. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/headerSection.js +80 -0
  20. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/studentViewSettings.js +213 -0
  21. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/HeaderSection.js +1 -1
  22. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/Scoring/partialDifferentWeightsBasic.js +2 -2
  23. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/Scoring/partialEqualWeightsBasic.js +1 -1
  24. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/allOrNothingForAllViews.smoke.js +2 -2
  25. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/backgroundImageAndCanvasProperties.js +68 -68
  26. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/editTabScoringSection.js +6 -6
  27. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/previewContentsForAllViews.smoke.js +1 -1
  28. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/setLimitSection.js +3 -289
  29. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/specialCharactersSection.js +1 -1
  30. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/specifyCorrectAnswerSection.js +2 -2
  31. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/studentViewSettings.js +2 -23
  32. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/allOrNothingAlternativePointsGreaterThanCorrectPoints.js +191 -0
  33. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/allOrNothingCorrectPointsEqualToAlternativePoints.js +190 -0
  34. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +284 -0
  35. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/allOrNothingPenaltyScoring.js +52 -0
  36. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/manuallyAndNonScored.js +113 -0
  37. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsAlternativePointsGreaterThanCorrectPoints.js +217 -0
  38. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsBasic.js +234 -0
  39. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsWithCorrectPointsEqualToAlternativePoints.js +217 -0
  40. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsWithCorrectPointsGreaterThanAlternativePoints.js +217 -0
  41. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialEqualWeightsBasic.js +136 -0
  42. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialEqualWeightsWithAlternativePointsGreaterThanCorrectPoints.js +197 -0
  43. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialEqualWeightsWithCorrectPointsEqualToAlternativePoints.js +169 -0
  44. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialEqualWeightsWithCorrectPointsGreaterThanAlternativePoints.js +197 -0
  45. package/cypress/e2e/ILC/FillInTheGapsTextNew/allOrNothingForAllViews.smoke.js +219 -0
  46. package/cypress/e2e/ILC/FillInTheGapsTextNew/checkAnswerFunctionalityForAllViews.smoke.js +115 -0
  47. package/cypress/e2e/ILC/FillInTheGapsTextNew/editTabBasicSection.js +142 -0
  48. package/cypress/e2e/ILC/FillInTheGapsTextNew/previewContentsForAllViews.smoke.js +152 -0
  49. package/cypress/e2e/ILC/FillInTheGapsTextNew/setLimitSection.js +39 -0
  50. package/cypress/e2e/ILC/MultipleSelection/studentViewSettings.js +2 -12
  51. package/cypress/e2e/ILC/ShortTextResponseNew/conditionalCheckboxes.js +497 -0
  52. package/cypress/e2e/ILC/ShortTextResponseNew/editTabBasicSections.js +503 -0
  53. package/cypress/e2e/ILC/ShortTextResponseNew/responseAnswersAndAcceptedStudentInput.js +233 -0
  54. package/cypress/e2e/ILC/ShortTextResponseNew/specialCharactersSection.js +291 -0
  55. package/cypress/e2e/ILC/ShortTextResponseNew/studentViewSettings.js +332 -0
  56. package/cypress/e2e/ILC/SingleSelection/studentViewSettings.js +2 -12
  57. package/cypress/e2e/ILC/TextEntryMath/editTabBasicSection.js +9 -8
  58. package/cypress/e2e/ILC/TextEntryMath/editTabScoringSection.js +4 -4
  59. package/cypress/e2e/ILC/TextEntryMath/minimumScoringPenaltyPointsAndRoundingDropdown.js +8 -2
  60. package/cypress/e2e/ILC/TextEntryMath/specifyCorrectAnswerSection.js +5 -2
  61. package/cypress/e2e/ILC/TextEntryMathWithImage/allOrNothingScoringForAllViews.smoke.js +334 -0
  62. package/cypress/e2e/ILC/TextEntryMathWithImage/backgroundImageAndCanvasProperties.js +419 -0
  63. package/cypress/e2e/ILC/TextEntryMathWithImage/checkAnswerFunctionalityForAllViews.smoke.js +166 -0
  64. package/cypress/e2e/ILC/TextEntryMathWithImage/previewTabContentsForAllViews.smoke.js +166 -0
  65. package/cypress/e2e/ILC/UploadResponse/editTabScoringSection.js +51 -0
  66. package/cypress/e2e/ILC/UploadResponse/gradingViewAndCorrectAnswerViewContents.smoke.js +99 -0
  67. package/cypress/e2e/ILC/UploadResponse/manuallyAndNonScoredScoring.js +71 -0
  68. package/cypress/e2e/ILC/UploadResponse/previewContentsForAllViews.smoke.js +155 -0
  69. package/cypress/e2e/ILC/UploadResponse/uploadResponseHeaderSection.js +66 -0
  70. package/cypress/e2e/migration/migration.js +6 -5
  71. package/cypress/e2e/migration/migration2.js +4 -3
  72. package/cypress/e2e/migration/migration3.js +4 -3
  73. package/cypress/e2e/migration/migration4.js +4 -3
  74. package/cypress/e2e/migration/migration5.js +4 -3
  75. package/cypress/fixtures/theme/ilc.json +3 -1
  76. package/cypress/pages/audioResponsePage.js +2 -1
  77. package/cypress/pages/components/additionalSettingsPanel.js +27 -0
  78. package/cypress/pages/components/autoScoredPreviewBase.js +1 -1
  79. package/cypress/pages/components/autoScoredScoringSection.js +1 -1
  80. package/cypress/pages/components/autoScoredScoringSectionMultipleResponsesType.js +1 -1
  81. package/cypress/pages/components/autoScoredSetCorrectAnswerSection.js +1 -1
  82. package/cypress/pages/components/autoScoredSpecifyCorrectAnswerSection.js +2 -2
  83. package/cypress/pages/components/autoScoredStudentViewSettings.js +8 -1
  84. package/cypress/pages/components/backgroundImageUploadComponent.js +5 -5
  85. package/cypress/pages/components/createQuestionBasePage.js +8 -2
  86. package/cypress/pages/components/essayResponseCommonComponents.js +6 -0
  87. package/cypress/pages/components/fillInTheGapsCommonComponents.js +13 -0
  88. package/cypress/pages/components/fillInTheGapsDragAndDropCommonComponents.js +40 -0
  89. package/cypress/pages/components/fillInTheGapsDropdownCommonComponent.js +422 -314
  90. package/cypress/pages/components/fillInTheGapsTextCommonComponent.js +438 -710
  91. package/cypress/pages/components/{figOverImageCanvasComponent.js → imageCanvasComponent.js} +274 -272
  92. package/cypress/pages/components/index.js +3 -3
  93. package/cypress/pages/components/maximumRecorderLengthComponent.js +55 -11
  94. package/cypress/pages/components/previewScoringAndShowCorrectAnswerComponent.js +1 -1
  95. package/cypress/pages/components/questionInputFieldComponent.js +49 -23
  96. package/cypress/pages/components/scoringSectionBase.js +1 -1
  97. package/cypress/pages/createItemPage.js +67 -2
  98. package/cypress/pages/fillInTheGapsDragAndDropPage.js +172 -711
  99. package/cypress/pages/fillInTheGapsDropdownPage.js +75 -72
  100. package/cypress/pages/fillInTheGapsOverImageDragAndDropPage.js +4 -4
  101. package/cypress/pages/fillInTheGapsOverImageDropdownPage.js +109 -273
  102. package/cypress/pages/fillInTheGapsOverImageTextPage.js +49 -291
  103. package/cypress/pages/fillInTheGapsTextPage.js +52 -199
  104. package/cypress/pages/index.js +5 -5
  105. package/cypress/pages/multipleSelectionPage.js +1 -0
  106. package/cypress/pages/shortTextResponsePage.js +575 -33
  107. package/cypress/pages/singleSelectionGridPage.js +1 -2
  108. package/cypress/pages/singleSelectionPage.js +5 -6
  109. package/cypress/pages/textEntryMathPage.js +46 -22
  110. package/cypress/pages/textEntryMathWithImagePage.js +212 -0
  111. package/cypress/pages/uploadResponsePage.js +74 -21
  112. package/cypress/support/migrationHelpers/extractLrnQuestionData.js +73 -2
  113. package/cypress/support/migrationHelpers/lrnQestionTypesENUM.js +1 -0
  114. package/cypress/support/migrationHelpers/verifyIeQuestionData.js +49 -2
  115. package/package.json +1 -1
  116. package/cypress/e2e/ILC/AudioResponseNew/minimalRecorderStyle.js +0 -482
  117. package/cypress/e2e/ILC/EssayResponse/essayResponseEquationEditor.smoke.js +0 -412
  118. package/cypress/pages/components/figOverImageCommonComponent.js +0 -1113
  119. package/cypress/pages/dragAndDropIntoCategoriesAllOrNothingScoring.js +0 -1155
  120. package/cypress/pages/dragAndDropIntoCategoriesCellsScoring.js +0 -1561
  121. package/cypress/pages/dragAndDropIntoCategoriesResponseScoring.js +0 -1396
  122. package/cypress/pages/fillInTheGapsScoring.js +0 -5872
  123. package/cypress/pages/fillInTheGapsSetCorrectAnswerSection.js +0 -260
@@ -1,65 +1,66 @@
1
- import utilities from "../../support/helpers/utilities"
2
- import { commonComponents } from "./commonComponents"
3
- import { optionsWrapperComponent } from "./optionsWrapperComponent"
4
- import { scoringSectionBase } from "./scoringSectionBase"
5
- import { autoScoredSetCorrectAnswerSection } from "./autoScoredSetCorrectAnswerSection"
6
- import { autoScoredScoringSectionMultipleResponsesType } from "./autoScoredScoringSectionMultipleResponsesType"
7
- import { additionalSettingsPanel } from "./additionalSettingsPanel"
8
- import { autoScoredAdditionalSettings } from "./autoScoredAdditionalSettings"
1
+ import utilities from "../../support/helpers/utilities";
2
+ import { autoScoredScoringSectionMultiResponseType } from "./autoScoredScoringSectionMultiResponseType";
3
+ import { autoScoredSpecifyCorrectAnswerSection } from "./autoScoredSpecifyCorrectAnswerSection";
4
+ import { commonComponents } from "./commonComponents";
5
+ import { optionsWrapperComponent } from "./optionsWrapperComponent";
6
+ import { createQuestionBasePage } from "./createQuestionBasePage";
9
7
  const css = Cypress.env('css');
10
8
 
11
- let optionsForResponse = ['changing', 'progressively', 'healthy', 'new'];
12
-
13
9
  const selectors = {
14
- ...commonComponents,
15
- ...optionsWrapperComponent,
16
- ...scoringSectionBase,
17
- optionsForResponseContainer: () => cy.get('.edit-mcq-options-wrapper'),
18
- optionsForResponseLabel: () => cy.get('.options-label'),
19
- responseDropdownOptions: (ariaLabel = null) => {
10
+ //Dropdown options section
11
+ dropdownOptionsLabel: () => cy.get('.dropdown-options-label'),
12
+ dropdownOptionsTab: () => cy.get('.ngie-tablist-tab-button[data-ngie-testid*="dropdown"]'),
13
+ dropdownOptionsInputField: () => cy.get('.input-editable input[type*="text"]'),
14
+ dropdownOptionsInputFieldNumeration: () => cy.get('[class*="MuiInputAdornment"]'),
15
+
16
+ //Specify correct answer dropdown
17
+ dropdownWrapperSpecifyCorrectAnswerSection: () => cy.get('.response-dropdown-wrapper'),
18
+ dropdownSpecifyCorrectAnswerSection: () => cy.get('.response-dropdown [role="combobox"]'),
19
+ dropdownLabelSpecifyCorrectAnswerSection: () => cy.get('.response-label'),
20
+
21
+ //Dropdown list
22
+ dropdownList: () => cy.get('.dropdown-list-ul'),
23
+ dropdownListOptions: (ariaLabel = null) => {
20
24
  if (ariaLabel) {
21
25
  return cy.get(`[role="listbox"] .dropdown-menu-item[aria-label*="${ariaLabel}"]`)
22
26
  } else {
23
27
  return cy.get('[role="listbox"] .dropdown-menu-item')
24
28
  }
25
29
  },
26
- responseDropdownOptionText: () => cy.get('[role="listbox"] .dropdown-menu-item .dropdown-label-text'),
27
- responseDropdownSetCorrectAnswerSection: () => cy.get('.response-dropdown [role="combobox"]'),
28
- responseFieldLabelSetCorrectAnswerSection: () => cy.get('.cloze-with-text-form-control-wrapper .input-field-label'),
29
- responseDropdownWrapperSetCorrectAnswerSection: () => cy.get('.response-dropdown-wrapper .dropdown-form-control'),
30
- optionsForResponseInputField: () => cy.get('.input-editable input[type*="text"]'),
31
- //TODO: Update class name once https://redmine.zeuslearning.com/issues/518498 is resolved
32
- optionIsRequiredErrorMessage: () => cy.get('.Mui-error.Mui-required'),
33
- optionNumeration: () => cy.get('.MuiInputAdornment-positionStart'),
34
- responseDropdownPlaceholderText: () => cy.get('.cloze-with-dropdown-placeholder'),
35
- randomizeOptionsCheckbox: () => cy.get('[data-ngie-testid="randomize-options-checkbox"] input'),
36
- matchFromAllResponsesCheckbox: () => cy.get('[data-ngie-testid="match-from-all-responses-checkbox"] input'),
37
- randomizeOptionsLabel: () => cy.get('[data-ngie-testid="randomize-options-checkbox"] .MuiFormControlLabel-label'),
38
- matchFromAllResponsesLabel: () => cy.get('[data-ngie-testid="match-from-all-responses-checkbox"] .MuiFormControlLabel-label'),
30
+
31
+ //Dropdown and Dropdown menu section
32
+ dropdownLabel: () => cy.get('.single-select-toggle-group-title'),
33
+ userSpecifiedWidthToggleButton: () => cy.get('[class*="SingleSelectToggleGroupstyles__ButtonContainer"] button').eq(0),
34
+ AutoScaleToggleButton: () => cy.get('[class*="SingleSelectToggleGroupstyles__ButtonContainer"] button').eq(1),
35
+ displayMultilineTextCheckbox: () => cy.get('[data-ngie-testid="display-multiline-text-in-dropdown-checkbox"] input'),
36
+ displayMultilineTextCheckboxLabel: () => cy.get('[data-ngie-testid="display-multiline-text-in-dropdown-checkbox"] [class*="label"]'),
37
+ dropdownMenuLabel: () => cy.get('[class*="StudentOptionstyles__SubLabel"]'),
38
+ wordWrapCheckbox: () => cy.get('[data-ngie-testid="word-wrap-for-dropdown-menu-checkbox"] input'),
39
+ wordWrapCheckboxLabel: () => cy.get('[data-ngie-testid="word-wrap-for-dropdown-menu-checkbox"] [class*="label"]'),
40
+
41
+ //Preview tab
42
+ dropdownWrapperPreviewTab: () => cy.get('[class*="question-preview-wrapper"] .response-dropdown-wrapper'),
43
+ dropdownPreviewTab: () => cy.get('[class*="question-preview-wrapper"] [aria-haspopup="listbox"]'),
44
+ dropdownNumerationPreviewTab: () => cy.get('.answer-numeration-number-box'),
45
+ correctAnswersLabel: () => cy.get('[class*="question-preview-wrapper"] [class*="correct-answer-label"]'),
46
+ correctAnswerResponseNumeration: () => cy.get('.answer-numeration-number-box'),
47
+ tickIconWrapper: () => cy.get('.tick-icon-wrapper [data-name*="Rectangle"]'),
39
48
  }
40
49
 
41
50
  const steps = {
42
- ...scoringSectionBase.steps,
43
- /**
44
- * @param {number} responseIndex index of the response token/container
45
- * @description Verify that options for response label and its section is displayed for the response token
46
- */
47
- verifyOptionsForResponseLabelAndSectionIsDisplayed: (responseIndex) => {
48
- utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.optionsForResponseContainer().eq(responseIndex), 'visible');
49
- utilities.verifyInnerText(fillInTheGapsDropdownCommonComponent.optionsForResponseLabel().eq(responseIndex), `Options for response ${responseIndex + 1}`);
50
- },
51
-
52
51
  /**
53
- * @param {number} optionsForResponseIndex Index of the options for response section
52
+ * @param {number} dropdownOptionsTabIndex Index of the dropdown options tab
54
53
  * @param {string[]} responseTextArray Array of text to be given as input in options input field
55
- * @description Add input to options input fields
54
+ * @description Add input to dropdown options input fields
56
55
  */
57
- addInputToResponseOptionFields: (optionsForResponseIndex, responseTextArray) => {
58
- fillInTheGapsDropdownCommonComponent.optionsSectionWrapper()
59
- .eq(optionsForResponseIndex)
56
+ addInputToDropdownOptionFields: (dropdownOptionsTabIndex, responseTextArray) => {
57
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownOptionsTab(), dropdownOptionsTabIndex)
58
+ .click();
59
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownOptionsTabIsSelected(dropdownOptionsTabIndex);
60
+ optionsWrapperComponent.optionsSectionWrapper()
60
61
  .within(() => {
61
62
  responseTextArray.forEach((responseFieldText, optionIndex) => {
62
- fillInTheGapsDropdownCommonComponent.steps.addInputToResponseOptionInputField(optionIndex, responseFieldText);
63
+ fillInTheGapsDropdownCommonComponent.steps.addInputToDropdownOptionInputField(optionIndex, responseFieldText);
63
64
  });
64
65
  });
65
66
  },
@@ -69,77 +70,199 @@ const steps = {
69
70
  * @param {string} responseText text to be given as input in option input field
70
71
  * @description Add input to options input fields
71
72
  */
72
- addInputToResponseOptionInputField: (optionIndex, responseFieldText) => {
73
- fillInTheGapsDropdownCommonComponent.optionsForResponseInputField()
74
- .eq(optionIndex)
73
+ addInputToDropdownOptionInputField: (optionIndex, responseFieldText) => {
74
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownOptionsInputField(), optionIndex)
75
75
  .clear()
76
76
  .type(responseFieldText, { delay: 0 })
77
77
  .should('have.value', responseFieldText);
78
78
  },
79
79
 
80
+ /**
81
+ * @param {number} dropdownOptionsTabIndex Index of the dropdown options tab
82
+ * @description Navigate to dropdown options tab
83
+ */
84
+ navigateToDropdownOptionsTab: (dropdownOptionsTabIndex) => {
85
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownOptionsTab(), dropdownOptionsTabIndex)
86
+ .click();
87
+ },
88
+
89
+ /**
90
+ * @param {number} dropdownOptionsTabIndex Index of the dropdown options tab
91
+ * @description Verify dropdown options tab is selected
92
+ */
93
+ verifyDropdownOptionsTabIsSelected: (dropdownOptionsTabIndex) => {
94
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownOptionsTab(), dropdownOptionsTabIndex)
95
+ .should('have.class', 'Mui-selected');
96
+ },
97
+
98
+ /**
99
+ * @param {number} dropdownOptionsTabIndex Index of the dropdown options tab
100
+ * @description Verify dropdown options tab is not selected
101
+ */
102
+ verifyDropdownOptionsTabIsNotSelected: (dropdownOptionsTabIndex) => {
103
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownOptionsTab(), dropdownOptionsTabIndex)
104
+ .should('not.have.class', 'Mui-selected');
105
+ },
106
+
107
+ /**
108
+ * @param {number} dropdownIndex Index of the dropdown
109
+ * @param {string} dropdownOption Option to be selected in the dropdown
110
+ * @description Select option from dropdown in specify correct answer section
111
+ */
112
+ selectResponseFromDropdownSpecifyCorrectAnswerSection: (dropdownIndex, dropdownOption) => {
113
+ fillInTheGapsDropdownCommonComponent.steps.expandDropdownInSpecifyCorrectAnswerSection(dropdownIndex)
114
+ fillInTheGapsDropdownCommonComponent.steps.selectOptionFromDropdownList(dropdownOption);
115
+ utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownSpecifyCorrectAnswerSection(), dropdownIndex), dropdownOption);
116
+ },
117
+
80
118
  /**
81
119
  * @param {string} dropdownOption Option to be selected from dropdown
82
120
  * @description Select option from dropdown
83
121
  */
84
- selectOptionFromResponseDropdown: (dropdownOption) => {
85
- fillInTheGapsDropdownCommonComponent.responseDropdownOptions(dropdownOption)
122
+ selectOptionFromDropdownList: (dropdownOption) => {
123
+ fillInTheGapsDropdownCommonComponent.dropdownListOptions(dropdownOption)
86
124
  .click();
87
- fillInTheGapsDropdownCommonComponent.dropdownList()
88
- .should('not.exist');
125
+ utilities.verifyElementVisibilityState(commonComponents.dropdownList(), 'notExist');
126
+ },
127
+
128
+ /**
129
+ * @param {number} dropdownIndex Index of dropdown in specify correct answer section
130
+ * @description Expand dropdown in specify correct answer section
131
+ */
132
+ expandDropdownInSpecifyCorrectAnswerSection: (dropdownIndex) => {
133
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownSpecifyCorrectAnswerSection(), dropdownIndex)
134
+ .click({ position: "right" });
135
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownSpecifyCorrectAnswerSection(), dropdownIndex)
136
+ .should('have.attr', 'aria-expanded', 'true');
89
137
  },
90
138
 
91
139
  /**
92
- * @param {number} dropdownIndex Index of the dropdown
93
- * @param {string} dropdownOption Option to be selected in the dropdown
94
- * @description Select option from dropdown in set correct answer section
140
+ * @param {Object[]} CorrectAnswerArray - An array of objects containing the dropdownIndex and dropdownOption to be selected.
141
+ * @param {number} CorrectAnswerArray[].dropdownIndex - The index of dropdown in preview tab
142
+ * @param {string} CorrectAnswerArray[].dropdownOption - The dropdown option to be selected from dropdown list
143
+ * @description Select option from dropdown in preview tab
144
+ */
145
+ selectResponseFromDropdownInPreviewTab: (CorrectAnswerArray) => {
146
+ CorrectAnswerArray.forEach(({ dropdownIndex, dropdownOption }) => {
147
+ fillInTheGapsDropdownCommonComponent.steps.expandDropdownInPreviewTab(dropdownIndex);
148
+ fillInTheGapsDropdownCommonComponent.steps.selectOptionFromDropdownList(dropdownOption);
149
+ fillInTheGapsDropdownCommonComponent.steps.verifyTextDisplayedInDropdownPreviewTab(dropdownIndex, dropdownOption);
150
+ });
151
+ },
152
+
153
+ /**
154
+ * @param {number} dropdownIndex Index of dropdown in preview tab
155
+ * @description Expand dropdown in preview tab
95
156
  */
96
- selectResponseFromSetCorrectAnswerSectionResponseDropdown: (dropdownIndex, dropdownOption) => {
97
- fillInTheGapsDropdownCommonComponent.steps.expandResponseDropdownInSetCorrectAnswerSection(dropdownIndex)
98
- fillInTheGapsDropdownCommonComponent.steps.selectOptionFromResponseDropdown(dropdownOption);
99
- fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection()
100
- .eq(dropdownIndex)
101
- .verifyInnerText(dropdownOption);
157
+ expandDropdownInPreviewTab: (dropdownIndex) => {
158
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownPreviewTab(), dropdownIndex)
159
+ .click();
160
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownPreviewTab(), dropdownIndex)
161
+ .should('have.attr', 'aria-expanded', 'true');
162
+ },
163
+
164
+ /**
165
+ * Verifies if the specified text is displayed in the dropdown preview tab.
166
+ * @param {number} dropdownIndex - The index of the dropdown.
167
+ * @param {string} dropdownText - The text expected to be displayed in the dropdown preview tab.
168
+ */
169
+ verifyTextDisplayedInDropdownPreviewTab: (dropdownIndex, dropdownText) => {
170
+ utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownPreviewTab(), dropdownIndex), dropdownText);
171
+ },
172
+
173
+ /**
174
+ * Verify text displayed in the dropdowns of the preview tab.
175
+ * @param {Object[]} dropdownTextArray - An array of objects containing the dropdownIndex and dropdownText.
176
+ * @param {number} dropdownTextArray[].dropdownIndex - The index of the dropdown.
177
+ * @param {string} dropdownTextArray[].dropdownText - The text to be verified in the respective dropdown.
178
+ */
179
+ verifyTextInDropdownsInPreviewTab: (dropdownTextArray) => {
180
+ dropdownTextArray.forEach(({ dropdownIndex, dropdownText }) => {
181
+ fillInTheGapsDropdownCommonComponent.steps.verifyTextDisplayedInDropdownPreviewTab(dropdownIndex, dropdownText);
182
+ });
183
+ },
184
+
185
+ /**
186
+ * Verify that a specific dropdown is disabled in the preview tab.
187
+ * @param {number} dropdownIndex - The index of the disabled dropdown.
188
+ */
189
+ verifyDropdownIsDisabled: (dropdownIndex) => {
190
+ utilities.verifyElementDisabledClass(utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownPreviewTab(), dropdownIndex));
191
+ },
192
+
193
+ verifyPointsPerResponseLabel: () => {
194
+ utilities.verifyInnerText(autoScoredScoringSectionMultiResponseType.pointsPerResponseLabel(), 'Points per response: -');
195
+ utilities.verifyElementVisibilityState(autoScoredScoringSectionMultiResponseType.pointsPerResponseLabel(), 'visible');
196
+ },
197
+
198
+ /**
199
+ * @description Verify points per response score displayed for partial equal weights
200
+ * @param {number} pointsPerResponse points per response score
201
+ */
202
+ verifyPartialEqualWeightsPointsPerResponseScore: (pointsPerResponse) => {
203
+ utilities.verifyInnerText(autoScoredScoringSectionMultiResponseType.pointsPerResponseLabel(), `Points per response: ${pointsPerResponse}`);
204
+ },
205
+
206
+ /**
207
+ * @param {number} index of the option input field
208
+ * @description verify the enter option input field, drag handle, delete button and option numeration
209
+ */
210
+ verifyOptionsContents: (index) => {
211
+ optionsWrapperComponent.optionWrapper()
212
+ .eq(index)
213
+ .within(() => {
214
+ fillInTheGapsDropdownCommonComponent.dropdownOptionsInputField()
215
+ .should('have.attr', 'placeholder', 'Enter option');
216
+ utilities.verifyElementVisibilityState(commonComponents.dragHandleButton(), 'exist');
217
+ utilities.verifyElementVisibilityState(commonComponents.deleteButton(), 'visible');
218
+ utilities.verifyTextContent(fillInTheGapsDropdownCommonComponent.dropdownOptionsInputFieldNumeration(), `${index + 1}`);
219
+ });
220
+ },
221
+
222
+ /**
223
+ * Verify dropdown is disabled in the specify correct answer section.
224
+ * @param {number} dropdownIndex - The index of the disabled dropdown.
225
+ */
226
+ verifyDisabledDropdownInSpecifyCorrectAnswerSection: (dropdownIndex) => {
227
+ utilities.verifyElementDisabledClass(utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownSpecifyCorrectAnswerSection(), dropdownIndex));
228
+ },
229
+
230
+ /**
231
+ * Verify dropdown is disabled in the preview tab.
232
+ * @param {number} dropdownIndex - The index of the disabled dropdown.
233
+ */
234
+ verifyDisabledDropdownInPreviewTab: (dropdownIndex) => {
235
+ utilities.verifyElementDisabledClass(utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownPreviewTab(), dropdownIndex));
102
236
  },
103
237
 
104
238
  /**
105
239
  * @param {string[]} dropdownOptionsArray Array of dropdown options
106
240
  * @description Verify the options displayed in dropdown
107
241
  */
108
- verifyResponseDropdownOptions: (dropdownOptionsArray) => {
242
+ verifyDropdownOptionsSpecifyCorrectAnswer: (dropdownOptionsArray) => {
109
243
  dropdownOptionsArray.forEach((dropdownOption, optionIndex) => {
110
- fillInTheGapsDropdownCommonComponent.responseDropdownOptions()
244
+ fillInTheGapsDropdownCommonComponent.dropdownListOptions()
111
245
  .eq(optionIndex)
112
246
  .should('have.attr', 'data-value', dropdownOption)
113
- fillInTheGapsDropdownCommonComponent.responseDropdownOptions()
114
- .eq(dropdownOptionsArray.length)
115
- .should('not.exist');
116
247
  });
248
+ fillInTheGapsDropdownCommonComponent.dropdownListOptions()
249
+ .eq(dropdownOptionsArray.length)
250
+ .should('not.exist');
117
251
  },
118
252
 
119
253
  /**
120
- * @param {number} responseTokenIndex Index of the response token
121
- * @description Verify the contents of options for response section displayed for a response token
254
+ * @param {string[]} dropdownOptionsArray Array of dropdown options
255
+ * @description Verify the options displayed in dropdown
122
256
  */
123
- verifyOptionsForResponseContents: (responseTokenIndex) => {
124
- fillInTheGapsDropdownCommonComponent.optionsSectionWrapper()
125
- .eq(responseTokenIndex)
126
- .should('exist')
127
- .within(() => {
128
- fillInTheGapsDropdownCommonComponent.optionWrapper()
129
- .each(($el, index) => {
130
- cy.wrap($el)
131
- .within(() => {
132
- fillInTheGapsDropdownCommonComponent.optionsForResponseInputField()
133
- .should('have.attr', 'placeholder', 'Enter option');
134
- commonComponents.dragHandleButton()
135
- .should('exist');
136
- commonComponents.deleteButton()
137
- .should('be.visible');
138
- fillInTheGapsDropdownCommonComponent.optionNumeration()
139
- .should('have.text', index + 1)
140
- });
141
- });
142
- });
257
+ verifyDropdownOptionsPreviewTab: (dropdownOptionsArray) => {
258
+ dropdownOptionsArray.forEach((dropdownOption, optionIndex) => {
259
+ fillInTheGapsDropdownCommonComponent.dropdownListOptions()
260
+ .eq(optionIndex)
261
+ .should('have.attr', 'data-value', dropdownOption)
262
+ });
263
+ fillInTheGapsDropdownCommonComponent.dropdownListOptions()
264
+ .eq(dropdownOptionsArray.length)
265
+ .should('not.exist');
143
266
  },
144
267
 
145
268
  /**
@@ -151,7 +274,7 @@ const steps = {
151
274
  commonComponents.dropdownList()
152
275
  .within(() => {
153
276
  for (let index = 0; index < currentOptions.length; index++) {
154
- fillInTheGapsDropdownCommonComponent.responseDropdownOptions()
277
+ fillInTheGapsDropdownCommonComponent.dropdownListOptions()
155
278
  .eq(index)
156
279
  .then(($element) => {
157
280
  expect($element.text()).to.be.oneOf(currentOptions);
@@ -163,9 +286,9 @@ const steps = {
163
286
  },
164
287
 
165
288
  /**
166
- * @param {string[]} previousOrderOfOptions Array of options displayed in preview tab
167
- * @description Verify that dropdown options are re-randomized in preview tab
168
- */
289
+ * @param {string[]} previousOrderOfOptions Array of dropdown options displayed in preview tab
290
+ * @description Verify that dropdown options are re-randomized in preview tab
291
+ */
169
292
  verifyRerandomizedOptionsOrder: (previousOrderOfOptions) => {
170
293
  commonComponents.dropdownList()
171
294
  .should('not.have.text', '')
@@ -174,7 +297,7 @@ const steps = {
174
297
 
175
298
  getDropdownOptionsArray: () => {
176
299
  const dropdownOptionsArray = []
177
- fillInTheGapsDropdownCommonComponent.responseDropdownOptions()
300
+ fillInTheGapsDropdownCommonComponent.dropdownListOptions()
178
301
  .each(($el) => {
179
302
  cy.wrap($el)
180
303
  .invoke('text')
@@ -186,310 +309,295 @@ const steps = {
186
309
  },
187
310
 
188
311
  /**
189
- * @param {number} responseDropdownIndex Index of response dropdown
190
- * @description Verify response dropdown is displayed in set correct answer section
312
+ * @param {number} dropdownIndex Index of dropdown in specify correct answer section
313
+ * @description Verify dropdown is collapsed in specify correct answer section
191
314
  */
192
- verifyResponseDropdownIsDisplayedInSetCorrectAnswerSection: (responseDropdownIndex) => {
193
- utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection().eq(responseDropdownIndex), 'visible');
315
+ verifyDropdownIsCollapsedInSpecifyCorrectAnswerSection: (dropdownIndex) => {
316
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownSpecifyCorrectAnswerSection(), dropdownIndex)
317
+ .should('have.attr', 'aria-expanded', 'false');
318
+ utilities.verifyElementVisibilityState(commonComponents.dropdownList(), 'notExist');
194
319
  },
195
320
 
196
- verifyDisabledResponseDropdownInSetCorrectAnswerSection: () => {
197
- fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection()
198
- .should('have.class', 'Mui-disabled');
199
- fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection()
321
+ /**
322
+ * @param {number} dropdownIndex Index of dropdown in specify correct answer section
323
+ * @description Expand and collapse dropdown in specify correct answer section
324
+ */
325
+ expandAndCollapseDropdownInSpecifyCorrectAnswerSection: (dropdownIndex) => {
326
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownSpecifyCorrectAnswerSection(), dropdownIndex)
327
+ .click({ position: "right" });
328
+ cy.get('body')
200
329
  .click();
201
- fillInTheGapsDropdownCommonComponent.dropdownList()
202
- .should('not.exist');
203
330
  },
204
331
 
205
332
  /**
206
- * @param {number} responseDropdownIndex Index of response dropdown in set correct answer section
207
- * @description Expand response dropdown in set correct answer section
333
+ * @param {number} optionIndex index of the option input field
334
+ * @description Focus in and focus out of options input field
208
335
  */
209
- expandResponseDropdownInSetCorrectAnswerSection: (responseDropdownIndex) => {
210
- fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection()
211
- .eq(responseDropdownIndex)
212
- .click({ position: "right" });
213
- fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection()
214
- .eq(responseDropdownIndex)
215
- .should('have.attr', 'aria-expanded', 'true');
336
+ focusInAndFocusOutOfDropdownOptionInputField: (optionIndex) => {
337
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownOptionsInputField(), optionIndex)
338
+ .click()
339
+ .blur();
216
340
  },
217
341
 
218
- verifyOptionsForResponseInputFieldDeleteButtonTooltip: () => {
219
- fillInTheGapsDropdownCommonComponent.deleteButton()
220
- .eq(1)
221
- .verifyTooltip('Delete option');
342
+ verifyUserSpecifiedToggleButtonIsSelected: () => {
343
+ fillInTheGapsDropdownCommonComponent.userSpecifiedWidthToggleButton()
344
+ .should('have.class', 'Mui-selected');
222
345
  },
223
346
 
224
- verifyOptionsForResponseInputFieldDisabledDeleteButtonTooltip: () => {
225
- fillInTheGapsDropdownCommonComponent.deleteButton()
226
- .eq(1)
227
- .trigger('mouseover', { force: true })
228
- fillInTheGapsDropdownCommonComponent.tooltipText()
229
- .should('have.text', 'Minimum two options are required');
230
- fillInTheGapsDropdownCommonComponent.deleteButton()
231
- .eq(1)
232
- .trigger('mouseout', { force: true });
233
- fillInTheGapsDropdownCommonComponent.tooltipText()
234
- .should('not.exist');
347
+ verifyAutoScaleToggleButtonNotSelected: () => {
348
+ fillInTheGapsDropdownCommonComponent.AutoScaleToggleButton()
349
+ .should('not.have.class', 'Mui-selected');
235
350
  },
236
351
 
237
- /**
238
- * @param {number} index of the option input field
239
- * @description this function focuses in and out of options input fields
240
- */
241
- focusInAndFocusOutOfOptionsForResponseInputField: (index) => {
242
- fillInTheGapsDropdownCommonComponent.optionsForResponseInputField()
243
- .eq(index)
244
- .focus();
245
- fillInTheGapsDropdownCommonComponent.optionsForResponseInputField()
246
- .eq(index)
247
- .blur();
352
+ verifyAutoScaleToggleButtonIsSelected: () => {
353
+ fillInTheGapsDropdownCommonComponent.AutoScaleToggleButton()
354
+ .should('have.class', 'Mui-selected');
248
355
  },
249
356
 
250
- /**
251
- * @param {number} index of option input field
252
- * @description this function verifies error message of option input field
253
- */
254
- verifyOptionsForResponseInputFieldErrorMessage: (index) => {
255
- fillInTheGapsDropdownCommonComponent.optionWrapper()
256
- .eq(index)
257
- .within(() => {
258
- fillInTheGapsDropdownCommonComponent.optionIsRequiredErrorMessage()
259
- .should('have.text', 'Error: Option is required.');
260
- });
357
+ verifyDisplayMultilineCheckboxIsNotChecked: () => {
358
+ fillInTheGapsDropdownCommonComponent.displayMultilineTextCheckbox()
359
+ .should('not.be.checked');
261
360
  },
262
361
 
263
- /**
264
- * @param {number} index of option input field
265
- * @description this function verifies error message does not exist for option input field
266
- */
267
- verifyOptionsForResponseInputFieldErrorMessageDoesNotExist: (index) => {
268
- fillInTheGapsDropdownCommonComponent.optionWrapper()
269
- .eq(index)
270
- .within(() => {
271
- fillInTheGapsDropdownCommonComponent.optionIsRequiredErrorMessage()
272
- .should('not.exist');
273
- });
274
- },
275
- verifyMatchFromAllResponsesLabelAndCheckboxEnabledState: () => {
276
- fillInTheGapsDropdownCommonComponent.matchFromAllResponsesLabel()
277
- .should('not.have.class', 'Mui-disabled');
278
- fillInTheGapsDropdownCommonComponent.matchFromAllResponsesCheckbox()
279
- .and('not.be.disabled');
362
+ checkDisplayMultilineCheckbox: () => {
363
+ fillInTheGapsDropdownCommonComponent.displayMultilineTextCheckbox()
364
+ .click()
365
+ .should('be.checked');
280
366
  },
281
367
 
282
- checkRandomizeOptionsCheckbox: () => {
283
- fillInTheGapsDropdownCommonComponent.randomizeOptionsCheckbox()
284
- .click()
368
+ verifyWordWrapForDropdownMenuCheckboxIsChecked: () => {
369
+ fillInTheGapsDropdownCommonComponent.wordWrapCheckbox()
285
370
  .should('be.checked');
286
371
  },
287
372
 
288
- uncheckRandomizeOptionsCheckbox: () => {
289
- fillInTheGapsDropdownCommonComponent.randomizeOptionsCheckbox()
373
+ uncheckWordWrapForDropdownMenuCheckbox: () => {
374
+ fillInTheGapsDropdownCommonComponent.wordWrapCheckbox()
290
375
  .click()
291
376
  .should('not.be.checked');
292
377
  },
293
378
 
294
- checkMatchFromAllResponsesCheckbox: () => {
295
- fillInTheGapsDropdownCommonComponent.matchFromAllResponsesCheckbox()
296
- .click()
297
- .should('be.checked');
379
+ selectUserSpecifiedWidthToggleButton: () => {
380
+ fillInTheGapsDropdownCommonComponent.userSpecifiedWidthToggleButton()
381
+ .click();
298
382
  },
299
383
 
300
- uncheckMatchFromAllResponsesCheckbox: () => {
301
- fillInTheGapsDropdownCommonComponent.matchFromAllResponsesCheckbox()
302
- .click()
303
- .should('not.be.checked');
384
+ selectAutoScaleToggleButton: () => {
385
+ fillInTheGapsDropdownCommonComponent.AutoScaleToggleButton()
386
+ .click();
304
387
  },
305
388
 
306
- verifyRandomizeOptionsCheckboxNotChecked: () => {
307
- fillInTheGapsDropdownCommonComponent.randomizeOptionsCheckbox()
308
- .should('not.be.checked');
389
+ compareDropdownMenuAndDropdownWidthForUserSpecifiedWidth: () => {
390
+ let dropdownWidth
391
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownSpecifyCorrectAnswerSection(), 0)
392
+ .then(($originalDropdownWidth) => {
393
+ dropdownWidth = $originalDropdownWidth.css('width'); //Storing original dropdown width
394
+ });
395
+ fillInTheGapsDropdownCommonComponent.steps.expandDropdownInSpecifyCorrectAnswerSection(0);
396
+ fillInTheGapsDropdownCommonComponent.dropdownList()
397
+ .then(($dropdownMenuWidth) => {
398
+ let dropdownMenuWidth = $dropdownMenuWidth.css('max-width');
399
+ expect(dropdownMenuWidth).to.be.eq(dropdownWidth); //Comparing dropdown menu and dropdown width
400
+ });
309
401
  },
310
402
 
311
- verifyMatchFromAllResponsesLabelAndCheckboxDisabledState: () => {
312
- fillInTheGapsDropdownCommonComponent.matchFromAllResponsesLabel()
313
- .should('have.class', 'Mui-disabled');
314
- fillInTheGapsDropdownCommonComponent.matchFromAllResponsesCheckbox()
315
- .and('be.disabled');
403
+ compareDropdownMenuAndDropdownWidthForAutoScaled: () => {
404
+ let originalDropdownWidth
405
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownSpecifyCorrectAnswerSection(), 0)
406
+ .then(($originalDropdownWidth) => {
407
+ originalDropdownWidth = $originalDropdownWidth.width(); //Storing original dropdown width
408
+ });
409
+ fillInTheGapsDropdownCommonComponent.steps.selectAutoScaleToggleButton();
410
+ fillInTheGapsDropdownCommonComponent.steps.verifyAutoScaleToggleButtonIsSelected();
411
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownSpecifyCorrectAnswerSection(), 0)
412
+ .then(($modifiedDropdownWidth) => {
413
+ let modifiedDropdownWidth = $modifiedDropdownWidth.width(); //Storing auto scaled dropdown width
414
+ expect(modifiedDropdownWidth).to.be.gt(originalDropdownWidth);
415
+ });
416
+ fillInTheGapsDropdownCommonComponent.steps.expandDropdownInSpecifyCorrectAnswerSection(0);
417
+ fillInTheGapsDropdownCommonComponent.dropdownList()
418
+ .then(($dropdownMenuWidth) => {
419
+ let dropdownMenuWidth = $dropdownMenuWidth.width();
420
+ expect(dropdownMenuWidth).to.be.gt(originalDropdownWidth); //Comparing auto scaled dropdown menu width and original dropdown width
421
+ });
316
422
  },
317
423
 
318
- /**
319
- * @param {index} responseDropdownIndex Index of response dropdown
320
- * @param {string} ariaLabel Aria-label of response dropdown
321
- * @description Verify aria-label of response dropdown in set correct answer section
322
- */
323
- verifyDropdownAriaLabelAttributeInSetCorrectAnswerSection: (responseDropdownIndex, ariaLabel) => {
324
- fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection()
325
- .eq(responseDropdownIndex)
326
- .should('have.attr', 'aria-label', ariaLabel);
424
+ verifyDropdownDefaultWidthInSpecifyCorrectAnswer: () => {
425
+ utilities.verifyCSS(utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownSpecifyCorrectAnswerSection(), 0), {
426
+ 'width': '120px'
427
+ });
428
+ fillInTheGapsDropdownCommonComponent.steps.expandDropdownInSpecifyCorrectAnswerSection(0);
429
+ utilities.verifyCSS(fillInTheGapsDropdownCommonComponent.dropdownList(), {
430
+ 'max-width': '120px'
431
+ });
432
+ },
433
+
434
+ compareDropdownMenuAndDropdownWidthForUserSpecifiedWidthInPreviewTab: () => {
435
+ let dropdownWidth
436
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownPreviewTab(), 0)
437
+ .then(($originalDropdownWidth) => {
438
+ dropdownWidth = $originalDropdownWidth.css('width'); //Storing original dropdown width
439
+ });
440
+ fillInTheGapsDropdownCommonComponent.steps.expandDropdownInPreviewTab(0);
441
+ fillInTheGapsDropdownCommonComponent.dropdownList()
442
+ .parent()
443
+ .then(($dropdownMenuWidth) => {
444
+ let dropdownMenuWidth = $dropdownMenuWidth.css('max-width');
445
+ expect(dropdownMenuWidth).to.be.eq(dropdownWidth); //Comparing dropdown menu and dropdown width
446
+ });
447
+ },
448
+
449
+ compareDropdownMenuAndDropdownWidthForAutoScaledInPreviewTab: () => {
450
+ let originalDropdownWidth
451
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownPreviewTab(), 0)
452
+ .then(($originalDropdownWidth) => {
453
+ originalDropdownWidth = $originalDropdownWidth.width(); //Storing original dropdown width
454
+ });
455
+ createQuestionBasePage.steps.switchToEditTab();
456
+ fillInTheGapsDropdownCommonComponent.steps.selectAutoScaleToggleButton();
457
+ fillInTheGapsDropdownCommonComponent.steps.verifyAutoScaleToggleButtonIsSelected();
458
+ createQuestionBasePage.steps.switchToPreviewTab();
459
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownPreviewTab(), 0)
460
+ .then(($modifiedDropdownWidth) => {
461
+ let modifiedDropdownWidth = $modifiedDropdownWidth.width(); //Storing auto scaled dropdown width
462
+ expect(modifiedDropdownWidth).to.be.gt(originalDropdownWidth);
463
+ });
464
+ fillInTheGapsDropdownCommonComponent.steps.expandDropdownInPreviewTab(0);
465
+ fillInTheGapsDropdownCommonComponent.dropdownList()
466
+ .then(($dropdownMenuWidth) => {
467
+ let dropdownMenuWidth = $dropdownMenuWidth.width();
468
+ expect(dropdownMenuWidth).to.be.gt(originalDropdownWidth); //Comparing auto scaled dropdown menu width and original dropdown width
469
+ });
470
+ },
471
+
472
+ verifyDropdownDefaultWidthInPreviewTab: () => {
473
+ utilities.verifyCSS(utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownPreviewTab(), 0), {
474
+ 'width': '120px'
475
+ });
476
+ fillInTheGapsDropdownCommonComponent.steps.expandDropdownInPreviewTab(0);
477
+ utilities.verifyCSS(fillInTheGapsDropdownCommonComponent.dropdownList(), {
478
+ 'max-width': '120px'
479
+ });
327
480
  },
328
481
 
329
482
  /**
330
- * @param {number} responseDropdownIndex Index of response dropdown
331
- * @description Verify placeholder for response dropdown in set correct answer section does not exist
483
+ * @param {number} dropdownIndex Index of dropdown in specify correct answer section
484
+ * @description Verify multi-line text is not displayed in dropdown in specify correct answer section
332
485
  */
333
- verifyPlaceholderAttributeInSetCorrectAnswerSectionResponseDropdownNotExists: (responseDropdownIndex) => {
334
- fillInTheGapsDropdownCommonComponent.responseDropdownWrapperSetCorrectAnswerSection()
335
- .eq(responseDropdownIndex)
336
- .within(() => {
337
- utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.responseDropdownPlaceholderText(), 'notExist');
338
- });
486
+ verifyMultilineTextNotDisplayedInDropdownSpecifyCorrectAnswerSection: (dropdownIndex) => {
487
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownWrapperSpecifyCorrectAnswerSection(), dropdownIndex)
488
+ .should('not.have.class', 'multiline-dropdown-text');
339
489
  },
340
490
 
341
491
  /**
342
- * @param {number} responseDropdownIndex Index of response dropdown
343
- * @param {string} placeholderText Placeholder for dropdown
344
- * @description Verify placeholder text displayed for response dropdown in set correct answer section
492
+ * @param {number} dropdownIndex Index of dropdown in specify correct answer section
493
+ * @description Verify multi-line text is displayed in dropdown in specify correct answer section
345
494
  */
346
- verifyPlaceholderAttributeInSetCorrectAnswerSectionResponseDropdown: (responseDropdownIndex, placeholderText) => {
347
- fillInTheGapsDropdownCommonComponent.responseDropdownWrapperSetCorrectAnswerSection()
348
- .eq(responseDropdownIndex)
349
- .within(() => {
350
- utilities.verifyTextContent(fillInTheGapsDropdownCommonComponent.responseDropdownPlaceholderText(), placeholderText);
351
- });
495
+ verifyMultilineTextIsDisplayedInDropdownSpecifyCorrectAnswerSection: (dropdownIndex) => {
496
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownWrapperSpecifyCorrectAnswerSection(), dropdownIndex)
497
+ .should('have.class', 'multiline-dropdown-text');
352
498
  },
353
499
 
354
500
  /**
355
- * @param {number} responseDropdownIndex Index of response dropdown
356
- * @param {number} height Height of response dropdown in set correct answer section
357
- * @description Verify height of response dropdown in set correct answer section
501
+ * @param {number} dropdownIndex Index of dropdown in specify correct answer section
502
+ * @description Verify multi-line text is not displayed in dropdown in specify correct answer section
358
503
  */
359
- verifyHeightOfResponseDropdownInSetCorrectAnswerSection: (responseDropdownIndex, height) => {
360
- fillInTheGapsDropdownCommonComponent.responseDropdownWrapperSetCorrectAnswerSection()
361
- .eq(responseDropdownIndex)
362
- .should('have.attr', 'height', `${height}px`);
504
+ verifyMultilineTextNotDisplayedInDropdownPreviewTab: (dropdownIndex) => {
505
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownWrapperPreviewTab(), dropdownIndex)
506
+ .should('not.have.class', 'multiline-dropdown-text');
363
507
  },
364
508
 
365
509
  /**
366
- * @param {number} responseDropdownIndex Index of response dropdown
367
- * @param {number} width Width of response dropdown in set correct answer section
368
- * @description Verify width of response dropdown in set correct answer section
510
+ * @param {number} dropdownIndex Index of dropdown in specify correct answer section
511
+ * @description Verify multi-line text is displayed in dropdown in specify correct answer section
369
512
  */
370
- verifyWidthOfResponseDropdownInSetCorrectAnswerSection: (responseDropdownIndex, width) => {
371
- fillInTheGapsDropdownCommonComponent.responseDropdownWrapperSetCorrectAnswerSection()
372
- .eq(responseDropdownIndex)
373
- .should('have.attr', 'width', `${width}px`);
513
+ verifyMultilineTextIsDisplayedInDropdownPreviewTab: (dropdownIndex) => {
514
+ utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownWrapperPreviewTab(), dropdownIndex)
515
+ .should('have.class', 'multiline-dropdown-text');
374
516
  },
375
- }
376
517
 
377
- const tests = {
378
- verifyCorrectResponseConditionSectionDefaultState: () => {
379
- it('\'Randomize options\' functionality label and checkbox should be displayed and by default it should be unchecked', () => {
380
- utilities.verifyInnerText(fillInTheGapsDropdownCommonComponent.randomizeOptionsLabel(), 'Randomize options');
381
- utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.randomizeOptionsLabel(), 'visible');
382
- fillInTheGapsDropdownCommonComponent.steps.verifyRandomizeOptionsCheckboxNotChecked();
383
- });
518
+ verifyDropdownMenuOptionsWordWrappedSpecifyCorrectAnswerSection: () => {
519
+ fillInTheGapsDropdownCommonComponent.dropdownList()
520
+ .should('have.class', 'wordwrap-dropdown-menu');
521
+ },
384
522
 
385
- it('\'Match from all responses\' functionality label and checkbox should be displayed and by default it should be unchecked and disabled', () => {
386
- utilities.verifyInnerText(fillInTheGapsDropdownCommonComponent.matchFromAllResponsesLabel(), 'Match from all responses');
387
- utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.matchFromAllResponsesLabel(), 'visible');
388
- fillInTheGapsDropdownCommonComponent.steps.verifyMatchFromAllResponsesLabelAndCheckboxDisabledState();
389
- });
523
+ verifyDropdownMenuOptionsNotWordWrappedSpecifyCorrectAnswerSection: () => {
524
+ fillInTheGapsDropdownCommonComponent.dropdownList()
525
+ .should('not.have.class', 'wordwrap-dropdown-menu');
526
+ },
390
527
 
391
- it('When the user hovers over the \'Match from all responses\' label, \'Feature available for only alternate correct answers\' text should appear on a tooltip, on hovering away from the label, the tooltip should disappear', () => {
392
- fillInTheGapsDropdownCommonComponent.matchFromAllResponsesLabel()
393
- .verifyTooltip('Feature available for only alternate correct answers');
394
- });
528
+ verifyDropdownMenuOptionsWordWrappedPreviewTab: () => {
529
+ fillInTheGapsDropdownCommonComponent.dropdownList()
530
+ .should('have.class', 'wordwrap-dropdown-menu');
531
+ },
395
532
 
396
- it('CSS of correct response conditions section', { tags: 'css' }, () => {
397
- const labels = [fillInTheGapsDropdownCommonComponent.randomizeOptionsLabel, fillInTheGapsDropdownCommonComponent.matchFromAllResponsesLabel]
398
- const uncheckedCheckboxes = [fillInTheGapsDropdownCommonComponent.randomizeOptionsCheckbox, fillInTheGapsDropdownCommonComponent.matchFromAllResponsesCheckbox]
399
- labels.forEach((checkingLabel) => {
400
- utilities.verifyCSS(checkingLabel(), {
401
- 'color': css.color.labelText,
402
- 'font-size': css.fontSize.normal,
403
- 'font-weight': css.fontWeight.regular
404
- });
405
- });
406
- uncheckedCheckboxes.forEach((uncheckedCheckbox) => {
407
- utilities.verifyCSS(uncheckedCheckbox().parent().find('svg'), {
408
- 'fill': css.color.uncheckedCheckbox
409
- });
410
- });
411
- });
533
+ verifyDropdownMenuOptionsNotWordWrappedPreviewTab: () => {
534
+ fillInTheGapsDropdownCommonComponent.dropdownList()
535
+ .should('not.have.class', 'wordwrap-dropdown-menu');
536
+ }
537
+ }
412
538
 
413
- it(`Accessibility of correct response conditions section`, { tags: 'a11y' }, () => {
414
- cy.checkAccessibility(fillInTheGapsDropdownCommonComponent.randomizeOptionsLabel().parents('.ngie-checkbox-form-group'));
539
+ const tests = {
540
+ /**
541
+ * Verifies the contents and functionality of the 'Specify correct answer' accordion for fill in the gaps over image dropdown question.
542
+ * @param {{'Correct' | 'Alternative'}} accordionName - The name of the accordion to be used in the validation.
543
+ * @example - verifySpecifyCorrectAnswerAccordionContentsAndFunctionality('Correct');
544
+ */
545
+ verifySpecifyCorrectAnswerAccordionContentsAndFunctionality: (accordionName) => {
546
+ it(`When user has added a response token in image, then its corresponding dropdown \'Dropdown 1\' should be displayed in the ${accordionName} accordion in collapsed state`, () => {
547
+ utilities.verifyElementCount(fillInTheGapsDropdownCommonComponent.dropdownSpecifyCorrectAnswerSection(), 1);
548
+ fillInTheGapsDropdownCommonComponent.steps.verifyDropdownIsCollapsedInSpecifyCorrectAnswerSection(0);
549
+ utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownLabelSpecifyCorrectAnswerSection(), 0), 'Dropdown 1');
415
550
  });
416
- },
417
551
 
418
- /**
419
- * @param {string} tabName Correct or Alternate tab
420
- * @description This function verifies the input field and error states of set correct answer section
421
- */
422
- verifySetCorrectAnswerTabContentsAndFunctionality: (tabName) => {
423
- it('An empty points input field and two dropdowns with labels \'Response 1\' and \'Response 2\' should be present', () => {
424
- fillInTheGapsDropdownCommonComponent.steps.verifyPointsFieldValue('');
425
- for (let index = 0; index < 2; index++) {
426
- utilities.verifyInnerText(fillInTheGapsDropdownCommonComponent.responseFieldLabelSetCorrectAnswerSection().eq(index), `Response ${index + 1}`)
427
- utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection().eq(index), 'visible');
428
- };
552
+ it('When user expands and collapses the dropdown without selecting any option, \'Error: Please set a correct answer.\' error message should be displayed', () => {
553
+ fillInTheGapsDropdownCommonComponent.steps.expandAndCollapseDropdownInSpecifyCorrectAnswerSection(0);
554
+ utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'visible');
555
+ utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: Please set a correct answer.');
429
556
  });
430
557
 
431
- it('When the user selects any option from the dropdown, that option should get set as correct answer option and it should get displayed on the dropdown', () => {
432
- fillInTheGapsDropdownCommonComponent.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(0, optionsForResponse[0]);
433
- fillInTheGapsDropdownCommonComponent.steps.selectResponseFromSetCorrectAnswerSectionResponseDropdown(1, optionsForResponse[1]);
558
+ it('When the user selects any option from the dropdown, then error message should disappear and that option should be displayed on the dropdown', () => {
559
+ fillInTheGapsDropdownCommonComponent.steps.selectResponseFromDropdownSpecifyCorrectAnswerSection(0, optionsForDropdown[0]);
560
+ commonComponents.steps.verifyErrorMessageIsNotDisplayed();
434
561
  });
435
562
 
436
- autoScoredSetCorrectAnswerSection.tests.verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty(tabName);
563
+ autoScoredSpecifyCorrectAnswerSection.tests.verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty(accordionName);
437
564
 
438
- it(`CSS of ${tabName} contents`, { tags: 'css' }, () => {
439
- utilities.verifyCSS(fillInTheGapsDropdownCommonComponent.responseFieldLabelSetCorrectAnswerSection(), {
565
+ it(`CSS of ${accordionName} accordion contents`, { tags: 'css' }, () => {
566
+ utilities.verifyCSS(fillInTheGapsDropdownCommonComponent.dropdownLabelSpecifyCorrectAnswerSection(), {
440
567
  'color': css.color.labels,
441
568
  'font-size': css.fontSize.default,
442
569
  'font-weight': css.fontWeight.regular
443
570
  });
444
- utilities.verifyCSS(fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection(), {
445
- 'opacity': '1',
446
- 'border': `1px solid ${css.color.figDefaultComponentBorder}`,
571
+ utilities.verifyCSS(fillInTheGapsDropdownCommonComponent.dropdownSpecifyCorrectAnswerSection(), {
572
+ 'background-color': css.color.figActiveComponentBg,
573
+ 'border': `1px solid ${css.color.activeComponentBorder}`
447
574
  });
448
575
  //CSS of selected dropdown option which appears on dropdown
449
- utilities.verifyCSS(fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection(), {
576
+ utilities.verifyCSS(fillInTheGapsDropdownCommonComponent.dropdownSpecifyCorrectAnswerSection(), {
450
577
  'color': css.color.liText,
451
578
  'font-size': css.fontSize.default,
452
579
  'font-weight': css.fontWeight.regular
453
580
  });
454
581
  });
455
582
 
456
- it(`Accessibility of ${tabName} contents`, { tags: 'a11y' }, () => {
457
- cy.checkAccessibility(fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection().parents('.cloze-with-text-authoring-mode-response-wrapper'));
458
- });
459
- },
460
-
461
- verifyResponseContentsOfSetCorrectAnswerSection: () => {
462
- it('Response dropdown contents should be displayed in the set correct answer section', () => {
463
- for (let index = 0; index < 2; index++) {
464
- utilities.verifyInnerText(fillInTheGapsDropdownCommonComponent.responseFieldLabelSetCorrectAnswerSection().eq(index), `Response ${index + 1}`)
465
- utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.responseDropdownSetCorrectAnswerSection().eq(index), 'visible');
466
- };
583
+ it(`Accessibility of ${accordionName} accordion contents`, { tags: 'a11y' }, () => {
584
+ cy.checkAccessibility(utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownSpecifyCorrectAnswerSection(), 0).parents('[aria-label="Specify correct answer section"]'));
467
585
  });
468
586
  },
469
587
 
470
- verifyManualScoringEditTabFunctionality: () => {
471
- it('When the user has selected \'Manually scored\' option from the \'Scoring type\' dropdown then the \'Set correct answer\' section should not be displayed; \'All or nothing\', \'Partial - equal weights\' and \'Partial - different weights\' radio buttons should not be displayed; \'Points\' and \'Minimum score awarded (if attempted)\' labels and input fields should be displayed and inside additional settings accordion, Check answer section i.e. \'Allow student to check answer\' checkbox should not be displayed', () => {
472
- utilities.verifyElementVisibilityState(autoScoredSetCorrectAnswerSection.setCorrectAnswerLabel(), 'notExist');
473
- utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.allOrNothingCheckbox(), 'notExist');
474
- utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.partialEqualWeightsCheckbox(), 'notExist');
475
- utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.partialDifferentWeightsCheckbox(), 'notExist');
476
- utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.penaltyPointsInputField(), 'notExist');
477
- utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.penaltyPointsLabel(), 'notExist');
478
- utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.rounddownScoreCheckbox(), 'notExist');
479
- utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.rounddownScoreCheckboxLabel(), 'notExist');
480
- utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.randomizeOptionsCheckbox(), 'notExist');
481
- utilities.verifyElementVisibilityState(fillInTheGapsDropdownCommonComponent.matchFromAllResponsesCheckbox(), 'notExist');
482
- scoringSectionBase.steps.verifyDefaultMinimumScoreIfAttemptedLabelAndPointsField();
483
- additionalSettingsPanel.steps.expandAdditonalSettings();
484
- utilities.verifyElementVisibilityState(autoScoredAdditionalSettings.checkAnswerLabel(), 'notExist');
485
- utilities.verifyElementVisibilityState(autoScoredAdditionalSettings.allowStudentsToCheckAnswerLabel(), 'notExist');
486
- utilities.verifyElementVisibilityState(autoScoredAdditionalSettings.allowStudentsToCheckAnswerCheckbox(), 'notExist');
588
+ verifyContentsOfSpecifyCorrectAnswerSection: () => {
589
+ it('When user selects a scoring type then in the \'Correct\' accordion, all the contents should be displayed', () => {
590
+ fillInTheGapsDropdownCommonComponent.dropdownSpecifyCorrectAnswerSection()
591
+ .each(($element, index) => {
592
+ utilities.verifyElementVisibilityState(cy.wrap($element), 'visible');
593
+ utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownLabelSpecifyCorrectAnswerSection(), index), `Dropdown ${index + 1}`);
594
+ utilities.verifyElementVisibilityState(utilities.getNthElement(fillInTheGapsDropdownCommonComponent.dropdownLabelSpecifyCorrectAnswerSection(), index), 'visible');
595
+ })
487
596
  });
488
597
  }
489
598
  }
490
599
 
491
600
  export const fillInTheGapsDropdownCommonComponent = {
492
601
  ...selectors,
493
- steps,
494
- tests
602
+ steps
495
603
  }