itemengine-cypress-automation 1.0.128 → 1.0.130

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. package/cypress/e2e/ILC/ContentBlocks/editTabBasics.js +210 -0
  2. package/cypress/e2e/ILC/ContentBlocks/previewContents.smoke.js +91 -0
  3. package/cypress/e2e/ILC/ContentBlocks/styleAndLayoutCustomizationSection.js +392 -0
  4. package/cypress/e2e/ILC/DrawingResponse/drawingResponseAdditionalSettings.js +1 -1
  5. package/cypress/e2e/ILC/DrawingResponse/drawingResponseBackground.js +1 -1
  6. package/cypress/e2e/ILC/DrawingResponse/drawingResponseCustomizeAdditionalOptions.js +2 -1
  7. package/cypress/e2e/ILC/DrawingResponse/drawingResponseGradingViewAndCorrectAnswerViewContents.smoke.js +2 -1
  8. package/cypress/e2e/ILC/EssayResponse/essayResponseSpecialCharacters.js +1 -0
  9. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/allOrNothingGroupedScoring.js +152 -0
  10. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/allOrNothingWithAlternativePointsGreaterThanCorrectPoints.js +196 -0
  11. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/allOrNothingWithCorrectPointsEqualToAlternativePoints.js +195 -0
  12. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/allOrNothingWithCorrectPointsGreaterThanAlternativePoints.js +288 -0
  13. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/manuallyAndNonScored.js +141 -0
  14. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialDifferentWeightsAlternativePointsGreaterThanCorrectPoints.js +245 -0
  15. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialDifferentWeightsBasic.js +413 -0
  16. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialDifferentWeightsWithCorrectPointsEqualToAlternativePoints.js +218 -0
  17. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialDifferentWeightsWithCorrectPointsGreaterThanAlternativePoints.js +245 -0
  18. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialEqualWeightsBasic.js +163 -0
  19. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialEqualWeightsWithAlternativePointsGreaterThanCorrectPoints.js +224 -0
  20. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialEqualWeightsWithCorrectPointsEqualToAlternativePoints.js +196 -0
  21. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/partialEqualWeightsWithCorrectPointsGreaterThanAlternativePoints.js +224 -0
  22. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/Scoring/responseLevelAlternateAnswerBasicScoring.js +83 -0
  23. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/clickAndDrop.js +653 -0
  24. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/draggableOptions.js +180 -0
  25. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/editTabScoringSection.js +229 -0
  26. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/specifyCorrectAnswerSection.js +90 -0
  27. package/cypress/e2e/ILC/FillInTheGapsDragAndDropNew/switchingCasesBetweenOptionsLayout.js +50 -0
  28. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/allOrNothingAlternativePointsGreaterThanCorrectPoints.js +204 -0
  29. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/allOrNothingCorrectPointsEqualToAlternativePoints.js +204 -0
  30. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/allOrNothingCorrectPointsGreaterThanAlternativePoints.js +298 -0
  31. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/allOrNothingPenaltyScoring.js +63 -0
  32. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/manuallyAndNonScored.js +111 -0
  33. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialDifferentWeightsAlternativePointsGreaterThanCorrectPoints.js +231 -0
  34. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialDifferentWeightsBasic.js +90 -0
  35. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialDifferentWeightsMinimumAndPenaltyScoring.js +300 -0
  36. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialDifferentWeightsWithCorrectPointsEqualToAlternativePoints.js +232 -0
  37. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialDifferentWeightsWithCorrectPointsGreaterThanAlternativePoints.js +231 -0
  38. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialEqualWeightsBasic.js +138 -0
  39. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialEqualWeightsWithAlternativePointsGreaterThanCorrectPoints.js +213 -0
  40. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialEqualWeightsWithCorrectPointsEqualToAlternativePoints.js +186 -0
  41. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/Scoring/partialEqualWeightsWithCorrectPointsGreaterThanAlternativePoints.js +214 -0
  42. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/dropdownAndDropdownMenuSection.js +161 -0
  43. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/dropdownOptionsSection.js +328 -0
  44. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/editTabBasicSection.js +144 -0
  45. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/editTabScoringSection.js +250 -0
  46. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/headerSection.js +75 -0
  47. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/minimumScoringPenaltyPointsAndRoundingDropdown.js +194 -0
  48. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/specifyCorrectAnswerSection.js +74 -0
  49. package/cypress/e2e/ILC/FillInTheGapsDropdownNew/studentViewSettings.js +188 -0
  50. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/clickAndDrop.js +8 -8
  51. package/cypress/e2e/ILC/FillInTheGapsOverImageDragAndDrop/editTabScoring.js +0 -1
  52. package/cypress/e2e/ILC/FillInTheGapsOverImageDropdownNew/specifyCorrectAnswerSection.js +4 -2
  53. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/editTabScoringSection.js +1 -52
  54. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/responseAnswersAndAcceptedStudentInput.js +3 -211
  55. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/setLimitSection.js +39 -3
  56. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/specialCharactersSection.js +1 -8
  57. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/specifyCorrectAnswerSection.js +3 -1
  58. package/cypress/e2e/ILC/FillInTheGapsOverImageTextNew/studentViewSettings.js +2 -50
  59. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/conditionalCheckboxScoring.js +325 -0
  60. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsBasic.js +1 -146
  61. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/partialDifferentWeightsMinimumAndPenaltyScoring.js +300 -0
  62. package/cypress/e2e/ILC/FillInTheGapsTextNew/Scoring/responseLevelAlternateAnswersBasicScoring.js +78 -0
  63. package/cypress/e2e/ILC/FillInTheGapsTextNew/editTabScoringSection.js +265 -0
  64. package/cypress/e2e/ILC/FillInTheGapsTextNew/headerSection.js +75 -0
  65. package/cypress/e2e/ILC/FillInTheGapsTextNew/minimumScoringPenaltyPointsAndRoundingDropdown.js +194 -0
  66. package/cypress/e2e/ILC/FillInTheGapsTextNew/responseAnswersAndAcceptedStudentInput.js +56 -0
  67. package/cypress/e2e/ILC/FillInTheGapsTextNew/setLimitSection.js +40 -2
  68. package/cypress/e2e/ILC/FillInTheGapsTextNew/specialCharactersSection.js +249 -0
  69. package/cypress/e2e/ILC/FillInTheGapsTextNew/specifyCorrectAnswerSection.js +64 -0
  70. package/cypress/e2e/ILC/FillInTheGapsTextNew/studentViewSettings.js +128 -0
  71. package/cypress/e2e/ILC/Graphing/allOrNothingForAllViews.smoke.js +889 -0
  72. package/cypress/e2e/ILC/Graphing/checkAnswerFunctionalityForAllViews.smoke.js +168 -0
  73. package/cypress/e2e/ILC/Graphing/gradingViewAndCorrectAnswerView.smoke.js +203 -0
  74. package/cypress/e2e/ILC/Graphing/previewContentsForAllViews.smoke.js +222 -0
  75. package/cypress/e2e/ILC/SimpleCalculator/calculatorFunctionality.js +349 -0
  76. package/cypress/e2e/ILC/SimpleCalculator/previewContents.smoke.js +132 -0
  77. package/cypress/e2e/ILC/UploadResponse/previewContentsForAllViews.smoke.js +35 -7
  78. package/cypress/e2e/ILC/UploadResponse/studentViewSettingsSection.js +213 -0
  79. package/cypress/e2e/ILC/UploadResponse/uploadResponseAdditionalSettings.js +41 -0
  80. package/cypress/e2e/ILC/UploadResponse/uploadResponseEditTabBasicSections.js +377 -0
  81. package/cypress/e2e/ILC/UploadResponse/uploadResponsePreview.js +161 -0
  82. package/cypress/e2e/ILC/UploadResponse/uplodResponsePreviewUploadedFileProperties.js +250 -0
  83. package/cypress/e2e/migration/migration.js +4 -41
  84. package/cypress/e2e/migration/migration10.js +6 -43
  85. package/cypress/e2e/migration/migration2.js +6 -43
  86. package/cypress/e2e/migration/migration3.js +6 -43
  87. package/cypress/e2e/migration/migration4.js +6 -43
  88. package/cypress/e2e/migration/migration5.js +6 -43
  89. package/cypress/e2e/migration/migration6.js +6 -43
  90. package/cypress/e2e/migration/migration7.js +6 -43
  91. package/cypress/e2e/migration/migration8.js +6 -43
  92. package/cypress/e2e/migration/migration9.js +6 -43
  93. package/cypress/fixtures/drawingToolbarOptionsAdditionalOptionsAndSpecialAndMathCharacters.js +2 -2
  94. package/cypress/fixtures/theme/ilc.json +6 -1
  95. package/cypress/fixtures/uploadResponseFileType.js +5 -0
  96. package/cypress/pages/components/autoScoredSpecifyCorrectAnswerSection.js +13 -13
  97. package/cypress/pages/components/customizeSpecialCharacterComponent.js +24 -6
  98. package/cypress/pages/components/draggableOptionContainer.js +1 -0
  99. package/cypress/pages/components/fillInTheGapsDragAndDropCommonComponents.js +42 -4
  100. package/cypress/pages/components/fillInTheGapsDropdownCommonComponent.js +149 -5
  101. package/cypress/pages/components/fillInTheGapsTextCommonComponent.js +954 -77
  102. package/cypress/pages/components/questionInputFieldComponent.js +1 -1
  103. package/cypress/pages/components/questionInstructionsComponent.js +2 -1
  104. package/cypress/pages/contentBlocksPage.js +515 -0
  105. package/cypress/pages/drawingResponsePage.js +2 -2
  106. package/cypress/pages/fillInTheGapsDragAndDropPage.js +359 -3
  107. package/cypress/pages/fillInTheGapsDropdownPage.js +21 -1
  108. package/cypress/pages/fillInTheGapsOverImageDragAndDropPage.js +5 -57
  109. package/cypress/pages/fillInTheGapsOverImageDropdownPage.js +3 -24
  110. package/cypress/pages/fillInTheGapsOverImageTextPage.js +1 -435
  111. package/cypress/pages/fillInTheGapsTextPage.js +9 -2
  112. package/cypress/pages/graphingPage.js +484 -0
  113. package/cypress/pages/index.js +4 -1
  114. package/cypress/pages/simpleCalculatorPage.js +310 -0
  115. package/cypress/pages/uploadResponsePage.js +260 -92
  116. package/cypress/support/commands.js +33 -1
  117. package/package.json +1 -1
  118. package/cypress/e2e/ILC/Passage/multipageContentEditTab.js +0 -242
  119. package/cypress/e2e/ILC/Passage/passageAdditionalSettings.js +0 -99
  120. package/cypress/e2e/ILC/Passage/passageEditTab.js +0 -241
  121. package/cypress/e2e/ILC/Passage/passageHeaderSection.js +0 -73
  122. package/cypress/e2e/ILC/Passage/passagePreviewTab.js +0 -246
@@ -1,7 +1,13 @@
1
1
  import utilities from "../../support/helpers/utilities";
2
+ import { acceptedStudentInputComponent } from "./acceptedStudentInputComponent";
3
+ import { autoScoredScoringSectionMultiResponseType } from "./autoScoredScoringSectionMultiResponseType";
4
+ import { autoScoredSpecifyCorrectAnswerSection } from "./autoScoredSpecifyCorrectAnswerSection";
2
5
  import { commonComponents } from "./commonComponents";
3
6
  import { createQuestionBasePage } from "./createQuestionBasePage";
7
+ import { scoringSectionBaseEditTab } from "./scoringSectionBaseEditTab";
4
8
  const css = Cypress.env('css');
9
+ const conditionalCheckboxes = ['Case sensitive', 'Validate if answer is included in the response', 'Ignore extra spaces', 'Ignore single letter mistake'];
10
+
5
11
 
6
12
  const selectors = {
7
13
  answerInputFieldSpecifyCorrectAnswerSection: () => cy.get('.label-image-text-inline-text-field input'),
@@ -26,6 +32,7 @@ const selectors = {
26
32
  noneLabel: () => cy.get('[aria-label="None"].ngie-radio-label'),
27
33
  limitReachedWarningMessage: () => cy.get('.disabled-wrapper-cls [class*="DisabledTextWrapper"]'),
28
34
  limitReachedWarningMessageContainer: () => cy.get('.disabled-wrapper-cls'),
35
+ penaltyPointsForEachIncorrectTextContainerInputField: () => cy.get('input[aria-label="Penalty points for each incorrect text container"]'),
29
36
 
30
37
  //response accordion
31
38
  responseAccordion: () => cy.get('.response-text-accordion'),
@@ -42,6 +49,42 @@ const selectors = {
42
49
  responseAccordionAddAlternateButtonLabel: () => cy.get('.add-alternate-btn p'),
43
50
  responseAreaNumeration: () => cy.get('.response-input-adornment'),
44
51
 
52
+ //Special characters section
53
+ specialCharactersLabel: () => cy.get('[class*="LabelImageWithTextstyles__CustomizedSpecialCharacterWrapper"]'),
54
+ enableSpecialCharactersCheckbox: () => cy.get('[data-ngie-testid="enable-special-characters-checkbox"] input'),
55
+ enableSpecialCharactersLabel: () => cy.get('[data-ngie-testid="enable-special-characters-checkbox"] [class*="MuiFormControlLabel-label"]'),
56
+ specialCharactersPopupTitle: () => cy.get('#alert-dialog-title'),
57
+ specialCharactersPopupCloseButton: () => cy.get('[class*="close-button"]'),
58
+ specialCharactersPopupCharactersCategoryWrapper: () => cy.get('.special-character-accordion'),
59
+ specialCharactersPopupCharacterSymbol: () => cy.get('.characters-button'),
60
+ specialCharactersPopupCategoryTitle: () => cy.get('.char-accordion-label'),
61
+ specialCharactersPopupCategoryAccordionIcon: () => cy.get('.special-math-content [class*="expandIconWrapper"]'),
62
+
63
+ //TODO: Shift all preview tab special characters popup related selectors/steps to a common component file once https://redmine.zeuslearning.com/issues/559296 is resolved
64
+ //preview tab special characters
65
+ specialCharactersPopupTitlePreviewTab: () => cy.get('[class*="Popupstyles__TitleWrapper"]'),
66
+ specialCharactersPopupCategoryAccordionLabelPreviewTab: () => cy.get('[class*="ResponseInputComponentstyles__AccordionLabel"]'),
67
+ specialCharactersPopupCategoryAccordionWrapperPreviewTab: () => cy.get('.special-character-accordion'),
68
+ specialCharactersPopupSymbolPreviewTab: () => cy.get('.ngie-accordion button'),
69
+ specialCharactersPopupCategoryAccordionChevronButtonPreviewTab: () => cy.get('[class*="MuiAccordionSummary-expandIconWrapper"]'),
70
+ specialCharactersPopupCategoryAccordionCloseButtonPreviewTab: () => cy.get('[data-at="close-button"]'),
71
+ specialCharactersCustomSymbolsPreviewTab: () => cy.get('[class*="ResponseInputComponentstyles__PopupContentWrapper"] button'),
72
+ specialCharactersButtonPreviewTab: () => cy.get('.cloze-with-text-special-character-button'),
73
+
74
+ //Conditional checkboxes
75
+ caseSensitiveCheckboxLabel: () => cy.get('[data-ngie-testid="case-sensitive-checkbox"] [class*="label"]'),
76
+ caseSensitiveCheckbox: () => cy.get('[data-ngie-testid="case-sensitive-checkbox"] input'),
77
+ validateIfAnswerIsIncludedCheckboxLabel: () => cy.get('[data-ngie-testid="validate-if-answer-is-included-in-the-response-checkbox"] [class*="label"]'),
78
+ validateIfAnswerIsIncludedCheckbox: () => cy.get('[data-ngie-testid="validate-if-answer-is-included-in-the-response-checkbox"] input'),
79
+ ignoreExtraSpacesCheckboxLabel: () => cy.get('[data-ngie-testid="ignore-extra-spaces-checkbox"] [class*="label"]'),
80
+ ignoreExtraSpacesCheckbox: () => cy.get('[data-ngie-testid="ignore-extra-spaces-checkbox"] input'),
81
+ ignoreSingleLetterMistakeCheckboxLabel: () => cy.get('[data-ngie-testid="ignore-single-letter-mistake-checkbox"] [class*="label"]'),
82
+ ignoreSingleLetterMistakeCheckbox: () => cy.get('[data-ngie-testid="ignore-single-letter-mistake-checkbox"] input'),
83
+
84
+ //Student view settings
85
+ spellCheckLabel: () => cy.get('[data-ngie-testid="spell-check-checkbox"] .MuiFormControlLabel-label'),
86
+ spellCheckCheckbox: () => cy.get('[data-ngie-testid="spell-check-checkbox"] input[type="checkbox"]'),
87
+
45
88
  //additional settings
46
89
  enterAriaLabelInputField: () => cy.get('input[aria-label*="Enter ARIA label"]')
47
90
  }
@@ -238,10 +281,11 @@ const steps = {
238
281
  },
239
282
 
240
283
  /**
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
- */
284
+ *
285
+ * @param {number} responseIndex index of response container
286
+ * @param {number} maxlen value of maxlength attribute
287
+ * @description function verifies maxlength attribute of response container in preview tab
288
+ */
245
289
  verifyMaximumCharacterLimitInPreviewTab: (responseIndex, maxlen) => {
246
290
  utilities.getNthElement(fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab(), responseIndex)
247
291
  .should('have.attr', 'maxlength', maxlen);
@@ -302,43 +346,429 @@ const steps = {
302
346
  utilities.getNthElement(fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab(), responseIndex)
303
347
  .type(responseText);
304
348
  },
305
- }
306
349
 
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
- });
350
+ verifyEnableSpecialCharactersCheckboxUnchecked: () => {
351
+ fillInTheGapsTextCommonComponent.enableSpecialCharactersCheckbox()
352
+ .should('not.be.checked');
353
+ },
313
354
 
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
- });
355
+ checkEnableSpecialCharactersCheckbox: () => {
356
+ fillInTheGapsTextCommonComponent.enableSpecialCharactersCheckbox()
357
+ .click()
358
+ .should('be.checked');
359
+ },
322
360
 
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
- });
361
+ uncheckEnableSpecialCharactersCheckbox: () => {
362
+ fillInTheGapsTextCommonComponent.enableSpecialCharactersCheckbox()
363
+ .click()
364
+ .should('not.be.checked');
365
+ },
329
366
 
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
- });
367
+ openSpecialCharactersPopupPreviewTab: () => {
368
+ fillInTheGapsTextCommonComponent.specialCharactersButtonPreviewTab()
369
+ .click();
370
+ },
336
371
 
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
- });
372
+ /**
373
+ * @description Verify symbols displayed in for a category in special characters popup
374
+ * @param {number} categoryIndex Index of the category
375
+ * @param {string[]} categorySymbolsArray Array of the symbols of the category
376
+ */
377
+ verifySpecialCharactersPopupCategorySymbolsInPreviewTab: (categoryIndex, categorySymbolsArray) => {
378
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.specialCharactersPopupCategoryAccordionLabelPreviewTab(), categoryIndex)
379
+ .click();
380
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.specialCharactersPopupCategoryAccordionWrapperPreviewTab(), categoryIndex)
381
+ .within(() => {
382
+ categorySymbolsArray[index].forEach((symbolARIALabel, index) => {
383
+ fillInTheGapsTextCommonComponent.specialCharactersPopupSymbolPreviewTab()
384
+ .eq(index)
385
+ .find('svg')
386
+ .should('have.attr', 'aria-label', `${symbolARIALabel}`);
387
+ });
388
+ });
389
+ },
390
+
391
+ closeSpecialCharactersPopupPreviewTab: () => {
392
+ fillInTheGapsTextCommonComponent.specialCharactersPopupCategoryAccordionCloseButtonPreviewTab()
393
+ .click();
394
+ },
395
+
396
+ /**
397
+ * @description Verify response accordion is collapsed in specify correct answer section
398
+ * @param {number} responseIndex index of response accordion
399
+ */
400
+ verifyResponseAccordionIsCollapsed: (responseIndex) => {
401
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordion(), responseIndex)
402
+ .find('.ngie-accordion-summary')
403
+ .should('have.attr', 'aria-expanded', 'false');
404
+ },
405
+
406
+ /**
407
+ * @description Verify response accordion is expanded in specify correct answer section
408
+ * @param {number} responseIndex index of response accordion
409
+ */
410
+ verifyResponseAccordionIsExpanded: (responseIndex) => {
411
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordion(), responseIndex)
412
+ .find('.ngie-accordion-summary')
413
+ .should('have.attr', 'aria-expanded', 'true');
414
+ },
415
+
416
+ /**
417
+ * @description Expand response accordion in specify correct answer section
418
+ * @param {number} responseIndex index of response accordion
419
+ */
420
+ expandResponseAccordionSpecifyCorrectAnswer: (responseIndex) => {
421
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordion(), responseIndex)
422
+ .click();
423
+ fillInTheGapsTextCommonComponent.steps.verifyResponseAccordionIsExpanded(responseIndex);
424
+ },
425
+
426
+ /**
427
+ * @description Collapse response accordion in specify correct answer section
428
+ * @param {number} responseIndex index of response accordion
429
+ */
430
+ collapseResponseAccordionSpecifyCorrectAnswer: (responseIndex) => {
431
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordionLabel(), responseIndex)
432
+ .click();
433
+ fillInTheGapsTextCommonComponent.steps.verifyResponseAccordionIsCollapsed(responseIndex);
434
+ },
435
+
436
+ /**
437
+ * Focus in and focus out of response accordion answer input field in specify correct answer section
438
+ * @param {number} answerFieldIndex answer input field index
439
+ */
440
+ focusInAndFocusOutOfResponseAnswerInputFieldSpecifyCorrectAnswer: (answerFieldIndex) => {
441
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.answerInputFieldSpecifyCorrectAnswerSection(), answerFieldIndex)
442
+ .click()
443
+ .blur();
444
+ },
445
+
446
+ /**
447
+ * Focus in and focus out of response accordion answer input field in preview tab
448
+ * @param {number} answerFieldIndex answer input field index
449
+ */
450
+ focusInAndFocusOutOfResponseAnswerInputFieldPreviewTab: (answerFieldIndex) => {
451
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab(), answerFieldIndex)
452
+ .click()
453
+ .blur();
454
+ },
455
+
456
+ /**
457
+ * Focus out of response accordion answer input field in specify correct answer section
458
+ * @param {number} answerFieldIndex answer input field index
459
+ */
460
+ focusOutOfResponseAnswerInputFieldSpecifyCorrectAnswer: (answerFieldIndex) => {
461
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.answerInputFieldSpecifyCorrectAnswerSection(), answerFieldIndex)
462
+ .blur();
463
+ },
464
+
465
+ /**
466
+ * Focus out of response accordion answer input field in preview tab
467
+ * @param {number} answerFieldIndex answer input field index
468
+ */
469
+ focusOutOfResponseAnswerInputFieldPreviewTab: (answerFieldIndex) => {
470
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab(), answerFieldIndex)
471
+ .blur();
472
+ },
473
+
474
+ /**
475
+ * Focus in response input field in preview tab
476
+ * @param {number} responseInputFieldIndex response input field index
477
+ */
478
+ focusInResponseInputFieldPreviewTab: (responseInputFieldIndex) => {
479
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab(), responseInputFieldIndex)
480
+ .click();
481
+ },
482
+
483
+ /**
484
+ * Verify the points score displayed on response accordions
485
+ * @param {number} responseAccordionIndex index of response accordion
486
+ * @param {number} pointsPerResponse Points to be displayed on response accordion
487
+ */
488
+ verifyPointsDisplayedOnResponseAccordion: (responseAccordionIndex, pointsPerResponse) => {
489
+ utilities.verifyElementVisibilityState(utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordionPointsLabel(), responseAccordionIndex), 'visible');
490
+ utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordionPointsLabel(), responseAccordionIndex), 'Points:');
491
+ utilities.verifyElementVisibilityState(utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordionPointsScore(), responseAccordionIndex), 'visible');
492
+ utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordionPointsScore(), responseAccordionIndex), `${pointsPerResponse}`);
493
+ },
494
+
495
+ /**
496
+ * Click on response accordion add alternate button
497
+ * @param {number} responseAccordionIndex index of response accordion
498
+ */
499
+ addAlternateAnswerInResponseAccordion: (responseAccordionIndex) => {
500
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordionAddAlternateButton(), responseAccordionIndex)
501
+ .click();
502
+ },
503
+
504
+ /**
505
+ * Verify the points input field and label displayed in response accordions
506
+ * @param {number} responseAccordionIndex index of response accordion
507
+ * @param {number} pointsInputFieldValue Points input field value
508
+ */
509
+ verifyPointsLabelAndInputFieldInResponseAccordion: (responseAccordionIndex, pointsInputFieldValue) => {
510
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordionPointsInputFieldWrapper(), responseAccordionIndex)
511
+ .within(() => {
512
+ utilities.verifyElementVisibilityState(autoScoredScoringSectionMultiResponseType.pointsLabel(), 'visible');
513
+ utilities.verifyInnerText(autoScoredScoringSectionMultiResponseType.pointsLabel(), 'Points');
514
+ utilities.verifyElementVisibilityState(autoScoredScoringSectionMultiResponseType.pointsInputField(), 'visible');
515
+ scoringSectionBaseEditTab.steps.verifyPointsFieldValue(pointsInputFieldValue);
516
+ });
517
+ },
518
+
519
+ verifyDefaultUncheckedStateOfConditionalCheckboxes: () => {
520
+ fillInTheGapsTextCommonComponent.caseSensitiveCheckbox()
521
+ .should('not.be.checked');
522
+ fillInTheGapsTextCommonComponent.validateIfAnswerIsIncludedCheckbox()
523
+ .should('not.be.checked');
524
+ fillInTheGapsTextCommonComponent.ignoreExtraSpacesCheckbox()
525
+ .should('not.be.checked');
526
+ fillInTheGapsTextCommonComponent.ignoreSingleLetterMistakeCheckbox()
527
+ .should('not.be.checked');
528
+ },
529
+
530
+ /**
531
+ * Check the conditional checkbox in edit tab
532
+ * @param {string} conditionalCheckboxName Name of the conditional checkbox to be checked
533
+ */
534
+ checkConditionalCheckbox: (conditionalCheckboxName) => {
535
+ switch (conditionalCheckboxName) {
536
+ case 'Case sensitive':
537
+ fillInTheGapsTextCommonComponent.caseSensitiveCheckbox()
538
+ .click()
539
+ .should('be.checked');
540
+ break;
541
+ case 'Validate if answer is included in the response':
542
+ fillInTheGapsTextCommonComponent.validateIfAnswerIsIncludedCheckbox()
543
+ .click()
544
+ .should('be.checked');
545
+ break;
546
+ case 'Ignore extra spaces':
547
+ fillInTheGapsTextCommonComponent.ignoreExtraSpacesCheckbox()
548
+ .click()
549
+ .should('be.checked');
550
+ break;
551
+ case 'Ignore single letter mistake':
552
+ fillInTheGapsTextCommonComponent.ignoreSingleLetterMistakeCheckbox()
553
+ .click()
554
+ .should('be.checked');
555
+ break;
556
+ default:
557
+ throw new Error('invalid state string');
558
+ }
559
+ },
560
+
561
+ /**
562
+ * Uncheck the conditional checkbox in edit tab
563
+ * @param {string} conditionalCheckboxName Name of the conditional checkbox to be unchecked
564
+ */
565
+ uncheckConditionalCheckbox: (conditionalCheckboxName) => {
566
+ switch (conditionalCheckboxName) {
567
+ case 'Case sensitive':
568
+ fillInTheGapsTextCommonComponent.caseSensitiveCheckbox()
569
+ .click()
570
+ .should('not.be.checked');
571
+ break;
572
+ case 'Validate if answer is included in the response':
573
+ fillInTheGapsTextCommonComponent.validateIfAnswerIsIncludedCheckbox()
574
+ .click()
575
+ .should('not.be.checked');
576
+ break;
577
+ case 'Ignore extra spaces':
578
+ fillInTheGapsTextCommonComponent.ignoreExtraSpacesCheckbox()
579
+ .click()
580
+ .should('not.be.checked');
581
+ break;
582
+ case 'Ignore single letter mistake':
583
+ fillInTheGapsTextCommonComponent.ignoreSingleLetterMistakeCheckbox()
584
+ .click()
585
+ .should('not.be.checked');
586
+ break;
587
+ default:
588
+ throw new Error('invalid state string');
589
+ }
590
+ },
591
+
592
+ /**
593
+ * Allot points inside response accordion points input field
594
+ * @param {number} responseAccordionIndex index of response accordion
595
+ * @param {number} pointsInputFieldValue Points input field value to be allotted
596
+ */
597
+ allotPointsInResponseAccordion: (responseAccordionIndex, pointsInputFieldValue) => {
598
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordionPointsInputFieldWrapper(), responseAccordionIndex)
599
+ .within(() => {
600
+ scoringSectionBaseEditTab.steps.allotPoints(pointsInputFieldValue);
601
+ });
602
+ },
603
+
604
+ verifySpellCheckCheckboxUnchecked: () => {
605
+ fillInTheGapsTextCommonComponent.spellCheckCheckbox()
606
+ .should('not.be.checked');
607
+ },
608
+
609
+ verifySpellCheckCheckboxChecked: () => {
610
+ fillInTheGapsTextCommonComponent.spellCheckCheckbox()
611
+ .should('be.checked');
612
+ },
613
+
614
+ checkSpellCheckCheckbox: () => {
615
+ fillInTheGapsTextCommonComponent.spellCheckCheckbox()
616
+ .click()
617
+ steps.verifySpellCheckCheckboxChecked();
618
+ },
619
+
620
+ uncheckSpellCheckCheckbox: () => {
621
+ fillInTheGapsTextCommonComponent.spellCheckCheckbox()
622
+ .click();
623
+ steps.verifySpellCheckCheckboxUnchecked();
624
+ },
625
+
626
+ /**
627
+ * Verify that the spell check for a response field in the Preview Tab is disabled.
628
+ * @param {number} responseFieldIndex - The index of the response field to verify.
629
+ */
630
+ verifySpellCheckOfResponseFieldPreviewTabDisabled: (responseFieldIndex) => {
631
+ fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab()
632
+ .eq(responseFieldIndex)
633
+ .should('have.attr', 'spellcheck', 'false');
634
+ },
635
+
636
+ /**
637
+ * Verify that the spell check for a response field in the Preview Tab is enabled.
638
+ * @param {number} responseFieldIndex - The index of the response field to verify.
639
+ */
640
+ verifySpellCheckOfResponseFieldPreviewTabEnabled: (responseFieldIndex) => {
641
+ fillInTheGapsTextCommonComponent.answerInputFieldPreviewTab()
642
+ .eq(responseFieldIndex)
643
+ .should('have.attr', 'spellcheck', 'true');
644
+ },
645
+
646
+ /**
647
+ *@description Verify numeration text for the answer input fields of the specify correct answer section.
648
+ * @param responseAccordionIndex denotes response accordion index
649
+ */
650
+ verifyResponseAccordionAnswerInputFieldNumeration: (responseAccordionIndex) => {
651
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordion(), responseAccordionIndex)
652
+ .within(() => {
653
+ fillInTheGapsTextCommonComponent.responseAccordionAnswerInputFieldWrapper()
654
+ .each(($el, index) => {
655
+ cy.wrap($el)
656
+ .within(() => {
657
+ fillInTheGapsTextCommonComponent.responseAccordionAnswerNumeration()
658
+ .should('have.text', `${index + 1}`);
659
+ });
660
+ });
661
+ });
662
+ },
663
+
664
+ /**
665
+ * @description Verify symbols displayed in for a category in special characters popup
666
+ * @param {number} categoryIndex Index of the category
667
+ * @param {string[]} categorySymbolsArray Array of the symbols of the category
668
+ */
669
+ verifySpecialCharactersPopupCategorySymbols: (categoryIndex, categorySymbolsArray) => {
670
+ fillInTheGapsTextCommonComponent.specialCharactersPopupCharactersCategoryWrapper()
671
+ .eq(categoryIndex)
672
+ .within(() => {
673
+ categorySymbolsArray[index].forEach((symbolARIALabel, index) => {
674
+ fillInTheGapsTextCommonComponent.specialCharactersPopupCharacterSymbol()
675
+ .eq(index)
676
+ .find('svg')
677
+ .should('have.attr', 'aria-label', `${symbolARIALabel}`);
678
+ });
679
+ });
680
+ },
681
+
682
+ /**
683
+ *@description Verify delete button for the answer input fields of the specify correct answer section.
684
+ * @param responseAccordionIndex denotes response accordion index
685
+ */
686
+ verifyResponseAccordionAnswerInputFieldDeleteButton: (responseAccordionIndex) => {
687
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordion(), responseAccordionIndex)
688
+ .within(() => {
689
+ fillInTheGapsTextCommonComponent.responseAccordionAnswerInputFieldWrapper()
690
+ .each(($el) => {
691
+ cy.wrap($el)
692
+ .within(() => {
693
+ fillInTheGapsTextCommonComponent.responseAccordionAnswerDeleteButton()
694
+ .should('be.visible');
695
+ });
696
+ });
697
+ });
698
+ },
699
+
700
+ /**
701
+ * Verify answer input field placeholder text
702
+ * @param {number} answerFieldIndex index of answer input field
703
+ */
704
+ verifyAnswerInputFieldPlaceholder: (answerFieldIndex) => {
705
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordionAnswerInputFieldWrapper(), answerFieldIndex)
706
+ .within(() => {
707
+ fillInTheGapsTextCommonComponent.answerInputFieldSpecifyCorrectAnswerSection()
708
+ .should('have.attr', 'placeholder', 'Enter answer');
709
+ });
710
+ },
711
+
712
+ /**
713
+ *@description Clicks delete button for the answer input fields of the specify correct answer section.
714
+ * @param responseAccordionIndex denotes response accordion index
715
+ */
716
+ deleteResponseAccordionAnswerInputField: (responseAccordionIndex, responseAccordionAnswerInputFieldIndex) => {
717
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordion(), responseAccordionIndex)
718
+ .within(() => {
719
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordionAnswerInputFieldWrapper(), responseAccordionAnswerInputFieldIndex)
720
+ .within(() => {
721
+ fillInTheGapsTextCommonComponent.responseAccordionAnswerDeleteButton()
722
+ .click();
723
+ });
724
+ });
725
+ },
341
726
 
727
+ /**
728
+ * Clear answer input field
729
+ * @param {number} answerFieldIndex index of answer input field
730
+ */
731
+ clearAnswerInputField: (answerFieldIndex) => {
732
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordionAnswerInputFieldWrapper(), answerFieldIndex)
733
+ .within(() => {
734
+ fillInTheGapsTextCommonComponent.answerInputFieldSpecifyCorrectAnswerSection()
735
+ .clear()
736
+ .blur();
737
+ });
738
+ },
739
+
740
+ /**
741
+ * @description verify the displayed penalty points for each incorrect text container
742
+ * @param {number} penaltyPoints displayed penalty points
743
+ */
744
+ verifyPenaltyPointsForEachIncorrectTextContainer: (penaltyPoints) => {
745
+ utilities.verifyInnerText(autoScoredScoringSectionMultiResponseType.penaltyPointsDetailsSectionAllottedPointsLabel(), `Penalty points for each incorrect text container: ${penaltyPoints}`);
746
+ },
747
+
748
+ /**
749
+ * @description Verifies the penalty points value for each incorrect text container
750
+ * @param {number} points - The expected penalty points value for each incorrect text container.
751
+ */
752
+ verifyPenaltyPointsForEachIncorrectTextContainerValue: (points) => {
753
+ fillInTheGapsTextCommonComponent.penaltyPointsForEachIncorrectTextContainerInputField()
754
+ .should('have.value', points);
755
+ },
756
+
757
+ /**
758
+ * @description Allots penalty points for each incorrect text container
759
+ * @param {number} points - The penalty points to be allotted for each text container.
760
+ */
761
+ allotPenaltyPointsForEachIncorrectTextContainer: (points) => {
762
+ fillInTheGapsTextCommonComponent.penaltyPointsForEachIncorrectTextContainerInputField()
763
+ .clear()
764
+ .type(`${points}`)
765
+ .should('have.value', points)
766
+ .blur();
767
+ },
768
+ }
769
+
770
+ const tests = {
771
+ verifySetLimitSectionErrorConditionsForMinAndMaxCharacterInputFields: () => {
342
772
  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
773
  fillInTheGapsTextCommonComponent.steps.clearAndFocusOutOfMinimumCharacterLimitInputField();
344
774
  utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: Minimum character limit is required.');
@@ -439,13 +869,13 @@ const tests = {
439
869
 
440
870
  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
871
  fillInTheGapsTextCommonComponent.steps.setMaximumLimit(0);
442
- utilities.verifyInnerText(fillInTheGapsTextCommonComponent.errorMessage(), 'Error: Maximum limit must be greater than 0.');
443
- utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.errorMessage(), 'visible');
872
+ utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: Maximum limit must be greater than 0.');
873
+ utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'visible');
444
874
  });
445
875
 
446
876
  it('When user enters limit more than zero in maximum limit input field, then error message should disappear', () => {
447
877
  fillInTheGapsTextCommonComponent.steps.setMaximumLimit(50);
448
- fillInTheGapsTextCommonComponent.steps.verifyErrorMessageIsNotDisplayed();
878
+ commonComponents.steps.verifyErrorMessageIsNotDisplayed();
449
879
  });
450
880
 
451
881
  it('When user should not be able to add limit more than 50 inside minimum and maximum limit input field', () => {
@@ -454,35 +884,58 @@ const tests = {
454
884
  fillInTheGapsTextCommonComponent.steps.setMaximumLimit(60);
455
885
  fillInTheGapsTextCommonComponent.steps.verifyMaximumLimit(6);
456
886
  });
887
+ },
457
888
 
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');
889
+ verifySetLimitSectionContents: () => {
890
+ it('\'Set limit\' label should be displayed', () => {
891
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.setLimitLabel(), 'Set limit');
892
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.setLimitLabel(), 'visible');
893
+ });
894
+
895
+ it('\'Character\' and \'None\' labels and radio buttons should be displayed and by default \'Character\' should be selected', () => {
896
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.characterLabel(), 'Character');
897
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.characterLabel(), 'visible');
898
+ fillInTheGapsTextCommonComponent.steps.verifyCharacterRadioButtonSelected();
899
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.noneLabel(), 'None');
900
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.noneLabel(), 'visible');
901
+ fillInTheGapsTextCommonComponent.steps.verifyNoneRadioButtonNotSelected();
902
+ });
903
+
904
+ it('\'Minimum character limit\' and \'Maximum character limit\' labels should be displayed', () => {
905
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.minimumCharacterLimitLabel(), 'Minimum character limit');
906
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.minimumCharacterLimitLabel(), 'visible');
907
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.maximumCharacterLimitLabel(), 'Maximum character limit');
908
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.maximumCharacterLimitLabel(), 'visible');
461
909
  });
462
- },
463
910
 
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', () => {
911
+ it('\'Minimum character limit\' and \'Maximum character limit\' input fields should be displayed and have 0 and 50 value by default', () => {
912
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.minimumCharacterLimitInputField(), 'visible');
913
+ fillInTheGapsTextCommonComponent.steps.verifyMinimumCharacterLimitInputField(0);
914
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.maximumCharacterLimitInputField(), 'visible');
466
915
  fillInTheGapsTextCommonComponent.steps.verifyMaximumCharacterLimitInputField(50);
467
- fillInTheGapsTextCommonComponent.steps.verifyMaximumCharacterLimit(0, 50);
468
916
  });
469
917
 
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);
918
+ it('User should be able to update values in both the input fields', () => {
919
+ fillInTheGapsTextCommonComponent.steps.setMinimumLimit(10);
920
+ fillInTheGapsTextCommonComponent.steps.setMaximumLimit(40);
473
921
  });
922
+ },
474
923
 
475
- it('User should able to enter characters in the answer input field', () => {
476
- fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'Flower' }]);
924
+ verifySetLimitSectionForNoneOption: () => {
925
+ it('When the user selects \'None\' radio button then the maximum and minimum character limit labels and input field should not be displayed', () => {
926
+ fillInTheGapsTextCommonComponent.steps.selectNoneRadioButton();
927
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.minMaxLabelAndInputFieldWrapper(), 'notExist');
477
928
  });
929
+ },
478
930
 
931
+ verifyMaximumCharacterLimitWarningConditionsSpecifyCorrectAnswerSection: () => {
479
932
  it('When the user reaches the character limit, then the warning message \'Maximum 10 characters have been entered\' should be displayed', () => {
480
933
  fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'pots' }]);
481
934
  fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 0, responseText: 'Flowerpots' }])
482
- fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageExist('Maximum 10 words have been entered.');
935
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageExist('Maximum 10 characters have been entered.');
483
936
  });
484
937
 
485
- it('CSS of error message', { tags: 'css' }, () => {
938
+ it('CSS of warning message', { tags: 'css' }, () => {
486
939
  utilities.verifyCSS(fillInTheGapsTextCommonComponent.limitReachedWarningMessage(), {
487
940
  'color': css.color.warningMessage,
488
941
  'font-size': css.fontSize.normal,
@@ -499,20 +952,41 @@ const tests = {
499
952
  });
500
953
  });
501
954
 
502
- it('Accessibility of error message', { tags: 'a11y' }, () => {
955
+ it('Accessibility of warning message', { tags: 'a11y' }, () => {
503
956
  cy.checkAccessibility(fillInTheGapsTextCommonComponent.limitReachedWarningMessage());
504
957
  });
505
958
 
959
+ it('The user should not be able to enter characters more than the maximum character limit and warning message should persist', () => {
960
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'From' }]);
961
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 0, responseText: 'Flowerpots' }])
962
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageExist('Maximum 10 characters have been entered.');
963
+ });
964
+
506
965
  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
966
  fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: '{backspace}' }]);
508
967
  fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 0, responseText: 'Flowerpot' }])
509
968
  fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageNotExist();
510
969
  });
511
970
 
971
+ it('When the user reaches the maximum character limit, then the warning message \'Maximum 10 characters have been entered\' should be displayed and on focusing out of the answer input field, the warning message should disappear', () => {
972
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'Flowerpots' }]);
973
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 0, responseText: 'Flowerpots' }])
974
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageExist('Maximum 10 characters have been entered.');
975
+ fillInTheGapsTextCommonComponent.steps.focusOutOfResponseAnswerInputFieldSpecifyCorrectAnswer(0);
976
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageNotExist();
977
+ });
978
+ },
979
+
980
+ verifyMinimumCharacterLimitWarningConditionsSpecifyCorrectAnswerSection: () => {
981
+ it('When the minimum character limit is set as 0, then on focusing out of the answer input field, no warning message should be displayed', () => {
982
+ fillInTheGapsTextCommonComponent.steps.focusInAndFocusOutOfResponseAnswerInputFieldSpecifyCorrectAnswer();
983
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageNotExist();
984
+ });
985
+
512
986
  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
987
  fillInTheGapsTextCommonComponent.steps.setMinimumLimit(6);
514
988
  fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'Air' }]);
515
- fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageExist('Minimum 6 words are required.');
989
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageExist('Minimum 6 characters are required.');
516
990
  });
517
991
 
518
992
  it('When the user enters the character greater than the minimum character limit value set by the user, then the warning message should disappear', () => {
@@ -521,7 +995,7 @@ const tests = {
521
995
  fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageNotExist();
522
996
  });
523
997
 
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', () => {
998
+ it('When the user selects \'None\' radio button then maximum limit should not be displayed in the specify correct answer section and when user types anything in the response field then error message should not be displayed', () => {
525
999
  fillInTheGapsTextCommonComponent.steps.selectNoneRadioButton();
526
1000
  fillInTheGapsTextCommonComponent.steps.verifyMaximumCharacterLimitNotExistInPreviewTab(0);
527
1001
  fillInTheGapsTextCommonComponent.steps.addTextInAnswerInputFieldsPreviewTab(0, 'water');
@@ -529,31 +1003,14 @@ const tests = {
529
1003
  });
530
1004
  },
531
1005
 
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);
537
- });
538
-
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);
544
- });
545
-
546
- it('User should able to enter characters in the response field', () => {
547
- fillInTheGapsTextCommonComponent.steps.addTextInAnswerInputFieldsPreviewTab(0, 'Flower');
548
- });
549
-
1006
+ verifyMaximumCharacterLimitWarningConditionsPreviewTab: () => {
550
1007
  it('When the user reaches the character limit, then the warning message \'Maximum 10 characters have been entered\' should be displayed', () => {
551
1008
  fillInTheGapsTextCommonComponent.steps.addTextInAnswerInputFieldsPreviewTab(0, 'pots');
552
1009
  fillInTheGapsTextCommonComponent.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flowerpots' }])
553
- fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageExist('Maximum 10 words have been entered.');
1010
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageExist('Maximum 10 characters have been entered.');
554
1011
  });
555
1012
 
556
- it('CSS of error message', { tags: 'css' }, () => {
1013
+ it('CSS of warning message', { tags: 'css' }, () => {
557
1014
  utilities.verifyCSS(fillInTheGapsTextCommonComponent.limitReachedWarningMessage(), {
558
1015
  'color': css.color.warningMessage,
559
1016
  'font-size': css.fontSize.normal,
@@ -570,22 +1027,43 @@ const tests = {
570
1027
  });
571
1028
  });
572
1029
 
573
- it('Accessibility of error message', { tags: 'a11y' }, () => {
1030
+ it('Accessibility of warning message', { tags: 'a11y' }, () => {
574
1031
  cy.checkAccessibility(fillInTheGapsTextCommonComponent.limitReachedWarningMessage());
575
1032
  });
576
1033
 
1034
+ it('The user should not be able to enter characters more than the maximum character limit and warning message should persist', () => {
1035
+ fillInTheGapsTextCommonComponent.steps.addTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'From' }]);
1036
+ fillInTheGapsTextCommonComponent.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flowerpots' }])
1037
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageExist('Maximum 10 characters have been entered.');
1038
+ });
1039
+
577
1040
  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
1041
  fillInTheGapsTextCommonComponent.steps.addTextInAnswerInputFieldsPreviewTab(0, '{backspace}');
579
1042
  fillInTheGapsTextCommonComponent.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flowerpot' }])
580
1043
  fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageNotExist();
581
1044
  });
582
1045
 
1046
+ it('When the user reaches the maximum character limit, then the warning message \'Maximum 10 characters have been entered\' should be displayed and on focusing out of the answer input field, the warning message should disappear', () => {
1047
+ fillInTheGapsTextCommonComponent.steps.addTextInAnswerInputFieldsPreviewTab('s');
1048
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 0, responseText: 'Flowerpots' }])
1049
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageExist('Maximum 10 characters have been entered.');
1050
+ fillInTheGapsTextCommonComponent.steps.focusOutOfResponseAnswerInputFieldPreviewTab(0);
1051
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageNotExist();
1052
+ });
1053
+ },
1054
+
1055
+ verifyMinimumCharacterLimitWarningConditionsPreviewTab: () => {
1056
+ it('When the minimum character limit is set as 0, then on focusing out of the answer input field, no warning message should be displayed', () => {
1057
+ fillInTheGapsTextCommonComponent.steps.focusInAndFocusOutOfResponseAnswerInputFieldPreviewTab();
1058
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageNotExist();
1059
+ });
1060
+
583
1061
  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
1062
  createQuestionBasePage.steps.switchToEditTab();
585
1063
  fillInTheGapsTextCommonComponent.steps.setMinimumLimit(6);
586
1064
  createQuestionBasePage.steps.switchToPreviewTab();
587
1065
  fillInTheGapsTextCommonComponent.steps.addTextInAnswerInputFieldsPreviewTab(0, 'Air');
588
- fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageExist('Minimum 6 words are required.');
1066
+ fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageExist('Minimum 6 characters are required.');
589
1067
  });
590
1068
 
591
1069
  it('When the user enters the character greater than the minimum character limit value set by the user, then the warning message should disappear', () => {
@@ -602,6 +1080,405 @@ const tests = {
602
1080
  fillInTheGapsTextCommonComponent.steps.addTextInAnswerInputFieldsPreviewTab(0, 'water');
603
1081
  fillInTheGapsTextCommonComponent.steps.verifyLimitReachedWarningMessageNotExist();
604
1082
  });
1083
+ },
1084
+
1085
+ verifyEnableSpecialCharactersCheckboxDefaultState: () => {
1086
+ it('\'Special characters\' section label and unchecked \'Enable special characters\' checkbox and label should be displayed', () => {
1087
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.specialCharactersLabel(), 'visible');
1088
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.specialCharactersLabel(), 'Special characters');
1089
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.enableSpecialCharactersLabel(), 'visible');
1090
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.enableSpecialCharactersLabel(), 'Enable special characters');
1091
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.enableSpecialCharactersCheckbox(), 'exist');
1092
+ fillInTheGapsTextCommonComponent.steps.verifyEnableSpecialCharactersCheckboxUnchecked();
1093
+ });
1094
+ },
1095
+
1096
+ /**
1097
+ * Verifies the contents and functionality of the 'Specify correct answer' accordion for multiple selection questions.
1098
+ * @param {{'Correct' | 'Alternative'}} accordionName - The name of the accordion to be used in the validation.
1099
+ * @example - verifySpecifyCorrectAnswerAccordionContentsAndFunctionality('Correct');
1100
+ */
1101
+ verifySpecifyCorrectAnswerAccordionContentsAndFunctionality: (accordionName) => {
1102
+ it(`Response accordions for the added response areas with label \'Response #\' should be displayed in the ${accordionName} accordion in expanded state`, () => {
1103
+ utilities.verifyElementCount(fillInTheGapsTextCommonComponent.responseAccordion(), 2);
1104
+ fillInTheGapsTextCommonComponent.steps.verifyResponseAccordionIsExpanded(0);
1105
+ utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordionLabel(), 0), 'Response 1');
1106
+ utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordionLabel(), 1), 'Response 2');
1107
+ });
1108
+
1109
+ it('When user focuses in and out of the response accordion \'Answer\' input field, \'Error: Answer is required.\' error message should be displayed', () => {
1110
+ fillInTheGapsTextCommonComponent.steps.focusInAndFocusOutOfResponseAnswerInputFieldSpecifyCorrectAnswer(0, 0);
1111
+ utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'visible');
1112
+ utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: Answer is required.');
1113
+ });
1114
+
1115
+ it('When gives an input to \'Answer\' input field, then error message should disappear', () => {
1116
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'Petals' }, { responseIndex: 1, responseText: 'Flower' }]);
1117
+ commonComponents.steps.verifyErrorMessageIsNotDisplayed();
1118
+ });
1119
+
1120
+ it('\'Accepted student input\' label, menu and its options - \'Text\', \'Number\', \'Integer\' should be displayed and \'Text\' option should be active', () => {
1121
+ utilities.verifyInnerText(acceptedStudentInputComponent.acceptedStudentInputLabel(), 'Accepted student input');
1122
+ utilities.verifyElementVisibilityState(acceptedStudentInputComponent.acceptedStudentInputLabel(), 'visible');
1123
+ acceptedStudentInputComponent.steps.verifyAcceptedStudentTypeMenuButtons(0);
1124
+ acceptedStudentInputComponent.steps.verifyAcceptedStudentTypeActiveButton(0, 'Text');
1125
+ });
1126
+
1127
+ it('User should be able to collapse response accordion', () => {
1128
+ fillInTheGapsTextCommonComponent.steps.collapseResponseAccordionSpecifyCorrectAnswer(0);
1129
+ });
1130
+
1131
+ autoScoredSpecifyCorrectAnswerSection.tests.verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty(accordionName);
1132
+
1133
+ it(`CSS of ${accordionName} accordion contents`, { tags: 'css' }, () => {
1134
+ utilities.verifyCSS(utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordionLabel(), 0), {
1135
+ 'color': css.color.text,
1136
+ 'font-size': css.fontSize.default,
1137
+ 'font-weight': css.fontWeight.bold
1138
+ });
1139
+ });
1140
+
1141
+ it(`Accessibility of ${accordionName} accordion contents`, { tags: 'a11y' }, () => {
1142
+ cy.checkAccessibility(utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordion(), 0).parents('[aria-label="Specify correct answer section"]'));
1143
+ });
1144
+ },
1145
+
1146
+ verifyContentsOfSpecifyCorrectAnswerSection: () => {
1147
+ it('When user selects a scoring type then in the \'Correct\' accordion, all the contents should be displayed', () => {
1148
+ utilities.verifyElementCount(fillInTheGapsTextCommonComponent.responseAccordion(), 2);
1149
+ fillInTheGapsTextCommonComponent.steps.verifyResponseAccordionIsExpanded(0);
1150
+ fillInTheGapsTextCommonComponent.steps.verifyResponseAccordionIsExpanded(1);
1151
+ utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordionLabel(), 0), 'Response 1');
1152
+ utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordionLabel(), 1), 'Response 2');
1153
+ });
1154
+ },
1155
+
1156
+ verifyConditionalCheckboxesSectionContents: () => {
1157
+ it(`By default four conditional checkboxes ${conditionalCheckboxes.join(', ')} should be displayed in the scoring section and all of them should be unchecked`, () => {
1158
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.caseSensitiveCheckbox(), 'exist');
1159
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.caseSensitiveCheckboxLabel(), 'visible');
1160
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.caseSensitiveCheckboxLabel(), `${conditionalCheckboxes[0]}`);
1161
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.validateIfAnswerIsIncludedCheckbox(), 'exist');
1162
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.validateIfAnswerIsIncludedCheckboxLabel(), 'visible');
1163
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.validateIfAnswerIsIncludedCheckboxLabel(), `${conditionalCheckboxes[1]}`);
1164
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.ignoreExtraSpacesCheckbox(), 'exist');
1165
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.ignoreExtraSpacesCheckboxLabel(), 'visible');
1166
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.ignoreExtraSpacesCheckboxLabel(), `${conditionalCheckboxes[2]}`);
1167
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.ignoreSingleLetterMistakeCheckbox(), 'exist');
1168
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.ignoreSingleLetterMistakeCheckboxLabel(), 'visible');
1169
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.ignoreSingleLetterMistakeCheckboxLabel(), `${conditionalCheckboxes[3]}`);
1170
+ fillInTheGapsTextCommonComponent.steps.verifyDefaultUncheckedStateOfConditionalCheckboxes();
1171
+ });
1172
+
1173
+ it('User should be able to check a conditional checkbox', () => {
1174
+ fillInTheGapsTextCommonComponent.steps.checkConditionalCheckbox(conditionalCheckboxes[0]);
1175
+ });
1176
+
1177
+ it('When \'Validate if answer is included in the response\' checkbox is checked, then \'Ignore extra spaces\', \'Ignore single letter mistake\' checkboxes should be disabled', () => {
1178
+ fillInTheGapsTextCommonComponent.steps.checkConditionalCheckbox(conditionalCheckboxes[1]);
1179
+ utilities.verifyElementDisabled(fillInTheGapsTextCommonComponent.ignoreExtraSpacesCheckbox());
1180
+ utilities.verifyElementDisabled(fillInTheGapsTextCommonComponent.ignoreSingleLetterMistakeCheckbox());
1181
+ });
1182
+
1183
+ it('CSS of conditional checkboxes', () => {
1184
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.caseSensitiveCheckboxLabel(), {
1185
+ 'color': css.color.checkboxLabel,
1186
+ 'font-size': css.fontSize.normal,
1187
+ 'font-weight': css.fontWeight.regular
1188
+ });
1189
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.caseSensitiveCheckbox().parent().find('rect').eq(1), {
1190
+ 'fill': css.color.activeButtons,
1191
+ });
1192
+ //disabled state
1193
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.ignoreExtraSpacesCheckboxLabel(), {
1194
+ 'color': css.color.labelText,
1195
+ 'font-size': css.fontSize.normal,
1196
+ 'font-weight': css.fontWeight.regular
1197
+ });
1198
+ });
1199
+
1200
+ it('Accessibility of conditional checkboxes', () => {
1201
+ cy.checkAccessibility(fillInTheGapsTextCommonComponent.caseSensitiveCheckboxLabel().parents('.scoring-type-checkbox-wrapper'));
1202
+ });
1203
+
1204
+ it('When \'Validate if answer is included in the response\' checkbox is unchecked, then \'Ignore extra spaces\', \'Ignore single letter mistake\' checkboxes should be enabled', () => {
1205
+ fillInTheGapsTextCommonComponent.steps.uncheckConditionalCheckbox(conditionalCheckboxes[1]);
1206
+ utilities.verifyElementNotDisabled(fillInTheGapsTextCommonComponent.ignoreExtraSpacesCheckbox());
1207
+ utilities.verifyElementNotDisabled(fillInTheGapsTextCommonComponent.ignoreSingleLetterMistakeCheckbox());
1208
+ });
1209
+ },
1210
+
1211
+ verifySpellCheckEditTabContents: () => {
1212
+ it('\'Spell check\' functionality label and checkbox should be displayed and by default it should be unchecked', () => {
1213
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.spellCheckLabel(), 'Spell check');
1214
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.spellCheckLabel(), 'visible');
1215
+ fillInTheGapsTextCommonComponent.steps.verifySpellCheckCheckboxUnchecked();
1216
+ });
1217
+
1218
+ it('CSS of \'Spell check\' section - unchecked state', { tags: 'css' }, () => {
1219
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.spellCheckLabel(), {
1220
+ 'color': css.color.labelText,
1221
+ 'font-size': css.fontSize.normal,
1222
+ 'font-weight': css.fontWeight.regular
1223
+ });
1224
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.spellCheckCheckbox().parent().find('svg'), {
1225
+ 'fill': css.color.uncheckedCheckbox
1226
+ });
1227
+ });
1228
+
1229
+ it('Accessibility of \'Spell check\' section - unchecked state', { tags: 'a11y' }, () => {
1230
+ cy.checkAccessibility(fillInTheGapsTextCommonComponent.spellCheckLabel().parents('.student-view-settings-container'));
1231
+ });
1232
+
1233
+ it('User should be able to check \'Spell check\' checkbox', () => {
1234
+ fillInTheGapsTextCommonComponent.steps.checkSpellCheckCheckbox();
1235
+ });
1236
+
1237
+ it('CSS of \'Spell check\' section - checked state', { tags: 'css' }, () => {
1238
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.spellCheckCheckbox().parent('.icon-checkbox-selected').find('.checkbox-icon-border-rect'), {
1239
+ 'fill': css.color.activeButtons
1240
+ });
1241
+ });
1242
+
1243
+ it('Accessibility of \'Spell check\' section - checked state', { tags: 'a11y' }, () => {
1244
+ cy.checkAccessibility(fillInTheGapsTextCommonComponent.spellCheckLabel());
1245
+ });
1246
+
1247
+ it('User should be able to uncheck \'Spell check\' checkbox', () => {
1248
+ fillInTheGapsTextCommonComponent.steps.uncheckSpellCheckCheckbox();
1249
+ });
1250
+ },
1251
+
1252
+ verifySpellCheckFunctionalityPreviewTab: () => {
1253
+ it('When the \'Spell check\' functionality is disabled, the response field should have \'spellcheck\' attribute set as \'false\' in preview tab', () => {
1254
+ fillInTheGapsTextCommonComponent.steps.verifySpellCheckOfResponseFieldPreviewTabDisabled(0);
1255
+ });
1256
+
1257
+ it('When the \'Spell check\' functionality is enabled, the response field should have \'spellcheck\' attribute set as \'true\' in the preview tab', () => {
1258
+ createQuestionBasePage.steps.switchToEditTab();
1259
+ fillInTheGapsTextCommonComponent.steps.checkSpellCheckCheckbox();
1260
+ createQuestionBasePage.steps.switchToPreviewTab();
1261
+ fillInTheGapsTextCommonComponent.steps.verifySpellCheckOfResponseFieldPreviewTabEnabled(0);
1262
+ });
1263
+ },
1264
+
1265
+ verifyAnswerInputFieldEditTab: () => {
1266
+ it('\'Answers\' label and one empty input field should be displayed', () => {
1267
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.responseAccordionAnswersLabel(), 'Answers');
1268
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.responseAccordionAnswersLabel(), 'visible');
1269
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.answerInputFieldSpecifyCorrectAnswerSection(), '');
1270
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.answerInputFieldSpecifyCorrectAnswerSection(), 'visible');
1271
+ utilities.verifyElementCount(fillInTheGapsTextCommonComponent.answerInputFieldSpecifyCorrectAnswerSection(), 1);
1272
+ });
1273
+
1274
+ it('When there is a single input field, then answer input field should not have numeration and delete button ', () => {
1275
+ utilities.verifyElementCount(fillInTheGapsTextCommonComponent.responseAccordionAnswerInputFieldWrapper(), 1);
1276
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.responseAccordionAnswerNumeration(), 'notExist');
1277
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.responseAccordionAnswerDeleteButton(), 'notExist');
1278
+ });
1279
+
1280
+ it('\'Add alternate\' button should be displayed', () => {
1281
+ utilities.verifyInnerText(fillInTheGapsTextCommonComponent.responseAccordionAddAlternateButtonLabel(), 'Add alternate');
1282
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.responseAccordionAddAlternateButtonLabel(), 'visible');
1283
+ });
1284
+
1285
+ it('When user has not entered text inside answer input field and clicks on \'Add alternate\' answer then \'Error: Answer is required.\' error message should be displayed', () => {
1286
+ fillInTheGapsTextCommonComponent.steps.addAlternateAnswerInResponseAccordion(0);
1287
+ utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: Answer is required.');
1288
+ utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'visible');
1289
+ });
1290
+
1291
+ it('When user enters text inside answer input field, then error message should disappear', () => {
1292
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'Flower' }]);
1293
+ commonComponents.steps.verifyErrorMessageIsNotDisplayed();
1294
+ });
1295
+
1296
+ it('When the user clicks on the \'Add Alternate\' button, then one alternate answer input field should be displayed', () => {
1297
+ fillInTheGapsTextCommonComponent.steps.addAlternateAnswerInResponseAccordion(0);
1298
+ utilities.verifyElementCount(fillInTheGapsTextCommonComponent.answerInputFieldSpecifyCorrectAnswerSection(), 2);
1299
+ utilities.verifyElementVisibilityState(fillInTheGapsTextCommonComponent.responseAccordionAddAlternateButton(), 'visible');
1300
+ });
1301
+
1302
+ it('Each input field should be appropriately numbered, and a delete button should be provided for each input field', () => {
1303
+ fillInTheGapsTextCommonComponent.steps.verifyResponseAccordionAnswerInputFieldNumeration(0);
1304
+ fillInTheGapsTextCommonComponent.steps.verifyResponseAccordionAnswerInputFieldDeleteButton(0);
1305
+ });
1306
+
1307
+ it('When user hovers over delete button, then tooltip \'Delete\' should be displayed', () => {
1308
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordionAnswerDeleteButton(), 0)
1309
+ .verifyTooltip('Delete');
1310
+ });
1311
+
1312
+ it('When no input is provided in answer input field, then placeholder text \'Enter answer\' should be displayed in the answer input field', () => {
1313
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholder(1);
1314
+ });
1315
+
1316
+ it('When the user clicks on the \'Add Alternate\' button without entering text in the newly added alternate answer input field, then an error message should be displayed, indicating \'Error: Answer is required.\'', () => {
1317
+ fillInTheGapsTextCommonComponent.steps.addAlternateAnswerInResponseAccordion(0);
1318
+ utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: Answer is required.');
1319
+ });
1320
+
1321
+ it('When user adds text in alternate input field and clicks on \'Add alternate\' button, then then a third alternate answer input field should be displayed and error message should disappear', () => {
1322
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 1, responseText: 'Leaf' }]);
1323
+ commonComponents.steps.verifyErrorMessageIsNotDisplayed();
1324
+ fillInTheGapsTextCommonComponent.steps.addAlternateAnswerInResponseAccordion(0);
1325
+ utilities.verifyElementCount(fillInTheGapsTextCommonComponent.answerInputFieldSpecifyCorrectAnswerSection(), 3);
1326
+ });
1327
+
1328
+ it('CSS of answer input field', { tags: 'css' }, () => {
1329
+ utilities.verifyCSS(fillInTheGapsTextCommonComponent.responseAccordionAnswersLabel(), {
1330
+ 'color': css.color.labels,
1331
+ 'font-size': css.fontSize.normal,
1332
+ 'font-weight': css.fontWeight.semibold,
1333
+ });
1334
+ utilities.verifyCSS(utilities.getNthElement(fillInTheGapsTextCommonComponent.answerInputFieldSpecifyCorrectAnswerSection(), 1), {
1335
+ 'color': css.color.text,
1336
+ 'font-size': css.fontSize.default,
1337
+ 'font-weight': css.fontWeight.regular,
1338
+ });
1339
+ utilities.verifyCSS(utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordionAnswerNumeration(), 1), {
1340
+ 'color': css.color.labels,
1341
+ 'font-size': css.fontSize.default,
1342
+ 'font-weight': css.fontWeight.semibold,
1343
+ });
1344
+ utilities.getNthElement(fillInTheGapsTextCommonComponent.responseAccordionAnswerDeleteButton(), 1)
1345
+ .find('button')
1346
+ .verifyPseudoClassBeforeProperty('color', css.color.deleteIcon);
1347
+ });
1348
+
1349
+ it('Accessibility of response accordion', { tags: 'a11y' }, () => {
1350
+ cy.checkAccessibility(fillInTheGapsTextCommonComponent.responseAccordion());
1351
+ });
1352
+
1353
+ it('When provided input is cleared from answer input field, then placeholder text should be displayed again in the answer input field', () => {
1354
+ fillInTheGapsTextCommonComponent.steps.clearAnswerInputField(0);
1355
+ fillInTheGapsTextCommonComponent.steps.verifyAnswerInputFieldPlaceholder(0);
1356
+ });
1357
+
1358
+ it('When user deletes input field, then alternate answer field should be deleted and each input field should have appropriate numeration and delete button', () => {
1359
+ fillInTheGapsTextCommonComponent.steps.deleteResponseAccordionAnswerInputField(0, 0);
1360
+ fillInTheGapsTextCommonComponent.steps.verifyResponseAccordionAnswerInputFieldNumeration(0);
1361
+ fillInTheGapsTextCommonComponent.steps.verifyResponseAccordionAnswerInputFieldDeleteButton(0);
1362
+ });
1363
+ },
1364
+
1365
+ verifyAcceptedStudentInputEditTabFunctionality: () => {
1366
+ it('When \'Text\' is selected in accepted student input, then user should be able to enter alphanumeric characters and special symbols in the answer input field', () => {
1367
+ acceptedStudentInputComponent.steps.verifyAcceptedStudentTypeActiveButton(0, 'Text');
1368
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'Hi23(^^)' }]);
1369
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 0, responseText: 'Hi23(^^)' }]);
1370
+ });
1371
+
1372
+ it('When user selects \'Number\' in accepted student input, then text inside the answer input field should only include numbers part from the previously entered input', () => {
1373
+ acceptedStudentInputComponent.steps.selectAcceptedStudentInputType(0, 'Number');
1374
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 0, responseText: '23' }]);
1375
+ });
1376
+
1377
+ it('User should not be able to enter characters or special symbols i.e. answer input field should only contain numbers', () => {
1378
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: 'ABc^12' }]);
1379
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 0, responseText: '12' }]);
1380
+ });
1381
+
1382
+ it('User should be able to enter negative numbers in answer input field', () => {
1383
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: '-5' }]);
1384
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 0, responseText: '-5' }]);
1385
+ });
1386
+
1387
+ it('User should be able to add zero in input field', () => {
1388
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: '0' }]);
1389
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 0, responseText: '0' }]);
1390
+ });
1391
+
1392
+ it('User should be able to enter decimal numbers in answer input field', () => {
1393
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: '29.54' }]);
1394
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 0, responseText: '29.54' }]);
1395
+ });
1396
+
1397
+ it('When user selects \'Integer\' in accepted student input, then text inside the answer input field should only include whole numbers part from the previously entered input', () => {
1398
+ acceptedStudentInputComponent.steps.selectAcceptedStudentInputType(0, 'Integer');
1399
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 0, responseText: '2954' }]);
1400
+ });
1401
+
1402
+ it('When \'Integer\' is selected in accepted student input, then user should not be able to add characters or special symbols i.e. input field should only include whole numbers', () => {
1403
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: '29hi*5k4.5' }]);
1404
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 0, responseText: '29545' }]);
1405
+ });
1406
+
1407
+ it('User should be able to add zero in input field', () => {
1408
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: '0' }]);
1409
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 0, responseText: '0' }]);
1410
+ });
1411
+
1412
+ it('User should not be able to add negative number i.e. input field should only include positive whole numbers', () => {
1413
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 0, responseText: '-44' }]);
1414
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 0, responseText: '44' }]);
1415
+ });
1416
+
1417
+ it('When user selects \'Text\' in accepted student input again, then answer input field should contain text from previously added input', () => {
1418
+ acceptedStudentInputComponent.steps.selectAcceptedStudentInputType(0, 'Text');
1419
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 0, responseText: '44' }]);
1420
+ });
1421
+
1422
+ it('When user adds alternate answer input field, then accepted student input should be applied on both the response answer input fields in the response accordion', () => {
1423
+ fillInTheGapsTextCommonComponent.steps.addAlternateAnswerInResponseAccordion(0);
1424
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsSpecifyCorrectAnswerSection([{ responseIndex: 1, responseText: 'Hi12' }]);
1425
+ fillInTheGapsTextCommonComponent.steps.verifyTextInResponseAccordionAnswerInputField([{ responseIndex: 1, responseText: 'Hi12' }]);
1426
+ });
1427
+ },
1428
+
1429
+ verifyAcceptedStudentInputPreviewTabFunctionality: () => {
1430
+ it('When \'Text\' is selected in accepted student input in edit tab, then user should be able to enter alphanumeric characters and special symbols in the preview tab', () => {
1431
+ acceptedStudentInputComponent.steps.verifyAcceptedStudentTypeActiveButton(0, 'Text');
1432
+ createQuestionBasePage.steps.switchToPreviewTab();
1433
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flower23^^' }]);
1434
+ fillInTheGapsTextCommonComponent.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flower23^^' }]);
1435
+ });
1436
+
1437
+ it('When user selects \'Number\' in accepted student input in edit tab, then user should be able to enter only numbers inside text container in preview tab', () => {
1438
+ createQuestionBasePage.steps.switchToEditTab();
1439
+ acceptedStudentInputComponent.steps.selectAcceptedStudentInputType(0, 'Number');
1440
+ createQuestionBasePage.steps.switchToPreviewTab();
1441
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flower232&' }]);
1442
+ fillInTheGapsTextCommonComponent.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: '232' }]);
1443
+ });
1444
+
1445
+ it('User should be able to enter decimal numbers inside text container in preview tab', () => {
1446
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: '23.2' }]);
1447
+ fillInTheGapsTextCommonComponent.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: '23.2' }]);
1448
+ });
1449
+
1450
+ it('User should be able to enter negative numbers inside text container in preview tab', () => {
1451
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: '-6' }]);
1452
+ fillInTheGapsTextCommonComponent.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: '-6' }]);
1453
+ });
1454
+
1455
+ it('User should be able to enter zero inside text container in preview tab', () => {
1456
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: '0' }]);
1457
+ fillInTheGapsTextCommonComponent.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: '0' }]);
1458
+ });
1459
+
1460
+ it('When user selects \'Integer\' in accepted student input in edit tab, then user should be able to add only whole numbers inside text container', () => {
1461
+ createQuestionBasePage.steps.switchToEditTab();
1462
+ acceptedStudentInputComponent.steps.selectAcceptedStudentInputType(0, 'Integer');
1463
+ createQuestionBasePage.steps.switchToPreviewTab();
1464
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: 'Flower232&*' }]);
1465
+ fillInTheGapsTextCommonComponent.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: '232' }]);
1466
+ });
1467
+
1468
+ it('When user has selected \'Integer\' in accepted student input, then user should not be able to add decimal numbers in the text container', () => {
1469
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: '22.4' }]);
1470
+ fillInTheGapsTextCommonComponent.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: '224' }]);
1471
+ });
1472
+
1473
+ it('When user has selected \'Integer\' in accepted student input, then user should not be able to add negative number inside text container i.e. input field should only include positive whole numbers.', () => {
1474
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: '-5' }]);
1475
+ fillInTheGapsTextCommonComponent.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: '5' }]);
1476
+ });
1477
+
1478
+ it('User should be able to enter zero inside text container in preview tab', () => {
1479
+ fillInTheGapsTextCommonComponent.steps.enterTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: '0' }]);
1480
+ fillInTheGapsTextCommonComponent.steps.verifyTextInAnswerInputFieldsPreviewTab([{ responseIndex: 0, responseText: '0' }]);
1481
+ });
605
1482
  }
606
1483
  }
607
1484