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,742 +1,203 @@
1
- import { additionalSettingsPanel, autoScoredAdditionalSettings, autoScoredPreviewBase, autoScoredScoringSection, autoScoredScoringSectionMultipleResponsesType, autoScoredSetCorrectAnswerSection, commonComponents, createQuestionBasePage, draggableOptionsContainer, fillInTheGapsCommonComponents, optionsWrapperComponent, previewScoringAndShowCorrectAnswerComponent, questionInstructionsComponent, scoringSectionBase, draggableOptionContainer, draggableOptionsSectionComponent, questionInputFieldComponent } from "./components"
1
+ import constants from "../fixtures/constants";
2
+ import utilities from "../support/helpers/utilities";
2
3
  const css = Cypress.env('css');
3
- let optionsForResponses = ['Response 1', 'Response 2'];
4
+ import { createQuestionBasePage, optionsWrapperComponent, autoScoredScoringPreviewTab, scoringSectionBaseEditTab, questionInputFieldComponent, fillInTheGapsDragAndDropCommonComponents, correctIncorrectAnswerLabelComponent, questionInstructionsComponent, autoScoredStudentViewSettings, ckEditorToolbar, equationEditorFlyout, draggableOptionContainer } from "./components"
4
5
 
5
6
  const selectors = {
6
- ...scoringSectionBase,
7
- ...createQuestionBasePage,
8
- ...additionalSettingsPanel,
7
+ ...fillInTheGapsDragAndDropCommonComponents,
9
8
  ...questionInstructionsComponent,
10
- ...commonComponents,
11
- ...fillInTheGapsCommonComponents,
12
- ...autoScoredSetCorrectAnswerSection,
13
- ...autoScoredAdditionalSettings,
14
- ...autoScoredPreviewBase,
15
- ...autoScoredScoringSectionMultipleResponsesType,
16
- ...optionsWrapperComponent,
17
- ...previewScoringAndShowCorrectAnswerComponent,
18
- ...draggableOptionContainer,
19
- ...draggableOptionsSectionComponent,
20
9
  ...questionInputFieldComponent,
21
- //TODO: Can be shifted to optionsWrapperComponent once https://redmine.zeuslearning.com/issues/518498 is resolved
22
- setCorrectAnswerResponseArea: () => cy.get('[class="droppable-area"] [role="button"]'),
23
- setCorrectAnswerDraggableOption: () => cy.get('.draggable-selected-item'),
24
- randomizeOptionsLabel: () => cy.get('[data-ngie-testid="randomize-options-checkbox"] .MuiFormControlLabel-label'),
25
- reuseOptionsLabel: () => cy.get('[data-ngie-testid="reuse-options-checkbox"] .MuiFormControlLabel-label'),
26
- hideDragHandleLabel: () => cy.get('[data-ngie-testid="hide-drag-handle-checkbox"] .MuiFormControlLabel-label'),
27
- matchFromAllResponsesLabel: () => cy.get('[data-ngie-testid="match-from-all-responses-checkbox"] .MuiFormControlLabel-label'),
28
- randomizeOptionsCheckbox: () => cy.get('[data-ngie-testid="randomize-options-checkbox"] input'),
29
- reuseOptionsCheckbox: () => cy.get('[data-ngie-testid="reuse-options-checkbox"] input'),
30
- hideDragHandleCheckbox: () => cy.get('[data-ngie-testid="hide-drag-handle-checkbox"] input'),
31
- matchFromAllResponsesCheckbox: () => cy.get('[data-ngie-testid="match-from-all-responses-checkbox"] input'),
32
- setCorrectAnswerResponseAreaWrapper: () => cy.get('[class*="DroppableHotspotstyle__DroppableHotspotWrapper"]'),
33
- setCorrectAnswerDraggableOptionContainer: () => cy.get('[class*="ClozeWithDragAndDropstyles__DraggableWrapper"]'),
10
+ //Specify correct answer section
11
+ dropzoneSpecifyCorrectAnswerSection: () => cy.get('[class="droppable-area"] [role="button"]'),
12
+ optionContainerOptionsSpecifyCorrectAnswerSection: () => cy.get('.draggable-selected-item'),
13
+
34
14
  //Preview tab
35
- previewTabResponseArea: () => cy.get('.no-split-pane-wrapper [class="droppable-area"] [role="button"]'),
36
- previewTabQuestionField: () => cy.get('.no-split-pane-wrapper div[class*="ClozeWithDragAndDropstyles__QuestionItemContainer"]'),
37
- previewTabDraggableOption: () => cy.get('.no-split-pane-wrapper .draggable-selected-item'),
38
- previewDraggableOptionsWrapper: () => cy.get('.no-split-pane-wrapper .draggable-wrapper'),
39
- previewTabCorrectAnswerContainer: () => cy.get('[class*="ClozeWithDragAndDropstyles__CorrectAnswerTextWrapper"]'),
40
- previewTabCorrectAnswerLabel: () => fillInTheGapsDragAndDropPage.previewTabCorrectAnswerContainer().find('[class*="ClozeWithDragAndDropstyles__CorrectAnswerLabel"]'),
41
- previewTabCorrectAnswerResponseNumerationWrapper: () => cy.get('[class*="ClozeWithDragAndDropstyles__NumerationWrapper"]'),
42
- previewTabCorrectAnswerResponseWrapper: () => fillInTheGapsDragAndDropPage.previewTabCorrectAnswerResponseNumerationWrapper().parents('[class*="ClozeWithDragAndDropstyles__ItemWrapper"]'),
43
- previewTabCorrectAnswerResponseText: () => cy.get('[class*="ClozeWithDragAndDropstyles__ItemWrapper"] .question-text-wrapper'),
44
- previewTabResponseAreaWrapper: () => cy.get('.no-split-pane-wrapper [class*="DroppableHotspotstyle__DroppableHotspotWrapper"]'),
45
- draggableOption: () => cy.get('.draggable-selected-item'),
15
+ questionContainerPreviewTab: () => cy.get('.question-item-container'),
16
+ dropzonePreviewTab: () => cy.get('[class*="DroppableHotspotstyle__DroppableHotspotWrapper"]'),
17
+ dropzoneContainerPreviewTab: () => cy.get('.answer-status-response-preview-wrapper'),
18
+ optionContainerOptionsPreviewTab: () => cy.get('.no-split-pane-wrapper .draggable-selected-item'),
19
+ dropzoneWrapperPreviewTab: () => cy.get('.label-image-with-dnd-canvas-wrapper .cell'),
20
+ dropzoneNumeration: () => cy.get('[class*="DroppableHotspotstyle__NumerationDiv"]')
46
21
  }
47
22
 
48
23
  const steps = {
49
24
  ...createQuestionBasePage.steps,
50
- ...questionInstructionsComponent.steps,
51
- ...additionalSettingsPanel.steps,
52
- ...scoringSectionBase.steps,
53
- ...fillInTheGapsCommonComponents.steps,
54
- ...autoScoredSetCorrectAnswerSection.steps,
55
- ...autoScoredPreviewBase.steps,
56
- ...autoScoredScoringSection.steps,
57
- ...autoScoredAdditionalSettings.steps,
58
25
  ...optionsWrapperComponent.steps,
59
- ...autoScoredScoringSectionMultipleResponsesType.steps,
60
- ...previewScoringAndShowCorrectAnswerComponent.steps,
61
- ...draggableOptionContainer.steps,
62
- ...draggableOptionsSectionComponent.steps,
63
- ...questionInputFieldComponent.steps,
64
- setCorrectAnswerSectionClickAndDropDraggableOptionInResponseArea: (optionName, responseAreaIndex) => {
65
- fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
66
- .contains(optionName)
67
- .click();
68
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
69
- .eq(responseAreaIndex)
70
- .click();
71
- },
72
-
73
- previewTabClickAndDropDraggableOptionInResponseArea: (optionName, responseAreaIndex) => {
74
- fillInTheGapsDragAndDropPage.previewTabDraggableOption()
75
- .contains(optionName)
76
- .click();
77
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
78
- .eq(responseAreaIndex)
79
- .click();
80
- },
81
-
82
- verifyIncorrectOptionCrossmarkIcon: (index) => {
83
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
84
- .eq(index)
85
- .parents('[class="droppable-area"]')
86
- .prev('.tick-icon-wrapper')
87
- .should('have.class', 'icon-incorrect')
88
- .and('be.visible');
89
- },
90
-
91
- verifyCorrectOptionCheckmarkIcon: (index) => {
92
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
93
- .eq(index)
94
- .parents('[class="droppable-area"]')
95
- .prev('.tick-icon-wrapper')
96
- .should('have.class', 'icon-correct')
97
- .and('be.visible');
98
- },
99
-
100
- verifyCorrectIncorrectIconNotVisible: (index) => {
101
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
102
- .eq(index)
103
- .parents('[class="droppable-area"]')
104
- .prev('.tick-icon-wrapper')
105
- .should('not.exist');
106
- },
107
-
108
- verifyCorrectAnswerResponsesInCorrectAnswerContainerAndCount: (correctAnswerArray, optionNumerationArray) => {
109
- fillInTheGapsDragAndDropPage.previewTabCorrectAnswerContainer()
110
- .should('be.visible');
111
- fillInTheGapsDragAndDropPage.previewTabCorrectAnswerLabel()
112
- .verifyInnerText('Correct answers:');
113
- correctAnswerArray.forEach((responseFieldText, count) => {
114
- fillInTheGapsDragAndDropPage.previewTabCorrectAnswerResponseNumerationWrapper()
115
- .eq(count)
116
- .should('have.text', optionNumerationArray[count]);
117
- fillInTheGapsDragAndDropPage.previewTabCorrectAnswerResponseText()
118
- .eq(count)
119
- .verifyInnerText(responseFieldText);
120
- });
121
- fillInTheGapsDragAndDropPage.previewTabCorrectAnswerResponseWrapper()
122
- .should('have.length', correctAnswerArray.length);
123
- },
124
-
125
- verifyInactiveStateOfResponseAreaInSetCorrectAnswerSection: (responseAreaIndex) => {
126
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
127
- .eq(responseAreaIndex)
128
- .should('have.class', 'isEmpty');
129
- },
130
-
131
- verifyActiveStateOfResponseAreaInSetCorrectAnswerSection: (responseAreaIndex) => {
132
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
133
- .eq(responseAreaIndex)
134
- .should('have.class', 'isActiveForDrop');
135
- },
136
-
137
- verifyInactiveStateOfDraggableOptionInSetCorrectAnswerSection: (optionIndex) => {
138
- fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
26
+ ...scoringSectionBaseEditTab.steps,
27
+ ...autoScoredScoringPreviewTab.steps,
28
+ ...fillInTheGapsDragAndDropCommonComponents.steps,
29
+ ...correctIncorrectAnswerLabelComponent.steps,
30
+ ...questionInstructionsComponent.steps,
31
+ ...autoScoredStudentViewSettings.steps,
32
+ ...ckEditorToolbar.steps,
33
+ ...equationEditorFlyout.steps,
34
+ /**
35
+ * Sets options in dropzone in the Preview Tab based on the provided optionsObject.
36
+ * @param {Object} optionsObject - An object where keys are option texts and values are dropzone indices.
37
+ */
38
+ clickAndDropOptionInDropzoneSpecifyCorrectAnswerSection: (optionsObject) => {
39
+ Object.entries(optionsObject).forEach(([optionText, dropzoneIndex]) => {
40
+ fillInTheGapsDragAndDropPage.optionContainerOptionsSpecifyCorrectAnswerSection()
41
+ .contains(optionText)
42
+ .click();
43
+ fillInTheGapsDragAndDropPage.dropzoneSpecifyCorrectAnswerSection()
44
+ .eq(dropzoneIndex)
45
+ .click({ force: true });
46
+ });
47
+ },
48
+
49
+ /**
50
+ * Sets options in dropzone in the Preview Tab based on the provided optionsObject.
51
+ * @param {Object} optionsObject - An object where keys are option texts and values are dropzone indices.
52
+ */
53
+ clickAndDropOptionInDropzonePreviewTab: (optionsObject) => {
54
+ Object.entries(optionsObject).forEach(([optionText, dropzoneIndex]) => {
55
+ fillInTheGapsDragAndDropPage.optionContainerOptionsPreviewTab()
56
+ .contains(optionText)
57
+ .click();
58
+ fillInTheGapsDragAndDropPage.dropzonePreviewTab()
59
+ .eq(dropzoneIndex)
60
+ .click({ force: true });
61
+ });
62
+ },
63
+
64
+ /**
65
+ * @description Verifies the text content of a specific preview tab dropzone element.
66
+ * @param {number} count - The index of the preview tab dropzone element to verify (zero-based).
67
+ * @param {string} text - The expected text content to match against the inner text of the specified dropzone element.
68
+ */
69
+ verifyDropzoneTextPreviewTab: (count, text) => {
70
+ utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsDragAndDropPage.dropzonePreviewTab(), count), text);
71
+ },
72
+
73
+ verifyDropzoneNumeration: () => {
74
+ fillInTheGapsDragAndDropPage.dropzoneNumeration()
75
+ .each(($element, index) => {
76
+ cy.wrap($element)
77
+ .should('have.text', `${index + 1}`)
78
+ });
79
+ },
80
+
81
+ /**
82
+ * Verifies the correct option icon for a specified dropzone in the Preview Tab.
83
+ * @param {number} optionIndex - The index of the option to verify.
84
+ */
85
+ verifyCorrectOptionIcon: (optionIndex) => {
86
+ fillInTheGapsDragAndDropPage.dropzoneContainerPreviewTab()
139
87
  .eq(optionIndex)
140
- .should('not.have.class', 'item-selected');
141
- },
142
-
143
- verifyActiveStateOfDraggableOptionInSetCorrectAnswerSection: (optionIndex) => {
144
- fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
88
+ .within(() => {
89
+ fillInTheGapsDragAndDropCommonComponents.tickIconWrapper()
90
+ .verifyPseudoClassBeforeProperty('color', css.color.correctAnswer);
91
+ });
92
+ },
93
+
94
+ /**
95
+ * @description Verifies the incorrect option icon for a specified dropzone in the Preview Tab.
96
+ * @param {number} optionIndex - The index of the option to verify.
97
+ */
98
+ verifyIncorrectOptionIcon: (optionIndex) => {
99
+ fillInTheGapsDragAndDropPage.dropzoneContainerPreviewTab()
145
100
  .eq(optionIndex)
146
- .should('have.class', 'item-selected');
147
- fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOptionsWrapper()
148
- .should('have.class', 'itemSelected');
149
- },
150
-
151
- verifyErroredStateOfResponseAreaInSetCorrectAnswerSection: (responseAreaIndex) => {
152
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
153
- .eq(responseAreaIndex)
154
- .should('have.class', 'isEmpty')
155
- .and('have.class', 'error');
156
- },
157
-
158
- verifyInactiveStateOfResponseAreaInPreviewTab: (responseAreaIndex) => {
159
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
160
- .eq(responseAreaIndex)
161
- .should('have.class', 'isEmpty');
162
- },
163
-
164
- verifyActiveStateOfResponseAreaInPreviewTab: (responseAreaIndex) => {
165
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
166
- .eq(responseAreaIndex)
167
- .should('have.class', 'isActiveForDrop');
168
- },
169
-
170
- verifyInactiveStateOfDraggableOptionInPreviewTab: (optionIndex) => {
171
- fillInTheGapsDragAndDropPage.previewTabDraggableOption()
101
+ .within(() => {
102
+ fillInTheGapsDragAndDropCommonComponents.tickIconWrapper()
103
+ .verifyPseudoClassBeforeProperty('color', css.color.incorrectAnswer);
104
+ });
105
+ },
106
+
107
+ /**
108
+ * @description Verifies the absence of a correct/incorrect option icon for a specified option in the Preview Tab.
109
+ * @param {number} optionIndex - The index of the option to verify.
110
+ */
111
+ verifyCorrectIncorrectIconNotExist: (optionIndex) => {
112
+ fillInTheGapsDragAndDropPage.dropzoneContainerPreviewTab()
172
113
  .eq(optionIndex)
173
- .should('not.have.class', 'item-selected');
114
+ .within(() => {
115
+ utilities.verifyElementVisibilityState(fillInTheGapsDragAndDropCommonComponents.tickIconWrapper(), 'notExist');
116
+ });
174
117
  },
175
118
 
176
- verifyActiveStateOfDraggableOptionInPreviewTab: (optionIndex) => {
177
- fillInTheGapsDragAndDropPage.previewTabDraggableOption()
119
+ /**
120
+ * @description Verifies that the image in the Preview tab has the correct source and alt text.
121
+ * @param {number} optionIndex - The index of the option in the Preview tab.
122
+ */
123
+ verifyDraggableOptionWithImageInPreviewTab: (optionIndex) => {
124
+ fillInTheGapsDragAndDropPage.optionContainerOptionsPreviewTab()
178
125
  .eq(optionIndex)
179
- .should('have.class', 'item-selected');
180
- },
181
-
182
- verifyFilledResponseAreaInSetCorrectAnswerSection: (responseAreaIndex, optionText) => {
183
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseAreaWrapper()
184
- .eq(responseAreaIndex)
185
- .should('have.class', 'isNotEmpty');
186
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
187
- .eq(responseAreaIndex)
188
- .should('have.text', optionText)
189
- .and('be.visible');
190
- },
191
-
192
- verifyInactiveStateOfFilledResponseAreaInSetCorrectAnswerSection: (optionIndex) => {
193
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
126
+ .find('img')
127
+ .should('have.attr', 'src', constants.foxImageLink)
128
+ .and('have.attr', 'alt', constants.foxImageAltText);
129
+ utilities.verifyElementVisibilityState(utilities.getNthElement(draggableOptionContainer.draggableOptionDragIcon(), optionIndex), 'exist');
130
+ },
131
+
132
+ /**
133
+ * @description Verifies that the bold text in the Preview tab is correct.
134
+ * @param {number} optionIndex - The index of the option in the Preview tab.
135
+ */
136
+ verifyDraggableOptionWithBoldTextInPreviewTab: (optionIndex) => {
137
+ fillInTheGapsDragAndDropPage.optionContainerOptionsPreviewTab()
194
138
  .eq(optionIndex)
195
- .should('not.have.class', 'isActiveForDrop');
196
- },
197
-
198
- verifyInactiveStateOfFilledResponseAreaInPreviewTab: (optionIndex) => {
199
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
139
+ .find('strong')
140
+ .should('have.text', 'This is a bold option');
141
+ utilities.verifyElementVisibilityState(utilities.getNthElement(draggableOptionContainer.draggableOptionDragIcon(), optionIndex), 'exist');
142
+ },
143
+
144
+ /**
145
+ * @description Verifies that the equation text in the Preview tab is correct.
146
+ * @param {number} optionIndex - The index of the option in the Preview tab.
147
+ */
148
+ verifyDraggableOptionWithEquationTextInPreviewTab: (optionIndex) => {
149
+ fillInTheGapsDragAndDropPage.optionContainerOptionsPreviewTab()
150
+ .find('[role="math"]')
151
+ .should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
152
+ .contains(constants.CKEditorInputFieldEnteredEquationText);
153
+ utilities.verifyElementVisibilityState(utilities.getNthElement(draggableOptionContainer.draggableOptionDragIcon(), optionIndex), 'exist');
154
+ },
155
+
156
+ /**
157
+ * @description Verifies that the image in the Preview tab has the correct source and alt text.
158
+ * @param {number} optionIndex - The index of the option in the Preview tab.
159
+ */
160
+ verifyDropzoneWithImageInPreviewTab: (optionIndex) => {
161
+ fillInTheGapsDragAndDropPage.dropzonePreviewTab()
200
162
  .eq(optionIndex)
201
- .should('not.have.class', 'isActiveForDrop');
202
- },
203
-
204
- verifyFilledResponseAreaInPreviewTab: (responseAreaIndex, optionText) => {
205
- fillInTheGapsDragAndDropPage.previewTabResponseAreaWrapper()
206
- .eq(responseAreaIndex)
207
- .should('have.class', 'isNotEmpty');
208
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
209
- .eq(responseAreaIndex)
210
- .should('have.text', optionText)
211
- .and('be.visible');
212
- },
213
-
214
- clickAndDropDraggableOptionInResponseContainerOfSetCorrectAnswerSection: (optionName) => {
215
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
216
- .contains(optionName)
217
- .click();
218
- fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOptionsWrapper('fill in the gaps - drag and drop')
219
- .click();
220
- },
221
-
222
- clickAndDropDraggableOptionInResponseContainerOfPreviewTab: (optionName) => {
223
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
224
- .contains(optionName)
225
- .click();
226
- fillInTheGapsDragAndDropPage.previewDraggableOptionsWrapper('fill in the gaps - drag and drop')
227
- .click();
228
- }
229
- }
230
-
231
- const tests = {
232
- ...createQuestionBasePage.tests,
233
- ...questionInstructionsComponent.tests,
234
- ...fillInTheGapsCommonComponents.tests,
235
- ...scoringSectionBase.tests,
236
- ...autoScoredScoringSection.tests,
237
- ...commonComponents.tests,
238
- ...additionalSettingsPanel.tests,
239
- ...autoScoredSetCorrectAnswerSection.tests,
240
- ...autoScoredAdditionalSettings.tests,
241
- ...previewScoringAndShowCorrectAnswerComponent.tests,
242
- ...autoScoredScoringSectionMultipleResponsesType.tests,
243
- ...draggableOptionContainer.tests,
244
- ...draggableOptionsSectionComponent.tests,
245
- ...questionInputFieldComponent.tests,
246
- verifyDefaultResponseLabelAndResponseAreasInSetCorrectAnswerSection: () => {
247
- it('Two empty response areas with labels \'Response 1\' and \'Response 2\' should be displayed', () => {
248
- for (let index = 0; index < 2; index++) {
249
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseFieldLabel()
250
- .eq(index)
251
- .verifyInnerText(`Response ${index + 1}`);
252
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
253
- .eq(index)
254
- .should('be.visible')
255
- .verifyInnerText('');
256
- };
257
- });
258
- },
259
-
260
- verifyDefaultDraggableOptionsInSetCorrectAnswerSection: () => {
261
- it('The two empty draggable options should be displayed along with their drag handles', () => {
262
- fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
263
- .should('have.length', 2)
264
- .each(($element) => {
265
- cy.wrap($element)
266
- .should('be.visible')
267
- .verifyInnerText('')
268
- .find('.drag-indicator-icon')
269
- .should('be.visible');
270
- });
271
- });
272
- },
273
-
274
- verifyDraggableOptionContentsInAlternateTab: () => {
275
- it('The draggable options set by the user should also be displayed in the response container of the alternate tab in the \'Set correct answer\' section', () => {
276
- draggableOptionsContainer.steps.verifyDraggableResponsesSetCorrectAnswer('fill in the gaps - drag and drop', optionsForResponses);
277
- });
278
- },
279
-
280
- verifyScoreForPartialEqualWeightsWhenResponseTokenIsAdded: () => {
281
- it('When user adds a response token to the question, one more response area should be displayed in the response container of the set correct answer section and points per response score should be updated accordingly', () => {
282
- cy.log('Pre-step: Adding a response token to question field')
283
- questionInputFieldComponent.questionInputField()
284
- .click();
285
- questionInputFieldComponent.ckEditorAddResponseButton()
286
- .click();
287
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
288
- .should('have.length', '3');
289
- fillInTheGapsDragAndDropPage.partialEqualWeightsPointsPerResponseScore()
290
- .each(($element) => {
291
- cy.wrap($element)
292
- .verifyInnerText('1.33');
293
- });
294
- });
295
- },
296
-
297
- verifyReuseOptionScoring: () => {
298
- it('When the user has set same answer options in the \'Set correct answer\' section, then the user should be awarded full points on attempting the question with reused options', () => {
299
- fillInTheGapsDragAndDropPage.steps.previewTabClickAndDropDraggableOptionInResponseArea('Response 1', 0);
300
- fillInTheGapsDragAndDropPage.steps.previewTabClickAndDropDraggableOptionInResponseArea('Response 1', 1);
301
- fillInTheGapsDragAndDropPage.previewScoreText()
302
- .verifyInnerText('5/5');
303
- fillInTheGapsDragAndDropPage.steps.verifyPreviewTabPointsBackgroundForCorrectAnswer();
304
- });
305
- },
306
-
307
- verifyHideDragHandleFunctionalityInSetCorrectAnswerSection: () => {
308
- it('When the \'Hide drag handle\' functionality is disabled, then the draggable options displayed in response container of the \'Set correct answer\' section should have a drag handle', () => {
309
- fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
310
- .each($element => {
311
- cy.wrap($element)
312
- .within(() => {
313
- fillInTheGapsDragAndDropPage.draggableOptionDragIcon()
314
- .should('be.visible');
315
- });
316
- });
317
- });
318
-
319
- it('When the user enables the \'Hide drag handle\' functionality, then the draggable options displayed in response container of the \'Set correct answer\' section should not have a drag handle', () => {
320
- fillInTheGapsDragAndDropPage.steps.switchToEditTab();
321
- fillInTheGapsDragAndDropPage.hideDragHandleCheckbox()
322
- .click()
323
- .should('be.checked');
324
- fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
325
- .each($element => {
326
- cy.wrap($element)
327
- .within(() => {
328
- fillInTheGapsDragAndDropPage.draggableOptionDragIcon()
329
- .should('not.exist');
330
- });
331
- });
332
- });
333
- },
334
-
335
- verifyInactiveStateOfResponseAreasAndDraggableOptionsWithCSSAndA11yInSetCorrectAnswerSection: () => {
336
- it('When the user has not selected any draggable option, the draggable options and response areas should be in inactive state', () => {
337
- fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOptionsWrapper()
338
- .within(() => {
339
- fillInTheGapsDragAndDropPage.draggableOption()
340
- .each($element => {
341
- cy.wrap($element)
342
- .should('not.have.class', 'item-selected');
343
- });
344
- });
345
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
346
- .each($element => {
347
- cy.wrap($element)
348
- .should('have.class', 'isEmpty');
349
- });
350
- });
351
-
352
- //Failing due to https://redmine.zeuslearning.com/issues/547859
353
- it('CSS of inactive state of draggable options and response areas', { tags: 'css' }, () => {
354
- fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
355
- .should('have.css', 'border', `1px solid ${css.color.figDefaultComponentBorder}`)
356
- .and('have.css', 'background-color', `${css.color.defaultBackground}`)
357
- .find('.drag-indicator-icon')
358
- .should('have.css', 'fill', `${css.color.activeButtons}`);
359
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
360
- .should('have.css', 'border', `2px dashed ${css.color.figDefaultComponentBorder}`);
361
- });
362
-
363
- it('Accessibility of inactive state of draggable options and response areas', { tags: 'a11y' }, () => {
364
- cy.checkAccessibility(fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOptionsWrapper().parents('.cloze-width-drag-and-drop-set-correct-response'));
365
- });
366
- },
367
-
368
- verifyActiveStateOfResponseAreaAndDraggableOptionsWithCSSAndA11yInSetCorrectAnswerSection: () => {
369
- it('When the user selects a draggable option, it should get in selected state and all the response areas should get in active state', () => {
370
- fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
371
- .contains('Response 1')
372
- .click();
373
- cy.log('checking active state of selected draggable option')
374
- fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfDraggableOptionInSetCorrectAnswerSection(0);
375
- cy.log('checking default state of unselected draggable option(s)')
376
- fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOptionsWrapper()
377
- .within(() => {
378
- fillInTheGapsDragAndDropPage.draggableOption()
379
- .each(($element, index) => {
380
- if (index !== 0) {
381
- cy.wrap($element)
382
- .should('not.have.class', 'item-selected');
383
- };
384
- });
385
- });
386
- cy.log('checking active state of all response areas')
387
- fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfResponseAreaInSetCorrectAnswerSection(0);
388
- fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfResponseAreaInSetCorrectAnswerSection(1);
389
- });
390
-
391
- it('CSS of active state of draggable options and response areas', { tags: 'css' }, () => {
392
- fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
393
- .eq(0)
394
- .should('have.css', 'border', `1px solid ${css.color.activeComponentBorder}`)
395
- .and('have.css', 'background-color', `${css.color.figActiveComponentBg}`)
396
- .find('.drag-indicator-icon')
397
- .should('have.css', 'fill', `${css.color.activeButtons}`);
398
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
399
- .should('have.css', 'border', `1px solid ${css.color.activeComponentBorder}`);
400
- });
401
-
402
- it('Accessibility of active state of draggable options and response areas', { tags: 'a11y' }, () => {
403
- cy.checkAccessibility(fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOptionsWrapper().parents('.cloze-width-drag-and-drop-set-correct-response'));
404
- });
405
- },
406
-
407
- verifyInactiveStateOfResponseAreaWhenDraggableOptionIsDeselectedInSetCorrectAnswerSection: () => {
408
- it('When the user deselects the draggable option, it should get in deselected state and the response areas should return to the inactive state', () => {
409
- fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
410
- .contains('Response 1')
411
- .click();
412
- cy.log('Checking default state of deselected draggable option')
413
- fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfDraggableOptionInSetCorrectAnswerSection(0);
414
- cy.log('Checking default inactive state of response areas')
415
- fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfResponseAreaInSetCorrectAnswerSection(0);
416
- fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfResponseAreaInSetCorrectAnswerSection(1);
417
- });
418
- },
419
-
420
- verifyFilledResponseAreaWithCSSAndA11yInSetCorrectAnswerSection: () => {
421
- it('When the user has dropped a draggable option inside a response area, drag handle should not be displayed in the response area', () => {
422
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseAreaWrapper()
423
- .eq(0)
424
- .within(() => {
425
- fillInTheGapsDragAndDropPage.draggableOptionDragIcon()
426
- .should('not.exist');
427
- });
428
- });
429
-
430
- it('CSS of filled response area', { tags: 'css' }, () => {
431
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
432
- .eq(0)
433
- .should('have.css', 'border', `1px solid ${css.color.figDefaultComponentBorder}`)
434
- .should('have.css', 'background-color', css.color.transparent)
435
- .find('.question-text-wrapper')
436
- .verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
437
- });
438
-
439
- it('Accessibility of filled response area', { tags: 'a11y' }, () => {
440
- cy.checkAccessibility(fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOptionsWrapper().parents('.cloze-width-drag-and-drop-set-correct-response'));
441
- });
442
- },
443
-
444
- verifyStateOfPartiallyFilledResponseAreasWhenDraggableOptionsIsSelectedInSetCorrectAnswerSection: () => {
445
- it('When the response areas are partially filled and the user selects a draggable option, then only the empty response area should get in active state', () => {
446
- fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
447
- .contains('Response 2')
448
- .click();
449
- fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfFilledResponseAreaInSetCorrectAnswerSection(0);
450
- fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfResponseAreaInSetCorrectAnswerSection(1);
451
- cy.log('Post step: deselecting the draggable option')
452
- fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
453
- .contains('Response 2')
454
- .click();
455
- });
456
- },
457
-
458
- verifySelectedStateOfDraggableOptionInFilledResponseAreaWithCSSandA11yInSetCorrectAnswerSection: () => {
459
- it('When the user selects a draggable option from the filled response area, the response container should get active for dropping the option, the filled response area should not get in active state and only the empty response area should get active', () => {
460
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
461
- .eq(0)
462
- .click();
463
- fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOptionsWrapper()
464
- .should('have.class', 'isActiveForDropping');
465
- fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfFilledResponseAreaInSetCorrectAnswerSection(0);
466
- fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfResponseAreaInSetCorrectAnswerSection(1);
467
- });
468
-
469
- it('CSS of draggable option from the filled response area in selected state', { tags: 'css' }, () => {
470
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
471
- .eq(0)
472
- .should('have.css', 'border', `1px solid ${css.color.activeComponentBorder}`)
473
- .and('have.css', 'background-color', `${css.color.figActiveComponentBg}`);
474
- });
475
-
476
- it('Accessibility of draggable option from the filled response area in selected state', { tags: 'a11y' }, () => {
477
- cy.checkAccessibility(fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea().parents('.cloze-width-drag-and-drop-set-correct-response'));
478
- });
479
- },
480
-
481
- verifyDeselectedStateOfDraggableOptionInFilledResponseAreaWithCSSandA11yInSetCorrectAnswerSection: () => {
482
- it('When the user deselects a draggable option from the filled response area, the draggable option should return to the inactive state', () => {
483
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
484
- .eq(0)
485
- .click();
486
- fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfFilledResponseAreaInSetCorrectAnswerSection(0);
487
- fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfResponseAreaInSetCorrectAnswerSection(1);
488
- });
489
- },
490
-
491
- verifyErroredStateOfResponseAreaWithCSSAndA11yInSetCorrectAnswerSection: () => {
492
- it('CSS of error state of response area', { tags: 'css' }, () => {
493
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
494
- .eq(0)
495
- .should('have.css', 'border', `2px dashed ${css.color.errorFieldBorder}`)
496
- .and('have.css', 'background-color', `${css.color.textAreaErrorBg}`);
497
- });
498
-
499
- it('Accessibility of error state of response area', { tags: 'a11y' }, () => {
500
- cy.checkAccessibility(fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea().parents('.cloze-width-drag-and-drop-set-correct-response'));
501
- });
502
-
503
- it('When the user selects a draggable option when a response area is in errored state, the error state of the response area should persist and the user should be able to drop an option into the errored response area', () => {
504
- fillInTheGapsDragAndDropPage.setCorrectAnswerDraggableOption()
505
- .contains('Response 1')
506
- .click();
507
- fillInTheGapsDragAndDropPage.steps.verifyErroredStateOfResponseAreaInSetCorrectAnswerSection(0);
508
- fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfResponseAreaInSetCorrectAnswerSection(0);
509
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
510
- .eq(0)
511
- .click();
512
- fillInTheGapsDragAndDropPage.steps.verifyFilledResponseAreaInSetCorrectAnswerSection(0, 'Response 1');
513
- });
514
-
515
- it('When the user has filled the errored response area, the response area should get filled with the dropped option and the \'Error: Please set a correct answer\' error message should disappear', () => {
516
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
517
- .eq(0)
518
- .should('not.have.class', 'isEmpty error');
519
- fillInTheGapsDragAndDropPage.errorMessage()
520
- .should('not.exist');
521
- });
522
-
523
- it('The user should be able to move a draggable option from one response area to another response area and the empty response area should get errored and \'Error: Please set a correct answer\' error message should be displayed', () => {
524
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
525
- .eq(0)
526
- .click();
527
- fillInTheGapsDragAndDropPage.setCorrectAnswerResponseArea()
528
- .eq(1)
529
- .click();
530
- fillInTheGapsDragAndDropPage.steps.verifyFilledResponseAreaInSetCorrectAnswerSection(1, 'Response 1');
531
- fillInTheGapsDragAndDropPage.steps.verifyErroredStateOfResponseAreaInSetCorrectAnswerSection(0);
532
- fillInTheGapsDragAndDropPage.errorMessage()
533
- .verifyInnerText('Error: Please set a correct answer.')
534
- .and('be.visible');
535
- });
536
- },
537
-
538
- verifyInactiveStateOfResponseAreasAndDraggableOptionsWithCSSAndA11yInPreviewTab: () => {
539
- it('When the user has not selected any draggable option, the draggable options and response areas should be in inactive state', () => {
540
- fillInTheGapsDragAndDropPage.previewTabDraggableOptionsWrapper('fill in the gaps - drag and drop')
541
- .within(() => {
542
- fillInTheGapsDragAndDropPage.draggableOption()
543
- .each($element => {
544
- cy.wrap($element)
545
- .should('not.have.class', 'item-selected');
546
- });
547
- });
548
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
549
- .each($element => {
550
- cy.wrap($element)
551
- .should('have.class', 'isEmpty');
552
- });
553
- });
554
-
555
- it('CSS of inactive state of draggable options and response areas', { tags: 'css' }, () => {
556
- fillInTheGapsDragAndDropPage.previewTabDraggableOption()
557
- .should('have.css', 'border', `1px solid ${css.color.figDefaultComponentBorder}`)
558
- .and('have.css', 'background-color', `${css.color.defaultBackground}`)
559
- .find('.drag-indicator-icon')
560
- .should('have.css', 'fill', `${css.color.activeButtons}`);
561
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
562
- .should('have.css', 'border', `2px dashed ${css.color.figDefaultComponentBorder}`);
563
- });
564
-
565
- it('Accessibility of inactive state of draggable options and response areas', { tags: 'a11y' }, () => {
566
- cy.checkAccessibility(fillInTheGapsDragAndDropPage.previewDraggableOptionsWrapper().parents('.cloze-with-drag-and-drop-preview'));
567
- });
568
- },
569
-
570
- verifyActiveStateOfResponseAreaAndDraggableOptionsWithCSSAndA11yInPreviewTab: () => {
571
- it('When the user selects a draggable option, it should get in selected state and all the response areas should get in active state', () => {
572
- fillInTheGapsDragAndDropPage.previewTabDraggableOption()
573
- .contains('Response 1')
574
- .click();
575
- cy.log('checking active state of selected draggable option')
576
- fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfDraggableOptionInPreviewTab(0);
577
- cy.log('checking default state of unselected draggable option')
578
- fillInTheGapsDragAndDropPage.previewTabDraggableOptionsWrapper('fill in the gaps - drag and drop')
579
- .within(() => {
580
- fillInTheGapsDragAndDropPage.draggableOption()
581
- .each(($element, index) => {
582
- if (index !== 0) {
583
- cy.wrap($element)
584
- .should('not.have.class', 'item-selected');
585
- };
586
- });
587
- });
588
- cy.log('checking active state of all response areas')
589
- fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfResponseAreaInPreviewTab(0);
590
- fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfResponseAreaInPreviewTab(1);
591
- });
592
-
593
- it('CSS of active state of draggable options and response areas', { tags: 'css' }, () => {
594
- fillInTheGapsDragAndDropPage.previewTabDraggableOptionsWrapper('fill in the gaps - drag and drop')
595
- .within(() => {
596
- fillInTheGapsDragAndDropPage.draggableOption()
597
- .eq(0)
598
- .should('have.css', 'border', `1px solid ${css.color.activeComponentBorder}`)
599
- .and('have.css', 'background-color', `${css.color.figActiveComponentBg}`)
600
- .find('.drag-indicator-icon')
601
- .should('have.css', 'fill', `${css.color.activeButtons}`);
602
- });
603
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
604
- .should('have.css', 'border', `1px solid ${css.color.activeComponentBorder}`);
605
- });
606
-
607
- it('Accessibility of active state of draggable options and response areas', { tags: 'a11y' }, () => {
608
- cy.checkAccessibility(fillInTheGapsDragAndDropPage.previewDraggableOptionsWrapper().parents('.cloze-with-drag-and-drop-preview'));
609
- });
610
- },
611
-
612
- verifyStateOfResponseAreaWhenDraggableOptionIsDeselectedInPreviewTab: () => {
613
- it('When the user deselects the draggable option, it should get in deselected state and the response areas should return to the inactive state', () => {
614
- fillInTheGapsDragAndDropPage.previewTabDraggableOption()
615
- .contains('Response 1')
616
- .click();
617
- cy.log('Checking default state of deselected draggable option')
618
- fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfDraggableOptionInPreviewTab(0);
619
- cy.log('Checking default inactive state of response areas')
620
- fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfResponseAreaInPreviewTab(0);
621
- fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfResponseAreaInPreviewTab(1);
622
- });
623
- },
624
-
625
- verifyFilledResponseAreaWithCSSAndA11yInPreviewTab: () => {
626
- it('When the user has dropped a draggable option inside a response area, drag handle should not be displayed in the response area', () => {
627
- fillInTheGapsDragAndDropPage.previewTabResponseAreaWrapper()
628
- .eq(0)
629
- .within(() => {
630
- fillInTheGapsDragAndDropPage.draggableOptionDragIcon()
631
- .should('not.exist');
632
- });
633
- });
634
-
635
- it('CSS of filled response area', { tags: 'css' }, () => {
636
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
637
- .eq(0)
638
- .should('have.css', 'border', `1px solid ${css.color.figDefaultComponentBorder}`)
639
- .find('.question-text-wrapper')
640
- .verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
641
- });
642
-
643
- it('Accessibility of filled response area', { tags: 'a11y' }, () => {
644
- cy.checkAccessibility(fillInTheGapsDragAndDropPage.previewDraggableOptionsWrapper().parents('.cloze-with-drag-and-drop-preview'));
645
- });
163
+ .find('img')
164
+ .should('have.attr', 'src', constants.foxImageLink)
165
+ .and('have.attr', 'alt', constants.foxImageAltText);
646
166
  },
647
167
 
648
- verifyStateOfPartiallyFilledResponseAreasInPreviewTab: () => {
649
- it('When the response areas are partially filled and the user selects a draggable option, then only the empty response area should get in active state', () => {
650
- fillInTheGapsDragAndDropPage.previewTabDraggableOption()
651
- .contains('Response 2')
652
- .click();
653
- fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfFilledResponseAreaInPreviewTab(0);
654
- fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfResponseAreaInPreviewTab(1);
655
- cy.log('Post step: deselecting the draggable option')
656
- fillInTheGapsDragAndDropPage.previewTabDraggableOption()
657
- .contains('Response 2')
658
- .click();
659
- });
168
+ /**
169
+ * @description Verifies that the equation text in the Preview tab is correct.
170
+ * @param {number} optionIndex - The index of the option in the Preview tab.
171
+ */
172
+ verifyDropzoneWithEquationTextInPreviewTab: (optionIndex) => {
173
+ fillInTheGapsDragAndDropPage.dropzonePreviewTab()
174
+ .eq(optionIndex)
175
+ .find('[role="math"]')
176
+ .should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
177
+ .contains(constants.CKEditorInputFieldEnteredEquationText);
660
178
  },
661
179
 
662
- verifyStateOfDraggableOptionInFilledResponseAreaWithCSSandA11yInPreviewTab: () => {
663
- it('When the user selects a draggable option from the filled response area, the response container should get active for dropping the option, the filled response area should not get in active state and only the empty response area should get active', () => {
664
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
665
- .eq(0)
666
- .click();
667
- fillInTheGapsDragAndDropPage.previewTabDraggableOptionsWrapper('fill in the gaps - drag and drop')
668
- .should('have.class', 'isActiveForDropping');
669
- fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfFilledResponseAreaInPreviewTab(0);
670
- fillInTheGapsDragAndDropPage.steps.verifyActiveStateOfResponseAreaInPreviewTab(1);
671
- });
672
-
673
- it('CSS of draggable option from the filled response area in selected state', { tags: 'css' }, () => {
674
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
675
- .eq(0)
676
- .should('have.css', 'border', `1px solid ${css.color.activeComponentBorder}`)
677
- .and('have.css', 'background-color', `${css.color.figActiveComponentBg}`);
678
- });
679
-
680
- it('Accessibility of draggable option from the filled response area in selected state', { tags: 'a11y' }, () => {
681
- cy.checkAccessibility(fillInTheGapsDragAndDropPage.previewDraggableOptionsWrapper().parents('.cloze-with-drag-and-drop-preview'));
682
- });
683
-
684
- it('When the user deselects a draggable option from the filled response area, the draggable option should return to the inactive state', () => {
685
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
686
- .eq(0)
687
- .click();
688
- fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfFilledResponseAreaInPreviewTab(0);
689
- fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfResponseAreaInPreviewTab(1);
690
- });
180
+ /**
181
+ * @description Verifies that the preview dropzone option at a specified index is disabled.
182
+ * @param {number} dropzoneIndex - The index of the preview dropzone option to verify (zero-based).
183
+ */
184
+ verifyPreviewDropzoneOptionDisabled: (dropzoneIndex) => {
185
+ utilities.verifyElementDisabled(fillInTheGapsDragAndDropPage.dropzonePreviewTab().eq(dropzoneIndex));
691
186
  },
692
187
 
693
- verifyMovingDraggableOptionFromOneResponseAreaToAnotherInPreviewTab: () => {
694
- it('The user should be able to move a draggable option from one response area to another response area', () => {
695
- cy.log('Pre step: Setting up an option in the response area')
696
- fillInTheGapsDragAndDropPage.steps.previewTabClickAndDropDraggableOptionInResponseArea('Response 1', 0);
697
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
698
- .eq(0)
699
- .click();
700
- fillInTheGapsDragAndDropPage.previewTabResponseArea()
701
- .eq(1)
702
- .click();
703
- fillInTheGapsDragAndDropPage.steps.verifyInactiveStateOfResponseAreaInPreviewTab(0);
704
- fillInTheGapsDragAndDropPage.steps.verifyFilledResponseAreaInPreviewTab(1, 'Response 1');
705
- });
188
+ /**
189
+ * @description Verifies the text content of a specific preview tab dropzone element.
190
+ * @param {number} count - The index of the preview tab dropzone element to verify (zero-based).
191
+ * @param {string} text - The expected text content to match against the inner text of the specified dropzone element.
192
+ */
193
+ verifyDropzoneContainsTextPreviewTab: (count, text) => {
194
+ fillInTheGapsDragAndDropPage.dropzonePreviewTab()
195
+ .eq(count)
196
+ .contains(text);
706
197
  },
707
-
708
- verifyHideDragHandleFunctionalityInPreviewTab: () => {
709
- it('When the \'Hide drag handle\' functionality is disabled, then the draggable options displayed in response container of the preview tab should have a drag handle', () => {
710
- fillInTheGapsDragAndDropPage.previewTabDraggableOption()
711
- .each($element => {
712
- cy.wrap($element)
713
- .within(() => {
714
- fillInTheGapsDragAndDropPage.draggableOptionDragIcon()
715
- .should('be.visible');
716
- });
717
- });
718
- });
719
-
720
- it('When the \'Hide drag handle\' functionality is enabled, then the draggable options displayed in response container of the preview tab should not have a drag handle', () => {
721
- fillInTheGapsDragAndDropPage.steps.switchToEditTab();
722
- fillInTheGapsDragAndDropPage.hideDragHandleCheckbox()
723
- .click()
724
- .should('be.checked');
725
- fillInTheGapsDragAndDropPage.steps.switchToPreviewTab();
726
- fillInTheGapsDragAndDropPage.previewTabDraggableOption()
727
- .each($element => {
728
- cy.wrap($element)
729
- .within(() => {
730
- fillInTheGapsDragAndDropPage.draggableOptionDragIcon()
731
- .should('not.exist');
732
- });
733
- });
734
- });
735
- }
736
198
  }
737
199
 
738
200
  export const fillInTheGapsDragAndDropPage = {
739
201
  ...selectors,
740
- steps,
741
- tests
202
+ steps
742
203
  }