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
@@ -0,0 +1,246 @@
1
+ import { fillInTheGapsOverImageDropdownPage } from "../../../pages";
2
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
+ import utilities from "../../../support/helpers/utilities";
4
+ const css = Cypress.env('css');
5
+
6
+ const optionsForDropdown = ['Image of a flower', 'Petals are displayed', 'Stem is the largest', 'Branches of a plane contain both leaves and flowers'];
7
+
8
+ describe('Create item page - Fill in the gaps over image - dropdown: Dropdown and Dropdown menu section', () => {
9
+ before(() => {
10
+ cy.loginAs('admin');
11
+ });
12
+
13
+ describe('Dropdown and Dropdown menu section contents', () => {
14
+ abortEarlySetup();
15
+ before(() => {
16
+ fillInTheGapsOverImageDropdownPage.steps.navigateToCreateQuestion('fill in the gaps over image - dropdown');
17
+ cy.barsPreLoaderWait();
18
+ });
19
+
20
+ it('Dropdown label, \'User specified width\' and \'Auto scale\' toggle buttons should be displayed', () => {
21
+ utilities.verifyInnerText(fillInTheGapsOverImageDropdownPage.dropdownLabel(), 'Dropdown');
22
+ utilities.verifyElementVisibilityState(fillInTheGapsOverImageDropdownPage.dropdownLabel(), 'visible');
23
+ utilities.verifyInnerText(fillInTheGapsOverImageDropdownPage.userSpecifiedWidthToggleButton(), 'User specified width');
24
+ utilities.verifyElementVisibilityState(fillInTheGapsOverImageDropdownPage.userSpecifiedWidthToggleButton(), 'visible');
25
+ utilities.verifyInnerText(fillInTheGapsOverImageDropdownPage.AutoScaleToggleButton(), 'Auto scale');
26
+ utilities.verifyElementVisibilityState(fillInTheGapsOverImageDropdownPage.AutoScaleToggleButton(), 'visible');
27
+ });
28
+
29
+ it('By default \'User specified width\' toggle button should be in selected state and \'Auto scale\' should not be in selected state', () => {
30
+ fillInTheGapsOverImageDropdownPage.steps.verifyUserSpecifiedToggleButtonIsSelected();
31
+ fillInTheGapsOverImageDropdownPage.steps.verifyAutoScaleToggleButtonNotSelected();
32
+ });
33
+
34
+ it('\'Display multiline text in dropdown\' checkbox and label should be displayed and by default it should be unchecked', () => {
35
+ utilities.verifyElementVisibilityState(fillInTheGapsOverImageDropdownPage.displayMultilineTextCheckbox(), 'exist');
36
+ utilities.verifyInnerText(fillInTheGapsOverImageDropdownPage.displayMultilineTextCheckboxLabel(), 'Display multiline text in dropdown');
37
+ utilities.verifyElementVisibilityState(fillInTheGapsOverImageDropdownPage.displayMultilineTextCheckboxLabel(), 'visible');
38
+ fillInTheGapsOverImageDropdownPage.steps.verifyDisplayMultilineCheckboxIsNotChecked();
39
+ });
40
+
41
+ it('\'Dropdown menu\' label should be displayed', () => {
42
+ utilities.verifyInnerText(fillInTheGapsOverImageDropdownPage.dropdownMenuLabel(), 'Dropdown menu');
43
+ utilities.verifyElementVisibilityState(fillInTheGapsOverImageDropdownPage.dropdownMenuLabel(), 'visible');
44
+ });
45
+
46
+ it('\'Word wrap for dropdown menu\' checkbox and label should be displayed and by default it should be checked', () => {
47
+ utilities.verifyElementVisibilityState(fillInTheGapsOverImageDropdownPage.wordWrapCheckbox(), 'exist');
48
+ utilities.verifyInnerText(fillInTheGapsOverImageDropdownPage.wordWrapCheckboxLabel(), 'Word wrap for dropdown menu');
49
+ utilities.verifyElementVisibilityState(fillInTheGapsOverImageDropdownPage.wordWrapCheckboxLabel(), 'visible');
50
+ fillInTheGapsOverImageDropdownPage.steps.verifyWordWrapForDropdownMenuCheckboxIsChecked();
51
+ });
52
+
53
+ it('CSS of Dropdown and Dropdown menu section', { tags: 'css' }, () => {
54
+ utilities.verifyCSS(fillInTheGapsOverImageDropdownPage.dropdownLabel(), {
55
+ 'color': css.color.sectionHeading,
56
+ 'font-size': css.fontSize.normal,
57
+ 'font-weight': css.fontWeight.semibold
58
+ });
59
+ utilities.verifyCSS(fillInTheGapsOverImageDropdownPage.userSpecifiedWidthToggleButton(), {
60
+ 'color': css.color.whiteText,
61
+ 'font-size': css.fontSize.normal,
62
+ 'font-weight': css.fontWeight.bold,
63
+ 'background-color': css.color.toggleButtonSelectedBg
64
+ });
65
+ utilities.verifyCSS(fillInTheGapsOverImageDropdownPage.AutoScaleToggleButton(), {
66
+ 'color': css.color.UnselectedToggleButton,
67
+ 'font-size': css.fontSize.normal,
68
+ 'font-weight': css.fontWeight.bold
69
+ });
70
+ utilities.verifyCSS(fillInTheGapsOverImageDropdownPage.displayMultilineTextCheckboxLabel(), {
71
+ 'color': css.color.labelText,
72
+ 'font-size': css.fontSize.normal,
73
+ 'font-weight': css.fontWeight.normal
74
+ });
75
+ utilities.verifyCSS(fillInTheGapsOverImageDropdownPage.dropdownMenuLabel(), {
76
+ 'color': css.color.sectionHeading,
77
+ 'font-size': css.fontSize.normal,
78
+ 'font-weight': css.fontWeight.semibold
79
+ });
80
+ utilities.verifyCSS(fillInTheGapsOverImageDropdownPage.wordWrapCheckboxLabel(), {
81
+ 'color': css.color.labelText,
82
+ 'font-size': css.fontSize.normal,
83
+ 'font-weight': css.fontWeight.normal
84
+ });
85
+ //Checked checkbox
86
+ utilities.verifyCSS(fillInTheGapsOverImageDropdownPage.wordWrapCheckbox().find('rect').eq(1), {
87
+ 'fill': css.color.activeButtons
88
+ });
89
+ });
90
+
91
+ it('Accessibility of Dropdown and Dropdown menu section', { tags: 'a11y' }, () => {
92
+ cy.checkAccessibility(fillInTheGapsOverImageDropdownPage.dropdownLabel().parents('.student-view-settings-container'));
93
+ });
94
+ });
95
+
96
+ describe('Dropdown section - Specify correct answer section dropdown', () => {
97
+ abortEarlySetup();
98
+ before(() => {
99
+ fillInTheGapsOverImageDropdownPage.steps.navigateToCreateQuestion('fill in the gaps over image - dropdown');
100
+ cy.barsPreLoaderWait();
101
+ fillInTheGapsOverImageDropdownPage.steps.uploadFile('highlightImage.jpg');
102
+ fillInTheGapsOverImageDropdownPage.steps.verifyImageIsUploaded();
103
+ fillInTheGapsOverImageDropdownPage.steps.insertResponseArea(10);
104
+ fillInTheGapsOverImageDropdownPage.steps.addInputToDropdownOptionFields(0, optionsForDropdown);
105
+ fillInTheGapsOverImageDropdownPage.steps.uncheckWordWrapForDropdownMenuCheckbox();
106
+ });
107
+
108
+ it('When \'User specified width\' toggle button is selected, then dropdown menu width should be the same as collapsed dropdown in specify correct answer section', () => {
109
+ fillInTheGapsOverImageDropdownPage.steps.compareDropdownMenuAndDropdownWidthForUserSpecifiedWidth();
110
+ cy.log('Choosing an option from dropdown to collapse it')
111
+ fillInTheGapsOverImageDropdownPage.steps.selectOptionFromDropdownList(optionsForDropdown[0]);
112
+ });
113
+
114
+ it('When \'Auto scale\' toggle button is selected, then width of the collapsed dropdown and the dropdown menu should be auto scaled(increased) to accommodate the longest option in the dropdown menu in specify correct answer section', () => {
115
+ fillInTheGapsOverImageDropdownPage.steps.compareDropdownMenuAndDropdownWidthForAutoScaled();
116
+ cy.log('Choosing an option from dropdown to collapse it')
117
+ fillInTheGapsOverImageDropdownPage.steps.selectOptionFromDropdownList(optionsForDropdown[0]);
118
+ });
119
+
120
+ it('When user selects the \'User specified width\' toggle button, then the collapsed dropdown and the dropdown menu should return to its default width', () => {
121
+ fillInTheGapsOverImageDropdownPage.steps.selectUserSpecifiedWidthToggleButton();
122
+ fillInTheGapsOverImageDropdownPage.steps.verifyUserSpecifiedToggleButtonIsSelected();
123
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownDefaultWidthInSpecifyCorrectAnswer();
124
+ cy.log('Choosing an option from dropdown to collapse it')
125
+ fillInTheGapsOverImageDropdownPage.steps.selectOptionFromDropdownList(optionsForDropdown[3]);
126
+ });
127
+
128
+ it('When \'Display multiline text in dropdown\' checkbox is unchecked and user selects and long text option in dropdown, then the selected long text option should be incompletely displayed in the dropdown with an ellipses at the end and a tooltip which displays the entire option', () => {
129
+ fillInTheGapsOverImageDropdownPage.steps.verifyMultilineTextNotDisplayedInDropdownSpecifyCorrectAnswerSection(0);
130
+ utilities.getNthElement(fillInTheGapsOverImageDropdownPage.dropdownSpecifyCorrectAnswerSection(), 0)
131
+ .verifyTooltip(`${optionsForDropdown[3]}`);
132
+ });
133
+
134
+ it('User should be able to check the \'Display multiline text in dropdown\' checkbox', () => {
135
+ fillInTheGapsOverImageDropdownPage.steps.checkDisplayMultilineCheckbox();
136
+ });
137
+
138
+ it('When \'Display multiline text in dropdown\' checkbox is checked, then the added long text option should be word wrapped and displayed in a multi-line format', () => {
139
+ fillInTheGapsOverImageDropdownPage.steps.verifyMultilineTextIsDisplayedInDropdownSpecifyCorrectAnswerSection(0);
140
+ });
141
+ });
142
+
143
+ describe('Dropdown menu section - Specify correct answer section dropdown', () => {
144
+ abortEarlySetup();
145
+ before(() => {
146
+ fillInTheGapsOverImageDropdownPage.steps.navigateToCreateQuestion('fill in the gaps over image - dropdown');
147
+ cy.barsPreLoaderWait();
148
+ fillInTheGapsOverImageDropdownPage.steps.uploadFile('highlightImage.jpg');
149
+ fillInTheGapsOverImageDropdownPage.steps.verifyImageIsUploaded();
150
+ fillInTheGapsOverImageDropdownPage.steps.insertResponseArea(10);
151
+ fillInTheGapsOverImageDropdownPage.steps.addInputToDropdownOptionFields(0, optionsForDropdown);
152
+ });
153
+
154
+ it('When \'Word wrap for dropdown menu\' checkbox is checked, then all the dropdown menu options should be word wrapped and displayed in a multi-line format', () => {
155
+ fillInTheGapsOverImageDropdownPage.steps.expandDropdownInSpecifyCorrectAnswerSection(0);
156
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownMenuOptionsWordWrappedSpecifyCorrectAnswerSection();
157
+ cy.log('Selecting an option to collapse the dropdown');
158
+ fillInTheGapsOverImageDropdownPage.steps.selectOptionFromDropdownList(optionsForDropdown[0]);
159
+ });
160
+
161
+ it('User should be able to uncheck the \'Word wrap for dropdown menu\' checkbox', () => {
162
+ fillInTheGapsOverImageDropdownPage.steps.uncheckWordWrapForDropdownMenuCheckbox();
163
+ });
164
+
165
+ it('When \'Word wrap for dropdown menu\' checkbox is unchecked, then all the dropdown menu options should be displayed in a single line', () => {
166
+ fillInTheGapsOverImageDropdownPage.steps.expandDropdownInSpecifyCorrectAnswerSection(0);
167
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownMenuOptionsNotWordWrappedSpecifyCorrectAnswerSection();
168
+ });
169
+ });
170
+
171
+ describe('Dropdown section - Preview tab', () => {
172
+ abortEarlySetup();
173
+ before(() => {
174
+ fillInTheGapsOverImageDropdownPage.steps.navigateToCreateQuestion('fill in the gaps over image - dropdown');
175
+ cy.barsPreLoaderWait();
176
+ fillInTheGapsOverImageDropdownPage.steps.uploadFile('highlightImage.jpg');
177
+ fillInTheGapsOverImageDropdownPage.steps.verifyImageIsUploaded();
178
+ fillInTheGapsOverImageDropdownPage.steps.insertResponseArea(10);
179
+ fillInTheGapsOverImageDropdownPage.steps.addInputToDropdownOptionFields(0, optionsForDropdown);
180
+ fillInTheGapsOverImageDropdownPage.steps.switchToPreviewTab();
181
+ });
182
+
183
+ it('When \'User specified width\' toggle button is selected, then dropdown menu width should be the same as collapsed dropdown in preview tab', () => {
184
+ fillInTheGapsOverImageDropdownPage.steps.compareDropdownMenuAndDropdownWidthForUserSpecifiedWidthInPreviewTab();
185
+ cy.log('Choosing an option from dropdown to collapse it')
186
+ fillInTheGapsOverImageDropdownPage.steps.selectOptionFromDropdownList(optionsForDropdown[0]);
187
+ });
188
+
189
+ it('When \'Auto scale\' toggle button is selected, then width of the collapsed dropdown and the dropdown menu should be auto scaled(increased) to accommodate the longest option in the dropdown menu in specify correct answer section', () => {
190
+ fillInTheGapsOverImageDropdownPage.steps.compareDropdownMenuAndDropdownWidthForAutoScaledInPreviewTab();
191
+ cy.log('Choosing an option from dropdown to collapse it')
192
+ fillInTheGapsOverImageDropdownPage.steps.selectOptionFromDropdownList(optionsForDropdown[3]);
193
+ });
194
+
195
+ it('When user selects the \'User specified width\' toggle button, then the collapsed dropdown and the dropdown menu should return to its default width', () => {
196
+ fillInTheGapsOverImageDropdownPage.steps.switchToEditTab();
197
+ fillInTheGapsOverImageDropdownPage.steps.selectUserSpecifiedWidthToggleButton();
198
+ fillInTheGapsOverImageDropdownPage.steps.verifyUserSpecifiedToggleButtonIsSelected();
199
+ fillInTheGapsOverImageDropdownPage.steps.switchToPreviewTab();
200
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownDefaultWidthInPreviewTab();
201
+ cy.log('Choosing an option from dropdown to collapse it')
202
+ fillInTheGapsOverImageDropdownPage.steps.selectOptionFromDropdownList(optionsForDropdown[3]);
203
+ });
204
+
205
+ it('When \'Display multiline text in dropdown\' checkbox is unchecked and user selects and long text option in dropdown, then the selected long text option should be incompletely displayed in the dropdown with an ellipses at the end and a tooltip which displays the entire option', () => {
206
+ fillInTheGapsOverImageDropdownPage.steps.verifyMultilineTextNotDisplayedInDropdownPreviewTab(0);
207
+ utilities.getNthElement(fillInTheGapsOverImageDropdownPage.dropdownPreviewTab(), 0)
208
+ .verifyTooltip(`${optionsForDropdown[3]}`);
209
+ });
210
+
211
+ it('When \'Display multiline text in dropdown\' checkbox is checked, then the added long text option should be word wrapped and displayed in a multi-line format', () => {
212
+ fillInTheGapsOverImageDropdownPage.steps.switchToEditTab();
213
+ fillInTheGapsOverImageDropdownPage.steps.checkDisplayMultilineCheckbox();
214
+ fillInTheGapsOverImageDropdownPage.steps.switchToPreviewTab();
215
+ fillInTheGapsOverImageDropdownPage.steps.verifyMultilineTextIsDisplayedInDropdownPreviewTab(0);
216
+ });
217
+ });
218
+
219
+ describe('Dropdown menu section- Preview tab', () => {
220
+ abortEarlySetup();
221
+ before(() => {
222
+ fillInTheGapsOverImageDropdownPage.steps.navigateToCreateQuestion('fill in the gaps over image - dropdown');
223
+ cy.barsPreLoaderWait();
224
+ fillInTheGapsOverImageDropdownPage.steps.uploadFile('highlightImage.jpg');
225
+ fillInTheGapsOverImageDropdownPage.steps.verifyImageIsUploaded();
226
+ fillInTheGapsOverImageDropdownPage.steps.insertResponseArea(10);
227
+ fillInTheGapsOverImageDropdownPage.steps.addInputToDropdownOptionFields(0, optionsForDropdown);
228
+ fillInTheGapsOverImageDropdownPage.steps.switchToPreviewTab();
229
+ });
230
+
231
+ it('When \'Word wrap for dropdown menu\' checkbox is checked, then all the dropdown menu options should be word wrapped and displayed in a multi-line format', () => {
232
+ fillInTheGapsOverImageDropdownPage.steps.expandDropdownInPreviewTab(0);
233
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownMenuOptionsWordWrappedPreviewTab();
234
+ cy.log('Selecting an option to collapse the dropdown');
235
+ fillInTheGapsOverImageDropdownPage.steps.selectOptionFromDropdownList(optionsForDropdown[0]);
236
+ });
237
+
238
+ it('When \'Word wrap for dropdown menu\' checkbox is unchecked, then all the dropdown menu options should be displayed in a single line', () => {
239
+ fillInTheGapsOverImageDropdownPage.steps.switchToEditTab();
240
+ fillInTheGapsOverImageDropdownPage.steps.uncheckWordWrapForDropdownMenuCheckbox();
241
+ fillInTheGapsOverImageDropdownPage.steps.switchToPreviewTab();
242
+ fillInTheGapsOverImageDropdownPage.steps.expandDropdownInPreviewTab(0);
243
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownMenuOptionsNotWordWrappedPreviewTab();
244
+ });
245
+ });
246
+ });
@@ -0,0 +1,332 @@
1
+ import { fillInTheGapsOverImageDropdownPage } 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 over image - dropdown: Dropdown options section', () => {
10
+ before(() => {
11
+ cy.loginAs('admin');
12
+ });
13
+
14
+ describe('Dropdown options section contents', () => {
15
+ abortEarlySetup();
16
+ before(() => {
17
+ fillInTheGapsOverImageDropdownPage.steps.navigateToCreateQuestion('fill in the gaps over image - dropdown');
18
+ cy.barsPreLoaderWait();
19
+ fillInTheGapsOverImageDropdownPage.steps.uploadFile('highlightImage.jpg');
20
+ fillInTheGapsOverImageDropdownPage.steps.verifyImageIsUploaded();
21
+ });
22
+
23
+ it('When user has not added response area on the image, \'Dropdown\' options section should not be visible', () => {
24
+ utilities.verifyElementVisibilityState(fillInTheGapsOverImageDropdownPage.dropdownOptionsTab(), 'notExist');
25
+ utilities.verifyElementVisibilityState(fillInTheGapsOverImageDropdownPage.dropdownOptionsLabel(), 'notExist');
26
+ });
27
+
28
+ it('When user adds a response area on the image, \'Dropdown options\' section should be displayed with \'Dropdown 1\' tab in selected state', () => {
29
+ fillInTheGapsOverImageDropdownPage.steps.insertResponseArea(10);
30
+ utilities.verifyInnerText(fillInTheGapsOverImageDropdownPage.dropdownOptionsLabel(), 'Dropdown options');
31
+ utilities.verifyInnerText(fillInTheGapsOverImageDropdownPage.dropdownOptionsTab(), 'Dropdown 1');
32
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownOptionsTabIsSelected(0);
33
+ });
34
+
35
+ it('By default 4 option input fields with placeholder text, drag handle and delete option icon buttons should be displayed', () => {
36
+ for (let index = 0; index < 4; index++) {
37
+ fillInTheGapsOverImageDropdownPage.steps.verifyOptionsContents(index);
38
+ };
39
+ });
40
+
41
+ it('\'Add Option\' button should be present', () => {
42
+ utilities.verifyInnerText(fillInTheGapsOverImageDropdownPage.addOptionButton(), 'Add option');
43
+ utilities.verifyElementVisibilityState(fillInTheGapsOverImageDropdownPage.addOptionButton(), 'visible');
44
+ });
45
+
46
+ fillInTheGapsOverImageDropdownPage.tests.verifyDragHandleTooltip();
47
+
48
+ it('When user clicks on the \'Delete\' option button then the respective options input field should get deleted and option numeration should change accordingly', () => {
49
+ cy.log('Pre step: Adding text in all option input fields')
50
+ fillInTheGapsOverImageDropdownPage.steps.addInputToDropdownOptionFields(0, optionsForDropdown);
51
+ const optionsAfterDeleting = optionsForDropdown.filter((el) => el !== options[1]);
52
+ fillInTheGapsOverImageDropdownPage.steps.deleteOption(1);
53
+ utilities.verifyElementCount(optionsWrapperComponent.optionWrapper(), 3);
54
+ cy.log('Verifying the input text given to input fields after deletion of 2nd option')
55
+ optionsAfterDeleting.forEach((inputFieldText, optionIndex) => {
56
+ utilities.verifyTextContent(utilities.getNthElement(fillInTheGapsOverImageDropdownPage.dropdownOptionsInputField(), optionIndex), inputFieldText);
57
+ });
58
+ });
59
+
60
+ it('When only two options are present, the delete buttons should be in disabled state', () => {
61
+ cy.log('Deleting one more option')
62
+ fillInTheGapsOverImageDropdownPage.steps.deleteOption(2);
63
+ fillInTheGapsOverImageDropdownPage.steps.verifyDeleteOptionButtonDisabledState();
64
+ });
65
+
66
+ fillInTheGapsOverImageDropdownPage.tests.verifyDisabledDeleteButtonTooltip();
67
+
68
+ fillInTheGapsOverImageDropdownPage.tests.verifyAddOptionFunctionality();
69
+
70
+ it('When user focus in and out of any of the \'Options\' input field without typing anything, an error message should be thrown', () => {
71
+ fillInTheGapsOverImageDropdownPage.steps.focusInAndFocusOutOfDropdownOptionInputField();
72
+ utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: Option is required.');
73
+ });
74
+
75
+ it('User should be able to enter text in options input field and \'Error: Option is required.\' error message should disappear', () => {
76
+ fillInTheGapsOverImageDropdownPage.steps.addInputToDropdownOptionInputField(2, 'option 1');
77
+ commonComponents.steps.verifyErrorMessageIsNotDisplayed();
78
+ });
79
+
80
+ fillInTheGapsOverImageDropdownPage.tests.verifyEnabledDeleteButtonAndTooltip();
81
+
82
+ it('When user add another response area to the image, another dropdown options tab \'Dropdown 2\' should be added and it should not be in selected state', () => {
83
+ utilities.verifyInnerText(utilities.getNthElement(fillInTheGapsOverImageDropdownPage.dropdownOptionsTab(), 1), 'Dropdown 1');
84
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownOptionsTabIsSelected(0);
85
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownOptionsTabIsNotSelected(1);
86
+ });
87
+
88
+ 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', () => {
89
+ fillInTheGapsOverImageDropdownPage.steps.navigateToDropdownOptionsTab(1);
90
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownOptionsTabIsSelected(1);
91
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownOptionsTabIsNotSelected(0);
92
+ for (let index = 0; index < optionFieldsCount; index++) {
93
+ fillInTheGapsOverImageDropdownPage.steps.verifyOptionsContents(index);
94
+ };
95
+ });
96
+
97
+ it('User should be able to give input to the option input fields in \'Dropdown 2\' tab', () => {
98
+ fillInTheGapsOverImageDropdownPage.steps.addInputToDropdownOptionInputField(0, 'Dropdown 2 option 1');
99
+ });
100
+
101
+ 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', () => {
102
+ fillInTheGapsOverImageDropdownPage.steps.navigateToDropdownOptionsTab(0);
103
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownOptionsTabIsSelected(0);
104
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownOptionsTabIsNotSelected(1);
105
+ });
106
+
107
+ it('CSS of Options section', { tags: 'css' }, () => {
108
+ utilities.verifyCSS(fillInTheGapsOverImageDropdownPage.dropdownOptionsLabel(), {
109
+ 'color': css.color.sectionHeading,
110
+ 'font-size': css.fontSize.default,
111
+ 'font-weight': css.fontWeight.semibold
112
+ });
113
+ utilities.verifyCSS(utilities.getNthElement(fillInTheGapsOverImageDropdownPage.dropdownOptionsTab(), 0), {
114
+ 'color': css.color.activeButtons,
115
+ 'font-size': css.fontSize.default,
116
+ 'font-weight': css.fontWeight.bold
117
+ });
118
+ utilities.verifyCSS(utilities.getNthElement(fillInTheGapsOverImageDropdownPage.dropdownOptionsTab(), 0), {
119
+ 'color': css.color.sectionHeading,
120
+ 'font-size': css.fontSize.default,
121
+ 'font-weight': css.fontWeight.bold
122
+ });
123
+ utilities.verifyCSS(commonComponents.dragHandleButton().find('svg'), {
124
+ 'fill': css.color.secondaryBtnActive
125
+ });
126
+ commonComponents.deleteButton()
127
+ .verifyPseudoClassBeforeProperty('color', css.color.deleteIcon);
128
+ utilities.verifyCSS(fillInTheGapsOverImageDropdownPage.dropdownOptionsInputField(), {
129
+ 'color': css.color.text,
130
+ 'font-size': css.fontSize.default,
131
+ 'font-weight': css.fontWeight.regular
132
+ });
133
+ utilities.verifyCSS(fillInTheGapsOverImageDropdownPage.addOptionButton(), {
134
+ 'color': css.color.secondaryBtnActive,
135
+ 'font-size': css.fontSize.default,
136
+ 'font-weight': css.fontWeight.medium
137
+ });
138
+ });
139
+
140
+ it('Accessibility of dropdown options section', { tags: 'a11y' }, () => {
141
+ cy.checkAccessibility(fillInTheGapsOverImageDropdownPage.dropdownOptionsLabel().parents('[class*="LabelImageWithDropDownstyles__ResponseOptionWrapper"]'));
142
+ });
143
+ });
144
+
145
+ describe('Dropdown options in Specify correct answer section', () => {
146
+ abortEarlySetup();
147
+ before(() => {
148
+ fillInTheGapsOverImageDropdownPage.steps.navigateToCreateQuestion('fill in the gaps over image - dropdown');
149
+ cy.barsPreLoaderWait();
150
+ fillInTheGapsOverImageDropdownPage.steps.uploadFile('highlightImage.jpg');
151
+ fillInTheGapsOverImageDropdownPage.steps.verifyImageIsUploaded();
152
+ fillInTheGapsOverImageDropdownPage.steps.insertResponseArea(10);
153
+ });
154
+
155
+ 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\'', () => {
156
+ fillInTheGapsOverImageDropdownPage.steps.verifyDisabledDropdownInSpecifyCorrectAnswerSection(0);
157
+ });
158
+
159
+ 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', () => {
160
+ utilities.getNthElement(fillInTheGapsOverImageDropdownPage.dropdownSpecifyCorrectAnswerSection(), 0)
161
+ .verifyTooltip('Please add options');
162
+ });
163
+
164
+ it('CSS of specify correct answer section disabled dropdown', { tags: 'css' }, () => {
165
+ utilities.verifyCSS(fillInTheGapsOverImageDropdownPage.dropdownSpecifyCorrectAnswerSection(), {
166
+ 'opacity': '1',
167
+ 'background': css.color.defaultBackground
168
+ });
169
+ });
170
+
171
+ it('Accessibility of specify correct answer section disabled dropdown', { tags: 'a11y' }, () => {
172
+ cy.checkAccessibility(fillInTheGapsOverImageDropdownPage.dropdownSpecifyCorrectAnswerSection());
173
+ });
174
+
175
+ it('When user enters a text in at least 1 option input field then the dropdown should be enabled', () => {
176
+ fillInTheGapsOverImageDropdownPage.steps.addInputToDropdownOptionInputField(0, optionsForDropdown[0]);
177
+ utilities.verifyElementNotDisabled(utilities.getNthElement(fillInTheGapsOverImageDropdownPage.dropdownSpecifyCorrectAnswerSection(), 0));
178
+ });
179
+
180
+ it('Added text in option input field should be displayed in dropdown of \'Specify correct answer\' section', () => {
181
+ cy.log('Add input to all options input field for dropdown 1');
182
+ fillInTheGapsOverImageDropdownPage.steps.addInputToDropdownOptionFields(0, optionsForDropdown);
183
+ fillInTheGapsOverImageDropdownPage.steps.expandDropdownInSpecifyCorrectAnswerSection(0)
184
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownOptionsSpecifyCorrectAnswer(optionsForDropdown);
185
+ });
186
+
187
+ it('When user deletes an option then the deleted option should not be displayed in dropdown in \'Specify correct answer\' section', () => {
188
+ fillInTheGapsOverImageDropdownPage.steps.deleteOption(3);
189
+ cy.log('Checking the deleted option should not exist in the dropdown')
190
+ fillInTheGapsOverImageDropdownPage.steps.expandDropdownInSpecifyCorrectAnswerSection(0);
191
+ let optionsForDropdown1 = optionsForDropdown.slice(0, 3);
192
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownOptionsSpecifyCorrectAnswer(optionsForDropdown1);
193
+ });
194
+
195
+ it('When user adds an option using \'Add Option\' button then the added option should be displayed in dropdown in \'Specify correct answer\' section', () => {
196
+ fillInTheGapsOverImageDropdownPage.steps.addOption();
197
+ fillInTheGapsOverImageDropdownPage.steps.addInputToDropdownOptionInputField(3, `${optionsForDropdown[3]}`);
198
+ fillInTheGapsOverImageDropdownPage.steps.expandDropdownInSpecifyCorrectAnswerSection(0);
199
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownOptionsSpecifyCorrectAnswer(optionsForDropdown);
200
+ });
201
+
202
+ 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', () => {
203
+ fillInTheGapsOverImageDropdownPage.steps.addInputToDropdownOptionInputField(0, `${optionsForDropdown[1]}`);
204
+ let optionsForDropdown1 = optionsForDropdown.slice(1, 4);
205
+ fillInTheGapsOverImageDropdownPage.steps.expandDropdownInSpecifyCorrectAnswerSection(0);
206
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownOptionsSpecifyCorrectAnswer(optionsForDropdown1);
207
+ });
208
+
209
+ it('When user has adds another response area, then the newly added dropdown should be in disabled state in specify correct answer section', () => {
210
+ fillInTheGapsOverImageDropdownPage.steps.insertResponseArea(40);
211
+ fillInTheGapsOverImageDropdownPage.steps.verifyDisabledDropdownInSpecifyCorrectAnswerSection(1);
212
+ });
213
+
214
+ it('CSS of specify correct answer section dropdown in active state', { tags: 'css' }, () => {
215
+ cy.log('Expand dropdown');
216
+ fillInTheGapsOverImageDropdownPage.steps.selectResponseFromDropdownSpecifyCorrectAnswerSection(0, `${optionsForDropdown[3]}`);
217
+ fillInTheGapsOverImageDropdownPage.steps.expandDropdownInSpecifyCorrectAnswerSection(0);
218
+ //Selected option
219
+ utilities.verifyCSS(fillInTheGapsOverImageDropdownPage.dropdownListOptions(optionsForDropdown[3]), {
220
+ 'color': css.color.liText,
221
+ 'font-size': css.fontSize.default,
222
+ 'font-weight': css.fontWeight.regular,
223
+ 'background-color': css.color.liTextSelectedBg
224
+ });
225
+ //Unselected option
226
+ utilities.verifyCSS(fillInTheGapsOverImageDropdownPage.dropdownListOptions(optionsForDropdown[2]), {
227
+ 'color': css.color.liText,
228
+ 'font-size': css.fontSize.default,
229
+ 'font-weight': css.fontWeight.regular,
230
+ 'background-color': css.color.transparent
231
+ });
232
+ utilities.verifyCSS(fillInTheGapsOverImageDropdownPage.dropdownSpecifyCorrectAnswerSection(), {
233
+ 'border': `1px solid ${css.color.activeComponentBorder}`,
234
+ });
235
+ });
236
+
237
+ it('Accessibility of specify correct answer section dropdown in active state', { tags: 'a11y' }, () => {
238
+ cy.checkAccessibility(fillInTheGapsOverImageDropdownPage.dropdownList());
239
+ });
240
+ });
241
+
242
+ describe('Dropdown options in preview tab', () => {
243
+ abortEarlySetup();
244
+ before(() => {
245
+ fillInTheGapsOverImageDropdownPage.steps.navigateToCreateQuestion('fill in the gaps over image - dropdown');
246
+ cy.barsPreLoaderWait();
247
+ fillInTheGapsOverImageDropdownPage.steps.uploadFile('highlightImage.jpg');
248
+ fillInTheGapsOverImageDropdownPage.steps.verifyImageIsUploaded();
249
+ fillInTheGapsOverImageDropdownPage.steps.insertResponseArea(10);
250
+ fillInTheGapsOverImageDropdownPage.steps.switchToPreviewTab();
251
+ });
252
+
253
+ 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\'', () => {
254
+ fillInTheGapsOverImageDropdownPage.steps.verifyDisabledDropdownInPreviewTab(0);
255
+ });
256
+
257
+ it('When user enters a text in at least 1 option input field then the preview tab dropdown should be enabled', () => {
258
+ fillInTheGapsOverImageDropdownPage.steps.switchToEditTab();
259
+ fillInTheGapsOverImageDropdownPage.steps.addInputToDropdownOptionInputField(0, optionsForDropdown[0]);
260
+ fillInTheGapsOverImageDropdownPage.steps.switchToPreviewTab();
261
+ utilities.verifyElementNotDisabled(utilities.getNthElement(fillInTheGapsOverImageDropdownPage.dropdownPreviewTab(), 0));
262
+ });
263
+
264
+ it('The added text in dropdown options input fields should be displayed in dropdown of \'preview tab\'', () => {
265
+ fillInTheGapsOverImageDropdownPage.steps.switchToEditTab();
266
+ fillInTheGapsOverImageDropdownPage.steps.addInputToDropdownOptionFields(0, optionsForDropdown);
267
+ fillInTheGapsOverImageDropdownPage.steps.switchToPreviewTab();
268
+ fillInTheGapsOverImageDropdownPage.steps.expandDropdownInPreviewTab(0)
269
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownOptionsPreviewTab(optionsForDropdown);
270
+ });
271
+
272
+ it('When user deletes an option then the deleted option should not be displayed in dropdown in \'preview tab\'', () => {
273
+ fillInTheGapsOverImageDropdownPage.steps.switchToEditTab();
274
+ fillInTheGapsOverImageDropdownPage.steps.deleteOption(3);
275
+ fillInTheGapsOverImageDropdownPage.steps.switchToPreviewTab();
276
+ cy.log('Checking the deleted option should not exist in the dropdown')
277
+ fillInTheGapsOverImageDropdownPage.steps.expandDropdownInPreviewTab(0);
278
+ let optionsForDropdown1 = optionsForDropdown.slice(0, 3);
279
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownOptionsPreviewTab(optionsForDropdown1);
280
+ });
281
+
282
+ it('When user adds an option using \'Add Option\' button then the added option should be displayed in dropdown in \'preview tab\'', () => {
283
+ fillInTheGapsOverImageDropdownPage.steps.switchToEditTab();
284
+ fillInTheGapsOverImageDropdownPage.steps.addOption();
285
+ fillInTheGapsOverImageDropdownPage.steps.addInputToDropdownOptionInputField(3, `${optionsForDropdown[3]}`);
286
+ fillInTheGapsOverImageDropdownPage.steps.switchToPreviewTab();
287
+ fillInTheGapsOverImageDropdownPage.steps.expandDropdownInPreviewTab(0);
288
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownOptionsPreviewTab(optionsForDropdown);
289
+ });
290
+
291
+ it('When the user has added two same options in the options, only one occurrence of that option should be listed in the dropdown', () => {
292
+ fillInTheGapsOverImageDropdownPage.steps.switchToEditTab();
293
+ fillInTheGapsOverImageDropdownPage.steps.addInputToDropdownOptionInputField(0, `${optionsForDropdown[1]}`);
294
+ fillInTheGapsOverImageDropdownPage.steps.switchToPreviewTab();
295
+ fillInTheGapsOverImageDropdownPage.steps.expandDropdownInPreviewTab(0);
296
+ let optionsForDropdown1 = optionsForDropdown.slice(1, 4);
297
+ fillInTheGapsOverImageDropdownPage.steps.verifyDropdownOptionsPreviewTab(optionsForDropdown1);
298
+ });
299
+
300
+ it('When user has adds another response area, then the newly added dropdown should be in disabled state in preview tab', () => {
301
+ fillInTheGapsOverImageDropdownPage.steps.insertResponseArea(40);
302
+ fillInTheGapsOverImageDropdownPage.steps.verifyDisabledDropdownInPreviewTab(1);
303
+ });
304
+
305
+ it('CSS of preview tab dropdown', { tags: 'css' }, () => {
306
+ cy.log('Expand dropdown');
307
+ fillInTheGapsOverImageDropdownPage.steps.selectResponseFromDropdownInPreviewTab(0, `${optionsForDropdown[3]}`);
308
+ fillInTheGapsOverImageDropdownPage.steps.expandDropdownInPreviewTab(0);
309
+ //Selected option
310
+ utilities.verifyCSS(fillInTheGapsOverImageDropdownPage.dropdownListOptions(optionsForDropdown[3]), {
311
+ 'color': css.color.liText,
312
+ 'font-size': css.fontSize.default,
313
+ 'font-weight': css.fontWeight.regular,
314
+ 'background-color': css.color.liTextSelectedBg
315
+ });
316
+ //Unselected option
317
+ utilities.verifyCSS(fillInTheGapsOverImageDropdownPage.dropdownListOptions(optionsForDropdown[2]), {
318
+ 'color': css.color.liText,
319
+ 'font-size': css.fontSize.default,
320
+ 'font-weight': css.fontWeight.regular,
321
+ 'background-color': css.color.transparent
322
+ });
323
+ utilities.verifyCSS(fillInTheGapsOverImageDropdownPage.dropdownSpecifyCorrectAnswerSection(), {
324
+ 'border': `1px solid ${css.color.activeComponentBorder}`,
325
+ });
326
+ });
327
+
328
+ it('Accessibility of preview tab dropdown in active state', { tags: 'a11y' }, () => {
329
+ cy.checkAccessibility(commonComponents.dropdownList());
330
+ });
331
+ });
332
+ });