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,878 +1,606 @@
1
1
  import utilities from "../../support/helpers/utilities";
2
- import { additionalSettingsPanel } from "./additionalSettingsPanel";
3
- import { autoScoredAdditionalSettings } from "./autoScoredAdditionalSettings";
4
- import { autoScoredScoringSectionMultipleResponsesType } from "./autoScoredScoringSectionMultipleResponsesType";
5
- import { autoScoredSetCorrectAnswerSection } from "./autoScoredSetCorrectAnswerSection";
6
2
  import { commonComponents } from "./commonComponents";
7
- import { figOverImageCommonComponent } from "./figOverImageCommonComponent";
8
- import { scoringSectionBase } from "./scoringSectionBase";
9
- import { specialAndCustomSpecialCharactersComponent } from "./specialAndCustomSpecialCharactersComponent";
3
+ import { createQuestionBasePage } from "./createQuestionBasePage";
10
4
  const css = Cypress.env('css');
11
5
 
12
6
  const selectors = {
13
- responseFieldSetCorrectAnswerSection: () => cy.get('.response-input-field input[type="text"]'),
14
- responseFieldWrapperSetCorrectAnswerSection: () => cy.get('.response-input-field'),
15
- responseFieldLabelSetCorrectAnswerSection: () => cy.get('.response-label'),
16
- caseSensitiveLabel: () => cy.get('.ngie-checkbox-control-label').eq(0),
17
- caseSensitiveCheckbox: () => cy.get('.ngie-checkbox input').eq(0),
18
- ignoreSpacesBeforeAndAfterLabel: () => cy.get('.ngie-checkbox-control-label').eq(1),
19
- ignoreSpacesBeforeAndAfterCheckbox: () => cy.get('.ngie-checkbox input').eq(1),
20
- matchFromAllResponsesLabel: () => cy.get('.ngie-checkbox-control-label').eq(2),
21
- matchFromAllResponsesCheckbox: () => cy.get('.ngie-checkbox input').eq(2),
22
- responseFieldPreviewTab: () => cy.get('[class*="ClozeWithTextResponsestyles__ContentWrapper"] .response-input-field input[type="text"]'),
23
- responseFieldWrapperPreviewTab: () => cy.get('[class*="question-preview-wrapper"] .response-input-field'),
24
- previewTabCorrectAnswerContainer: () => cy.get('[class*="ClozeWithTextResponsestyles__CorrectAnswerWrapper"]'),
25
- previewTabCorrectAnswerResponseWrapper: () => cy.get('[class*="ClozeWithTextResponsestyles__CorrectResponseWrapper"] [aria-label*="Add answer for response"]'),
26
- previewTabResponseWrapper: () => cy.get('.draggable-input .cloze-with-text-answer-status-response-preview-wrapper'),
27
- previewTabCorrectAnswerLabel: () => cy.get('[class*="ClozeWithTextResponsestyles__CorrectAnswerLabel"]'),
28
- responseNumeration: () => cy.get('.response-input-adornment'),
29
- setCharacterLimitLabel: () => cy.get('[aria-labelledby="Set character limit"]'),
30
- setCharacterLimitInputField: () => cy.get('input[aria-label="Set character limit"]'),
31
- typeOfAnswerInputLabel: () => cy.get('[id*="Type-of-Answer-input"][id*="dropdown-label"]'),
32
- typeOfAnswerInputDropdown: () => cy.get('[id*="Type-of-Answer-input"][id*="select"]'),
33
- typeOfAnswerInputDropdownListOptions: (ariaLabel = null) => {
34
- if (ariaLabel) {
35
- return cy.get(`[aria-labelledby*="Type-of-Answer-input"][aria-labelledby*="dropdown-label"] li[role="option"][aria-label*="${ariaLabel}"]`)
36
- } else {
37
- return cy.get('[aria-labelledby*="Type-of-Answer-input"][aria-labelledby*="dropdown-label"] li[role="option"]')
38
- }
39
- },
40
- multilineResponseLabel: () => cy.get('[data-ngie-testid="multiline-response-checkbox"] .MuiFormControlLabel-label'),
41
- multilineResponseCheckbox: () => cy.get('[data-ngie-testid="multiline-response-checkbox"] input'),
42
- multilineResponseAreaSetCorrectAnswerSection: () => cy.get('.response-multiline-input-field textarea'),
43
- multilineResponseAreaPreviewTab: () => cy.get('.cloze-with-text-response-preview-wrapper .response-multiline-input-field textarea'),
44
- spellCheckLabel: () => cy.get('[data-ngie-testid="spell-check-checkbox"] .MuiFormControlLabel-label'),
45
- spellCheckCheckbox: () => cy.get('[data-ngie-testid="spell-check-checkbox"] input[type="checkbox"]'),
46
- previewTabResponseFieldSpecialCharactersButton: () => cy.get('.cloze-with-text-response-preview-wrapper .custon-special-character-button'),
7
+ answerInputFieldSpecifyCorrectAnswerSection: () => cy.get('.label-image-text-inline-text-field input'),
8
+ answerInputFieldPreviewTab: () => cy.get('[class*="question-preview-wrapper"] .response-input-field input'),
9
+ responseAreaNumeration: () => cy.get('.response-input-adornment'),
10
+ correctAnswerSectionWrapper: () => cy.get('.cloze-with-text-correct-answer-wrapper'),
11
+ correctAnswersLabel: () => cy.get('[class*="question-preview-wrapper"] [class*="correct-answer-label"]'),
12
+ responseStatusWrapper: () => cy.get('.cloze-with-text-answer-status-response-preview-wrapper:visible'),
13
+ correctAnswerResponseNumeration: () => cy.get('.answer-numeration-number-box'),
14
+ correctAnswerResponseWrapper: () => cy.get('[class*="ClozeWithTextResponsestyles__AnswerCell"]'),
15
+ correctAnswerResponse: () => cy.get('[class*="AnswerWrapperForLabel"]'),
16
+
17
+ setLimitLabel: () => cy.get('[class*="SetLimitWrapper"] .text-label'),
18
+ minimumCharacterLimitLabel: () => cy.get('.label-image-min-max-container .additional-settings-label').eq(0),
19
+ maximumCharacterLimitLabel: () => cy.get('.label-image-min-max-container .additional-settings-label').eq(1),
20
+ minMaxLabelAndInputFieldWrapper: () => cy.get('.label-image-min-max-container'),
21
+ minimumCharacterLimitInputField: () => cy.get('.label-image-min-max-container input').eq(0),
22
+ maximumCharacterLimitInputField: () => cy.get('.label-image-min-max-container input').eq(1),
23
+ characterRadioButton: () => cy.get('input[aria-label="Character"]'),
24
+ characterLabel: () => cy.get('[aria-label="Character"].ngie-radio-label'),
25
+ noneRadioButton: () => cy.get('input[aria-label="None"]'),
26
+ noneLabel: () => cy.get('[aria-label="None"].ngie-radio-label'),
27
+ limitReachedWarningMessage: () => cy.get('.disabled-wrapper-cls [class*="DisabledTextWrapper"]'),
28
+ limitReachedWarningMessageContainer: () => cy.get('.disabled-wrapper-cls'),
29
+
30
+ //response accordion
31
+ responseAccordion: () => cy.get('.response-text-accordion'),
32
+ responseAccordionLabel: () => cy.get('[class*="ResponseComponentstyles__Label"]'),
33
+ responseAccordionAnswersLabel: () => cy.get('.correct-response-answer-wrapper-cls .points-label'),
34
+ responseAccordionAnswerInputFieldWrapper: () => cy.get('.label-image-text-answer-label'),
35
+ responseAccordionAnswerNumeration: () => cy.get('.additional-option-placeholder-input .start-adornment'),
36
+ responseAccordionAnswerDeleteButton: () => cy.get('.delete-button'),
37
+ responseAccordionPointsWrapper: () => cy.get('[class*="ResponseComponentstyles__PointsDiv"]'),
38
+ responseAccordionPointsLabel: () => cy.get('[class*="ResponseComponentstyles__PointsLabel"]'),
39
+ responseAccordionPointsScore: () => cy.get('[class*="ResponseComponentstyles__Points-"]'),
40
+ responseAccordionPointsInputFieldWrapper: () => cy.get('[class*="ResponseComponentstyles__PointsWrapper"]'),
41
+ responseAccordionAddAlternateButton: () => cy.get('.add-alternate-btn'),
42
+ responseAccordionAddAlternateButtonLabel: () => cy.get('.add-alternate-btn p'),
43
+ responseAreaNumeration: () => cy.get('.response-input-adornment'),
44
+
45
+ //additional settings
46
+ enterAriaLabelInputField: () => cy.get('input[aria-label*="Enter ARIA label"]')
47
47
  }
48
48
 
49
49
  const steps = {
50
50
  /**
51
- * Enters text into a response field in the 'Set correct answer' section.
52
- * @param {number} index - The index of the response field to target.
53
- * @param {string} text - The text to be entered into the response field.
54
- * @returns {void}
55
- */
56
- enterTextInResponseFieldSetCorrectAnswerSection: (index, text) => {
57
- fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
58
- .eq(index)
59
- .clear()
60
- .type(text)
61
- .blur();
51
+ * Enter text in the answer input fields of the specify correct answer section.
52
+ * @param {Object[]} responses - An array of objects containing the responseIndex and responseText.
53
+ * @param {number} responses[].responseIndex - The index of the answer input field for each response.
54
+ * @param {string} responses[].responseText - The text to be entered in the respective answer input field.
55
+ * @example - enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([
56
+ * { responseIndex: 0, responseText: "Answer 1" },
57
+ * { responseIndex: 1, responseText: "Answer 2" },
58
+ * ]);
59
+ */
60
+ enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection: (responses) => {
61
+ responses.forEach(({ responseIndex, responseText }) => {
62
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.answerInputFieldSpecifyCorrectAnswerSection(), responseIndex)
63
+ .clear()
64
+ .type(responseText)
65
+ .blur();
66
+ });
62
67
  },
63
68
 
64
69
  /**
65
- * Clears the response field in the correct answer section at the specified index.
66
- * @param {number} index - The index of the response field to clear.
70
+ * Verify text in the answer input fields of the preview tab.
71
+ * @param {Object[]} responses - An array of objects containing the responseIndex and responseText.
72
+ * @param {number} responses[].responseIndex - The index of the answer input field for each response.
73
+ * @param {string} responses[].responseText - The text to be verified in the respective answer input field.
67
74
  */
68
- clearResponseFieldSetCorrectAnswerSection: (index) => {
69
- fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
70
- .eq(index)
71
- .clear();
75
+ verifyTextInAnswerInputFieldsPreviewTab: (responses) => {
76
+ responses.forEach(({ responseIndex, responseText }) => {
77
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab(), responseIndex)
78
+ .should('have.value', responseText)
79
+ });
72
80
  },
73
81
 
74
82
  /**
75
- * Clears the response field in the preview tab at the specified index.
76
- * @param {number} index - The index of the response field to clear.
83
+ * Enter text in the answer input fields of the preview tab.
84
+ * @param {Object[]} responses - An array of objects containing the responseIndex and responseText.
85
+ * @param {number} responses[].responseIndex - The index of the answer input field for each response.
86
+ * @param {string} responses[].responseText - The text to be entered in the respective answer input field.
77
87
  */
78
- clearResponseFieldPreviewTab: (index) => {
79
- fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
80
- .eq(index)
81
- .clear();
88
+ enterTextInAnswerInputFieldsPreviewTab: (responses) => {
89
+ responses.forEach(({ responseIndex, responseText }) => {
90
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab(), responseIndex)
91
+ .clear()
92
+ .type(responseText)
93
+ .blur();
94
+ });
82
95
  },
83
96
 
84
97
  /**
85
- * Verifies the text value in a response field in the 'Set Correct Answer' section.
86
- * @param {number} index - The index of the response field to target.
87
- * @param {string} value - The expected text value to compare against.
88
- * @returns {void}
98
+ * Verify that a specific answer input field is disabled on the preview tab.
99
+ * @param {number} inputFieldIndex - The index of the disabled answer input field.
89
100
  */
90
- verifyTextInResponseFieldSetCorrectAnswerSection: (index, value) => {
91
- fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
92
- .eq(index)
93
- .should('have.attr', 'value', value);
101
+ verifyAnswerInputFieldDisabled: (inputFieldIndex) => {
102
+ utilities.verifyElementDisabled(utilities.getNthElement(fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab(), inputFieldIndex));
94
103
  },
95
104
 
96
- /**
97
- * Enters text into a response field in the preview tab
98
- * @param {number} index - The index of the response field to target.
99
- * @param {string} text - The text to be entered into the response field.
100
- * @returns {void}
101
- */
102
- enterTextInResponseFieldPreviewTab: (index, text) => {
103
- fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
104
- .eq(index)
105
- .clear()
106
- .type(text)
107
- .blur();
105
+ verifyResponseAreaNumeration: () => {
106
+ fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab()
107
+ .each(($element, index) => {
108
+ cy.wrap($element)
109
+ .parents('.cloze-with-text-response-field-wrapper')
110
+ .within(() => {
111
+ utilities.verifyTextContent(fillInTheGapsTextCommonComponent.responseAreaNumeration(), `${index + 1}`);
112
+ });
113
+ });
108
114
  },
109
115
 
110
116
  /**
111
- * Verifies the text value in a response field in the 'Set Correct Answer' section.
112
- * @param {number} index - The index of the response field to target.
113
- * @param {string} value - The expected text value to compare against.
114
- * @returns {void}
117
+ * Verify correct answer responses in the correct answer section and count.
118
+ * @param {string[]} correctAnswerArray - An array containing the expected correct answer responses.
119
+ * @example verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount(['Flower', 'Petals', 'Stem']);
115
120
  */
116
- verifyTextInResponseFieldPreviewTab: (index, value) => {
117
- fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
118
- .eq(index)
119
- .should('have.attr', 'value', value);
120
- },
121
-
122
- verifyMatchFromAllResponsesLabelAndCheckboxEnabledState: () => {
123
- fillInTheGapsTextCommonComponent.matchFromAllResponsesLabel()
124
- .should('not.have.class', 'Mui-disabled');
125
- fillInTheGapsTextCommonComponent.matchFromAllResponsesCheckbox()
126
- .and('not.be.disabled');
127
- },
128
-
129
- verifyCaseSensitiveCheckboxNotChecked: () => {
130
- fillInTheGapsTextCommonComponent.caseSensitiveCheckbox()
131
- .should('not.be.checked');
121
+ verifyCorrectAnswerResponsesInCorrectAnswerSectionAndCount: (correctAnswerArray) => {
122
+ utilities.verifyElementCount(fillInTheGapsTextCommonComponent.correctAnswerResponseWrapper(), correctAnswerArray.length);
123
+ correctAnswerArray.forEach((correctAnswer, index) => {
124
+ fillInTheGapsTextCommonComponent.correctAnswerResponseWrapper()
125
+ .eq(index)
126
+ .within(() => {
127
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.correctAnswerResponseNumeration(), `${index + 1}`);
128
+ fillInTheGapsTextCommonComponent.correctAnswerResponse()
129
+ .should('have.text', correctAnswer);
130
+ });
131
+ });
132
132
  },
133
133
 
134
- verifyCaseSensitiveCheckBoxChecked: () => {
135
- fillInTheGapsTextCommonComponent.caseSensitiveCheckbox()
136
- .should('be.checked')
134
+ verifyCorrectAnswerSectionNotExists: () => {
135
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.correctAnswerSectionWrapper(), 'notExist');
137
136
  },
138
137
 
139
- verifyIgnoreSpacesBeforeAndAfterCheckboxChecked: () => {
140
- fillInTheGapsTextCommonComponent.ignoreSpacesBeforeAndAfterCheckbox()
138
+ verifyCharacterRadioButtonSelected: () => {
139
+ fillInTheGapsTextCommonComponent.characterRadioButton()
141
140
  .should('be.checked');
142
141
  },
143
142
 
144
- verifyIgnoreSpacesBeforeAndAfterCheckboxNotChecked: () => {
145
- fillInTheGapsTextCommonComponent.ignoreSpacesBeforeAndAfterCheckbox()
143
+ verifyNoneRadioButtonNotSelected: () => {
144
+ fillInTheGapsTextCommonComponent.noneRadioButton()
146
145
  .should('not.be.checked');
147
146
  },
148
147
 
149
- verifyMatchFromAllResponsesLabelAndCheckboxDisabledState: () => {
150
- fillInTheGapsTextCommonComponent.matchFromAllResponsesLabel()
151
- .should('have.class', 'Mui-disabled');
152
- fillInTheGapsTextCommonComponent.matchFromAllResponsesCheckbox()
153
- .and('be.disabled');
154
- },
155
-
156
- //Note: Need to move this in figOverImageCommonComponent file along with the selectors once the checkbox enhancement build is uploaded
157
- checkMatchFromAllResponsesCheckbox: () => {
158
- fillInTheGapsTextCommonComponent.matchFromAllResponsesCheckbox()
148
+ selectCharacterRadioButton: () => {
149
+ fillInTheGapsTextCommonComponent.characterRadioButton()
159
150
  .click()
160
151
  .should('be.checked');
161
152
  },
162
153
 
163
- /**
164
- * @param {string[]} correctAnswerArray array of correct answer response
165
- * @param {number[]} optionNumerationArray numeration of the correct answer response
166
- * @description verify the correct answer responses in the correct answer container
167
- */
168
- verifyCorrectAnswerResponsesInCorrectAnswerContainerAndCount: (correctAnswerArray, optionNumerationArray) => {
169
- fillInTheGapsTextCommonComponent.previewTabCorrectAnswerContainer()
170
- .should('be.visible')
171
- .within(() => {
172
- correctAnswerArray.forEach((responseFieldText, count) => {
173
- fillInTheGapsTextCommonComponent.previewTabCorrectAnswerResponseWrapper()
174
- .eq(count)
175
- .should('have.value', responseFieldText);
176
- });
177
- optionNumerationArray.forEach((optionNumeration, count) => {
178
- fillInTheGapsTextCommonComponent.responseNumeration()
179
- .eq(count)
180
- .should('have.text', `${optionNumeration}`);
181
- });
182
- });
183
- fillInTheGapsTextCommonComponent.previewTabCorrectAnswerResponseWrapper()
184
- .should('have.length', optionNumerationArray.length);
185
- },
186
-
187
- /**
188
- * Verify that the incorrect option at the specified index has a cross-mark icon and is visible.
189
- * @param {number} index - The index of the incorrect option to verify.
190
- */
191
- verifyIncorrectOptionCrossmarkIcon: (index) => {
192
- fillInTheGapsTextCommonComponent.previewTabResponseWrapper()
193
- .eq(index)
194
- .find('.tick-icon-wrapper')
195
- .should('have.class', 'icon-incorrect')
196
- .and('be.visible');
197
- },
198
-
199
- /**
200
- * Verify that the correct option at the specified index has a check-mark icon and is visible.
201
- * @param {number} index - The index of the correct option to verify.
202
- */
203
- verifyCorrectOptionCheckmarkIcon: (index) => {
204
- fillInTheGapsTextCommonComponent.previewTabResponseWrapper()
205
- .eq(index)
206
- .find('.tick-icon-wrapper')
207
- .should('have.class', 'icon-correct')
208
- .and('be.visible');
209
- },
210
-
211
- verifyPreviewTabCorrectAnswerContainerNotExist: () => {
212
- utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.previewTabCorrectAnswerContainer(), 'notExist');
213
- },
214
-
215
- checkCaseSensitiveCheckbox: () => {
216
- fillInTheGapsTextCommonComponent.caseSensitiveCheckbox()
154
+ selectNoneRadioButton: () => {
155
+ fillInTheGapsTextCommonComponent.noneRadioButton()
217
156
  .click()
218
- .should('be.checked');
219
- },
220
-
221
- uncheckIgnoreSpacesBeforeAndAfterCheckbox: () => {
222
- fillInTheGapsTextCommonComponent.ignoreSpacesBeforeAndAfterCheckbox()
223
- .click()
224
- .should('not.be.checked');
225
- },
226
-
227
- uncheckMatchFromAllResponsesCheckbox: () => {
228
- fillInTheGapsTextCommonComponent.matchFromAllResponsesCheckbox()
229
- .click()
230
- .should('not.be.checked')
231
- },
232
-
233
- /**
234
- * @param {number} index - The index of the option to verify.
235
- * @description Verify that the option at the specified index does not have a check-mark or cross-mark.
236
- */
237
- verifyCheckmarkOrCrossmarkNotVisible: (index) => {
238
- utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.previewTabResponseWrapper().eq(index).find('.tick-icon-wrapper'), 'notExist');
239
157
  },
240
158
 
241
159
  /**
242
- * Verify the character limit input field value.
243
- * @param {string} value - The expected character limit value to match the input field value.
160
+ * @param {number} minLimit value of minimum input field
161
+ * @description this function verifies the value in minimum limit input field
244
162
  */
245
- verifySetCharacterLimitInputFieldValue: (value) => {
246
- fillInTheGapsTextCommonComponent.setCharacterLimitInputField()
247
- .should('have.value', value)
163
+ verifyMinimumCharacterLimitInputField: (minLimit) => {
164
+ fillInTheGapsTextCommonComponent.minimumCharacterLimitInputField()
165
+ .should('have.value', minLimit);
248
166
  },
249
167
 
250
168
  /**
251
- * Verify that the placeholder attribute does not exist in a response field in the Correct Answer section.
252
- * @param {number} responseFieldIndex - The index of the response field to verify.
169
+ * @param {number} maxLimit value of maximum input field
170
+ * @description this function verifies the value in maximum limit input field
253
171
  */
254
- verifyPlaceholderAttributeInSetCorrectAnswerSectionResponseFieldNotExists: (responseFieldIndex) => {
255
- fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
256
- .eq(responseFieldIndex)
257
- .should('not.have.attr', 'placeholder');
172
+ verifyMaximumCharacterLimitInputField: (maxLimit) => {
173
+ fillInTheGapsTextCommonComponent.maximumCharacterLimitInputField()
174
+ .should('have.value', maxLimit);
258
175
  },
259
176
 
260
177
  /**
261
- * Verify that the placeholder attribute does not exist in a response field in the Preview Tab.
262
- * @param {number} responseFieldIndex - The index of the response field to verify.
178
+ * @param {number} maxLimit value to be entered in maximum limit input field
179
+ * @description this function enters the value in maximum limit input field
263
180
  */
264
- verifyPlaceholderAttributeInPreviewTabResponseFieldNotExists: (responseFieldIndex) => {
265
- fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
266
- .eq(responseFieldIndex)
267
- .should('not.have.attr', 'placeholder');
268
- },
269
-
270
- /**
271
- * Verify the placeholder attribute in a response field in the Correct Answer section.
272
- * @param {number} responseFieldIndex - The index of the response field to verify.
273
- * @param {string} placeholderText - The expected placeholder text to match the attribute.
274
- */
275
- verifyPlaceholderAttributeInSetCorrectAnswerSectionResponseField: (responseFieldIndex, placeholderText) => {
276
- fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
277
- .eq(responseFieldIndex)
278
- .should('have.attr', 'placeholder', placeholderText);
279
- },
280
-
281
- /**
282
- * Verify the placeholder attribute in a response field in the Preview Tab.
283
- * @param {number} responseFieldIndex - The index of the response field to verify.
284
- * @param {string} placeholderText - The expected placeholder text to match the attribute.
285
- */
286
- verifyPlaceholderAttributeInPreviewTabResponseField: (responseFieldIndex, placeholderText) => {
287
- fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
288
- .eq(responseFieldIndex)
289
- .should('have.attr', 'placeholder', placeholderText);
181
+ setMaximumLimit: (maxLimit) => {
182
+ fillInTheGapsTextCommonComponent.maximumCharacterLimitInputField()
183
+ .clear()
184
+ .type(maxLimit)
185
+ .blur();
290
186
  },
291
187
 
292
188
  /**
293
- * @param {index} responseIndex Index of response field
294
- * @param {string} ariaLabel Aria-label of response field
295
- * @description Verify Aria-label of response field in set correct answer section
296
- * @param {number} index of response field in preview tab
297
- * @description this function focuses in the preview atb response field
189
+ * @param {number} maxLimit value to be entered in maximum limit input field
190
+ * @description this function verifies the value in maximum limit input field
298
191
  */
299
- focusInResponseFieldPreviewTab: (index) => {
300
- fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
301
- .eq(index)
302
- .click();
303
- },
304
-
305
- /**
306
- * @param {index} responseIndex Index of response
307
- * @param {string} ariaLabel Aria-label of response
308
- * @description Verify aria-label of response in set correct answer section
309
- */
310
- verifyResponseFieldAriaLabelAttributeInSetCorrectAnswerSection: (responseIndex, ariaLabel) => {
311
- fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
312
- .eq(responseIndex)
313
- .should('have.attr', 'aria-label', ariaLabel);
314
- },
315
-
316
- /**
317
- * @param {index} responseIndex Index of response field
318
- * @param {string} ariaLabel Aria-label of response field
319
- * @description Verify Aria-label of response field in preview tab
320
- */
321
- verifyResponseFieldAriaLabelAttributeInPreviewTab: (responseIndex, ariaLabel) => {
322
- fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
323
- .eq(responseIndex)
324
- .should('have.attr', 'aria-label', ariaLabel);
325
- },
192
+ verifyMaximumLimit: (maxLimit) => {
193
+ fillInTheGapsTextCommonComponent.maximumCharacterLimitInputField()
194
+ .should('have.value', maxLimit);
326
195
 
327
- /**
328
- * @param {number} responseIndex Index of response field
329
- * @description Verify response is displayed in set correct answer section
330
- */
331
- verifyResponseFieldIsDisplayedInSetCorrectAnswerSection: (responseIndex) => {
332
- utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection().eq(responseIndex), 'visible');
333
196
  },
334
197
 
335
198
  /**
336
- * @param {array} dropdownOptionsArray array of type of answer dropdown options
337
- * @description This function is used to verify the type of answer dropdown options
199
+ * @param {number} minLimit value to be entered in minimum limit input field
200
+ * @description this function enters and verifies the value in minimum limit input field
338
201
  */
339
- verifyTypeOfAnswerDropdownOptions: (dropdownOptionsArray) => {
340
- dropdownOptionsArray.forEach((option, count) => {
341
- fillInTheGapsTextCommonComponent.typeOfAnswerInputDropdownListOptions()
342
- .eq(count)
343
- .should('have.text', option);
344
- });
345
- },
346
-
347
- clickOnTypeOfAnswerDropdown: () => {
348
- fillInTheGapsTextCommonComponent.typeOfAnswerInputDropdown()
349
- .eq(0)
350
- .click();
202
+ setMinimumLimit: (minLimit) => {
203
+ fillInTheGapsTextCommonComponent.minimumCharacterLimitInputField()
204
+ .clear()
205
+ .type(minLimit)
206
+ .blur();
351
207
  },
352
208
 
353
209
  /**
354
- * Select a specific option from the "Type of Answer" dropdown.
355
- * @param {("Text" | "Number")} option - The option to select from the dropdown.
210
+ * @param {number} minLimit value to be entered in minimum limit input field
211
+ * @description this function verifies the value in minimum limit input field
356
212
  */
357
- selectTypeOfAnswerDropdownOption: (option) => {
358
- fillInTheGapsTextCommonComponent.typeOfAnswerInputDropdownListOptions(option)
359
- .click();
213
+ verifyMinimumLimit: (minLimit) => {
214
+ fillInTheGapsTextCommonComponent.minimumCharacterLimitInputField()
215
+ .should('have.value', minLimit)
360
216
  },
361
217
 
362
- setCharacterLimit: (value) => {
363
- fillInTheGapsTextCommonComponent.setCharacterLimitInputField()
218
+ clearAndFocusOutOfMaximumCharacterLimitInputField: () => {
219
+ fillInTheGapsTextCommonComponent.maximumCharacterLimitInputField()
364
220
  .clear()
365
- .type(value)
366
221
  .blur();
367
222
  },
368
223
 
369
- verifySetCharacterLimitInputFieldMinimumValue: () => {
370
- fillInTheGapsTextCommonComponent.setCharacterLimitInputField()
371
- .should('not.have.value', '0')
372
- .and('have.value', '1');
373
- },
374
-
375
- clearSetCharacterLimitInputField: () => {
376
- fillInTheGapsTextCommonComponent.setCharacterLimitInputField()
224
+ clearAndFocusOutOfMinimumCharacterLimitInputField: () => {
225
+ fillInTheGapsTextCommonComponent.minimumCharacterLimitInputField()
377
226
  .clear()
378
227
  .blur();
379
228
  },
380
229
 
381
- /**
382
- * Verify the height attribute of a response field in the Correct Answer section.
383
- * @param {number} responseFieldIndex - The index of the response field to verify.
384
- * @param {string} height - The expected height value to match the attribute.
385
- */
386
- verifyHeightResponseFieldSetCorrectAnswerSection: (responseFieldIndex, height) => {
387
- fillInTheGapsTextCommonComponent.responseFieldWrapperSetCorrectAnswerSection()
388
- .eq(responseFieldIndex)
389
- .should('have.attr', 'height', height);
230
+ verifyMaximumLimitErrorMessage: () => {
231
+ utilities.verifyInnerText(utilities.getNthElement(commonComponents.errorMessage(), 1), 'Error: Maximum limit must be greater than or equal to Minimum limit.');
232
+ utilities.verifyElementVisibilityState(utilities.getNthElement(commonComponents.errorMessage(), 1), 'visible');
233
+ },
234
+
235
+ verifyMinimumLimitErrorMessage: () => {
236
+ utilities.verifyInnerText(utilities.getNthElement(commonComponents.errorMessage(), 0), 'Error: Minimum limit must be less than or equal to Maximum limit.');
237
+ utilities.verifyElementVisibilityState(utilities.getNthElement(commonComponents.errorMessage(), 0), 'visible');
390
238
  },
391
239
 
392
240
  /**
393
- * Verify the width attribute of a response field in the Correct Answer section.
394
- * @param {number} responseFieldIndex - The index of the response field to verify.
395
- * @param {string} width - The expected width value to match the attribute.
396
- */
397
- verifyWidthResponseFieldSetCorrectAnswerSection: (responseFieldIndex, width) => {
398
- fillInTheGapsTextCommonComponent.responseFieldWrapperSetCorrectAnswerSection()
399
- .eq(responseFieldIndex)
400
- .should('have.attr', 'width', width);
241
+ * @param {number} responseIndex index of response container
242
+ * @param {number} maxlen value of maxlength attribute
243
+ * @description function verifies maxlength attribute of response container in preview tab
244
+ */
245
+ verifyMaximumCharacterLimitInPreviewTab: (responseIndex, maxlen) => {
246
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab(), responseIndex)
247
+ .should('have.attr', 'maxlength', maxlen);
401
248
  },
402
249
 
403
250
  /**
404
- * Verify the height attribute of a response field in the Preview Tab.
405
- * @param {number} responseFieldIndex - The index of the response field to verify.
406
- * @param {string} height - The expected height value to match the attribute.
251
+ * @param {number} responseIndex index of input field in specify correct answer
252
+ * @param {number} maxlen value of maxlength attribute
253
+ * @description function verifies maxlength attribute of input field in specify correct answer
407
254
  */
408
- verifyHeightResponseFieldPreviewTab: (responseFieldIndex, height) => {
409
- fillInTheGapsTextCommonComponent.responseFieldWrapperPreviewTab()
410
- .eq(responseFieldIndex)
411
- .should('have.attr', 'height', height);
255
+ verifyMaximumCharacterLimit: (responseIndex, maxlen) => {
256
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.answerInputFieldSpecifyCorrectAnswerSection(), responseIndex)
257
+ .should('have.attr', 'maxlength', maxlen);
412
258
  },
413
259
 
414
260
  /**
415
- * Verify the width attribute of a response field in the Preview Tab.
416
- * @param {number} responseFieldIndex - The index of the response field to verify.
417
- * @param {string} width - The expected width value to match the attribute.
261
+ * @param {number} responseIndex index of response container in preview tab
262
+ * @description function verifies maxlength attribute of input field in preview tab
418
263
  */
419
- verifyWidthResponseFieldPreviewTab: (responseFieldIndex, width) => {
420
- fillInTheGapsTextCommonComponent.responseFieldWrapperPreviewTab()
421
- .eq(responseFieldIndex)
422
- .should('have.attr', 'width', width);
264
+ verifyMaximumCharacterLimitNotExistInPreviewTab: (responseIndex) => {
265
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab(), responseIndex)
266
+ .should('not.have.attr', 'maxlength');
423
267
  },
424
268
 
425
- verifyTypeOfAnswerLabelAndDropdownResponseAccordion: () => {
426
- figOverImageCommonComponent.responseAccordionWrapper()
427
- .within(() => {
428
- utilities.verifyInnerText(fillInTheGapsTextCommonComponent.typeOfAnswerInputLabel(), 'Type of answer input');
429
- utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.typeOfAnswerInputLabel(), 'visible');
430
- utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.typeOfAnswerInputDropdown(), 'visible');
431
- utilities.verifyInnerText(fillInTheGapsTextCommonComponent.typeOfAnswerInputDropdown(), 'Text');
432
- });
269
+ verifyLimitReachedWarningMessageNotExist: () => {
270
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.limitReachedWarningMessage(), 'notExist');
433
271
  },
434
272
 
435
273
  /**
436
- * Click on the "Type of Answer" dropdown in a response accordion.
437
- * @param {number} responseIndex - The index of the response accordion to click the dropdown in.
274
+ * @description this function verifies warning text for limit reached
275
+ * @param {string} warningText warning message displayed
438
276
  */
439
- clickOnTypeOfAnswerDropdownInResponseAccordion: (responseIndex) => {
440
- figOverImageCommonComponent.responseAccordionWrapper()
441
- .eq(responseIndex)
442
- .within(() => {
443
- fillInTheGapsTextCommonComponent.typeOfAnswerInputDropdown()
444
- .click();
445
- });
277
+ verifyLimitReachedWarningMessageExist: (warningText) => {
278
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.limitReachedWarningMessage(), 'visible');
279
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.limitReachedWarningMessage(), warningText);
446
280
  },
447
281
 
448
282
  /**
449
- * Verify the selected option in the "Type of Answer" dropdown in a response accordion.
450
- * @param {number} responseIndex - The index of the response accordion to verify.
451
- * @param {string} option - The expected option to be selected in the dropdown.
283
+ *@description Verify text in the answer input fields of the specify correct answer section.
284
+ * @param {Object[]} responses - An array of objects containing the responseIndex and responseText.
285
+ * @param {number} responses[].responseIndex - The index of the answer input field for each response.
286
+ * @param {string} responses[].responseText - The text to be verified for the respective answer input field.
452
287
  */
453
- verifySelectedOptionInTypeOfAnswerDropdownInResponseAccordion: (responseIndex, option) => {
454
- figOverImageCommonComponent.responseAccordionWrapper()
455
- .eq(responseIndex)
456
- .within(() => {
457
- utilities.verifyInnerText(fillInTheGapsTextCommonComponent.typeOfAnswerInputDropdown(), option);
458
- });
288
+ verifyTextInResponseAccordionAnswerInputField: (responses) => {
289
+ responses.forEach(({ responseIndex, responseText }) => {
290
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.answerInputFieldSpecifyCorrectAnswerSection(), responseIndex)
291
+ .should('have.value', responseText);
292
+ });
459
293
  },
460
294
 
461
- verifyMultilineResponseCheckboxNotChecked: () => {
462
- fillInTheGapsTextCommonComponent.multilineResponseCheckbox()
463
- .should('not.be.checked');
295
+ //Used in setLimitSection.js only.
296
+ /**
297
+ * @param {number} responseIndex index number of text container
298
+ * @param {string} responseText text to be added in text container
299
+ * @description function enters text in the answer input fields of the preview tab
300
+ */
301
+ addTextInAnswerInputFieldsPreviewTab: (responseIndex, responseText) => {
302
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab(), responseIndex)
303
+ .type(responseText);
464
304
  },
305
+ }
465
306
 
466
- verifyMultilineResponseForResponseFieldSetCorrectAnswerSectionDisabled: () => {
467
- fillInTheGapsTextCommonComponent.responseFieldWrapperSetCorrectAnswerSection()
468
- .each(($el) => {
469
- cy.wrap($el)
470
- .should('not.have.class', 'response-multiline-input-field');
471
- // Assert that textarea does not exist
472
- cy.wrap($el)
473
- .find('textarea')
474
- .should('not.exist');
475
- });
476
- },
307
+ const tests = {
308
+ verifySetLimitSectionContents: () => {
309
+ it('\'Set limit\' label should be displayed', () => {
310
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.setLimitLabel(), 'Set limit');
311
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.setLimitLabel(), 'visible');
312
+ });
477
313
 
478
- verifyMultilineResponseForResponseFieldPreviewTabDisabled: () => {
479
- fillInTheGapsTextCommonComponent.responseFieldWrapperPreviewTab()
480
- .each(($el) => {
481
- cy.wrap($el)
482
- .should('not.have.class', 'response-multiline-input-field')
483
- // Assert that textarea does not exist
484
- cy.wrap($el)
485
- .find('textarea')
486
- .should('not.exist');
487
- });
488
- },
314
+ it('\'Character\' and \'None\' labels and radio buttons should be displayed and by default \'Character\' should be selected', () => {
315
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.characterLabel(), 'Character');
316
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.characterLabel(), 'visible');
317
+ fillInTheGapsTextCommonComponent.steps.verifyCharacterRadioButtonSelected();
318
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.noneLabel(), 'None');
319
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.noneLabel(), 'visible');
320
+ fillInTheGapsTextCommonComponent.steps.verifyNoneRadioButtonNotSelected();
321
+ });
489
322
 
490
- checkMultilineResponseCheckbox: () => {
491
- fillInTheGapsTextCommonComponent.multilineResponseCheckbox()
492
- .click()
493
- .should('be.checked');
494
- },
323
+ it('\'Minimum character limit\' and \'Maximum character limit\' labels should be displayed', () => {
324
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.minimumCharacterLimitLabel(), 'Minimum character limit');
325
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.minimumCharacterLimitLabel(), 'visible');
326
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.maximumCharacterLimitLabel(), 'Maximum character limit');
327
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.maximumCharacterLimitLabel(), 'visible');
328
+ });
495
329
 
496
- uncheckMultilineResponseCheckbox: () => {
497
- fillInTheGapsTextCommonComponent.multilineResponseCheckbox()
498
- .click()
499
- .should('not.be.checked');
500
- },
330
+ it('\'Minimum character limit\' and \'Maximum character limit\' input fields should be displayed and have 0 and 50 value by default', () => {
331
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.minimumCharacterLimitInputField(), 'visible');
332
+ fillInTheGapsTextCommonComponent.steps.verifyMinimumCharacterLimitInputField(0);
333
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.maximumCharacterLimitInputField(), 'visible');
334
+ fillInTheGapsTextCommonComponent.steps.verifyMaximumCharacterLimitInputField(50);
335
+ });
501
336
 
502
- /**
503
- * Enter text in a multiline response area in the set correct answer section.
504
- * @param {number} responseFieldIndex - The index of the response field to enter text in.
505
- * @param {string} text - The text to enter in the multiline response area.
506
- */
507
- enterTextInMultilineResponseAreaSetCorrectAnswerSection: (responseFieldIndex, text) => {
508
- fillInTheGapsTextCommonComponent.multilineResponseAreaSetCorrectAnswerSection()
509
- .eq(responseFieldIndex)
510
- .clear()
511
- .type(text);
512
- },
337
+ it('User should be able to update values in both the input fields', () => {
338
+ fillInTheGapsTextCommonComponent.steps.setMinimumLimit(10);
339
+ fillInTheGapsTextCommonComponent.steps.setMaximumLimit(40);
340
+ });
513
341
 
514
- /**
515
- * Verify the text in a multiline response area in the set correct answer section.
516
- * @param {number} responseFieldIndex - The index of the response field to verify.
517
- * @param {string} text - The expected text to be present in the multiline response area.
518
- */
519
- verifyTextInMultilineResponseAreaSetCorrectAnswerSection: (responseFieldIndex, text) => {
520
- fillInTheGapsTextCommonComponent.multilineResponseAreaSetCorrectAnswerSection()
521
- .eq(responseFieldIndex)
522
- .should('have.text', text);
523
- },
342
+ it('When the user clears the minimum character limit input field and focuses out of it, then error message \'Error: Minimum character limit is required\' should be displayed below the input field', () => {
343
+ fillInTheGapsTextCommonComponent.steps.clearAndFocusOutOfMinimumCharacterLimitInputField();
344
+ utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: Minimum character limit is required.');
345
+ utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'visible');
346
+ });
524
347
 
525
- /**
526
- * Enter text in a multiline response area in the Preview Tab.
527
- * @param {number} responseFieldIndex - The index of the response field to enter text in.
528
- * @param {string} text - The text to enter in the multiline response area.
529
- */
530
- enterTextInMultilineResponseAreaPreviewTab: (responseFieldIndex, text) => {
531
- fillInTheGapsTextCommonComponent.multilineResponseAreaPreviewTab()
532
- .eq(responseFieldIndex)
533
- .clear()
534
- .type(text);
535
- },
348
+ commonComponents.tests.verifyErrorMessageCSSAndA11y();
536
349
 
537
- /**
538
- * Verify the text in a multiline response area in the Preview Tab.
539
- * @param {number} responseFieldIndex - The index of the response field to verify.
540
- * @param {string} text - The expected text to be present in the multiline response area.
541
- */
542
- verifyTextInMultilineResponseAreaPreviewTab: (responseFieldIndex, text) => {
543
- fillInTheGapsTextCommonComponent.multilineResponseAreaPreviewTab()
544
- .eq(responseFieldIndex)
545
- .should('have.text', text);
546
- },
350
+ it('When the user enters value in minimum character limit input field then the error message should disappear', () => {
351
+ fillInTheGapsTextCommonComponent.steps.setMinimumLimit(0);
352
+ commonComponents.steps.verifyErrorMessageIsNotDisplayed();
353
+ });
547
354
 
548
- verifySpellCheckCheckboxNotChecked: () => {
549
- fillInTheGapsTextCommonComponent.spellCheckCheckbox()
550
- .should('not.be.checked');
551
- },
355
+ it('When the user clears the maximum character limit input field and focuses out of it, then error message \'Error: Maximum character limit is required.\' should be displayed below the input field', () => {
356
+ fillInTheGapsTextCommonComponent.steps.clearAndFocusOutOfMaximumCharacterLimitInputField();
357
+ utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: Maximum character limit is required.');
358
+ utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'visible');
359
+ });
552
360
 
553
- /**
554
- * Verify that the spell check for a response field in the Correct Answer section is disabled.
555
- * @param {number} responseFieldIndex - The index of the response field to verify.
556
- */
557
- verifySpellCheckOfResponseFieldSetCorrectAnswerSectionDisabled: (responseFieldIndex) => {
558
- fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
559
- .eq(responseFieldIndex)
560
- .should('have.attr', 'spellcheck', 'false');
561
- },
361
+ it('When the user enters value in maximum character limit input field then the error message should disappear', () => {
362
+ fillInTheGapsTextCommonComponent.steps.setMaximumLimit(40);
363
+ commonComponents.steps.verifyErrorMessageIsNotDisplayed();
364
+ });
562
365
 
563
- /**
564
- * Verify that the spell check for a response field in the Correct Answer section is enabled.
565
- * @param {number} responseFieldIndex - The index of the response field to verify.
566
- */
567
- verifySpellCheckOfResponseFieldSetCorrectAnswerSectionEnabled: (responseFieldIndex) => {
568
- fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
569
- .eq(responseFieldIndex)
570
- .should('have.attr', 'spellcheck', 'true');
571
- },
366
+ it('When the user sets minimum limit input field value greater than maximum limit input field value then error message \'Error: Minimum limit must be less than or equal to maximum limit.\' and \'Error: Maximum limit must be greater than or equal to minimum limit.\'should be displayed below the minimum and maximum input field respectively', () => {
367
+ fillInTheGapsTextCommonComponent.steps.setMinimumLimit(45);
368
+ fillInTheGapsTextCommonComponent.steps.verifyMaximumLimitErrorMessage();
369
+ fillInTheGapsTextCommonComponent.steps.verifyMinimumLimitErrorMessage();
370
+ });
572
371
 
573
- /**
574
- * Verify that the spell check for a response field in the Preview Tab is disabled.
575
- * @param {number} responseFieldIndex - The index of the response field to verify.
576
- */
577
- verifySpellCheckOfResponseFieldPreviewTabDisabled: (responseFieldIndex) => {
578
- fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
579
- .eq(responseFieldIndex)
580
- .should('have.attr', 'spellcheck', 'false');
581
- },
372
+ commonComponents.tests.verifyErrorMessageCSSAndA11y();
582
373
 
583
- /**
584
- * Verify that the spell check for a response field in the Preview Tab is enabled.
585
- * @param {number} responseFieldIndex - The index of the response field to verify.
586
- */
587
- verifySpellCheckOfResponseFieldPreviewTabEnabled: (responseFieldIndex) => {
588
- fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
589
- .eq(responseFieldIndex)
590
- .should('have.attr', 'spellcheck', 'true');
591
- },
374
+ it('When the user sets minimum limit input field value less than or equal to maximum limit input field value then error message should disappear', () => {
375
+ fillInTheGapsTextCommonComponent.steps.setMinimumLimit(30);
376
+ commonComponents.steps.verifyErrorMessageIsNotDisplayed();
377
+ });
592
378
 
593
- checkSpellCheckCheckbox: () => {
594
- fillInTheGapsTextCommonComponent.spellCheckCheckbox()
595
- .click()
596
- .should('be.checked');
597
- },
379
+ it('When the user sets maximum limit input field value less than minimum limit input field value then error message \'Error: Minimum limit must be less than or equal to maximum limit.\' and \'Error: Maximum limit must be greater than or equal to minimum limit.\'should be displayed below the minimum and maximum input field respectively', () => {
380
+ fillInTheGapsTextCommonComponent.steps.setMaximumLimit(26);
381
+ fillInTheGapsTextCommonComponent.steps.verifyMaximumLimitErrorMessage();
382
+ fillInTheGapsTextCommonComponent.steps.verifyMinimumLimitErrorMessage();
383
+ });
598
384
 
599
- /**
600
- * Verify the numeration of response fields in the Preview Tab and Correct Answer section.
601
- * @param {string[]} numerationArray - An array of expected numeration strings to verify.
602
- */
603
- verifyPreviewTabResponseFieldAndCorrectAnswerNumeration: (numerationArray) => {
604
- numerationArray.forEach((optionNumeration, index) => {
605
- fillInTheGapsTextCommonComponent.previewTabResponseWrapper()
606
- .eq(index)
607
- .within(() => {
608
- fillInTheGapsTextCommonComponent.responseNumeration()
609
- .should('have.text', optionNumeration);
610
- });
611
- fillInTheGapsTextCommonComponent.previewTabCorrectAnswerResponseWrapper()
612
- .eq(index)
613
- .parent()
614
- .within(() => {
615
- fillInTheGapsTextCommonComponent.responseNumeration()
616
- .should('have.text', optionNumeration);
617
- });
385
+ it('When the user sets maximum limit input field value greater than or equal to minimum limit input field value then error message should disappear', () => {
386
+ fillInTheGapsTextCommonComponent.steps.setMaximumLimit(45);
387
+ commonComponents.steps.verifyErrorMessageIsNotDisplayed();
618
388
  });
619
- },
620
389
 
621
- /**
622
- * @param {number} responseIndex Index of response field in preview tab
623
- * @description Verify response field is displayed in preview tab
624
- */
625
- verifyResponseFieldIsDisplayedInPreviewTab: (responseIndex) => {
626
- utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.responseFieldPreviewTab().eq(responseIndex), 'visible');
627
- },
390
+ it('CSS of \'Set character limit\' sections', { tags: 'css' }, () => {
391
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.setLimitLabel(), {
392
+ 'color': css.color.labels,
393
+ 'font-size': css.fontSize.normal,
394
+ 'font-weight': css.fontWeight.semibold
395
+ });
396
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.characterLabel(), {
397
+ 'color': css.color.labelText,
398
+ 'font-size': css.fontSize.normal,
399
+ 'font-weight': css.fontWeight.regular
400
+ });
401
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.characterLabel(), {
402
+ 'color': css.color.labelText,
403
+ 'font-size': css.fontSize.normal,
404
+ 'font-weight': css.fontWeight.regular
405
+ });
406
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.noneLabel(), {
407
+ 'color': css.color.labelText,
408
+ 'font-size': css.fontSize.normal,
409
+ 'font-weight': css.fontWeight.regular
410
+ });
411
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.minimumCharacterLimitLabel(), {
412
+ 'color': css.color.labels,
413
+ 'font-size': css.fontSize.normal,
414
+ 'font-weight': css.fontWeight.semibold
415
+ });
416
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.minimumCharacterLimitLabel(), {
417
+ 'color': css.color.labels,
418
+ 'font-size': css.fontSize.normal,
419
+ 'font-weight': css.fontWeight.semibold
420
+ });
421
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.minimumCharacterLimitInputField(), {
422
+ 'color': css.color.text,
423
+ 'font-size': css.fontSize.default,
424
+ 'font-weight': css.fontWeight.regular
425
+ });
426
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.maximumCharacterLimitInputField(), {
427
+ 'color': css.color.text,
428
+ 'font-size': css.fontSize.default,
429
+ 'font-weight': css.fontWeight.regular
430
+ });
431
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.characterRadioButton().parent().find('svg'), {
432
+ 'fill': css.color.activeButtons
433
+ });
434
+ });
628
435
 
629
- /**
630
- * Verify that the special character button is not visible in a response field in the Correct Answer section.
631
- * @param {number} responseFieldIndex - The index of the response field to verify.
632
- */
633
- verifySpecialCharacterButtonNotVisibleInResponseFieldSetCorrectAnswerSection: (responseFieldIndex) => {
634
- specialAndCustomSpecialCharactersComponent.setCorrectAnsResponseFieldSpecialCharactersButton()
635
- .eq(responseFieldIndex)
636
- .should('not.have.class', 'active-response-input-field')
637
- .should('not.be.visible');
638
- },
436
+ it('Accessibility of \'Set limit\' section', { tags: 'a11y' }, () => {
437
+ cy.checkAccessibility(fillInTheGapsTextCommonComponent.setLimitLabel().parents('[class*="SetLimitWrapper"]'));
438
+ });
639
439
 
640
- /**
641
- * Focus and verify the special characters button in a response field in the Correct Answer section.
642
- * @param {number} responseFieldIndex - The index of the response field to focus and verify.
643
- */
644
- focusAndVerifySpecialCharactersButtonInResponseFieldSetCorrectAnswerSection: (responseFieldIndex) => {
645
- fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
646
- .eq(responseFieldIndex)
647
- .click();
648
- specialAndCustomSpecialCharactersComponent.setCorrectAnsResponseFieldSpecialCharactersButton()
649
- .eq(responseFieldIndex)
650
- .should('have.class', 'active-response-input-field')
651
- .should('be.visible');
652
- },
440
+ it('When user enters zero in maximum limit input field, then error message \'Error: Maximum limit must be greater than 0.\' should be displayed', () => {
441
+ fillInTheGapsTextCommonComponent.steps.setMaximumLimit(0);
442
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.errorMessage(), 'Error: Maximum limit must be greater than 0.');
443
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.errorMessage(), 'visible');
444
+ });
653
445
 
654
- /**
655
- * Verify that the special character button is not visible in a response field in the Preview Tab.
656
- * @param {number} responseFieldIndex - The index of the response field to verify.
657
- */
658
- verifySpecialCharacterButtonNotVisibleInResponseFieldPreviewTab: (responseFieldIndex) => {
659
- fillInTheGapsTextCommonComponent.previewTabResponseFieldSpecialCharactersButton()
660
- .eq(responseFieldIndex)
661
- .should('not.have.class', 'active-response-input-field')
662
- .should('not.be.visible');
663
- },
446
+ it('When user enters limit more than zero in maximum limit input field, then error message should disappear', () => {
447
+ fillInTheGapsTextCommonComponent.steps.setMaximumLimit(50);
448
+ fillInTheGapsTextCommonComponent.steps.verifyErrorMessageIsNotDisplayed();
449
+ });
664
450
 
665
- /**
666
- * Focus and verify the special characters button in a response field in the Preview Tab.
667
- * @param {number} responseFieldIndex - The index of the response field to focus and verify.
668
- */
669
- focusAndVerifySpecialCharactersButtonInResponseFieldPreviewTab: (responseFieldIndex) => {
670
- fillInTheGapsTextCommonComponent.responseFieldPreviewTab()
671
- .eq(responseFieldIndex)
672
- .click();
673
- fillInTheGapsTextCommonComponent.previewTabResponseFieldSpecialCharactersButton()
674
- .eq(responseFieldIndex)
675
- .should('have.class', 'active-response-input-field')
676
- .should('be.visible');
677
- },
451
+ it('When user should not be able to add limit more than 50 inside minimum and maximum limit input field', () => {
452
+ fillInTheGapsTextCommonComponent.steps.setMinimumLimit(60);
453
+ fillInTheGapsTextCommonComponent.steps.verifyMinimumLimit(6);
454
+ fillInTheGapsTextCommonComponent.steps.setMaximumLimit(60);
455
+ fillInTheGapsTextCommonComponent.steps.verifyMaximumLimit(6);
456
+ });
678
457
 
679
- /**
680
- * Click on the special characters button in a response field in the Preview Tab.
681
- * @param {number} responseFieldIndex - The index of the response field to click the button.
682
- */
683
- clickOnSpecialCharactersButtonPreviewTab: (responseFieldIndex) => {
684
- fillInTheGapsTextCommonComponent.previewTabResponseFieldSpecialCharactersButton()
685
- .eq(responseFieldIndex)
686
- .click();
458
+ it('When the user selects \'None\' radio button then the maximum and minimum character limit labels and input field should not be displayed', () => {
459
+ fillInTheGapsTextCommonComponent.steps.selectNoneRadioButton();
460
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.minMaxLabelAndInputFieldWrapper(), 'notExist');
461
+ });
687
462
  },
688
463
 
689
- /**
690
- * Verify the numeration of response fields in the Preview Tab.
691
- * @param {string[]} optionNumerationArray - An array of expected numeration strings to verify.
692
- */
693
- verifyResponseFieldNumeration: (optionNumerationArray) => {
694
- optionNumerationArray.forEach((optionNumeration, count) => {
695
- fillInTheGapsTextCommonComponent.previewTabResponseWrapper()
696
- .eq(count)
697
- .should('be.visible')
698
- .within(() => {
699
- fillInTheGapsTextCommonComponent.responseNumeration()
700
- .should('have.text', `${optionNumeration}`);
701
- });
464
+ verifySetLimitSectionEditTabFunctionality: () => {
465
+ it('When maximum character limit input field value is 50 then maximum character limit should be 50 in the specify correct answer section', () => {
466
+ fillInTheGapsTextCommonComponent.steps.verifyMaximumCharacterLimitInputField(50);
467
+ fillInTheGapsTextCommonComponent.steps.verifyMaximumCharacterLimit(0, 50);
702
468
  });
703
- }
704
- }
705
469
 
706
- const tests = {
707
- ...autoScoredSetCorrectAnswerSection.tests,
708
- /**
709
- * @param {string} tabName Correct or Alternate tab
710
- * @description This function verifies the input field and error states of set correct answer section
711
- */
712
- verifySetCorrectAnswerTabContentsAndFunctionality: (tabName) => {
713
- it('An empty points input field and two empty response fields with labels \'Response 1\' and \'Response 2\' should be present', () => {
714
- scoringSectionBase.steps.verifyPointsFieldValue('');
715
- for (let index = 0; index < 2; index++) {
716
- utilities.verifyInnerText(fillInTheGapsTextCommonComponent.responseFieldLabelSetCorrectAnswerSection().eq(index), `Response ${index + 1}`)
717
- utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection().eq(index), 'visible');
718
- };
470
+ it('When the user updates the maximum character limit input field value then maximum character limit should update in the specify correct answer section', () => {
471
+ fillInTheGapsTextCommonComponent.steps.setMaximumLimit(10);
472
+ fillInTheGapsTextCommonComponent.steps.verifyMaximumCharacterLimit(0, 10);
719
473
  });
720
474
 
721
- it('User should be able to enter text in the empty response field', () => {
722
- fillInTheGapsTextCommonComponent.steps.enterTextInResponseFieldSetCorrectAnswerSection(0, 'Flower');
723
- fillInTheGapsTextCommonComponent.steps.verifyTextInResponseFieldSetCorrectAnswerSection(0, 'Flower');
475
+ it('User should able to enter characters in the answer input field', () => {
476
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'Flower' }]);
724
477
  });
725
478
 
726
- it(`When the user has only partially filled response fields out of the available response fields, \'Error: Please set a correct answer.\' validation error message should be thrown along with an error icon on the \'${tabName}\'`, () => {
727
- fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection()
728
- .eq(1)
729
- .focus()
730
- .blur();
731
- utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: Please set a correct answer.');
732
- if (tabName == 'Correct tab') {
733
- autoScoredSetCorrectAnswerSection.correctTab()
734
- .within(() => {
735
- utilities.verifyElementVisibilityState(autoScoredSetCorrectAnswerSection.setCorrectAnswerErrorIcon(), 'visible');
736
- });
737
- } else {
738
- autoScoredSetCorrectAnswerSection.alternateAnswerTab(1)
739
- .within(() => {
740
- utilities.verifyElementVisibilityState(autoScoredSetCorrectAnswerSection.setCorrectAnswerErrorIcon(), 'visible');
741
- });
742
- };
479
+ it('When the user reaches the character limit, then the warning message \'Maximum 10 characters have been entered\' should be displayed', () => {
480
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'pots' }]);
481
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 0, responseText: 'Flowerpots' }])
482
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageExist('Maximum 10 words have been entered.');
743
483
  });
744
484
 
745
- autoScoredSetCorrectAnswerSection.tests.verifyCSSAndA11yOfAutoScoredSetCorrectAnswerErrorMessage();
746
-
747
- it('CSS of response field error state', { tags: 'css' }, () => {
748
- utilities.verifyCSS(fillInTheGapsTextCommonComponent.responseFieldWrapperSetCorrectAnswerSection().eq(1), {
749
- 'background-color': css.color.errorFieldBg
485
+ it('CSS of error message', { tags: 'css' }, () => {
486
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.limitReachedWarningMessage(), {
487
+ 'color': css.color.warningMessage,
488
+ 'font-size': css.fontSize.normal,
489
+ 'font-weight': css.fontWeight.regular
750
490
  });
751
- utilities.verifyCSS(fillInTheGapsTextCommonComponent.responseFieldWrapperSetCorrectAnswerSection().eq(1).find('fieldset'), {
752
- 'border': `1px solid ${css.color.errorFieldBorder}`
491
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.limitReachedWarningMessageContainer().find('svg'), {
492
+ 'color': css.color.warningMessage,
493
+ });
494
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.limitReachedWarningMessageContainer(), {
495
+ 'border': `1px solid ${css.color.warningContainerBorder}`
496
+ });
497
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.limitReachedWarningMessageContainer(), {
498
+ 'background-color': css.color.warningContainerBackground
753
499
  });
754
500
  });
755
501
 
756
- it('Accessibility of response field error state', { tags: 'a11y' }, () => {
757
- cy.checkAccessibility(fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection().parents('.cloze-with-text-response-form-controls-wrapper'));
502
+ it('Accessibility of error message', { tags: 'a11y' }, () => {
503
+ cy.checkAccessibility(fillInTheGapsTextCommonComponent.limitReachedWarningMessage());
758
504
  });
759
505
 
760
- it('When the user has added text in all the available response fields, the error message should disappear', () => {
761
- fillInTheGapsTextCommonComponent.steps.enterTextInResponseFieldSetCorrectAnswerSection(1, 'Leaf');
762
- fillInTheGapsTextCommonComponent.steps.verifyTextInResponseFieldSetCorrectAnswerSection(1, 'Leaf');
763
- utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'notExist');
506
+ it('When the user removes/deletes some characters to make the number of characters less than the set maximum limit, the warning message should disappear', () => {
507
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: '{backspace}' }]);
508
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 0, responseText: 'Flowerpot' }])
509
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageNotExist();
764
510
  });
765
511
 
766
- autoScoredSetCorrectAnswerSection.tests.verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty(tabName);
512
+ it('When the user updates minimum character limit and enters character less than the minimum character limit value set and focus out of response field, then the warning message \'Minimum 6 characters are required\' should be displayed in specify correct answer', () => {
513
+ fillInTheGapsTextCommonComponent.steps.setMinimumLimit(6);
514
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'Air' }]);
515
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageExist('Minimum 6 words are required.');
516
+ });
767
517
 
768
- it(`CSS of ${tabName} contents`, { tags: 'css' }, () => {
769
- utilities.verifyCSS(fillInTheGapsTextCommonComponent.responseFieldLabelSetCorrectAnswerSection(), {
770
- 'color': css.color.labels,
771
- 'font-size': css.fontSize.default,
772
- 'font-weight': css.fontWeight.regular
773
- });
774
- utilities.verifyCSS(fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection(), {
775
- 'color': css.color.text,
776
- 'font-size': css.fontSize.default,
777
- 'font-weight': css.fontWeight.regular
778
- });
518
+ it('When the user enters the character greater than the minimum character limit value set by the user, then the warning message should disappear', () => {
519
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'Airwater' }]);
520
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 0, responseText: 'Airwater' }])
521
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageNotExist();
779
522
  });
780
523
 
781
- it(`Accessibility of ${tabName} contents`, { tags: 'a11y' }, () => {
782
- cy.checkAccessibility(fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection().parents('.cloze-with-text-authoring-mode-response-wrapper'));
524
+ it('When the user selects \'None\' radio button then maximum limit should not be displayed in the preview tab and when user types anything in the response field then error message should not be displayed', () => {
525
+ fillInTheGapsTextCommonComponent.steps.selectNoneRadioButton();
526
+ fillInTheGapsTextCommonComponent.steps.verifyMaximumCharacterLimitNotExistInPreviewTab(0);
527
+ fillInTheGapsTextCommonComponent.steps.addTextInAnswerInputFieldsPreviewTab(0, 'water');
528
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageNotExist();
783
529
  });
784
530
  },
785
531
 
786
- verifyCorrectResponseConditionSectionDefaultState: () => {
787
- it('\'Case sensitive\' functionality label and checkbox should be displayed and by default it should be unchecked', () => {
788
- utilities.verifyInnerText(fillInTheGapsTextCommonComponent.caseSensitiveLabel(), 'Case sensitive');
789
- utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.caseSensitiveLabel(), 'visible');
790
- fillInTheGapsTextCommonComponent.steps.verifyCaseSensitiveCheckboxNotChecked();
532
+ verifySetLimitSectionPreviewTabFunctionality: () => {
533
+ it('When maximum character limit input field value is 50 then maximum character limit should be 50 in the preview tab', () => {
534
+ fillInTheGapsTextCommonComponent.steps.verifyMaximumCharacterLimitInputField(50);
535
+ createQuestionBasePage.steps.switchToPreviewTab();
536
+ fillInTheGapsTextCommonComponent.steps.verifyMaximumCharacterLimitInPreviewTab(0, 50);
791
537
  });
792
538
 
793
- it('\'Ignore spaces before and after\' functionality label and checkbox should be displayed and by default it should be checked', () => {
794
- utilities.verifyInnerText(fillInTheGapsTextCommonComponent.ignoreSpacesBeforeAndAfterLabel(), 'Ignore spaces before and after');
795
- utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.ignoreSpacesBeforeAndAfterLabel(), 'visible');
796
- fillInTheGapsTextCommonComponent.steps.verifyIgnoreSpacesBeforeAndAfterCheckboxChecked();
539
+ it('When the user updates the maximum character limit input field value then maximum character limit should update in the preview tab', () => {
540
+ createQuestionBasePage.steps.switchToEditTab();
541
+ fillInTheGapsTextCommonComponent.steps.setMaximumLimit(10);
542
+ createQuestionBasePage.steps.switchToPreviewTab();
543
+ fillInTheGapsTextCommonComponent.steps.verifyMaximumCharacterLimitInPreviewTab(0, 10);
797
544
  });
798
545
 
799
- it('\'Match from all responses\' functionality label and checkbox should be displayed and by default it should be unchecked and disabled', () => {
800
- utilities.verifyInnerText(fillInTheGapsTextCommonComponent.matchFromAllResponsesLabel(), 'Match from all responses');
801
- fillInTheGapsTextCommonComponent.steps.verifyMatchFromAllResponsesLabelAndCheckboxDisabledState();
546
+ it('User should able to enter characters in the response field', () => {
547
+ fillInTheGapsTextCommonComponent.steps.addTextInAnswerInputFieldsPreviewTab(0, 'Flower');
802
548
  });
803
549
 
804
- 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', () => {
805
- fillInTheGapsTextCommonComponent.matchFromAllResponsesLabel()
806
- .verifyTooltip('Feature available for only alternate correct answers');
550
+ it('When the user reaches the character limit, then the warning message \'Maximum 10 characters have been entered\' should be displayed', () => {
551
+ fillInTheGapsTextCommonComponent.steps.addTextInAnswerInputFieldsPreviewTab(0, 'pots');
552
+ fillInTheGapsTextCommonComponent.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flowerpots' }])
553
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageExist('Maximum 10 words have been entered.');
807
554
  });
808
555
 
809
- it('CSS of correct response conditions section', { tags: 'css' }, () => {
810
- const labels = [fillInTheGapsTextCommonComponent.caseSensitiveLabel, fillInTheGapsTextCommonComponent.ignoreSpacesBeforeAndAfterLabel, fillInTheGapsTextCommonComponent.matchFromAllResponsesLabel]
811
- const uncheckedCheckboxes = [fillInTheGapsTextCommonComponent.caseSensitiveCheckbox, fillInTheGapsTextCommonComponent.matchFromAllResponsesCheckbox]
812
- labels.forEach((checkingLabel) => {
813
- utilities.verifyCSS(checkingLabel(), {
814
- 'color': css.color.labelText,
815
- 'font-size': css.fontSize.normal,
816
- 'font-weight': css.fontWeight.regular
817
- });
556
+ it('CSS of error message', { tags: 'css' }, () => {
557
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.limitReachedWarningMessage(), {
558
+ 'color': css.color.warningMessage,
559
+ 'font-size': css.fontSize.normal,
560
+ 'font-weight': css.fontWeight.regular
818
561
  });
819
- uncheckedCheckboxes.forEach((uncheckedCheckbox) => {
820
- utilities.verifyCSS(uncheckedCheckbox().parent().find('svg'), {
821
- 'fill': css.color.uncheckedCheckbox
822
- });
562
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.limitReachedWarningMessageContainer().find('svg'), {
563
+ 'color': css.color.warningMessage,
823
564
  });
824
- utilities.verifyCSS(fillInTheGapsTextCommonComponent.ignoreSpacesBeforeAndAfterCheckbox().parent().find('svg'), {
825
- 'fill': css.color.activeButtons
565
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.limitReachedWarningMessageContainer(), {
566
+ 'border': `1px solid ${css.color.warningContainerBorder}`
826
567
  });
827
- cy.log('Checking CSS of match from all responses tooltip')
828
- utilities.hoverOverElement(fillInTheGapsTextCommonComponent.matchFromAllResponsesLabel());
829
- utilities.verifyElementVisibilityState(commonComponents.tooltipText(), 'visible');
830
- utilities.verifyCSS(commonComponents.tooltipText(), {
831
- 'color': css.color.whiteText,
832
- 'font-size': css.fontSize.normal,
833
- 'font-weight': css.fontWeight.regular,
834
- 'background-color': css.color.tooltipBg
568
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.limitReachedWarningMessageContainer(), {
569
+ 'background-color': css.color.warningContainerBackground
835
570
  });
836
- utilities.verifyElementVisibilityState(commonComponents.tooltipText(), 'notExist');
837
571
  });
838
572
 
839
- it(`Accessibility of correct response conditions section`, { tags: 'a11y' }, () => {
840
- cy.checkAccessibility(fillInTheGapsTextCommonComponent.ignoreSpacesBeforeAndAfterCheckbox().parents('.ngie-checkbox-form-group'));
841
- cy.log('Checking a11y of match from all responses tooltip')
842
- utilities.hoverOverElement(fillInTheGapsTextCommonComponent.matchFromAllResponsesLabel());
843
- utilities.verifyElementVisibilityState(commonComponents.tooltipText(), 'visible');
844
- cy.checkAccessibility(commonComponents.tooltipText());
845
- utilities.verifyElementVisibilityState(commonComponents.tooltipText(), 'notExist');
573
+ it('Accessibility of error message', { tags: 'a11y' }, () => {
574
+ cy.checkAccessibility(fillInTheGapsTextCommonComponent.limitReachedWarningMessage());
846
575
  });
847
- },
848
576
 
849
- verifyResponseContentsOfSetCorrectAnswerSection: () => {
850
- it('Response option contents should be displayed in the set correct answer section', () => {
851
- for (let index = 0; index < 2; index++) {
852
- utilities.verifyInnerText(fillInTheGapsTextCommonComponent.responseFieldLabelSetCorrectAnswerSection().eq(index), `Response ${index + 1}`)
853
- utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.responseFieldSetCorrectAnswerSection().eq(index), 'visible');
854
- };
577
+ it('When the user removes/deletes some characters to make the number of characters less than the set maximum limit, the warning message should disappear', () => {
578
+ fillInTheGapsTextCommonComponent.steps.addTextInAnswerInputFieldsPreviewTab(0, '{backspace}');
579
+ fillInTheGapsTextCommonComponent.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flowerpot' }])
580
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageNotExist();
581
+ });
582
+
583
+ it('When the user updates minimum character limit in edit tab and enters character less than the minimum character limit value set and focus out of response field, then the warning message \'Minimum 6 characters are required\' should be displayed in preview tab', () => {
584
+ createQuestionBasePage.steps.switchToEditTab();
585
+ fillInTheGapsTextCommonComponent.steps.setMinimumLimit(6);
586
+ createQuestionBasePage.steps.switchToPreviewTab();
587
+ fillInTheGapsTextCommonComponent.steps.addTextInAnswerInputFieldsPreviewTab(0, 'Air');
588
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageExist('Minimum 6 words are required.');
589
+ });
590
+
591
+ it('When the user enters the character greater than the minimum character limit value set by the user, then the warning message should disappear', () => {
592
+ fillInTheGapsTextCommonComponent.steps.addTextInAnswerInputFieldsPreviewTab(0, 'water');
593
+ fillInTheGapsTextCommonComponent.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Airwater' }])
594
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageNotExist();
855
595
  });
856
- },
857
596
 
858
- verifyManualScoringEditTabFunctionality: () => {
859
- 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', () => {
860
- utilities.verifyElementVisibilityState(autoScoredSetCorrectAnswerSection.setCorrectAnswerLabel(), 'notExist');
861
- utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.allOrNothingCheckbox(), 'notExist');
862
- utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.partialEqualWeightsCheckbox(), 'notExist');
863
- utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.partialDifferentWeightsCheckbox(), 'notExist');
864
- utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.penaltyPointsInputField(), 'notExist');
865
- utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.penaltyPointsLabel(), 'notExist');
866
- utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.rounddownScoreCheckbox(), 'notExist');
867
- utilities.verifyElementVisibilityState(autoScoredScoringSectionMultipleResponsesType.rounddownScoreCheckboxLabel(), 'notExist');
868
- utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.caseSensitiveCheckbox(), 'notExist');
869
- utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.ignoreSpacesBeforeAndAfterCheckbox(), 'notExist');
870
- utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.matchFromAllResponsesCheckbox(), 'notExist');
871
- scoringSectionBase.steps.verifyDefaultMinimumScoreIfAttemptedLabelAndPointsField();
872
- additionalSettingsPanel.steps.expandAdditonalSettings();
873
- utilities.verifyElementVisibilityState(autoScoredAdditionalSettings.checkAnswerLabel(), 'notExist');
874
- utilities.verifyElementVisibilityState(autoScoredAdditionalSettings.allowStudentsToCheckAnswerLabel(), 'notExist');
875
- utilities.verifyElementVisibilityState(autoScoredAdditionalSettings.allowStudentsToCheckAnswerCheckbox(), 'notExist');
597
+ it('When the user selects \'None\' radio button then maximum limit should not be displayed in the preview tab and when user types anything in the response field then error message should not be displayed', () => {
598
+ createQuestionBasePage.steps.switchToEditTab();
599
+ fillInTheGapsTextCommonComponent.steps.selectNoneRadioButton();
600
+ createQuestionBasePage.steps.switchToPreviewTab();
601
+ fillInTheGapsTextCommonComponent.steps.verifyMaximumCharacterLimitNotExistInPreviewTab(0);
602
+ fillInTheGapsTextCommonComponent.steps.addTextInAnswerInputFieldsPreviewTab(0, 'water');
603
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageNotExist();
876
604
  });
877
605
  }
878
606
  }