itemengine-cypress-automation 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. package/.build_wna +4 -0
  2. package/README.md +3 -0
  3. package/currents.config.js +6 -0
  4. package/cypress/API/createItem/toggleItemMode.js +15 -0
  5. package/cypress/config-files/ildev.json +15 -0
  6. package/cypress/config-files/ilprod.json +15 -0
  7. package/cypress/config-files/ilqa.json +15 -0
  8. package/cypress/config-files/ilstage.json +15 -0
  9. package/cypress/e2e/ILC/sorry-cypress-test/spec1.js +18 -0
  10. package/cypress/e2e/ILC/sorry-cypress-test/spec2.js +18 -0
  11. package/cypress/e2e/ILC/sorry-cypress-test/spec3.js +18 -0
  12. package/cypress/fixtures/accessibilityConfig.json +6 -0
  13. package/cypress/fixtures/constants.js +18 -0
  14. package/cypress/fixtures/equationEditorCategoriesAndSymbols .js +2271 -0
  15. package/cypress/fixtures/specialAndMathCharacters.js +118 -0
  16. package/cypress/fixtures/theme/ilc.json +150 -0
  17. package/cypress/fixtures/theme/ngie.json +26 -0
  18. package/cypress/fixtures/uploads/20mbFile.png +0 -0
  19. package/cypress/fixtures/uploads/80mbFile.pdf +0 -0
  20. package/cypress/fixtures/uploads/highlightImage.jpg +0 -0
  21. package/cypress/fixtures/uploads/image.png +0 -0
  22. package/cypress/fixtures/uploads/sample.aac +0 -0
  23. package/cypress/fixtures/uploads/sample.accdb +0 -0
  24. package/cypress/fixtures/uploads/sample.csv +100 -0
  25. package/cypress/fixtures/uploads/sample.doc +0 -0
  26. package/cypress/fixtures/uploads/sample.gif +0 -0
  27. package/cypress/fixtures/uploads/sample.heic +0 -0
  28. package/cypress/fixtures/uploads/sample.heif +0 -0
  29. package/cypress/fixtures/uploads/sample.hevc +0 -0
  30. package/cypress/fixtures/uploads/sample.jpeg +0 -0
  31. package/cypress/fixtures/uploads/sample.jpg +0 -0
  32. package/cypress/fixtures/uploads/sample.mp3 +0 -0
  33. package/cypress/fixtures/uploads/sample.mp4 +0 -0
  34. package/cypress/fixtures/uploads/sample.pdf +0 -0
  35. package/cypress/fixtures/uploads/sample.ppt +0 -0
  36. package/cypress/fixtures/uploads/sample.pub +0 -0
  37. package/cypress/fixtures/uploads/sample.rtf +7902 -0
  38. package/cypress/fixtures/uploads/sample.svg +10 -0
  39. package/cypress/fixtures/uploads/sample.txt +1 -0
  40. package/cypress/fixtures/uploads/sample.wav +0 -0
  41. package/cypress/fixtures/uploads/sample.xlsx +0 -0
  42. package/cypress/fixtures/uploads/sample.xps +0 -0
  43. package/cypress/fixtures/uploads/sample.zip +0 -0
  44. package/cypress/fixtures/uploads/sample1.jpg +0 -0
  45. package/cypress/fixtures/uploads/sample1.mp3 +0 -0
  46. package/cypress/fixtures/uploads/sample1.zip +0 -0
  47. package/cypress/fixtures/uploads/sample10Sec.mp3 +0 -0
  48. package/cypress/fixtures/uploads/sample2.jpg +0 -0
  49. package/cypress/fixtures/uploads/sample2.mp3 +0 -0
  50. package/cypress/fixtures/uploads/sampleVirus.zip +0 -0
  51. package/cypress/pages/audioPlayerPage.js +628 -0
  52. package/cypress/pages/audioResponsePage.js +264 -0
  53. package/cypress/pages/components/additionalSettingsPanel.js +174 -0
  54. package/cypress/pages/components/answerNumerationComponent.js +109 -0
  55. package/cypress/pages/components/autoScoredAdditionalSettings.js +183 -0
  56. package/cypress/pages/components/autoScoredPreviewBase.js +94 -0
  57. package/cypress/pages/components/autoScoredScoringSection.js +195 -0
  58. package/cypress/pages/components/autoScoredScoringSectionMultipleResponsesType.js +268 -0
  59. package/cypress/pages/components/autoScoredSetCorrectAnswerSection.js +291 -0
  60. package/cypress/pages/components/ckEditorToolbar.js +64 -0
  61. package/cypress/pages/components/colorPopupComponent.js +293 -0
  62. package/cypress/pages/components/commonComponents.js +93 -0
  63. package/cypress/pages/components/componentsFlowChart/figFlowChart.png +0 -0
  64. package/cypress/pages/components/createCustomCategoryFlyout.js +138 -0
  65. package/cypress/pages/components/createQuestionBasePage.js +225 -0
  66. package/cypress/pages/components/customizeHighlightPropertiesComponent.js +318 -0
  67. package/cypress/pages/components/dragAndDropResponseOptions.js +738 -0
  68. package/cypress/pages/components/dragAndDropSetCorrectAnswerCheckboxComponents.js +124 -0
  69. package/cypress/pages/components/draggableOptionsContainer.js +857 -0
  70. package/cypress/pages/components/editCategoryFlyout.js +40 -0
  71. package/cypress/pages/components/equationEditorFlyout.js +158 -0
  72. package/cypress/pages/components/essayResponseCommonComponents.js +86 -0
  73. package/cypress/pages/components/figOverImageCommonComponent.js +924 -0
  74. package/cypress/pages/components/fillInTheGapsCommonComponents.js +687 -0
  75. package/cypress/pages/components/fillInTheGapsDropdownCommonComponent.js +442 -0
  76. package/cypress/pages/components/fillInTheGapsTextCommonComponent.js +884 -0
  77. package/cypress/pages/components/gridCommonComponents.js +951 -0
  78. package/cypress/pages/components/index.js +38 -0
  79. package/cypress/pages/components/listSortingAndOrderingBase.js +401 -0
  80. package/cypress/pages/components/maximumRecorderLengthComponent.js +116 -0
  81. package/cypress/pages/components/mcqAdditionalSettingsBase.js +390 -0
  82. package/cypress/pages/components/mcqOptionsComponent.js +263 -0
  83. package/cypress/pages/components/mcqPreviewComponents.js +78 -0
  84. package/cypress/pages/components/mcqQuestionCommonComponents.js +265 -0
  85. package/cypress/pages/components/mcqScoringComponent.js +120 -0
  86. package/cypress/pages/components/mcqSetCorrectAnswerSection.js +143 -0
  87. package/cypress/pages/components/optionsWrapperComponent.js +221 -0
  88. package/cypress/pages/components/playbackControlsBaseComponent.js +163 -0
  89. package/cypress/pages/components/previewScoringAndShowCorrectAnswerComponent.js +90 -0
  90. package/cypress/pages/components/questionInstructionsComponent.js +112 -0
  91. package/cypress/pages/components/scoringSectionBase.js +308 -0
  92. package/cypress/pages/components/setPointsPopupBase.js +79 -0
  93. package/cypress/pages/components/specialAndCustomSpecialCharactersComponent.js +79 -0
  94. package/cypress/pages/components/specialCharactersFlyoutComponent.js +58 -0
  95. package/cypress/pages/components/studentResponseAreaAndLayoutComponent.js +28 -0
  96. package/cypress/pages/components/uploadImageSectionComponent.js +594 -0
  97. package/cypress/pages/createItemPage.js +28 -0
  98. package/cypress/pages/dialogBoxBase.js +111 -0
  99. package/cypress/pages/dragAndDropIntoCategoriesAllOrNothingScoring.js +1161 -0
  100. package/cypress/pages/dragAndDropIntoCategoriesCellsScoring.js +1559 -0
  101. package/cypress/pages/dragAndDropIntoCategoriesPage.js +1556 -0
  102. package/cypress/pages/dragAndDropIntoCategoriesResponseScoring.js +1396 -0
  103. package/cypress/pages/essayResponseBasicPage.js +57 -0
  104. package/cypress/pages/essayResponseMathPage.js +47 -0
  105. package/cypress/pages/essayResponsePage.js +385 -0
  106. package/cypress/pages/feedbackScalePage.js +698 -0
  107. package/cypress/pages/fillInTheGapsDragAndDropPage.js +742 -0
  108. package/cypress/pages/fillInTheGapsDropdownPage.js +99 -0
  109. package/cypress/pages/fillInTheGapsOverImageDropdownPage.js +232 -0
  110. package/cypress/pages/fillInTheGapsOverImageTextPage.js +135 -0
  111. package/cypress/pages/fillInTheGapsScoring.js +5974 -0
  112. package/cypress/pages/fillInTheGapsSetCorrectAnswerSection.js +260 -0
  113. package/cypress/pages/fillInTheGapsTextPage.js +225 -0
  114. package/cypress/pages/highlightImagePage.js +1316 -0
  115. package/cypress/pages/highlightPage.js +870 -0
  116. package/cypress/pages/index.js +30 -0
  117. package/cypress/pages/listMatchingPage.js +1330 -0
  118. package/cypress/pages/listMatchingScoring.js +2635 -0
  119. package/cypress/pages/listOrderingPage.js +751 -0
  120. package/cypress/pages/listSortingPage.js +1201 -0
  121. package/cypress/pages/multipleSelectionGridPage.js +359 -0
  122. package/cypress/pages/multipleSelectionPage.js +88 -0
  123. package/cypress/pages/passagePage.js +426 -0
  124. package/cypress/pages/readingRulerPage.js +302 -0
  125. package/cypress/pages/selectQuestionResourceToolPage.js +64 -0
  126. package/cypress/pages/shortTextResponsePage.js +197 -0
  127. package/cypress/pages/singleSelectionGridPage.js +370 -0
  128. package/cypress/pages/singleSelectionPage.js +65 -0
  129. package/cypress/pages/uploadResponsePage.js +110 -0
  130. package/cypress/pages/videoResponsePage.js +375 -0
  131. package/cypress/support/commands.js +140 -0
  132. package/cypress/support/e2e.js +14 -0
  133. package/cypress/support/helpers/abortEarly.js +19 -0
  134. package/cypress/support/helpers/accessibility.js +34 -0
  135. package/cypress/support/helpers/cypressUtilities.js +64 -0
  136. package/cypress/support/helpers/localStorage.js +13 -0
  137. package/cypress/support/helpers/selectText.js +77 -0
  138. package/cypress/support/helpers/utilities.js +126 -0
  139. package/cypress.config.js +76 -0
  140. package/il.yaml +14 -0
  141. package/language +1 -0
  142. package/package.json +26 -0
@@ -0,0 +1,221 @@
1
+ import constants from "../../fixtures/constants";
2
+ import { commonComponents } from "./commonComponents";
3
+
4
+ const selectors = {
5
+ optionsLabel: () => cy.get('.options-label'),
6
+ optionsSectionWrapper: () => cy.get('[data-rbd-droppable-id="assessment-option-item-options"]'),
7
+ optionWrapper: () => cy.get('[data-rbd-draggable-id*="option-draggable"]'),
8
+ addOptionButton: () => cy.get('.add-option-wrapper-cls button').contains('Add option'),
9
+ deleteOptionButton: () => cy.get('.ngie-button[aria-label*="Delete option"]'),
10
+ optionsInputField: () => cy.get('.option-component [role="textbox"]'),
11
+ //TODO: Need to update this in all TEI
12
+ optionNumeration: () => cy.get('[class*="SingleOptionstyle__AdornmentDiv"]')
13
+ }
14
+
15
+ const steps = {
16
+ //V3 - Need to update in all files
17
+ verifyOptionsLabel: () => {
18
+ optionsWrapperComponent.optionsLabel()
19
+ .should('have.text', 'Options')
20
+ .and('be.visible');
21
+ },
22
+
23
+ //V3 - Need to update in all files
24
+ /**
25
+ * @param {number} index of the option
26
+ * @description verify the enter option input field, drag handle, delete button and option numeration
27
+ */
28
+ verifyOptionsContents: (index) => {
29
+ optionsWrapperComponent.optionWrapper()
30
+ .eq(index)
31
+ .within(() => {
32
+ optionsWrapperComponent.optionsInputField()
33
+ .should('have.attr', 'data-cke-editorplaceholder', 'Enter option');
34
+ commonComponents.dragHandleButton()
35
+ .should('exist');
36
+ commonComponents.deleteButton()
37
+ .should('be.visible');
38
+ optionsWrapperComponent.optionNumeration()
39
+ .should('have.text', index + 1);
40
+ });
41
+ },
42
+
43
+ //V3 - Need to update in all files
44
+ /**
45
+ * @param {number} index of the option
46
+ * @description this function deletes an option
47
+ */
48
+ deleteOption: (index) => {
49
+ optionsWrapperComponent.deleteOptionButton()
50
+ .eq(index)
51
+ .click();
52
+ },
53
+
54
+ //V3 - Need to update in all files
55
+ addOption: () => {
56
+ optionsWrapperComponent.addOptionButton()
57
+ .click();
58
+ },
59
+
60
+ //V3 - Need to update in all files
61
+ verifyAddOptionButton: () => {
62
+ optionsWrapperComponent.addOptionButton()
63
+ .should('have.text', 'Add option')
64
+ .should('be.visible');
65
+ },
66
+
67
+ //V3 - Need to update in all files
68
+ /**
69
+ * @param {number} index of option
70
+ * @description this function verifies error message of option input field
71
+ */
72
+ verifyOptionsInputFieldErrorMessage: (index) => {
73
+ optionsWrapperComponent.optionWrapper()
74
+ .eq(index)
75
+ .within(() => {
76
+ commonComponents.errorMessage()
77
+ .should('have.text', 'Error: Option is required.');
78
+ });
79
+ },
80
+
81
+ //V3 - Need to update in all files
82
+ /**
83
+ * @param {number} index of option
84
+ * @description this function verifies error message does not exist for option input field
85
+ */
86
+ verifyOptionsInputFieldErrorMessageDoesNotExist: (index) => {
87
+ optionsWrapperComponent.optionWrapper()
88
+ .eq(index)
89
+ .within(() => {
90
+ commonComponents.errorMessage()
91
+ .should('not.exist');
92
+ });
93
+ },
94
+
95
+ /**
96
+ * @param {number} countOfOptions count of options input fields
97
+ * @description this function verifies the number of options input fields
98
+ */
99
+ verifyCountOfOptionsInputFields: (countOfOptions) => {
100
+ optionsWrapperComponent.optionsInputField()
101
+ .should('have.length', countOfOptions);
102
+ },
103
+
104
+ //V3 - Need to update in all files
105
+ /**
106
+ * @param {number} index of the option input field
107
+ * @description this function focuses in and out of options input fields
108
+ */
109
+ focusInAndFocusOutOfOptionsInputField: (index) => {
110
+ steps.focusInOptionsInputField(index)
111
+ optionsWrapperComponent.optionsInputField()
112
+ .eq(index)
113
+ .blur();
114
+ },
115
+
116
+ //V3 - Need to update in all files
117
+ /**
118
+ * @param {number} index of the option input field
119
+ * @description this function focuses in and out of options input fields
120
+ */
121
+ focusInOptionsInputField: (index) => {
122
+ optionsWrapperComponent.optionsInputField()
123
+ .eq(index)
124
+ .focus();
125
+ },
126
+
127
+ /**
128
+ * @param {number} index of the option input field
129
+ * @param {string} option input text
130
+ * @description this function add input to options input fields
131
+ */
132
+ addBoldTextInputToOptionsInputField: (index) => {
133
+ optionsWrapperComponent.optionsInputField()
134
+ .eq(index)
135
+ .type('This is a bold option')
136
+ .should('have.text', '​​​​​​​This is a bold option');
137
+ },
138
+
139
+ /**
140
+ * @param {number} index of option
141
+ * @description this function verifies bold text in options input fields
142
+ */
143
+ verifyBoldOption: (index) => {
144
+ optionsWrapperComponent.optionsInputField()
145
+ .eq(index)
146
+ .find('strong')
147
+ .should('exist')
148
+ .should('have.text', '​​​​​​​This is a bold option');
149
+ },
150
+
151
+ /**
152
+ * @param {number} index of option
153
+ * @description this function verifies image in options input fields
154
+ */
155
+ verifyImageAndAltTextInOptionsInputField: (index) => {
156
+ optionsWrapperComponent.optionsInputField()
157
+ .eq(index)
158
+ .find('img')
159
+ .should('have.attr', 'src', constants.foxImageLink)
160
+ .and('have.attr', 'alt', constants.foxImageAltText);
161
+ },
162
+
163
+ /**
164
+ * @param {number} index of option
165
+ * @description this function verifies equation in options input fields
166
+ */
167
+ verifyEquationInOptionsInputField: (index) => {
168
+ optionsWrapperComponent.optionsInputField()
169
+ .eq(index)
170
+ .find('[data-widget="ngie_equation"]')
171
+ .should('have.attr', 'aria-label', constants.CKEditorInputFieldEnteredEquationAriaLabel)
172
+ .contains(constants.CKEditorInputFieldEnteredEquationText);
173
+ },
174
+
175
+ /**
176
+ * @param {number} index of option
177
+ * @description this function verifies link in options input fields
178
+ */
179
+ verifyLinkInOptionsInputField: (index) => {
180
+ optionsWrapperComponent.optionsInputField()
181
+ .eq(index)
182
+ .find('a')
183
+ .should('have.text', 'lorem')
184
+ .and('have.attr', 'href', `${Cypress.config().baseUrl}`);
185
+ },
186
+
187
+ //V3 - Need to update in all files
188
+ /**
189
+ * @param {string[]} optionsTextArray array of options
190
+ * @description this function adds input to the options input field
191
+ */
192
+ addInputToOptionsInputField: (optionsTextArray) => {
193
+ optionsTextArray.forEach((optionsText, index) => {
194
+ optionsWrapperComponent.optionsInputField()
195
+ .eq(index)
196
+ .type(optionsText)
197
+ .should('have.text', optionsText)
198
+ .blur();
199
+ });
200
+ },
201
+
202
+ //V3 - Need to update in all files
203
+ /**
204
+ * @param {number} index of option input field
205
+ * @param {string} textContent to enter text in the options input field
206
+ */
207
+ editOptionInputField: (index, textContent) => {
208
+ optionsWrapperComponent.optionsSectionWrapper()
209
+ .within(() => {
210
+ optionsWrapperComponent.optionsInputField()
211
+ .eq(index)
212
+ .clear()
213
+ .type(textContent);
214
+ });
215
+ },
216
+ }
217
+
218
+ export const optionsWrapperComponent = {
219
+ ...selectors,
220
+ steps
221
+ }
@@ -0,0 +1,163 @@
1
+ const selectors = {
2
+ volumeControlButton: () => cy.get('.audio-player-icon'),
3
+ volumeControlSlider: () => cy.get('.audio-volume-control-slider'),
4
+ muteVolumeIcon: () => cy.get('.audio-mute-icon-wr'),
5
+ unmutedVolumeIcon: () => cy.get('.audio-volume-icon-wr'),
6
+ progressBar: () => cy.get('.progress-bar-wrapper'),
7
+ progressBarSlider: () => cy.get('input[aria-label="Slider bar"]'),
8
+ playbackPlayButton: () => cy.get('button[aria-label="Play"]'),
9
+ playbackPauseButton: () => cy.get('button[aria-label="Pause"]'),
10
+ }
11
+
12
+ const steps = {
13
+ startPlayback: () => {
14
+ playbackControlsBaseComponent.playbackPlayButton()
15
+ .click();
16
+ },
17
+
18
+ pausePlayback: () => {
19
+ playbackControlsBaseComponent.playbackPauseButton()
20
+ .click();
21
+ },
22
+
23
+ hoverOnVolumeControlButton: () => {
24
+ playbackControlsBaseComponent.volumeControlButton()
25
+ .realHover();
26
+ },
27
+
28
+ hoverOnVolumeControlSlider: () => {
29
+ playbackControlsBaseComponent.volumeControlSlider()
30
+ .trigger('mouseover')
31
+ },
32
+
33
+ /**
34
+ * @param {number} volume of the audio/video player - from 0 to 100
35
+ * @description this function is used to verify volume of the audio/video player
36
+ */
37
+ verifyVolumeOfPlaybackPlayer: (volume) => {
38
+ playbackControlsBaseComponent.volumeControlSlider()
39
+ .should('have.value', volume)
40
+ .blur();
41
+ },
42
+
43
+ /**
44
+ * @description Sets the volume to a specified percentage for the audio/video playback.
45
+ * @param {number} volumePercentage - The desired volume percentage (0-100).
46
+ * @throws {Error} Throws an error if the volume control element cannot be located or if the click action fails.
47
+ */
48
+ setVolumeSliderForPlayback: (volumePercentage) => {
49
+ playbackControlsBaseComponent.volumeControlSlider()
50
+ .then(($sliderWidth) => {
51
+ const sliderWidth = $sliderWidth[0].clientWidth;
52
+ const volumeLevel = sliderWidth - (sliderWidth * volumePercentage / 100);
53
+ playbackControlsBaseComponent.volumeControlSlider()
54
+ .realClick({ x: 5, y: volumeLevel });
55
+ });
56
+ },
57
+
58
+ hoverAwayFromVolumeControlButton: () => {
59
+ cy.get('body')
60
+ .realHover();
61
+ },
62
+
63
+ clickOnVolumeButton: () => {
64
+ playbackControlsBaseComponent.volumeControlButton()
65
+ .realClick();
66
+ },
67
+
68
+ focusOutFromVolumeControlButton: () => {
69
+ playbackControlsBaseComponent.volumeControlButton()
70
+ .blur();
71
+ },
72
+
73
+ seekProgressBarSliderToCenter: () => {
74
+ playbackControlsBaseComponent.progressBar()
75
+ .click();
76
+ },
77
+
78
+ hoverOnProgressBarSlider: () => {
79
+ playbackControlsBaseComponent.progressBarSlider()
80
+ .realHover();
81
+ },
82
+
83
+ /**
84
+ * @description Verifies that the position of the progress bar slider is greater than or equal to the specified position.
85
+ * This function retrieves the position of the progress bar slider, which is represented as a numeric value,
86
+ * and compares it with the specified position to ensure it meets or exceeds the expected value.
87
+ * @param {number} sliderPositionToCompare - The expected minimum position of the progress bar slider in percentage (0 to 100).
88
+ * @throws {Error} Throws an error if the slider position is less than the expected position.
89
+ */
90
+ verifyProgressBarSliderPosition: (sliderPositionToCompare) => {
91
+ playbackControlsBaseComponent.progressBarSlider()
92
+ .then(($value) => {
93
+ const value = $value[0].valueAsNumber
94
+ cy.log('The assertion is verifying the value synchronously i.e in real time')
95
+ expect(value).to.be.gte(sliderPositionToCompare);
96
+ });
97
+ },
98
+
99
+ verifyPlaybackProgressBarSliderEnabledState: () => {
100
+ playbackControlsBaseComponent.progressBarSlider()
101
+ .should('be.enabled');
102
+ },
103
+
104
+ verifyPlaybackProgressBarSliderDisabledState: () => {
105
+ playbackControlsBaseComponent.progressBarSlider()
106
+ .should('be.disabled');
107
+ },
108
+
109
+ verifyProgressBarSliderWhenSeekIsDisabled: () => {
110
+ let initialWidthProgressBar
111
+ playbackControlsBaseComponent.progressBarSlider()
112
+ .then(($currWidth) => {
113
+ initialWidthProgressBar = $currWidth[0].valueAsNumber
114
+ });
115
+ playbackControlsBaseComponent.steps.seekProgressBarSliderToCenter();
116
+ playbackControlsBaseComponent.progressBarSlider()
117
+ .then(($finalWidth) => {
118
+ cy.log('The assertion is verifying the value synchronously i.e in real time')
119
+ const finalWidth = $finalWidth[0].valueAsNumber
120
+ expect(finalWidth).to.closeTo(initialWidthProgressBar, 5)
121
+ });
122
+ },
123
+
124
+ pauseAndVerifyProgressBarSliderPosition: () => {
125
+ let initialWidthProgressBar
126
+ playbackControlsBaseComponent.progressBarSlider()
127
+ .then(($currWidth) => {
128
+ initialWidthProgressBar = $currWidth[0].valueAsNumber
129
+ });
130
+ playbackControlsBaseComponent.steps.pausePlayback();
131
+ playbackControlsBaseComponent.progressBarSlider()
132
+ .then(($finalWidth) => {
133
+ cy.log('The assertion is verifying the value synchronously i.e in real time')
134
+ const finalWidth = $finalWidth[0].valueAsNumber
135
+ expect(finalWidth).to.closeTo(initialWidthProgressBar, 5)
136
+ });
137
+ },
138
+
139
+ verifyPlaybackPlayButtonEnabledState: () => {
140
+ playbackControlsBaseComponent.playbackPlayButton()
141
+ .should('be.enabled');
142
+ },
143
+
144
+ verifyPlaybackPlayButtonDisabledState: () => {
145
+ playbackControlsBaseComponent.playbackPlayButton()
146
+ .should('be.disabled');
147
+ },
148
+
149
+ verifyPlaybackPauseButtonEnabledState: () => {
150
+ playbackControlsBaseComponent.playbackPauseButton()
151
+ .should('be.enabled');
152
+ },
153
+
154
+ verifyPlaybackPauseButtonDisabledState: () => {
155
+ playbackControlsBaseComponent.playbackPauseButton()
156
+ .should('be.disabled');
157
+ },
158
+ }
159
+
160
+ export const playbackControlsBaseComponent = {
161
+ ...selectors,
162
+ steps
163
+ }
@@ -0,0 +1,90 @@
1
+ import { createQuestionBasePage } from "./createQuestionBasePage";
2
+ const css = Cypress.env('css');
3
+
4
+ const selectors = {
5
+ showCorrectAnswerCheckbox: () => cy.get('input[aria-label="Show correct answer"]'),
6
+ showCorrectAnswerCheckboxLabel: () => cy.get('.showAnswer-options-label').eq(1),
7
+ previewScoreText: () => cy.get('.check-score-view-text')
8
+ }
9
+
10
+ const steps = {
11
+ //V3 - This function should be updated in all files
12
+ checkShowCorrectAnswerCheckbox: () => {
13
+ previewScoringAndShowCorrectAnswerComponent.showCorrectAnswerCheckbox()
14
+ .click()
15
+ .should('be.checked');
16
+ },
17
+
18
+ //V3 - This function should be updated in all files
19
+ uncheckShowCorrectAnswerCheckbox: () => {
20
+ cy.log('Deselect the show correct checkbox')
21
+ previewScoringAndShowCorrectAnswerComponent.showCorrectAnswerCheckbox()
22
+ .click()
23
+ .should('not.be.checked');
24
+ },
25
+
26
+ //V3 - This function should be updated in all files
27
+ verifyDefaultShowCorrectAnswerCheckboxAndLabel: () => {
28
+ previewScoringAndShowCorrectAnswerComponent.showCorrectAnswerCheckboxLabel()
29
+ .verifyInnerText('Show correct answer');
30
+ previewScoringAndShowCorrectAnswerComponent.showCorrectAnswerCheckbox()
31
+ .should('exist')
32
+ .and('not.be.checked');
33
+ },
34
+
35
+ //V3 - This function should be updated in all files
36
+ /**
37
+ * @param {number} scoredPoints points scored by the user
38
+ * @param {number} totalPoints maximum points that can be achieved by the user
39
+ * @description this function verifies score displayed in the preview tab
40
+ */
41
+ verifyPreviewTabScoreText: (scoredPoints, totalPoints) => {
42
+ previewScoringAndShowCorrectAnswerComponent.previewScoreText()
43
+ .should('have.text', `${scoredPoints}/${totalPoints}`);
44
+ }
45
+ }
46
+
47
+ const tests = {
48
+ verifyShowCorrectAnswerAndPointsNotDisplayedInPreviewTab: () => {
49
+ it('Show correct answer checkbox as well as points besides it should not be displayed', () => {
50
+ previewScoringAndShowCorrectAnswerComponent.showCorrectAnswerCheckbox()
51
+ .should('not.exist');
52
+ previewScoringAndShowCorrectAnswerComponent.previewScoreText()
53
+ .should('not.exist');
54
+ });
55
+ },
56
+
57
+ //V3 - This function should be updated in all files
58
+ verifyShowCorrectAnswerLabelAndCheckboxExistAndPreviewScoreNotExistInPreviewTab: () => {
59
+ it('Show correct answer checkbox should be displayed and it should be unchecked by default and points should not be displayed beside it ', () => {
60
+ previewScoringAndShowCorrectAnswerComponent.showCorrectAnswerCheckbox()
61
+ .should('not.be.checked');
62
+ previewScoringAndShowCorrectAnswerComponent.showCorrectAnswerCheckboxLabel()
63
+ .verifyInnerText('Show correct answer');
64
+ previewScoringAndShowCorrectAnswerComponent.previewScoreText()
65
+ .should('not.exist');
66
+ });
67
+ },
68
+
69
+ //TODO: Need to dicuss this as this is not required everywhere(only the tabs css)
70
+ verifyCSSOfPreviewAndEditTabAndScoringContents: () => {
71
+ it('CSS of Preview tab', { tags: 'css' }, () => {
72
+ //CSS of inactive edit tab
73
+ createQuestionBasePage.editTab()
74
+ .verifyCSS(css.color.sectionHeading, css.fontSize.default, css.fontWeight.bold);
75
+ //CSS of active preview tab
76
+ createQuestionBasePage.previewTab()
77
+ .verifyCSS(css.color.activeButtons, css.fontSize.default, css.fontWeight.bold);
78
+ previewScoringAndShowCorrectAnswerComponent.previewScoreText()
79
+ .verifyCSS(css.color.labels, css.fontSize.default, css.fontWeight.regular);
80
+ previewScoringAndShowCorrectAnswerComponent.showCorrectAnswerCheckboxLabel()
81
+ .verifyCSS(css.color.labelText, css.fontSize.normal, css.fontWeight.regular);
82
+ });
83
+ }
84
+ }
85
+
86
+ export const previewScoringAndShowCorrectAnswerComponent = {
87
+ ...selectors,
88
+ steps,
89
+ tests
90
+ }
@@ -0,0 +1,112 @@
1
+ import { commonComponents } from "./commonComponents";
2
+ import { createQuestionBasePage } from "./createQuestionBasePage";
3
+ const css = Cypress.env('css');
4
+
5
+ const selectors = {
6
+ questionInstructionsLabelEditTab: () => cy.get('.edit-question-instruction-label'),
7
+ questionInstructionsInputField: () => cy.get('[title="Question Instructions"]'),
8
+ questionInstructionsText: () => cy.get('.edit-question-preview-wrapper .question-instruction.question-text-wrapper'),
9
+ }
10
+
11
+ const steps = {
12
+ addQuestionInstructions: () => {
13
+ questionInstructionsComponent.questionInstructionsInputField()
14
+ .type('Which of the following is the major contributor to increased carbon dioxide levels because of urbanization? Select your answer from the options below.', { delay: 0 })
15
+ .blur();
16
+ },
17
+
18
+ verifyQuestionInstructionsErrorMessageIsNotDisplayed: () => {
19
+ questionInstructionsComponent.questionInstructionsLabelEditTab()
20
+ .parents('.edit-question-instruction-wrapper')
21
+ .within(() => {
22
+ commonComponents.errorMessage()
23
+ .should('not.exist');
24
+ });
25
+ },
26
+
27
+ verifyQuestionInstructionsErrorMessage: () => {
28
+ questionInstructionsComponent.questionInstructionsLabelEditTab()
29
+ .parents('.edit-question-instruction-wrapper')
30
+ .within(() => {
31
+ commonComponents.errorMessage()
32
+ .verifyInnerText('Error: Question instructions are required.');
33
+ });
34
+ }
35
+ }
36
+
37
+ const tests = {
38
+ verifyQuestionInstructionsInputFieldEditTab: () => {
39
+ it('CSS of Question Instructions in Edit tab', { tags: 'css' }, () => {
40
+ questionInstructionsComponent.questionInstructionsLabelEditTab()
41
+ .verifyCSS(css.color.sectionHeading, css.fontSize.normal, css.fontWeight.semibold);
42
+ questionInstructionsComponent.questionInstructionsInputField()
43
+ .verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
44
+ });
45
+
46
+ //Note: a11y covered in header section
47
+
48
+ it('\'Question Instructions\' label and input field should be displayed and \'Enter Question Instructions\' placeholder text should be displayed on input field', () => {
49
+ questionInstructionsComponent.questionInstructionsLabelEditTab()
50
+ .verifyInnerText('Question instructions');
51
+ questionInstructionsComponent.questionInstructionsInputField()
52
+ .and('have.attr', 'data-cke-editorplaceholder', 'Enter question instructions');
53
+ });
54
+
55
+ it('When user focus in and out of the \'Question Instructions\' input field without typing anything, an error message should be thrown', () => {
56
+ questionInstructionsComponent.questionInstructionsInputField()
57
+ .click()
58
+ .blur();
59
+ questionInstructionsComponent.steps.verifyQuestionInstructionsErrorMessage()
60
+ });
61
+
62
+ it('CSS of question instructions error message', { tags: 'css' }, () => {
63
+ questionInstructionsComponent.questionInstructionsLabelEditTab()
64
+ .parents('.edit-question-instruction-wrapper')
65
+ .within(() => {
66
+ commonComponents.errorMessage()
67
+ .verifyCSS(css.color.errorText, css.fontSize.small, css.fontWeight.regular);
68
+ });
69
+ });
70
+
71
+ it('Accessibility of question instructions error message', { tags: 'a11y' }, () => {
72
+ cy.checkAccessibility(questionInstructionsComponent.questionInstructionsLabelEditTab().parents('.edit-question-instruction-wrapper'));
73
+ });
74
+
75
+ it('The user should be able to add the Question Instructions and \'Error :Question Instructions are required.\' error message should disappear', () => {
76
+ questionInstructionsComponent.steps.addQuestionInstructions()
77
+ questionInstructionsComponent.steps.verifyQuestionInstructionsErrorMessageIsNotDisplayed()
78
+ });
79
+
80
+ it('When user adds Question instruction the placeholder text should not be displayed', () => {
81
+ questionInstructionsComponent.questionInstructionsInputField()
82
+ .should('not.have.attr', 'data-cke-editorplaceholder');
83
+ });
84
+ },
85
+
86
+ verifyQuestionInstructionsInputFieldPreviewTab: () => {
87
+ //TODO: Need to decide approach for the below case as Question instruction is a compulsory field and it's empty state cannot be checked in the other views like grading, student, correct answer.
88
+ it('When user has not entered any text in the Question instructions input field in the \'Edit\' tab then nothing should be displayed in the \'Preview\' tab', () => {
89
+ cy.barsPreLoaderWait();
90
+ cy.log('Switching to Preview Tab')
91
+ createQuestionBasePage.steps.switchToPreviewTab();
92
+ questionInstructionsComponent.questionInstructionsText()
93
+ .should('not.exist');
94
+ });
95
+
96
+ it('The added Question Instructions should be displayed on \'Preview\' tab', () => {
97
+ cy.log('Switching to Edit Tab')
98
+ createQuestionBasePage.steps.switchToEditTab();
99
+ questionInstructionsComponent.steps.addQuestionInstructions()
100
+ cy.log('Switching to Preview Tab')
101
+ createQuestionBasePage.steps.switchToPreviewTab();
102
+ questionInstructionsComponent.questionInstructionsText()
103
+ .should('have.text', 'Which of the following is the major contributor to increased carbon dioxide levels because of urbanization? Select your answer from the options below.');
104
+ });
105
+ }
106
+ };
107
+
108
+ export const questionInstructionsComponent = {
109
+ ...selectors,
110
+ steps,
111
+ tests
112
+ };