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
@@ -0,0 +1,328 @@
1
+ import { fillInTheGapsDropdownPage } from "../../../pages";
2
+ import { commonComponents, optionsWrapperComponent } from "../../../pages/components";
3
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
4
+ import utilities from "../../../support/helpers/utilities";
5
+ const css = Cypress.env('css');
6
+
7
+ const optionsForDropdown = ['Flower', 'Petal', 'Stem', 'Branch'];
8
+
9
+ describe('Create item page - Fill in the gaps with dropdown: Dropdown options section', () => {
10
+ before(() => {
11
+ cy.loginAs('admin');
12
+ });
13
+
14
+ describe('Dropdown options section contents', () => {
15
+ abortEarlySetup();
16
+ before(() => {
17
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
18
+ cy.barsPreLoaderWait();
19
+ });
20
+
21
+ it('By default, \'Dropdown options\' section with two tabs, "Dropdown 1" and "Dropdown 2" should be displayed. "Dropdown 1" tab in selected state', () => {
22
+ utilities.verifyInnerText(fillInTheGapsDropdownPage.dropdownOptionsLabel(), 'Dropdown options');
23
+ utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsDropdownPage.dropdownOptionsTab(), 0), 'Dropdown 1');
24
+ fillInTheGapsDropdownPage.steps.verifyDropdownOptionsTabIsSelected(0);
25
+ });
26
+
27
+ it('By default 4 option input fields with placeholder text, drag handle and delete option icon buttons should be displayed', () => {
28
+ for (let index = 0; index < 4; index++) {
29
+ fillInTheGapsDropdownPage.steps.verifyOptionsInputFieldContents(index);
30
+ };
31
+ });
32
+
33
+ it('\'Add Option\' button should be present', () => {
34
+ utilities.verifyInnerText(fillInTheGapsDropdownPage.addOptionButton(), 'Add option');
35
+ utilities.verifyElementVisibilityState(fillInTheGapsDropdownPage.addOptionButton(), 'visible');
36
+ });
37
+
38
+ fillInTheGapsDropdownPage.tests.verifyDragHandleTooltip();
39
+
40
+ it('When user clicks on the \'Delete\' option button then the respective options input field should get deleted and option numeration should change accordingly', () => {
41
+ cy.log('Pre step: Adding text in all option input fields')
42
+ fillInTheGapsDropdownPage.steps.addInputToDropdownOptionFields(0, optionsForDropdown);
43
+ const optionsAfterDeleting = optionsForDropdown.filter((el) => el !== optionsForDropdown[1]);
44
+ fillInTheGapsDropdownPage.steps.deleteOption(1);
45
+ utilities.verifyElementCount(optionsWrapperComponent.optionWrapper(), 3);
46
+ cy.log('Verifying the input text given to input fields after deletion of 2nd option')
47
+ optionsAfterDeleting.forEach((inputFieldText, optionIndex) => {
48
+ utilities.verifyInputFieldValue(utilities.getNthElement(fillInTheGapsDropdownPage.dropdownOptionsInputField(), optionIndex), inputFieldText);
49
+ });
50
+ });
51
+
52
+ it('When only two options are present, the delete buttons should be in disabled state', () => {
53
+ cy.log('Deleting one more option')
54
+ fillInTheGapsDropdownPage.steps.deleteOption(2);
55
+ fillInTheGapsDropdownPage.steps.verifyDeleteOptionButtonDisabledState();
56
+ });
57
+
58
+ fillInTheGapsDropdownPage.tests.verifyDisabledDeleteButtonTooltip();
59
+
60
+ fillInTheGapsDropdownPage.tests.verifyAddOptionFunctionalityForDropdownOptions();
61
+
62
+ it('When user focus in and out of any of the \'Options\' input field without typing anything, an error message should be thrown', () => {
63
+ fillInTheGapsDropdownPage.steps.focusInAndFocusOutOfDropdownOptionInputField(0);
64
+ utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: Option is required.');
65
+ });
66
+
67
+ it('User should be able to enter text in options input field and \'Error: Option is required.\' error message should disappear', () => {
68
+ fillInTheGapsDropdownPage.steps.addInputToDropdownOptionInputField(2, 'option 1');
69
+ commonComponents.steps.verifyErrorMessageIsNotDisplayed();
70
+ });
71
+
72
+ fillInTheGapsDropdownPage.tests.verifyEnabledDeleteButtonAndTooltip();
73
+
74
+ it('When user add another response area, another dropdown options tab \'Dropdown 3\' should be added and it should not be in selected state', () => {
75
+ utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsDropdownPage.dropdownOptionsTab(), 0), 'Dropdown 1');
76
+ fillInTheGapsDropdownPage.steps.verifyDropdownOptionsTabIsSelected(0);
77
+ fillInTheGapsDropdownPage.steps.verifyDropdownOptionsTabIsNotSelected(1);
78
+ fillInTheGapsDropdownPage.steps.verifyDropdownOptionsTabIsNotSelected(2);
79
+ });
80
+
81
+ it('When user clicks on \'Dropdown 2\' tab, then user should be navigated to \'Dropdown 2\' options tab and it should have the default 4 empty option input fields', () => {
82
+ fillInTheGapsDropdownPage.steps.navigateToDropdownOptionsTab(1);
83
+ fillInTheGapsDropdownPage.steps.verifyDropdownOptionsTabIsSelected(1);
84
+ fillInTheGapsDropdownPage.steps.verifyDropdownOptionsTabIsNotSelected(0);
85
+ for (let index = 0; index < optionFieldsCount; index++) {
86
+ fillInTheGapsDropdownPage.steps.verifyOptionsInputFieldContents(index);
87
+ };
88
+ });
89
+
90
+ it('User should be able to give input to the option input fields in \'Dropdown 2\' tab', () => {
91
+ fillInTheGapsDropdownPage.steps.addInputToDropdownOptionInputField(0, 'Dropdown 2 option 1');
92
+ });
93
+
94
+ it('When all option input fields in \'Dropdown 2\' are not filled, then user should be able to navigate to a different \'Dropdown options\' tab', () => {
95
+ fillInTheGapsDropdownPage.steps.navigateToDropdownOptionsTab(0);
96
+ fillInTheGapsDropdownPage.steps.verifyDropdownOptionsTabIsSelected(0);
97
+ fillInTheGapsDropdownPage.steps.verifyDropdownOptionsTabIsNotSelected(1);
98
+ });
99
+
100
+ it('CSS of Options section', { tags: 'css' }, () => {
101
+ utilities.verifyCSS(fillInTheGapsDropdownPage.dropdownOptionsLabel(), {
102
+ 'color': css.color.sectionHeading,
103
+ 'font-size': css.fontSize.default,
104
+ 'font-weight': css.fontWeight.semibold
105
+ });
106
+ utilities.verifyCSS(utilities.getNthElement(fillInTheGapsDropdownPage.dropdownOptionsTab(), 0), {
107
+ 'color': css.color.activeButtons,
108
+ 'font-size': css.fontSize.default,
109
+ 'font-weight': css.fontWeight.bold
110
+ });
111
+ utilities.verifyCSS(utilities.getNthElement(fillInTheGapsDropdownPage.dropdownOptionsTab(), 0), {
112
+ 'color': css.color.sectionHeading,
113
+ 'font-size': css.fontSize.default,
114
+ 'font-weight': css.fontWeight.bold
115
+ });
116
+ utilities.verifyCSS(commonComponents.dragHandleButton().find('svg'), {
117
+ 'fill': css.color.secondaryBtnActive
118
+ });
119
+ commonComponents.deleteButton()
120
+ .verifyPseudoClassBeforeProperty('color', css.color.deleteIcon);
121
+ utilities.verifyCSS(fillInTheGapsDropdownPage.dropdownOptionsInputField(), {
122
+ 'color': css.color.text,
123
+ 'font-size': css.fontSize.default,
124
+ 'font-weight': css.fontWeight.regular
125
+ });
126
+ utilities.verifyCSS(fillInTheGapsDropdownPage.addOptionButton(), {
127
+ 'color': css.color.secondaryBtnActive,
128
+ 'font-size': css.fontSize.default,
129
+ 'font-weight': css.fontWeight.medium
130
+ });
131
+ });
132
+
133
+ it('Accessibility of dropdown options section', { tags: 'a11y' }, () => {
134
+ cy.checkAccessibility(fillInTheGapsDropdownPage.dropdownOptionsLabel().parents('[class*="LabelImageWithDropDownstyles__ResponseOptionWrapper"]'));
135
+ });
136
+ });
137
+
138
+ describe('Dropdown options in Specify correct answer section', () => {
139
+ abortEarlySetup();
140
+ before(() => {
141
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
142
+ cy.barsPreLoaderWait();
143
+ });
144
+
145
+ it('When user has not entered text in the options input field then the dropdown should be disabled and the user should not be able to expand the dropdown in the \'Specify correct answer\'', () => {
146
+ fillInTheGapsDropdownPage.steps.verifyDisabledDropdownInSpecifyCorrectAnswerSection(0);
147
+ });
148
+
149
+ it('When the user has not added any options, on hovering over the dropdown, a tooltip \'Please add options\' should be displayed and on focusing away from the dropdown, the tooltip should disappear', () => {
150
+ utilities.getNthElement(fillInTheGapsDropdownPage.dropdownSpecifyCorrectAnswerSection(), 0)
151
+ .verifyTooltip('Please add options');
152
+ });
153
+
154
+ it('CSS of specify correct answer section disabled dropdown', { tags: 'css' }, () => {
155
+ utilities.verifyCSS(fillInTheGapsDropdownPage.dropdownSpecifyCorrectAnswerSection(), {
156
+ 'opacity': '1',
157
+ 'background': css.color.defaultBackground
158
+ });
159
+ });
160
+
161
+ it('Accessibility of specify correct answer section disabled dropdown', { tags: 'a11y' }, () => {
162
+ cy.checkAccessibility(fillInTheGapsDropdownPage.dropdownSpecifyCorrectAnswerSection());
163
+ });
164
+
165
+ it('When user enters a text in at least 1 option input field then the dropdown should be enabled', () => {
166
+ fillInTheGapsDropdownPage.steps.addInputToDropdownOptionInputField(0, optionsForDropdown[0]);
167
+ utilities.verifyElementNotDisabled(utilities.getNthElement(fillInTheGapsDropdownPage.dropdownSpecifyCorrectAnswerSection(), 0));
168
+ });
169
+
170
+ it('Added text in option input field should be displayed in dropdown of \'Specify correct answer\' section', () => {
171
+ cy.log('Add input to all options input field for dropdown 1');
172
+ fillInTheGapsDropdownPage.steps.addInputToDropdownOptionFields(0, optionsForDropdown);
173
+ fillInTheGapsDropdownPage.steps.expandDropdownInSpecifyCorrectAnswerSection(0);
174
+ fillInTheGapsDropdownPage.steps.verifyDropdownOptionsSpecifyCorrectAnswer(optionsForDropdown);
175
+ });
176
+
177
+ it('When user deletes an option then the deleted option should not be displayed in dropdown in \'Specify correct answer\' section', () => {
178
+ fillInTheGapsDropdownPage.steps.deleteOption(3);
179
+ cy.log('Checking the deleted option should not exist in the dropdown')
180
+ fillInTheGapsDropdownPage.steps.expandDropdownInSpecifyCorrectAnswerSection(0);
181
+ let optionsForDropdown1 = optionsForDropdown.slice(0, 3);
182
+ fillInTheGapsDropdownPage.steps.verifyDropdownOptionsSpecifyCorrectAnswer(optionsForDropdown1);
183
+ });
184
+
185
+ it('When user adds an option using \'Add Option\' button then the added option should be displayed in dropdown in \'Specify correct answer\' section', () => {
186
+ fillInTheGapsDropdownPage.steps.addOption();
187
+ fillInTheGapsDropdownPage.steps.addInputToDropdownOptionInputField(3, `${optionsForDropdown[3]}`);
188
+ fillInTheGapsDropdownPage.steps.expandDropdownInSpecifyCorrectAnswerSection(0);
189
+ fillInTheGapsDropdownPage.steps.verifyDropdownOptionsSpecifyCorrectAnswer(optionsForDropdown);
190
+ });
191
+
192
+ it('When the user has added two same options in the options section, only one occurrence of that option should be listed in the dropdown', () => {
193
+ fillInTheGapsDropdownPage.steps.addInputToDropdownOptionInputField(0, `${optionsForDropdown[1]}`);
194
+ let optionsForDropdown1 = optionsForDropdown.slice(1, 4);
195
+ fillInTheGapsDropdownPage.steps.expandDropdownInSpecifyCorrectAnswerSection(0);
196
+ fillInTheGapsDropdownPage.steps.verifyDropdownOptionsSpecifyCorrectAnswer(optionsForDropdown1);
197
+ });
198
+
199
+ it('When user has adds another response area, then the newly added dropdown should be in disabled state in specify correct answer section', () => {
200
+ fillInTheGapsDropdownPage.steps.addResponseArea();
201
+ fillInTheGapsDropdownPage.steps.verifyDisabledDropdownInSpecifyCorrectAnswerSection(1);
202
+ });
203
+
204
+ it('CSS of specify correct answer section dropdown in active state', { tags: 'css' }, () => {
205
+ cy.log('Expand dropdown');
206
+ fillInTheGapsDropdownPage.steps.selectResponseFromDropdownSpecifyCorrectAnswerSection(0, `${optionsForDropdown[3]}`);
207
+ fillInTheGapsDropdownPage.steps.expandDropdownInSpecifyCorrectAnswerSection(0);
208
+ //Selected option
209
+ utilities.verifyCSS(fillInTheGapsDropdownPage.dropdownListOptions(optionsForDropdown[3]), {
210
+ 'color': css.color.liText,
211
+ 'font-size': css.fontSize.default,
212
+ 'font-weight': css.fontWeight.regular,
213
+ 'background-color': css.color.liTextSelectedBg
214
+ });
215
+ //Unselected option
216
+ utilities.verifyCSS(fillInTheGapsDropdownPage.dropdownListOptions(optionsForDropdown[2]), {
217
+ 'color': css.color.liText,
218
+ 'font-size': css.fontSize.default,
219
+ 'font-weight': css.fontWeight.regular,
220
+ 'background-color': css.color.transparent
221
+ });
222
+ utilities.verifyCSS(fillInTheGapsDropdownPage.dropdownSpecifyCorrectAnswerSection(), {
223
+ 'border': `1px solid ${css.color.activeComponentBorder}`,
224
+ });
225
+ });
226
+
227
+ it('Accessibility of specify correct answer section dropdown in active state', { tags: 'a11y' }, () => {
228
+ cy.checkAccessibility(fillInTheGapsDropdownPage.dropdownList());
229
+ });
230
+ });
231
+
232
+ describe('Dropdown options in preview tab', () => {
233
+ abortEarlySetup();
234
+ before(() => {
235
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
236
+ cy.barsPreLoaderWait();
237
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
238
+ });
239
+
240
+ it('When user has not entered text in the options input field then the dropdown should be disabled and the user should not be able to expand the dropdown in the \'preview tab\'', () => {
241
+ fillInTheGapsDropdownPage.steps.verifyDisabledDropdownInPreviewTab(0);
242
+ });
243
+
244
+ it('When user enters a text in at least 1 option input field then the preview tab dropdown should be enabled', () => {
245
+ fillInTheGapsDropdownPage.steps.switchToEditTab();
246
+ fillInTheGapsDropdownPage.steps.addInputToDropdownOptionInputField(0, optionsForDropdown[0]);
247
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
248
+ utilities.verifyElementNotDisabled(utilities.getNthElement(fillInTheGapsDropdownPage.dropdownPreviewTab(), 0));
249
+ });
250
+
251
+ it('The added text in dropdown options input fields should be displayed in dropdown of \'preview tab\'', () => {
252
+ fillInTheGapsDropdownPage.steps.switchToEditTab();
253
+ fillInTheGapsDropdownPage.steps.addInputToDropdownOptionFields(0, optionsForDropdown);
254
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
255
+ fillInTheGapsDropdownPage.steps.expandDropdownInPreviewTab(0)
256
+ fillInTheGapsDropdownPage.steps.verifyDropdownOptionsPreviewTab(optionsForDropdown);
257
+ cy.log('Selecting an option to close the dropdown')
258
+ fillInTheGapsDropdownPage.steps.selectOptionFromDropdownList(`${optionsForDropdown[3]}`);
259
+ });
260
+
261
+ it('When user deletes an option then the deleted option should not be displayed in dropdown in \'preview tab\'', () => {
262
+ fillInTheGapsDropdownPage.steps.switchToEditTab();
263
+ fillInTheGapsDropdownPage.steps.deleteOption(3);
264
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
265
+ cy.log('Checking the deleted option should not exist in the dropdown')
266
+ fillInTheGapsDropdownPage.steps.expandDropdownInPreviewTab(0);
267
+ let optionsForDropdown1 = optionsForDropdown.slice(0, 3);
268
+ fillInTheGapsDropdownPage.steps.verifyDropdownOptionsPreviewTab(optionsForDropdown1);
269
+ cy.log('Selecting an option to close the dropdown')
270
+ fillInTheGapsDropdownPage.steps.selectOptionFromDropdownList(`${optionsForDropdown[1]}`);
271
+ });
272
+
273
+ it('When user adds an option using \'Add Option\' button then the added option should be displayed in dropdown in \'preview tab\'', () => {
274
+ fillInTheGapsDropdownPage.steps.switchToEditTab();
275
+ fillInTheGapsDropdownPage.steps.addOption();
276
+ fillInTheGapsDropdownPage.steps.addInputToDropdownOptionInputField(3, `${optionsForDropdown[3]}`);
277
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
278
+ fillInTheGapsDropdownPage.steps.expandDropdownInPreviewTab(0);
279
+ fillInTheGapsDropdownPage.steps.verifyDropdownOptionsPreviewTab(optionsForDropdown);
280
+ cy.log('Selecting an option to close the dropdown')
281
+ fillInTheGapsDropdownPage.steps.selectOptionFromDropdownList(`${optionsForDropdown[1]}`);
282
+ });
283
+
284
+ it('When the user has added two same options in the options, only one occurrence of that option should be listed in the dropdown', () => {
285
+ fillInTheGapsDropdownPage.steps.switchToEditTab();
286
+ fillInTheGapsDropdownPage.steps.addInputToDropdownOptionInputField(0, `${optionsForDropdown[1]}`);
287
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
288
+ fillInTheGapsDropdownPage.steps.expandDropdownInPreviewTab(0);
289
+ let optionsForDropdown1 = optionsForDropdown.slice(1, 4);
290
+ fillInTheGapsDropdownPage.steps.verifyDropdownOptionsPreviewTab(optionsForDropdown1);
291
+ cy.log('Selecting an option to close the dropdown')
292
+ fillInTheGapsDropdownPage.steps.selectOptionFromDropdownList(`${optionsForDropdown[1]}`);
293
+ });
294
+
295
+ it('When user has adds another response area, then the newly added dropdown should be in disabled state in preview tab', () => {
296
+ fillInTheGapsDropdownPage.steps.switchToEditTab();
297
+ fillInTheGapsDropdownPage.steps.addResponseArea();
298
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
299
+ fillInTheGapsDropdownPage.steps.verifyDisabledDropdownInPreviewTab(2);
300
+ });
301
+
302
+ it('CSS of preview tab dropdown', { tags: 'css' }, () => {
303
+ cy.log('Expand dropdown');
304
+ fillInTheGapsDropdownPage.steps.expandDropdownInPreviewTab(0);
305
+ //Selected option
306
+ utilities.verifyCSS(fillInTheGapsDropdownPage.dropdownListOptions(optionsForDropdown[3]), {
307
+ 'color': css.color.liText,
308
+ 'font-size': css.fontSize.default,
309
+ 'font-weight': css.fontWeight.regular,
310
+ 'background-color': css.color.liTextSelectedBg
311
+ });
312
+ //Unselected option
313
+ utilities.verifyCSS(fillInTheGapsDropdownPage.dropdownListOptions(optionsForDropdown[2]), {
314
+ 'color': css.color.liText,
315
+ 'font-size': css.fontSize.default,
316
+ 'font-weight': css.fontWeight.regular,
317
+ 'background-color': css.color.transparent
318
+ });
319
+ utilities.verifyCSS(fillInTheGapsDropdownPage.dropdownSpecifyCorrectAnswerSection(), {
320
+ 'border': `1px solid ${css.color.activeComponentBorder}`,
321
+ });
322
+ });
323
+
324
+ it('Accessibility of preview tab dropdown in active state', { tags: 'a11y' }, () => {
325
+ cy.checkAccessibility(commonComponents.dropdownList());
326
+ });
327
+ });
328
+ });
@@ -0,0 +1,144 @@
1
+ import { dialogBoxBase, fillInTheGapsDropdownPage } from "../../../pages";
2
+ import utilities from "../../../support/helpers/utilities";
3
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
4
+ const css = Cypress.env('css');
5
+
6
+ const dropdownPointerStyles = ['none', 'bottom', 'bottom right', 'right', 'top right', 'top', 'top left', 'left', 'bottom left'];
7
+
8
+ describe('Create item page - Fill in the gaps: Question instructions, Options section', () => {
9
+ before(() => {
10
+ cy.loginAs('admin');
11
+ });
12
+
13
+ describe('Question instructions input field - Edit tab', () => {
14
+ abortEarlySetup();
15
+ before(() => {
16
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
17
+ cy.barsPreLoaderWait();
18
+ });
19
+
20
+ fillInTheGapsDropdownPage.tests.verifyQuestionInstructionsInputFieldEditTab();
21
+ });
22
+
23
+ describe('Question instructions input field - Preview tab', () => {
24
+ abortEarlySetup();
25
+ before(() => {
26
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
27
+ cy.barsPreLoaderWait();
28
+ });
29
+
30
+ fillInTheGapsDropdownPage.tests.verifyQuestionInstructionsInputFieldPreviewTab();
31
+ });
32
+
33
+
34
+ describe('Question input field - Edit tab', () => {
35
+ abortEarlySetup();
36
+ before(() => {
37
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
38
+ cy.barsPreLoaderWait();
39
+ });
40
+
41
+ it('\'Question\' label and input field should be displayed and by default in the question input field, sample \'Lorem Ipsum\' text along with two dropdowns should be present', () => {
42
+ utilities.verifyInnerText(fillInTheGapsDropdownPage.questionLabel(), 'Question');
43
+ utilities.verifyInnerText(fillInTheGapsDropdownPage.questionInputField(), 'Lorem ipsum dolor sit amet, \n1\nclose\nonsectetur adipiscing elit. Ut pellentesque tinciduntornare. Integer porttitor est quis urna porttitor, eget tempus tellus dapibus \n2\nclose');
44
+ utilities.verifyElementCount(fillInTheGapsDropdownPage.responseArea(), 2);
45
+ });
46
+
47
+ it('The dropdown should be displayed with a settings button, numeric count and a close button in the question input field', () => {
48
+ for (let index = 0; index < 2; index++) {
49
+ fillInTheGapsDropdownPage.steps.verifyResponseAreaContents(index)
50
+ };
51
+ });
52
+
53
+ it('CSS of Question input field contents', { tags: 'css' }, () => {
54
+ utilities.verifyCSS(fillInTheGapsDropdownPage.questionInputField(), {
55
+ 'color': css.color.text,
56
+ 'font-size': css.fontSize.default,
57
+ 'font-weight': css.fontWeight.regular
58
+ });
59
+ utilities.verifyCSS(fillInTheGapsDropdownPage.responseArea().find('.add_response_element'), {
60
+ 'background-color': css.color.figActiveComponentBg,
61
+ 'border': `1px solid ${css.color.activeButtons}`
62
+ });
63
+ utilities.verifyCSS(fillInTheGapsDropdownPage.responseAreaNumeration(), {
64
+ 'color': css.color.liText,
65
+ 'font-size': '32px',
66
+ 'font-weight': css.fontWeight.regular
67
+ });
68
+ fillInTheGapsDropdownPage.responseAreaCloseButton()
69
+ .verifyPseudoClassBeforeProperty('color', css.color.activeButtons)
70
+ });
71
+
72
+ it('When the user has not focused inside the question input field, the \'add dropdown\' button should be in disabled state', () => {
73
+ fillInTheGapsDropdownPage.steps.verifyResponseAreaButtonDisabled();
74
+ });
75
+
76
+ it('When the user focuses in the question input field, the \'+add dropdown\' button should get enabled, and when the user clicks on the \'+add dropdown\' button, a dropdown in the question input field, a new dropdown tab with \'Dropdown #\' label in the \'Dropdown options\' section, a new dropdown in the \'Specify correct answer\' section and a new \'ARIA label for dropdowns\' input field in the additional settings should get added', () => {
77
+ fillInTheGapsDropdownPage.steps.focusInQuestionInputField();
78
+ fillInTheGapsDropdownPage.steps.verifyResponseAreaButtonEnabled();
79
+ fillInTheGapsDropdownPage.steps.clickOnAddResponseAreaButton();
80
+ utilities.verifyElementCount(fillInTheGapsDropdownPage.responseArea(), 3);
81
+ fillInTheGapsDropdownPage.steps.verifyResponseAreaContents(2);
82
+ utilities.verifyElementCount(fillInTheGapsDropdownPage.dropdownOptionsTab(), 3);
83
+ utilities.verifyElementCount(fillInTheGapsDropdownPage.dropdownSpecifyCorrectAnswerSection(), 3);
84
+ fillInTheGapsDropdownPage.steps.expandAdditonalSettings();
85
+ utilities.verifyElementCount(fillInTheGapsDropdownPage.enterAriaLabelInputField(), 3);
86
+ });
87
+
88
+ it('When the user clicks on the \'close\' button present on a dropdown, the dropdown in the question input field should get removed and the count of the dropdowns present in the question input field should get updated accordingly, the dropdown tab count, dropdown count in the \'specify correct answer\' section and \'ARIA label for dropdowns\' input field in the additional settings should also get removed', () => {
89
+ cy.log('Switching to edit tab')
90
+ fillInTheGapsDropdownPage.steps.switchToEditTab();
91
+ fillInTheGapsDropdownPage.steps.deleteAResponseArea(1);
92
+ cy.log('Checking if 3rd dropdown gets removed from the question input field and the numeric counts get updated')
93
+ utilities.verifyElementCount(fillInTheGapsDropdownPage.responseArea(), 2);
94
+ for (let index = 0; index < 2; index++) {
95
+ fillInTheGapsDropdownPage.steps.verifyResponseAreaContents(index)
96
+ };
97
+ utilities.verifyElementCount(fillInTheGapsDropdownPage.dropdownOptionsTab(), 2);
98
+ utilities.verifyElementCount(fillInTheGapsDropdownPage.dropdownSpecifyCorrectAnswerSection(), 2);
99
+ utilities.verifyElementCount(fillInTheGapsDropdownPage.enterAriaLabelInputField(), 2);
100
+ });
101
+
102
+ it('When the user removes all dropdowns from the question input field, an error message \'Error: Minimum one response token is required.\' should be displayed', () => {
103
+ cy.log('Switching to edit tab')
104
+ fillInTheGapsDropdownPage.steps.switchToEditTab();
105
+ fillInTheGapsDropdownPage.steps.deleteAResponseArea(0);
106
+ fillInTheGapsDropdownPage.steps.deleteAResponseArea(0);
107
+ utilities.verifyInnerText(fillInTheGapsDropdownPage.errorMessage(), 'Error: Minimum one response token is required.')
108
+ });
109
+
110
+ fillInTheGapsDropdownPage.tests.verifyErrorMessageCSSAndA11y();
111
+
112
+ fillInTheGapsDropdownPage.tests.addResponseAreaAndVerifyMinimumOneAreaRequiredErrorMessageNotExist();
113
+
114
+ fillInTheGapsDropdownPage.tests.verifyQuestionInputFieldPlaceholderText();
115
+ });
116
+
117
+ describe('Question input field - Preview tab', () => {
118
+ abortEarlySetup();
119
+ before(() => {
120
+ fillInTheGapsDropdownPage.steps.navigateToCreateQuestion('fill in the gaps with dropdown');
121
+ cy.barsPreLoaderWait();
122
+ });
123
+
124
+ it('When the user adds a new dropdown in the question input field, the added dropdown should be displayed in the preview tab', () => {
125
+ fillInTheGapsDropdownPage.steps.addResponseArea();
126
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
127
+ utilities.verifyElementCount(fillInTheGapsDropdownPage.dropdownPreviewTab(), 3);
128
+ });
129
+
130
+ it('When the user edits the question input field text, the modified text should be visible in the preview tab', () => {
131
+ fillInTheGapsDropdownPage.steps.switchToEditTab();
132
+ fillInTheGapsDropdownPage.steps.addInputToQuestionInputField('Lorem ipsum');
133
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
134
+ utilities.verifyInnerText(fillInTheGapsDropdownPage.questionContainerPreviewTab(), 'Lorem ipsum dolor sit amet, \n​\n​\nonsectetur adipiscing elit. Ut pellentesque tinciduntornare. Integer porttitor est quis urna porttitor, eget tempus tellus dapibus \n​\n​\n​\n​\nLorem ipsum');
135
+ });
136
+
137
+ it('When the user deletes a dropdown, it should get deleted from the question preview', () => {
138
+ fillInTheGapsDropdownPage.steps.switchToEditTab();
139
+ fillInTheGapsDropdownPage.steps.deleteAResponseArea(2);
140
+ fillInTheGapsDropdownPage.steps.switchToPreviewTab();
141
+ utilities.verifyInnerText(fillInTheGapsDropdownPage.questionContainerPreviewTab(), 'Lorem ipsum dolor sit amet, \n​\n​\nonsectetur adipiscing elit. Ut pellentesque tinciduntornare. Integer porttitor est quis urna porttitor, eget tempus tellus dapibus \n​\n​\nLorem ipsum');
142
+ });
143
+ });
144
+ });