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,302 @@
1
+ import utilities from "../support/helpers/utilities";
2
+ import { createQuestionBasePage, additionalSettingsPanel } from "./components";
3
+ import { dialogBoxBase } from "./dialogBoxBase";
4
+ import { selectQuestionResourceToolPage } from "./selectQuestionResourceToolPage";
5
+ const css = Cypress.env('css');
6
+
7
+ const selectors = {
8
+ ...additionalSettingsPanel,
9
+ //TODO: Need to update selectors https://redmine.zeuslearning.com/issues/518498
10
+ displayButtonToStudentLabel: () => cy.get('[data-ngie-testid="display-button-to-student-checkbox"] .MuiFormControlLabel-label'),
11
+ allowStudentToResizeLabel: () => cy.get('[data-ngie-testid="allow-student-to-resize-checkbox"] .MuiFormControlLabel-label'),
12
+ visibleOnLandingLabel: () => cy.get('[data-ngie-testid="visible-on-landing-checkbox"] .MuiFormControlLabel-label'),
13
+ displayButtonToStudentCheckbox: () => cy.get('[data-ngie-testid="display-button-to-student-checkbox"] input[type="checkbox"]'),
14
+ allowStudentToResizeCheckbox: () => cy.get('[data-ngie-testid="allow-student-to-resize-checkbox"] input[type="checkbox"]'),
15
+ visibleOnLandingCheckbox: () => cy.get('[data-ngie-testid="visible-on-landing-checkbox"] input[type="checkbox"]'),
16
+ readingRulerEditWrapper: () => cy.get('.resource-and-tool-tablist-wrapper'),
17
+ opacityLabel: () => cy.get('#input-slider'),
18
+ opacityInputField: () => cy.get('.line-reader-opacity input'),
19
+ opacitySlider: () => cy.get('.MuiSlider-root'),
20
+ colorLabel: () => cy.get('[class*="LineReaderstyles__PropertyLabel"]').eq(1),
21
+ colorBlock: () => cy.get('.MuiFormGroup-root .MuiRadio-root'),
22
+ colorBlockLabel: () => cy.get('.MuiFormControl-root .MuiFormControlLabel-root .MuiTypography-root'),
23
+ defaultNumberOfLinesLabel: () => cy.get('[class*="LineReaderstyles__PropertyLabel"]').eq(2),
24
+ defaultNumberOfLinesInputField: () => cy.get('input[aria-label="Default number of lines"]'),
25
+ //Preview Tab
26
+ readingRulerButton: () => cy.get('.LineReaderButton'),
27
+ readingRuler: () => cy.get('.resizable'),
28
+ closeButton: () => cy.get('.LineReaderCloseButton'),
29
+ dragButton: () => cy.get('.LineReaderMoveButton'),
30
+ resizeButton: () => cy.get('.resizeMaskButton'),
31
+ topResizeButton: () => cy.get('.resizeTopWindowButton'),
32
+ bottomResizeButton: () => cy.get('.resizeBottomWindowButton'),
33
+ previewWrapper: () => cy.get('[class*="TabsComponentstyles__PreviewWrapper"]'),
34
+ rulerOpacity: () => cy.get('.resizable [class*="LineReaderComponentstyles__LineReaderMask"]').eq(0),
35
+ rulerColor: () => cy.get('.resizable [class*="LineReaderComponentstyles__LineReaderMask"]').eq(0),
36
+ }
37
+
38
+ const steps = {
39
+ ...createQuestionBasePage.steps,
40
+ ...additionalSettingsPanel.steps,
41
+
42
+ verifyDisplayButtonToStudentCheckboxIsChecked: () => {
43
+ readingRulerPage.displayButtonToStudentCheckbox()
44
+ .should('be.checked');
45
+ },
46
+
47
+ verifyAllowStudentToResizeCheckboxIsChecked: () => {
48
+ readingRulerPage.allowStudentToResizeCheckbox()
49
+ .should('be.checked');
50
+ },
51
+
52
+ verifyVisibleOnLandingCheckboxIsUnchecked: () => {
53
+ readingRulerPage.visibleOnLandingCheckbox()
54
+ .should('not.be.checked');
55
+ },
56
+
57
+ verifyDefaultNumberOfLinesInputFieldValue: (value) => {
58
+ readingRulerPage.defaultNumberOfLinesInputField()
59
+ .should('have.value', value)
60
+ },
61
+
62
+ verifyOpacityInputFieldValue: (opacityValue) => {
63
+ readingRulerPage.opacityInputField()
64
+ .should('have.value', opacityValue)
65
+ },
66
+
67
+ verifyOpacitySliderValue: (opacityValue) => {
68
+ readingRulerPage.opacitySlider()
69
+ .find('input')
70
+ .should('have.value', opacityValue)
71
+ },
72
+
73
+ verifyMaxOpacitySliderValue: (maxValue) => {
74
+ readingRulerPage.opacitySlider()
75
+ .find('[role="slider"]')
76
+ .should('have.attr', 'aria-valuemax', maxValue)
77
+ },
78
+
79
+ verifyColorBlock: (blockIndex, colorLabel, color) => {
80
+ utilities.verifyCSS(readingRulerPage.colorBlock().eq(blockIndex), {
81
+ 'background-color': color
82
+ });
83
+ utilities.verifyElementVisibilityState(readingRulerPage.colorBlockLabel().eq(blockIndex), 'visible');
84
+ utilities.verifyInnerText(readingRulerPage.colorBlockLabel().eq(blockIndex), colorLabel);
85
+ },
86
+
87
+ verifyColorBlockSelectedState: (blockIndex) => {
88
+ readingRulerPage.colorBlock()
89
+ .eq(blockIndex)
90
+ .find('svg')
91
+ .should('be.visible');
92
+ },
93
+
94
+ verifyColorBlockUnSelectedState: (blockIndex) => {
95
+ readingRulerPage.colorBlock()
96
+ .eq(blockIndex)
97
+ .find('svg')
98
+ .should('not.exist');
99
+ },
100
+
101
+ selectColorBlock: (blockIndex) => {
102
+ readingRulerPage.colorBlock()
103
+ .eq(blockIndex)
104
+ .click();
105
+ },
106
+
107
+ addInputToOpacityInputField: (value) => {
108
+ readingRulerPage.opacityInputField()
109
+ .clear()
110
+ .type(value, { delay: 0 })
111
+ },
112
+
113
+ addInputToDefaultNumberOfLinesInputField: (value) => {
114
+ readingRulerPage.defaultNumberOfLinesInputField()
115
+ .clear()
116
+ .type(value, { delay: 0 })
117
+ },
118
+
119
+ clickOnOpacitySlider: () => {
120
+ readingRulerPage.opacitySlider()
121
+ .click();
122
+ },
123
+
124
+ //Conditional checkboxes
125
+ checkDisplayButtonToStudentCheckbox: () => {
126
+ readingRulerPage.displayButtonToStudentCheckbox()
127
+ .click()
128
+ .should('be.checked');
129
+ },
130
+
131
+ uncheckDisplayButtonToStudentCheckbox: () => {
132
+ readingRulerPage.displayButtonToStudentCheckbox()
133
+ .click()
134
+ .should('not.be.checked');
135
+ },
136
+
137
+ checkAllowStudentToResizeCheckbox: () => {
138
+ readingRulerPage.allowStudentToResizeCheckbox()
139
+ .click()
140
+ .should('be.checked');
141
+ },
142
+
143
+ uncheckAllowStudentToResizeCheckbox: () => {
144
+ readingRulerPage.allowStudentToResizeCheckbox()
145
+ .click()
146
+ .should('not.be.checked');
147
+ },
148
+
149
+ checkVisibleOnLandingCheckbox: () => {
150
+ readingRulerPage.visibleOnLandingCheckbox()
151
+ .click()
152
+ .should('be.checked');
153
+ },
154
+
155
+ uncheckVisibleOnLandingCheckbox: () => {
156
+ readingRulerPage.visibleOnLandingCheckbox()
157
+ .click()
158
+ .should('not.be.checked');
159
+ },
160
+
161
+ verifySelectedStateOfReadingRulerButton: () => {
162
+ readingRulerPage.readingRulerButton()
163
+ .should('have.class', 'active');
164
+ },
165
+
166
+ verifyUnselectedStateOfReadingRulerButton: () => {
167
+ readingRulerPage.readingRulerButton()
168
+ .should('not.have.class', 'active');
169
+ },
170
+
171
+ clickOnReadingRulerButton: () => {
172
+ readingRulerPage.readingRulerButton()
173
+ .click({ force: true });
174
+ },
175
+
176
+ verifyResizeButtonsEnabled: () => {
177
+ readingRulerPage.resizeButton()
178
+ .should('be.enabled');
179
+ readingRulerPage.topResizeButton()
180
+ .should('be.enabled');
181
+ readingRulerPage.bottomResizeButton()
182
+ .should('be.enabled');
183
+ },
184
+
185
+ verifyCloseButtonEnabled: () => {
186
+ readingRulerPage.closeButton()
187
+ .should('be.enabled');
188
+ },
189
+
190
+ verifyDragButtonEnabled: () => {
191
+ readingRulerPage.dragButton()
192
+ .should('be.enabled');
193
+ },
194
+
195
+ verifyResizeButtonDisabled: () => {
196
+ readingRulerPage.resizeButton()
197
+ .should('be.disabled');
198
+ readingRulerPage.topResizeButton()
199
+ .should('be.disabled');
200
+ readingRulerPage.bottomResizeButton()
201
+ .should('be.disabled');
202
+ },
203
+
204
+ hoverOnReadingRulerButton: () => {
205
+ readingRulerPage.readingRulerButton()
206
+ .realHover()
207
+ },
208
+
209
+ hoverAwayFromReadingRulerButton: () => {
210
+ readingRulerPage.readingRulerButton()
211
+ .realHover({ position: 'topLeft' })
212
+ },
213
+
214
+ clickOnCloseButtonInReadingRuler: () => {
215
+ readingRulerPage.closeButton()
216
+ .click()
217
+ },
218
+
219
+ /**
220
+ * @param {number} opacityValue opacity of the ruler
221
+ * @description this function verifies opacity of the ruler displayed in the preview tab
222
+ */
223
+ verifyReadingRulerOpacityInPreviewTab: (opacityValue) => {
224
+ readingRulerPage.rulerOpacity()
225
+ .should('have.attr', 'opacity', opacityValue)
226
+ },
227
+
228
+ /**
229
+ * @param {string} colorValue color of the ruler
230
+ * @description this function verifies color of the ruler displayed in the preview tab
231
+ */
232
+ verifyReadingRulerColorInPreviewTab: (colorValue) => {
233
+ readingRulerPage.rulerColor()
234
+ .should('have.attr', 'color', colorValue)
235
+ },
236
+
237
+ /**
238
+ * @param {number} heightValue height of the ruler
239
+ * @param {number} sizeValue size of the ruler
240
+ * @description this function verifies height and size of ruler displayed in the preview tab
241
+ */
242
+ verifyHeightAndSizeOfReadingRuler: (heightValue, sizeValue) => {
243
+ readingRulerPage.readingRuler()
244
+ .should('have.attr', 'height', heightValue)
245
+ .should('have.attr', 'size', sizeValue)
246
+ },
247
+
248
+ //additional settings
249
+ addTextToTeacherGuidelinesInputField: () => {
250
+ readingRulerPage.additionalSettingsTeacherGuidelinesInputField()
251
+ .type('Teacher scoring guidelines', { delay: 0 })
252
+ .blur();
253
+ },
254
+ }
255
+
256
+ const tests = {
257
+ ...createQuestionBasePage.tests,
258
+ ...additionalSettingsPanel.tests,
259
+ //Header section
260
+ verifyCancelButton: () => {
261
+ it('When user has made no edits and clicks on Cancel button, the user should be directed back to the \'Select a Question\' page', () => {
262
+ createQuestionBasePage.cancelButton()
263
+ .click();
264
+ utilities.verifyElementVisibilityState(selectQuestionResourceToolPage.selectAQuestionHeaderText(), 'visible');
265
+ utilities.verifyElementVisibilityState(selectQuestionResourceToolPage.questionTypeOptionTitle(), 'visible');
266
+ });
267
+
268
+ it('When user has made some edits/changes and clicks on Cancel button, a popup should be displayed', () => {
269
+ selectQuestionResourceToolPage.steps.selectResourceType('Reading ruler');
270
+ utilities.verifyElementVisibilityState(readingRulerPage.opacityInputField(), 'visible');
271
+ readingRulerPage.steps.addInputToOpacityInputField('30');
272
+ createQuestionBasePage.cancelButton()
273
+ .click();
274
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible')
275
+ });
276
+
277
+ dialogBoxBase.tests.verifyContentsOfLeavePagePopupWithCSSAnda11y();
278
+
279
+ it(`Clicking on \'No, I'd like to go back\' button should close the popup and user should remain on the edit interface of the question`, () => {
280
+ dialogBoxBase.buttonReject()
281
+ .click();
282
+ createQuestionBasePage.editTab()
283
+ .should('have.attr', 'aria-selected', 'true')
284
+ readingRulerPage.steps.verifyOpacityInputFieldValue('30');
285
+ });
286
+
287
+ it(`Clicking on \'Yes, I want to leave this page\' button should discard all changes and direct the user to the \'Select a question\' page.`, () => {
288
+ createQuestionBasePage.cancelButton()
289
+ .click();
290
+ dialogBoxBase.buttonAccept()
291
+ .click();
292
+ utilities.verifyElementVisibilityState(selectQuestionResourceToolPage.selectAQuestionHeaderText(), 'visible');
293
+ utilities.verifyElementVisibilityState(selectQuestionResourceToolPage.questionTypeOptionTitle(), 'visible');
294
+ });
295
+ },
296
+ }
297
+
298
+ export const readingRulerPage = {
299
+ ...selectors,
300
+ steps,
301
+ tests
302
+ }
@@ -0,0 +1,64 @@
1
+ const selectors = {
2
+ questionTypeOptionTitle: (ariaLabel = null) => {
3
+ if (ariaLabel) {
4
+ return cy.get(`.type-card-container [aria-label="${ariaLabel}"]`)
5
+ } else {
6
+ return cy.get('.type-card-container')
7
+ }
8
+ },
9
+ selectAQuestionHeaderText: () => cy.get('[class*="QuestionResourceToolstyles__HeaderText"]'),
10
+ questionTypeCategory: () => cy.get('[class*="QuestionResourceToolstyles__CategorySection"]'),
11
+ resourceTypeCategory: () => cy.get('.MuiCard-root')
12
+ }
13
+
14
+ const questionTypeCategoryMap = {
15
+ 'multiple selection': 'Multiple choice selection',
16
+ 'single selection': 'Multiple choice selection',
17
+ 'single selection - block': 'Multiple choice selection',
18
+ 'true or false': 'Multiple choice selection',
19
+ 'single selection grid': 'Multiple choice selection',
20
+ 'multiple selection grid': 'Multiple choice selection',
21
+ 'multiple selection - block': 'Multiple choice selection',
22
+ 'fill in the gaps with dropdown': 'Fill in the gaps',
23
+ 'fill in the gaps with text': 'Fill in the gaps',
24
+ 'fill in the gaps over image - dropdown': 'Fill in the gaps',
25
+ 'fill in the gaps over image - text': 'Fill in the gaps',
26
+ 'fill in the gaps with drag and drop': 'Fill in the gaps',
27
+ 'drag and drop into categories': 'Drag and drop',
28
+ 'list matching': 'List',
29
+ 'list ordering': 'List',
30
+ 'list sorting': 'List',
31
+ 'essay response - rich text': 'Constructed response',
32
+ 'essay response - basic': 'Constructed response',
33
+ 'essay response - math': 'Constructed response',
34
+ 'short text response': 'Constructed response',
35
+ 'upload response': 'Recorded response',
36
+ 'audio response': 'Recorded response',
37
+ 'video response': 'Recorded response',
38
+ 'highlight': 'Highlight',
39
+ 'highlight image': 'Highlight',
40
+ 'feedback scale': 'Miscellaneous',
41
+ }
42
+
43
+ const steps = {
44
+ //TODO: Need to update this for all question types on high priority
45
+ selectQuestionType: (questionType) => {
46
+ const questionCategory = questionTypeCategoryMap[questionType];
47
+ selectQuestionResourceToolPage.questionTypeCategory()
48
+ .contains(questionCategory)
49
+ .click();
50
+ selectQuestionResourceToolPage.questionTypeOptionTitle(questionType)
51
+ .click();
52
+ },
53
+
54
+ selectResourceType: (resourceCategory) => {
55
+ selectQuestionResourceToolPage.resourceTypeCategory()
56
+ .contains(resourceCategory)
57
+ .click();
58
+ }
59
+ }
60
+
61
+ export const selectQuestionResourceToolPage = {
62
+ ...selectors,
63
+ steps
64
+ }
@@ -0,0 +1,197 @@
1
+ import { questionInstructionsComponent, scoringSectionBase, createQuestionBasePage, additionalSettingsPanel, commonComponents, autoScoredPreviewBase, autoScoredSetCorrectAnswerSection, autoScoredScoringSection, autoScoredAdditionalSettings, specialCharactersFlyoutComponent, specialAndCustomSpecialCharactersComponent, previewScoringAndShowCorrectAnswerComponent } from "./components/";
2
+ import { studentResponseAndLayoutComponent } from "./components/studentResponseAreaAndLayoutComponent";
3
+ const css = Cypress.env('css');
4
+
5
+ const selectors = {
6
+ ...scoringSectionBase,
7
+ ...createQuestionBasePage,
8
+ ...additionalSettingsPanel,
9
+ ...questionInstructionsComponent,
10
+ ...commonComponents,
11
+ ...autoScoredSetCorrectAnswerSection,
12
+ ...autoScoredAdditionalSettings,
13
+ ...autoScoredPreviewBase,
14
+ ...specialCharactersFlyoutComponent,
15
+ ...specialAndCustomSpecialCharactersComponent,
16
+ ...previewScoringAndShowCorrectAnswerComponent,
17
+ setCorrectAnswerResponseField: () => cy.get('.short-text-response-input-field input'),
18
+ setCorrectAnswerResponseFieldWrapper: () => cy.get('.short-text-response-input-field input').parents('.MuiTextField-root'),
19
+ exactRadioOptionLabel: () => cy.get('.ngie-radio-label').eq(0),
20
+ containsTextRadioOptionLabel: () => cy.get('.ngie-radio-label').eq(1),
21
+ caseSensitiveCheckboxLabel: () => cy.get('[data-ngie-testid="case-sensitive-checkbox"] .MuiFormControlLabel-label'),
22
+ ignoreSpacesBeforeAndAfterCheckboxLabel: () => cy.get('[data-ngie-testid="ignore-spaces-before-and-after-checkbox"] .MuiFormControlLabel-label').eq(1),
23
+ exactRadioButton: () => cy.get('input[aria-label="Exact"]'),
24
+ containsTextRadioButton: () => cy.get('input[aria-label="Contains text"]'),
25
+ caseSensitiveCheckbox: () => cy.get('[data-ngie-testid="case-sensitive-checkbox"] input'),
26
+ ignoreSpacesBeforeAndAfterCheckbox: () => cy.get('[data-ngie-testid="ignore-spaces-before-and-after-checkbox"] input'),
27
+ previewTabResponseField: () => cy.get('[class*="edit-question-preview-wrapper"] .short-text-preview-response-input-field input'),
28
+ previewTabResponseFieldWrapper: () => cy.get('[class*="edit-question-preview-wrapper"] .short-text-preview-response-input-field input').parents('.MuiTextField-root'),
29
+ //Preview tab
30
+ previewTabCorrectAnswerContainer: () => cy.get('[class*="ShortTextResponsestyles__CorrectAnswerWrapper"]'),
31
+ previewTabCorrectAnswerLabel: () => cy.get('[class*="ShortTextResponsestyles__CorrectAnswerLabel"]'),
32
+ previewTabCorrectAnswerResponse: () => cy.get('[class*="ShortTextResponsestyles__CorrectAnswerValueWrapper"]'),
33
+ previewTabResponseFieldSpecialCharactersButton: () => cy.get('.cloze-with-text-response-preview-wrapper .custon-special-character-button'),
34
+ //Additional settings
35
+ ariaLabelLabel: () => cy.get('[class*="ShortTextResponsestyle__AriaLabelWrapper"] .text-label'),
36
+ ariaLabelInputField: () => cy.get('.input-field [aria-label="ARIA label"]'),
37
+ placeholderTextLabel: () => cy.get('[class*="ShortTextResponsestyle__PlaceholderWrapper"] .text-label'),
38
+ placeholderTextInputField: () => cy.get('input[aria-label="Placeholder Text"]'),
39
+ typeOfAnswerInputLabel: () => cy.get('#Type-of-Answer-input-dropdown-label'),
40
+ typeOfAnswerInputDropdown: () => cy.get('#Type-of-Answer-input-select'),
41
+ typeOfAnswerInputDropdownListOptions: (optionNumber) => cy.get('[aria-labelledby*="Type-of-Answer-input"] .dropdown-menu-item').eq(optionNumber),
42
+ setCharacterLimitLabel: () => cy.get('label[aria-labelledby="Set character limit"]'),
43
+ setCharacterLimitInputField: () => cy.get('input[aria-label="Set character limit"]'),
44
+ spellCheckLabel: () => cy.get('[data-ngie-testid="spell-check-checkbox"] .MuiFormControlLabel-label'),
45
+ spellCheckCheckbox: () => cy.get('[data-ngie-testid="spell-check-checkbox"] input')
46
+ }
47
+
48
+ const steps = {
49
+ ...createQuestionBasePage.steps,
50
+ ...questionInstructionsComponent.steps,
51
+ ...scoringSectionBase.steps,
52
+ ...additionalSettingsPanel.steps,
53
+ ...autoScoredSetCorrectAnswerSection.steps,
54
+ ...autoScoredAdditionalSettings.steps,
55
+ ...autoScoredPreviewBase.steps,
56
+ ...specialCharactersFlyoutComponent.steps,
57
+ verifyCorrectOptionCheckmarkIcon: () => {
58
+ autoScoredPreviewBase.correctIcon()
59
+ .should('be.visible');
60
+ },
61
+
62
+ verifyIncorrectOptionCrossmarkIcon: () => {
63
+ autoScoredPreviewBase.incorrectIcon()
64
+ .should('be.visible');
65
+ },
66
+
67
+ verifyCorrectAnswerResponsesInCorrectAnswerContainerAndCount: (correctAnswer) => {
68
+ shortTextResponsePage.previewTabCorrectAnswerContainer()
69
+ .should('be.visible');
70
+ shortTextResponsePage.previewTabCorrectAnswerResponse()
71
+ .verifyInnerText(correctAnswer)
72
+ shortTextResponsePage.previewTabCorrectAnswerResponse()
73
+ .should('have.length', 1);
74
+ }
75
+ }
76
+
77
+ const tests = {
78
+ ...commonComponents.tests,
79
+ ...createQuestionBasePage.tests,
80
+ ...questionInstructionsComponent.tests,
81
+ ...additionalSettingsPanel.tests,
82
+ ...scoringSectionBase.tests,
83
+ ...autoScoredSetCorrectAnswerSection.tests,
84
+ ...autoScoredScoringSection.tests,
85
+ ...autoScoredAdditionalSettings.tests,
86
+ ...specialCharactersFlyoutComponent.tests,
87
+ ...specialAndCustomSpecialCharactersComponent.tests,
88
+ ...previewScoringAndShowCorrectAnswerComponent.tests,
89
+ ...studentResponseAndLayoutComponent.tests,
90
+ verifyAnswerInputScoreAndCorrectIncorrectAnswerLabel: (answerInput, score, isCorrect) => {
91
+ shortTextResponsePage.previewTabResponseField()
92
+ .clear()
93
+ .type(answerInput);
94
+ previewScoringAndShowCorrectAnswerComponent.previewScoreText()
95
+ .verifyInnerText(score);
96
+ autoScoredPreviewBase.checkAnswerButton()
97
+ .click();
98
+ if (isCorrect) {
99
+ autoScoredPreviewBase.correctIcon()
100
+ .should('be.visible');
101
+ } else {
102
+ autoScoredPreviewBase.incorrectIcon()
103
+ .should('be.visible');
104
+ };
105
+ },
106
+
107
+ verifySetCorrectAnswerTabContentsAndFunctionality: (tabName) => {
108
+ it(`CSS of ${tabName} contents`, { tags: 'css' }, () => {
109
+ shortTextResponsePage.setCorrectAnswerResponseField()
110
+ .verifyCSS(css.color.text, css.fontSize.default, css.fontWeight.regular);
111
+ });
112
+
113
+ it('By default, an empty points input field and a correct answer response field', () => {
114
+ shortTextResponsePage.pointsInputField()
115
+ .should('have.value', '');
116
+ shortTextResponsePage.setCorrectAnswerResponseField()
117
+ .should('be.visible');
118
+ });
119
+
120
+ it('User should be able to enter text in the empty response field', () => {
121
+ shortTextResponsePage.setCorrectAnswerResponseField()
122
+ .type('Lorem Ipsum')
123
+ .should('have.value', 'Lorem Ipsum');
124
+ });
125
+
126
+ it(`When the user focuses in and out of the empty correct answer response field, \'Error: Please set a correct answer.\' validation error message should be thrown along with an error icon on the \'${tabName}\'`, () => {
127
+ cy.log('Pre-step : Clearing the correct answer response field')
128
+ shortTextResponsePage.setCorrectAnswerResponseField()
129
+ .clear();
130
+ cy.get('body')
131
+ .click();
132
+ commonComponents.errorMessage()
133
+ .should('have.text', 'Error: Please set a correct answer.');
134
+ if (tabName == 'Correct tab') {
135
+ autoScoredSetCorrectAnswerSection.correctTab()
136
+ .within(() => {
137
+ autoScoredSetCorrectAnswerSection.setCorrectAnswerErrorIcon()
138
+ .should('be.visible');
139
+ });
140
+ } else {
141
+ autoScoredSetCorrectAnswerSection.alternateAnswerTab(1)
142
+ .within(() => {
143
+ autoScoredSetCorrectAnswerSection.setCorrectAnswerErrorIcon()
144
+ .should('be.visible');
145
+ });
146
+ };
147
+ });
148
+
149
+ autoScoredSetCorrectAnswerSection.tests.verifyCSSAndA11yOfAutoScoredSetCorrectAnswerErrorMessage();
150
+
151
+ it('CSS of response field error state', { tags: 'css' }, () => {
152
+ shortTextResponsePage.setCorrectAnswerResponseField()
153
+ .should('have.css', 'background-color', css.color.errorFieldBg)
154
+ .parent('.short-text-response-input-field')
155
+ .find('fieldset')
156
+ .should('have.css', 'border', `1px solid ${css.color.errorFieldBorder}`)
157
+ });
158
+
159
+ it('Accessibility of response field error state', { tags: 'a11y' }, () => {
160
+ cy.checkAccessibility(shortTextResponsePage.setCorrectAnswerResponseField().parents('[class*="ShortTextResponsestyles__ResponseFieldSpecialCharacterButtonWrapper"]'));
161
+ });
162
+
163
+ it('When the user has added text in correct answer response field, the error message should disappear', () => {
164
+ shortTextResponsePage.setCorrectAnswerResponseField()
165
+ .type('dolor sit amet')
166
+ .should('have.value', 'dolor sit amet');
167
+ commonComponents.errorMessage()
168
+ .should('not.exist');
169
+ });
170
+
171
+ autoScoredSetCorrectAnswerSection.tests.verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty(tabName);
172
+ },
173
+
174
+ verifyMinimumScoreAwardedForIncorrectAnswer: (totalPoints) => {
175
+ it('When user has provided minimum score awarded (if attempted) points, then in Preview tab on entering incorrect answer, minimum score should be provided for the question', () => {
176
+ cy.log('Switch to edit tab and set minimum score if attempted points')
177
+ createQuestionBasePage.steps.switchToEditTab();
178
+ scoringSectionBase.minimumScoreIfAttemptedInputField()
179
+ .type('1')
180
+ .should('have.value', '1');
181
+ createQuestionBasePage.steps.switchToPreviewTab()
182
+ shortTextResponsePage.previewTabResponseField()
183
+ .type('Incorrect answer')
184
+ .blur();
185
+ previewScoringAndShowCorrectAnswerComponent.previewScoreText()
186
+ .then(($points) => {
187
+ expect($points.text()).to.equal(`1/${totalPoints}`);
188
+ });
189
+ });
190
+ }
191
+ }
192
+
193
+ export const shortTextResponsePage = {
194
+ ...selectors,
195
+ steps,
196
+ tests
197
+ }