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,594 @@
1
+ import constants from "../../fixtures/constants";
2
+ import utilities from "../../support/helpers/utilities";
3
+ import { dialogBoxBase } from "../dialogBoxBase";
4
+ import { commonComponents } from "./commonComponents";
5
+ const css = Cypress.env('css');
6
+
7
+ const selector = {
8
+ uploadCloudIcon: () => cy.get('.upload-question-upload-cloud-icon-wrapper'),
9
+ dragAndDropFilesHereText: () => cy.get('.drag-and-drop-file-text'),
10
+ fileUploadOptionsLabel: () => cy.get('.file-input-label'),
11
+ deviceLink: () => cy.get('.icon-Device'),
12
+ sourceURLIcon: () => cy.get('[class*="SourceUrlWrapper"]'),
13
+ supportedFileFormatLabel: () => cy.get('.supported-file-text'),
14
+ supportedFileFormatInfoIcon: () => cy.get('.supported-file-icon-wrapper'),
15
+ sourceURLText: () => cy.get('.icon-Link'),
16
+ editImageButton: () => cy.get('.edit-delete-btn-wrapper button').eq(0),
17
+ deleteImageButton: () => cy.get('.edit-delete-btn-wrapper button').eq(1),
18
+ //Upload image popup
19
+ inputTypeFile: () => cy.get('input[type="file"]'),
20
+ uploadImagePopup: () => cy.get('[aria-describedby="alert-dialog-description"]'),
21
+ imagePopupTitle: () => cy.get('#alert-dialog-title'),
22
+ imagePopupPreviewLabel: () => cy.get('.preview-label-wrapper'),
23
+ imagePopupWidthLabel: () => cy.get('[aria-describedby="alert-dialog-description"] .highlight-image-property-label.text-label').eq(0),
24
+ imagePopupWidthInputField: () => cy.get('[aria-describedby="alert-dialog-description"] .highlight-image-input-field input').eq(0),
25
+ imagePopupHeightLabel: () => cy.get('[aria-describedby="alert-dialog-description"] .highlight-image-property-label.text-label').eq(1),
26
+ imagePopupHeightInputField: () => cy.get('[aria-describedby="alert-dialog-description"] .highlight-image-input-field input').eq(1),
27
+ buttonAspectRatio: () => cy.get('[class*="LockIconWrapper"] button'),
28
+ buttonResetDimensions: () => cy.get('[class*="ResetIconWrapper"] button'),
29
+ imagePopupButtonCancel: () => cy.get('.compact-popup-action-button-wrapper button').eq(0),
30
+ imagePopupButtonOk: () => cy.get('.compact-popup-action-button-wrapper button').eq(1),
31
+ imagePopupButtonReplace: () => cy.get('.preview-replace-button'),
32
+ imagePopupImagePreview: () => cy.get('[class*="ImagePreviewBox"]'),
33
+ addSourceURLPopupSourceURLLabel: () => cy.get('.dialog-content .inline-text-property-label'),
34
+ addSourceURLPopupSourceURLInputField: () => cy.get('.dialog-content .inline-text-question-prefix-wrapper input'),
35
+ deleteImagePopupButtonCancel: () => cy.get('.delete-action-btn-wrapper button').eq(0),
36
+ deleteImagePopupButtonDelete: () => cy.get('.delete-action-btn-wrapper button').eq(1)
37
+ }
38
+
39
+ const steps = {
40
+ /**
41
+ * @param {string} file name of the file in fixtures/upload folder
42
+ * @description this function uploads a file
43
+ */
44
+ uploadFile: (file) => {
45
+ uploadImageSectionComponent.inputTypeFile()
46
+ .attachFile(`uploads/${file}`);
47
+ uploadImageSectionComponent.uploadImagePopup()
48
+ .should('exist');
49
+ },
50
+
51
+ /**
52
+ * @description this function verifies the reset dimensions button is disabled
53
+ */
54
+ verifyButtonResetDimensionsDisabled: () => {
55
+ uploadImageSectionComponent.buttonResetDimensions()
56
+ .should('be.disabled');
57
+ },
58
+
59
+ /**
60
+ * @description this function verifies the reset dimensions button is enabled
61
+ */
62
+ verifyButtonResetDimensionsEnabled: () => {
63
+ uploadImageSectionComponent.buttonResetDimensions()
64
+ .should('be.enabled');
65
+ },
66
+
67
+ /**
68
+ * @description this function resets dimensions
69
+ */
70
+ resetDimensions: () => {
71
+ uploadImageSectionComponent.buttonResetDimensions()
72
+ .click();
73
+ },
74
+
75
+ /**
76
+ * @description this function locks aspect ratio
77
+ */
78
+ lockAspectRatio: () => {
79
+ uploadImageSectionComponent.buttonAspectRatio()
80
+ .click();
81
+ steps.verifyButtonAspectRatioLocked();
82
+ },
83
+
84
+ /**
85
+ * @description this function unlocks aspect ratio
86
+ */
87
+ unlockAspectRatio: () => {
88
+ uploadImageSectionComponent.buttonAspectRatio()
89
+ .click();
90
+ steps.verifyButtonAspectRatioUnlocked();
91
+ },
92
+
93
+ /**
94
+ * @description this function verifies aspect ratio is locked
95
+ */
96
+ verifyButtonAspectRatioLocked: () => {
97
+ uploadImageSectionComponent.buttonAspectRatio()
98
+ .should('have.attr', 'aria-label', 'Locked aspect ratio')
99
+ },
100
+
101
+ /**
102
+ * @description this function verifies aspect ratio is unlocked
103
+ */
104
+ verifyButtonAspectRatioUnlocked: () => {
105
+ uploadImageSectionComponent.buttonAspectRatio()
106
+ .should('have.attr', 'aria-label', 'Unlocked aspect ratio')
107
+ },
108
+
109
+ /**
110
+ * @param {number} imageWidth width of the image
111
+ * @description this function verifies width input field value
112
+ */
113
+ verifyWidthInputFieldValueInImagePopup: (imageWidth) => {
114
+ uploadImageSectionComponent.imagePopupWidthInputField()
115
+ .should('have.value', imageWidth);
116
+ },
117
+
118
+ /**
119
+ * @param {number} imageHeight width of the image
120
+ * @description this function verifies height input field value
121
+ */
122
+ verifyHeightInputFieldValueInImagePopup: (imageHeight) => {
123
+ uploadImageSectionComponent.imagePopupHeightInputField()
124
+ .should('have.value', imageHeight);
125
+ },
126
+
127
+ /**
128
+ * @param {number} imageHeight height of image
129
+ * @description this function updates height input field value
130
+ */
131
+ updateImageHeight: (imageHeight) => {
132
+ uploadImageSectionComponent.imagePopupHeightInputField()
133
+ .clear()
134
+ .type(imageHeight);
135
+ steps.verifyHeightInputFieldValueInImagePopup(imageHeight);
136
+ },
137
+
138
+ /**
139
+ * @param {number} imageWidth width of image
140
+ * @description this function updates width input field value
141
+ */
142
+ updateImageWidth: (imageWidth) => {
143
+ uploadImageSectionComponent.imagePopupWidthInputField()
144
+ .clear()
145
+ .type(imageWidth);
146
+ steps.verifyWidthInputFieldValueInImagePopup(imageWidth);
147
+ },
148
+
149
+ /**
150
+ * @param {*} imageWidth width of image in image popup preview section
151
+ * @param {*} imageHeight height of image in image popup preview section
152
+ * @description this function verifies height and width of image in image popup
153
+ */
154
+ verifyImagePopupImageHeightWidth: (imageWidth, imageHeight) => {
155
+ uploadImageSectionComponent.imagePopupImagePreview()
156
+ .find('img')
157
+ .should('have.attr', 'width', imageWidth)
158
+ .and('have.attr', 'height', imageHeight);
159
+ },
160
+
161
+ /**
162
+ * @description this functions clicks on cancel button of image popup
163
+ */
164
+ clickOnImagePopupCancelButton: () => {
165
+ uploadImageSectionComponent.imagePopupButtonCancel()
166
+ .click();
167
+ uploadImageSectionComponent.uploadImagePopup()
168
+ .should('not.exist');
169
+ },
170
+
171
+ /**
172
+ * @description this functions clicks on ok button of image popup
173
+ */
174
+ clickOnImagePopupOkButton: () => {
175
+ uploadImageSectionComponent.imagePopupButtonOk()
176
+ .click();
177
+ uploadImageSectionComponent.uploadImagePopup()
178
+ .should('not.exist');
179
+ },
180
+
181
+ /**
182
+ * @description this function verifies the uploaded image in image popup
183
+ */
184
+ verifyUploadedImageInImagePopup: () => {
185
+ uploadImageSectionComponent.imagePopupImagePreview()
186
+ .find('img')
187
+ .should('exist');
188
+ },
189
+
190
+ /**
191
+ * @param {string} file name of the file in fixtures/upload folder
192
+ * @description this function replaces the uploaded file in the upload image popup
193
+ */
194
+ replaceImage: (file) => {
195
+ uploadImageSectionComponent.uploadImagePopup()
196
+ .within(() => {
197
+ uploadImageSectionComponent.inputTypeFile()
198
+ .attachFile(`uploads/${file}`);
199
+ })
200
+ },
201
+
202
+ /**
203
+ * @description this function clicks on the source URL text in image section
204
+ */
205
+ clickOnSourceURL: () => {
206
+ uploadImageSectionComponent.sourceURLText()
207
+ .click();
208
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'visible');
209
+ },
210
+
211
+ //Failing due to https://redmine.zeuslearning.com/issues/542849
212
+ /**
213
+ * @param sourceUrl sourceURL of the image to be uploaded
214
+ * @description this image uploads an image using the source url
215
+ */
216
+ uploadImageUsingSourceURL: (sourceUrl) => {
217
+ uploadImageSectionComponent.addSourceURLPopupSourceURLInputField()
218
+ .type(sourceUrl)
219
+ .blur();
220
+ uploadImageSectionComponent.addSourceURLPopupSourceURLInputField()
221
+ .should('have.value', sourceUrl);
222
+ uploadImageSectionComponent.imagePopupImagePreview()
223
+ .find('img')
224
+ .should('have.attr', 'src', sourceUrl);
225
+ },
226
+
227
+ clickOnEditImageButton: () => {
228
+ uploadImageSectionComponent.editImageButton()
229
+ .click()
230
+ },
231
+
232
+
233
+ clickOnDeleteImageButton: () => {
234
+ uploadImageSectionComponent.deleteImageButton()
235
+ .click();
236
+ },
237
+
238
+ clickOnCancelButtonInDeleteImagePopup: () => {
239
+ uploadImageSectionComponent.deleteImagePopupButtonCancel()
240
+ .click();
241
+ dialogBoxBase.dialogBox()
242
+ .should('not.exist');
243
+ },
244
+
245
+ clickOnDeleteButtonInDeleteImagePopup: () => {
246
+ uploadImageSectionComponent.deleteImagePopupButtonDelete()
247
+ .click();
248
+ dialogBoxBase.dialogBox()
249
+ .should('not.exist');
250
+ }
251
+ }
252
+
253
+ const tests = {
254
+ /**
255
+ * @description this function verifies upload image popup title
256
+ */
257
+ verifyUploadImagePopupImageTitle: () => {
258
+ it('When user uploads an image using device, a popup should be displayed with title \'Image\'', () => {
259
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
260
+ utilities.verifyInnerText(uploadImageSectionComponent.imagePopupTitle(), 'Image');
261
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.imagePopupTitle(), 'visible');
262
+ });
263
+ },
264
+
265
+ /**
266
+ * @description this function verifies replace button in upload image popup
267
+ */
268
+ verifyButtonReplaceInImagePopup: () => {
269
+ it('\'Replace\' button should be displayed', () => {
270
+ utilities.verifyInnerText(uploadImageSectionComponent.imagePopupButtonReplace(), 'Replace');
271
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.imagePopupButtonReplace(), 'visible');
272
+ });
273
+
274
+ it('CSS of Replace button', { tags: 'css' }, () => {
275
+ utilities.verifyCSS(uploadImageSectionComponent.imagePopupButtonReplace(), {
276
+ 'color': css.color.successBtn,
277
+ 'font-size': css.fontSize.default,
278
+ 'background-color': css.color.successBtnBg,
279
+ 'font-weight': css.fontWeight.semibold
280
+ });
281
+ });
282
+
283
+ //Note: a11y covered in uploadImageEditTabContents function
284
+ },
285
+
286
+ /**
287
+ * @description this function checks edit tab contents in upload image section
288
+ */
289
+ uploadImageEditTabContents: () => {
290
+ it('In the highlight image area should have a cloud icon and text \'Drag & Drop files here or browse files on your device or insert a source URL\' should be displayed', () => {
291
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadCloudIcon(), 'visible');
292
+ utilities.verifyInnerText(uploadImageSectionComponent.dragAndDropFilesHereText(), 'Drag & Drop files here');
293
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.dragAndDropFilesHereText(), 'visible');
294
+ utilities.verifyInnerText(uploadImageSectionComponent.fileUploadOptionsLabel(), 'or browse files on your device or insert a \nsource URL');
295
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.fileUploadOptionsLabel(), 'visible');
296
+ });
297
+
298
+ it('Computer and link icons should be displayed before link texts \'device\' and \'source URL\' respectively', () => {
299
+ uploadImageSectionComponent.deviceLink()
300
+ .verifyPseudoClassBeforeProperty('content', '""');
301
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.sourceURLIcon(), 'visible');
302
+ });
303
+
304
+ it('When user hovers over \'device\' then a tooltip text \'Select a file from device\' should be displayed and on removing focus the tooltip should disappear', () => {
305
+ uploadImageSectionComponent.deviceLink()
306
+ .trigger('mouseover')
307
+ commonComponents.tooltipText()
308
+ .verifyInnerText('Select a file from device');
309
+ uploadImageSectionComponent.deviceLink()
310
+ .trigger('mouseout')
311
+ });
312
+
313
+ it('CSS of Edit tab contents', { tags: 'css' }, () => {
314
+ utilities.verifyCSS((uploadImageSectionComponent.uploadCloudIcon().find('path')), {
315
+ 'fill': css.color.secondaryBtn
316
+ });
317
+ utilities.verifyCSS((uploadImageSectionComponent.dragAndDropFilesHereText()), {
318
+ 'color': css.color.text,
319
+ 'font-size': css.fontSize.huge,
320
+ 'font-weight': css.fontWeight.bold
321
+ });
322
+ utilities.verifyCSS((uploadImageSectionComponent.fileUploadOptionsLabel()), {
323
+ 'color': css.color.text,
324
+ 'font-size': css.fontSize.heading,
325
+ 'font-weight': css.fontWeight.semibold
326
+ });
327
+ uploadImageSectionComponent.deviceLink()
328
+ .verifyPseudoClassBeforeProperty('color', css.color.text);
329
+ utilities.verifyCSS((uploadImageSectionComponent.sourceURLIcon()), {
330
+ 'color': css.color.text
331
+ });
332
+ utilities.verifyCSS((uploadImageSectionComponent.supportedFileFormatLabel()), {
333
+ 'color': css.color.text,
334
+ 'font-size': css.fontSize.normal,
335
+ 'font-weight': css.fontWeight.regular
336
+ });
337
+ utilities.verifyCSS((uploadImageSectionComponent.supportedFileFormatInfoIcon().find('path')), {
338
+ 'fill': css.color.activeButtons
339
+ });
340
+ });
341
+
342
+ it('Accessibility of edit tab contents', { tags: 'a11y' }, () => {
343
+ cy.checkAccessibility(uploadImageSectionComponent.uploadCloudIcon().parents('.upload-file-content'));
344
+ });
345
+
346
+ //Failing due to - https://redmine.zeuslearning.com/issues/542758
347
+ it('\'Supported file formats\' label should be displayed along with an info icon, hovering over the supported file formats info icon a tooltip should be displayed with list of all the supported file types', () => {
348
+ utilities.verifyInnerText(uploadImageSectionComponent.supportedFileFormatLabel(), 'Supported file formats');
349
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.supportedFileFormatLabel(), 'visible');
350
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.supportedFileFormatInfoIcon(), 'visible');
351
+ uploadImageSectionComponent.supportedFileFormatInfoIcon()
352
+ .verifyTooltip('Supported file formats: JPG, JPEG, PNG, GIF, HEIC, HEIF and SVG.');
353
+ });
354
+
355
+ it('CSS of Supported file types tooltip', { tags: 'css' }, () => {
356
+ uploadImageSectionComponent.supportedFileFormatInfoIcon()
357
+ .trigger('mouseover')
358
+ utilities.verifyCSS(commonComponents.tooltipText(), {
359
+ 'color': css.color.whiteText,
360
+ 'font-size': css.fontSize.small,
361
+ 'font-weight': css.fontWeight.light
362
+ });
363
+ uploadImageSectionComponent.supportedFileFormatInfoIcon()
364
+ .trigger('mouseout')
365
+ });
366
+
367
+ it('Accessibility of supported file types tooltip', { tags: 'a11y' }, () => {
368
+ uploadImageSectionComponent.supportedFileFormatInfoIcon()
369
+ .trigger('mouseover')
370
+ cy.checkAccessibility(commonComponents.tooltipText());
371
+ uploadImageSectionComponent.supportedFileFormatInfoIcon()
372
+ .trigger('mouseout')
373
+ });
374
+ },
375
+
376
+ /**
377
+ * @param {*} imageWidth width of image in image popup preview section
378
+ * @param {*} imageHeight height of image in image popup preview section
379
+ * @description this function verifies content of upload image popup
380
+ */
381
+ uploadImagePopupContents: (imageWidth, imageHeight) => {
382
+ it('\'Preview\' title should be displayed with the uploaded image in popup', () => {
383
+ utilities.verifyInnerText(uploadImageSectionComponent.imagePopupPreviewLabel(), 'Preview');
384
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.imagePopupPreviewLabel(), 'visible');
385
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
386
+ });
387
+
388
+ it('\'Height\' and \'Width\' labels and input fields should be displayed and the input fields should be prefilled with the height and width of the image', () => {
389
+ utilities.verifyInnerText(uploadImageSectionComponent.imagePopupWidthLabel(), 'Width (px)');
390
+ uploadImageSectionComponent.steps.verifyWidthInputFieldValueInImagePopup(imageWidth);
391
+ utilities.verifyInnerText(uploadImageSectionComponent.imagePopupHeightLabel(), 'Height (px)');
392
+ uploadImageSectionComponent.steps.verifyHeightInputFieldValueInImagePopup(imageHeight);
393
+ });
394
+
395
+ it('\'Aspect ratio\' and \'Reset dimensions\' buttons should be displayed, by default aspect ratio should be locked and reset dimensions should be disabled', () => {
396
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.buttonAspectRatio(), 'visible');
397
+ uploadImageSectionComponent.steps.verifyButtonAspectRatioLocked();
398
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.buttonResetDimensions(), 'visible');
399
+ uploadImageSectionComponent.steps.verifyButtonResetDimensionsDisabled();
400
+ });
401
+
402
+ it('\'Cancel\' and \'Ok\' buttons should be displayed', () => {
403
+ utilities.verifyInnerText(uploadImageSectionComponent.imagePopupButtonCancel(), 'Cancel');
404
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.imagePopupButtonCancel(), 'visible');
405
+ utilities.verifyInnerText(uploadImageSectionComponent.imagePopupButtonOk(), 'Ok');
406
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.imagePopupButtonOk(), 'visible');
407
+ });
408
+
409
+ it('CSS of Image popup contents', { tags: 'css' }, () => {
410
+ utilities.verifyCSS(uploadImageSectionComponent.imagePopupTitle().find('span'), {
411
+ 'color': css.color.flyoutTitle,
412
+ 'font-size': css.fontSize.heading,
413
+ 'font-weight': css.fontWeight.bold
414
+ });
415
+ utilities.verifyCSS(uploadImageSectionComponent.imagePopupPreviewLabel(), {
416
+ 'color': css.color.labels,
417
+ 'font-size': css.fontSize.normal,
418
+ 'font-weight': css.fontWeight.semibold
419
+ });
420
+ utilities.verifyCSS(uploadImageSectionComponent.imagePopupPreviewLabel(), {
421
+ 'color': css.color.labels,
422
+ 'font-size': css.fontSize.normal,
423
+ 'font-weight': css.fontWeight.semibold
424
+ });
425
+ utilities.verifyCSS(uploadImageSectionComponent.imagePopupImagePreview(), {
426
+ 'border': `1px solid ${css.color.secondaryBtnBorder}`,
427
+ });
428
+ utilities.verifyCSS(uploadImageSectionComponent.imagePopupButtonOk(), {
429
+ 'color': css.color.primaryBtn,
430
+ 'font-size': css.fontSize.default,
431
+ 'font-weight': css.fontWeight.semibold,
432
+ 'background-color': css.color.primaryBtnBg
433
+ });
434
+ utilities.verifyCSS(uploadImageSectionComponent.imagePopupButtonCancel(), {
435
+ 'color': css.color.secondaryBtn,
436
+ 'font-size': css.fontSize.default,
437
+ 'font-weight': css.fontWeight.semibold,
438
+ 'background-color': css.color.transparent
439
+ });
440
+ });
441
+
442
+ it('Accessibility of Image popup', { tags: 'a11y' }, () => {
443
+ cy.checkAccessibility(uploadImageSectionComponent.uploadImagePopup());
444
+ });
445
+ },
446
+
447
+ /**
448
+ * @param {*} imageWidth width of image in image popup preview section
449
+ * @param {*} imageHeight height of image in image popup preview section
450
+ * @description this function verifies functionality of upload image popup height, width, aspect ratio and reset dimensions
451
+ */
452
+ uploadImageHeightWidthAspectRatioAndResetDimensionsFunctionality: (imageWidth, imageHeight) => {
453
+ it('When aspect ratio is locked and user changes the value in width input field, the height input field should also be updated accordingly and the dimensions should be updated in the image popup preview section', () => {
454
+ cy.log('Updating dimensions in the image popup')
455
+ uploadImageSectionComponent.steps.unlockAspectRatio();
456
+ uploadImageSectionComponent.steps.updateImageWidth(500);
457
+ uploadImageSectionComponent.steps.updateImageHeight(500);
458
+ uploadImageSectionComponent.steps.lockAspectRatio();
459
+ uploadImageSectionComponent.steps.verifyButtonAspectRatioLocked();
460
+ uploadImageSectionComponent.steps.updateImageHeight(200);
461
+ uploadImageSectionComponent.steps.verifyWidthInputFieldValueInImagePopup(200);
462
+ uploadImageSectionComponent.steps.updateImageWidth(400);
463
+ uploadImageSectionComponent.steps.verifyHeightInputFieldValueInImagePopup(400);
464
+ uploadImageSectionComponent.steps.verifyImagePopupImageHeightWidth(400, 400);
465
+ });
466
+
467
+ it('When user unlocks the aspect ratio button and changes the value in the width input field, the height input field should not change', () => {
468
+ uploadImageSectionComponent.steps.unlockAspectRatio();
469
+ uploadImageSectionComponent.steps.updateImageHeight(200);
470
+ uploadImageSectionComponent.steps.verifyWidthInputFieldValueInImagePopup(400);
471
+ });
472
+
473
+ it('When user locks the aspect ratio button and changes the value in the width input field, the height input field should be updated accordingly to maintain the updated aspect ratio', () => {
474
+ uploadImageSectionComponent.steps.lockAspectRatio();
475
+ uploadImageSectionComponent.steps.updateImageWidth(600);
476
+ uploadImageSectionComponent.steps.verifyHeightInputFieldValueInImagePopup(300);
477
+ });
478
+
479
+ it('When user edits the height or width of the image the \'Reset dimensions\' button should be enabled', () => {
480
+ uploadImageSectionComponent.steps.verifyButtonResetDimensionsEnabled();
481
+ });
482
+
483
+ it('When user selects the \'Reset dimensions\' button the height and width should be reset to the original value', () => {
484
+ uploadImageSectionComponent.steps.resetDimensions();
485
+ uploadImageSectionComponent.steps.verifyWidthInputFieldValueInImagePopup(imageWidth);
486
+ uploadImageSectionComponent.steps.verifyHeightInputFieldValueInImagePopup(imageHeight);
487
+ });
488
+ },
489
+
490
+ /**
491
+ * @description this function verifies replace button functionality
492
+ */
493
+ uploadImageReplaceButtonFunctionality: () => {
494
+ it('User should be able to \'Replace\' the image in the \'Image\' popup', () => {
495
+ uploadImageSectionComponent.steps.replaceImage('sample1.jpg');
496
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
497
+ uploadImageSectionComponent.steps.verifyHeightInputFieldValueInImagePopup(225);
498
+ uploadImageSectionComponent.steps.verifyWidthInputFieldValueInImagePopup(225);
499
+ });
500
+ },
501
+
502
+ /**
503
+ * @description this function verifies the title of Add source URL image popup
504
+ */
505
+ verifyUploadImageSourceURLTitle: () => {
506
+ it('When user selects source URL, a popup should be displayed with title \'Add source URL\'', () => {
507
+ uploadImageSectionComponent.steps.clickOnSourceURL();
508
+ utilities.verifyInnerText(uploadImageSectionComponent.imagePopupTitle(), 'Add source URL');
509
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.imagePopupTitle(), 'visible');
510
+ });
511
+ },
512
+
513
+ verifyUploadImageSourceURLDefaultLabelAndInputField: () => {
514
+ it('\'Source url\' label and input field should be displayed and by default it should be empty', () => {
515
+ utilities.verifyInnerText(uploadImageSectionComponent.addSourceURLPopupSourceURLLabel(), 'Source url');
516
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.addSourceURLPopupSourceURLLabel(), 'visible');
517
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.addSourceURLPopupSourceURLInputField(), 'visible');
518
+ utilities.verifyInnerText(uploadImageSectionComponent.addSourceURLPopupSourceURLInputField(), '');
519
+ });
520
+
521
+ it('When user enters a link that does not support image file then an error message \'Error: The provided URL does not link to a supported image file. Please enter a URL for a JPEG, PNG, GIF, or SVG.\' should be displayed', () => {
522
+ uploadImageSectionComponent.steps.uploadImageUsingSourceURL(Cypress.config().baseUrl);
523
+ utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: The provided URL does not link to a supported image file. Please enter a URL for a JPEG, PNG, GIF, or SVG.');
524
+ utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'visible');
525
+ });
526
+
527
+ it('When user clears the \'Source url\' input field an error message \'Error: Source URL is required.\' is displayed', () => {
528
+ uploadImageSectionComponent.addSourceURLPopupSourceURLInputField()
529
+ .clear()
530
+ .blur();
531
+ utilities.verifyInnerText(commonComponents.errorMessage(), 'Error: Source URL is required.');
532
+ utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'visible');
533
+ });
534
+
535
+ it('When user enters supported image link in \'Source url\', an image should be displayed in the image popup preview section', () => {
536
+ uploadImageSectionComponent.steps.uploadImageUsingSourceURL(constants.flowerImage);
537
+ utilities.verifyElementVisibilityState(commonComponents.errorMessage(), 'notExist');
538
+ });
539
+ },
540
+
541
+ verifyUploadImageSourceURLLabelAndInputFieldInEditSourceURLPopup: () => {
542
+ it('\'Source url\' label and input field containing source url should be displayed', () => {
543
+ utilities.verifyInnerText(uploadImageSectionComponent.addSourceURLPopupSourceURLLabel(), 'Source url');
544
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.addSourceURLPopupSourceURLLabel(), 'visible');
545
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.addSourceURLPopupSourceURLInputField(), 'visible');
546
+ uploadImageSectionComponent.addSourceURLPopupSourceURLInputField()
547
+ .should('have.value', constants.flowerImage);
548
+ });
549
+ },
550
+
551
+ verifyDeleteImagePopup: () => {
552
+ it('When user clicks on the Delete image button, a popup should be displayed with message \'Are you sure you want to delete the image?\'', () => {
553
+ uploadImageSectionComponent.steps.clickOnDeleteImageButton();
554
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
555
+ utilities.verifyInnerText(dialogBoxBase.dialogBoxTitle(), 'Delete')
556
+ utilities.verifyInnerText(dialogBoxBase.dialogBoxContent(), 'Are you sure you want to delete the image?')
557
+ utilities.verifyInnerText(dialogBoxBase.buttonReject(), 'Cancel')
558
+ utilities.verifyInnerText(dialogBoxBase.buttonAccept(), 'Delete image')
559
+ });
560
+
561
+ it('CSS of popup', { tags: 'css' }, () => {
562
+ utilities.verifyCSS(dialogBoxBase.dialogBox(), {
563
+ 'background-color': css.color.defaultBackground,
564
+ });
565
+ utilities.verifyCSS(dialogBoxBase.dialogBoxContent(), {
566
+ 'color': css.color.sectionHeading,
567
+ 'font-size': css.fontSize.default,
568
+ 'font-weight': css.fontWeight.regular
569
+ });
570
+ utilities.verifyCSS(dialogBoxBase.buttonReject(), {
571
+ 'color': css.color.secondaryBtn,
572
+ 'font-size': css.fontSize.default,
573
+ 'font-weight': css.fontWeight.semibold,
574
+ 'background-color': css.color.transparent
575
+ });
576
+ utilities.verifyCSS(dialogBoxBase.buttonAccept(), {
577
+ 'color': css.color.primaryBtn,
578
+ 'font-size': css.fontSize.default,
579
+ 'font-weight': css.fontWeight.semibold,
580
+ 'background-color': css.color.activeButtons
581
+ });
582
+ });
583
+
584
+ it('Accessibility of popup', { tags: 'a11y' }, () => {
585
+ cy.checkAccessibility(dialogBoxBase.dialogBox());
586
+ });
587
+ }
588
+ }
589
+
590
+ export const uploadImageSectionComponent = {
591
+ ...selector,
592
+ steps,
593
+ tests
594
+ }
@@ -0,0 +1,28 @@
1
+ const css = Cypress.env('css');
2
+
3
+ const selectors = {
4
+ createQuestionPageQuestionTypeHeader: () => cy.get('div[class*="HeaderComponentstyles__BlockLabel"]'),
5
+ addQuestionButton: () => cy.get('.ngie-btn-contained').contains('add question'),
6
+ addResourceAndToolsButton: () => cy.get('.ngie-btn-contained').contains('add resource and tool'),
7
+ previewTab: () => cy.get('[data-ngie-testid="preview-tab"]'),
8
+ editTab: () => cy.get('[data-ngie-testid="edit-tab"]'),
9
+ settingsButton: () => cy.get('.settingsBtn '),
10
+ viewAllQuestionsButton: () => cy.get('.view-question-resource-button-wrapper')
11
+ }
12
+
13
+ const steps = {
14
+ clickOnAddQuestion: () => {
15
+ createItemPage.addQuestionButton()
16
+ .click();
17
+ },
18
+
19
+ clickOnAddResource: () => {
20
+ createItemPage.addResourceAndToolsButton()
21
+ .click();
22
+ }
23
+ }
24
+
25
+ export const createItemPage = {
26
+ ...selectors,
27
+ steps
28
+ }