itemengine-cypress-automation 1.0.25 → 1.0.26

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,200 @@
1
+ import constants from "../../../fixtures/constants";
2
+ import { highlightImagePage } from "../../../pages";
3
+ import { uploadImageSectionComponent } from "../../../pages/components/uploadImageSectionComponent";
4
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
5
+ import utilities from "../../../support/helpers/utilities";
6
+
7
+ describe('Create Item page - Highlight image: Question instructions, edit tab contents and image popup', () => {
8
+ before(() => {
9
+ cy.loginAs('admin');
10
+ });
11
+
12
+ describe('Question instructions input field - Edit tab', () => {
13
+ abortEarlySetup();
14
+ before(() => {
15
+ cy.log('Navigating to highlight image question type');
16
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
17
+ });
18
+
19
+ highlightImagePage.tests.verifyQuestionInstructionsInputFieldEditTab();
20
+ });
21
+
22
+ describe('Question instructions input field - Preview tab', () => {
23
+ abortEarlySetup();
24
+ before(() => {
25
+ cy.log('Navigating to Highlight image question type');
26
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
27
+ });
28
+
29
+ highlightImagePage.tests.verifyQuestionInstructionsInputFieldPreviewTab();
30
+ });
31
+
32
+ describe('Highlight image - Edit tab default contents', () => {
33
+ abortEarlySetup();
34
+ before(() => {
35
+ cy.log('Navigating to highlight image question type');
36
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
37
+ });
38
+
39
+ it('\'Highlight image\' title should be displayed', () => {
40
+ utilities.verifyInnerText(highlightImagePage.highlightImageLabel(), 'Highlight image');
41
+ utilities.verifyElementVisibilityState(highlightImagePage.highlightImageLabel(), 'visible');
42
+ });
43
+
44
+ uploadImageSectionComponent.tests.uploadImageEditTabContents();
45
+ });
46
+
47
+ describe('Upload image - device popup contents', () => {
48
+ abortEarlySetup();
49
+ before(() => {
50
+ cy.log('Navigating to highlight image question type');
51
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
52
+ });
53
+
54
+ uploadImageSectionComponent.tests.verifyUploadImagePopupImageTitle();
55
+
56
+ uploadImageSectionComponent.tests.uploadImagePopupContents(500, 500);
57
+
58
+ uploadImageSectionComponent.tests.verifyButtonReplaceInImagePopup();
59
+ });
60
+
61
+ //Failing due to https://redmine.zeuslearning.com/issues/547305
62
+ describe('Upload image popup contents functionality', () => {
63
+ abortEarlySetup();
64
+ before(() => {
65
+ cy.log('Navigating to highlight image question type');
66
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
67
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
68
+ });
69
+
70
+ uploadImageSectionComponent.tests.uploadImageHeightWidthAspectRatioAndResetDimensionsFunctionality(500, 500);
71
+
72
+ uploadImageSectionComponent.tests.uploadImageReplaceButtonFunctionality();
73
+
74
+ it('When user selects the \'Cancel\' button the image should not be uploaded', () => {
75
+ uploadImageSectionComponent.steps.clickOnImagePopupCancelButton();
76
+ utilities.verifyElementVisibilityState(highlightImagePage.highlighImageCanvas(), 'notExist');
77
+ });
78
+
79
+ it('When user uploads an image and selects \'Ok\' button the image should be displayed in the highlight image section', () => {
80
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
81
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
82
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
83
+ utilities.verifyElementVisibilityState(highlightImagePage.highlighImageCanvas(), 'visible');
84
+ });
85
+ });
86
+
87
+ describe('Upload image - source URL popup contents', () => {
88
+ abortEarlySetup();
89
+ before(() => {
90
+ cy.log('Navigating to highlight image question type');
91
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
92
+ });
93
+
94
+ uploadImageSectionComponent.tests.verifyUploadImageSourceURLTitle();
95
+
96
+ uploadImageSectionComponent.tests.verifyUploadImageSourceURLDefaultLabelAndInputField();
97
+
98
+ uploadImageSectionComponent.tests.uploadImagePopupContents(650, 684);
99
+ });
100
+
101
+ describe('Upload image \'Source URL\' popup contents functionality', () => {
102
+ abortEarlySetup();
103
+ before(() => {
104
+ cy.log('Navigating to highlight image question type');
105
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
106
+ uploadImageSectionComponent.steps.clickOnSourceURL();
107
+ uploadImageSectionComponent.steps.uploadImageUsingSourceURL(constants.flowerImage);
108
+ });
109
+
110
+ uploadImageSectionComponent.tests.uploadImageHeightWidthAspectRatioAndResetDimensionsFunctionality(650, 684);
111
+
112
+ it('When user selects the \'Cancel\' button the image should not be uploaded', () => {
113
+ uploadImageSectionComponent.steps.clickOnImagePopupCancelButton();
114
+ utilities.verifyElementVisibilityState(highlightImagePage.highlighImageCanvas(), 'notExist');
115
+ });
116
+
117
+ it('When user uploads an image and selects \'Ok\' button the image should be displayed in the highlight image section', () => {
118
+ uploadImageSectionComponent.steps.clickOnSourceURL();
119
+ uploadImageSectionComponent.steps.uploadImageUsingSourceURL(constants.flowerImage);
120
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
121
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
122
+ utilities.verifyElementVisibilityState(highlightImagePage.highlighImageCanvas(), 'visible');
123
+ });
124
+ });
125
+
126
+ describe('Supported file types functionality: device popup', () => {
127
+ abortEarlySetup();
128
+ before(() => {
129
+ cy.log('Navigating to highlight image question type');
130
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
131
+ cy.barsPreLoaderWait();
132
+ });
133
+
134
+ const supportedFormatFiles = {
135
+ jpg: 'highlightImage.jpg',
136
+ jpeg: 'sample.jpeg',
137
+ png: 'image.png',
138
+ gif: 'sample.gif',
139
+ heic: 'sample.heic',
140
+ heif: 'sample.heif',
141
+ svg: 'sample.svg'
142
+ };
143
+
144
+ Object.keys(supportedFormatFiles).forEach((fileType) => {
145
+ it(`User should be able to upload ${fileType} file in the upload section using link text \'device\' and it should be displayed in the \'Set correct answer\' section and \'Preview tab\'`, () => {
146
+ uploadImageSectionComponent.steps.uploadFile(supportedFormatFiles[fileType]);
147
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
148
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
149
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
150
+ highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
151
+ highlightImagePage.steps.verifyImageUploadedInSetCorrectAnswerSection();
152
+ highlightImagePage.steps.verifyUploadedImageFormatInSetCorrectAnswerSection(fileType);
153
+ cy.log('Checking in preview tab')
154
+ highlightImagePage.steps.switchToPreviewTab();
155
+ highlightImagePage.steps.verifyUploadedImageFormatInPreviewTab(fileType);
156
+ highlightImagePage.steps.switchToEditTab();
157
+ cy.log('Post step: Delete the image')
158
+ uploadImageSectionComponent.steps.clickOnDeleteImageButton();
159
+ highlightImagePage.steps.clickOnAcceptButtonInDialogBox();
160
+ });
161
+ });
162
+ });
163
+
164
+ describe('Supported file types functionality: Source URL popup', () => {
165
+ abortEarlySetup();
166
+ before(() => {
167
+ cy.log('Navigating to highlight image question type');
168
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
169
+ cy.barsPreLoaderWait();
170
+ });
171
+
172
+ const supportedFormatFiles = {
173
+ jpg: constants.foxImageLink,
174
+ jpeg: constants.sampleJPEGLink,
175
+ png: constants.samplePNGLink,
176
+ gif: constants.sampleGIFLink,
177
+ svg: constants.sampleSVGLink
178
+ };
179
+
180
+ Object.keys(supportedFormatFiles).forEach((fileType) => {
181
+ it(`User should be able to upload ${fileType} file in the upload section using link text \'device\' and it should be displayed in the \'Set correct answer\' section and \'Preview tab\'`, () => {
182
+ uploadImageSectionComponent.steps.clickOnSourceURL();
183
+ uploadImageSectionComponent.steps.uploadImageUsingSourceURL(supportedFormatFiles[fileType]);
184
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
185
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
186
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
187
+ highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
188
+ highlightImagePage.steps.verifyImageUploadedInSetCorrectAnswerSection();
189
+ highlightImagePage.steps.verifyUploadedImageFormatInSetCorrectAnswerSection(fileType);
190
+ cy.log('Checking in preview tab')
191
+ highlightImagePage.steps.switchToPreviewTab();
192
+ highlightImagePage.steps.verifyUploadedImageFormatInPreviewTab(fileType);
193
+ highlightImagePage.steps.switchToEditTab();
194
+ cy.log('Post step: Delete the image')
195
+ uploadImageSectionComponent.steps.clickOnDeleteImageButton();
196
+ highlightImagePage.steps.clickOnAcceptButtonInDialogBox();
197
+ });
198
+ });
199
+ });
200
+ });
@@ -0,0 +1,318 @@
1
+ import constants from "../../../fixtures/constants";
2
+ import { dialogBoxBase, highlightImagePage } from "../../../pages";
3
+ import { uploadImageSectionComponent } from "../../../pages/components/uploadImageSectionComponent";
4
+ import abortEarlySetup from "../../../support/helpers/abortEarly";
5
+ import utilities from "../../../support/helpers/utilities";
6
+ const css = Cypress.env('css');
7
+
8
+ describe('Create Item page - Highlight image: Edit tab tools, content and functionality', () => {
9
+ before(() => {
10
+ cy.loginAs('admin');
11
+ });
12
+
13
+ describe('Highlight image contents - Edit tab', () => {
14
+ abortEarlySetup();
15
+ before(() => {
16
+ cy.log('Navigating to highlight image question type');
17
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
18
+ cy.log('Uploading an image');
19
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
20
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
21
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
22
+ });
23
+
24
+ it('\'Pen\' tool should be visible and should be in selected state by default', () => {
25
+ utilities.verifyElementVisibilityState(highlightImagePage.penTool(), 'visible');
26
+ highlightImagePage.steps.verifySelectedStateOfPenTool();
27
+ });
28
+
29
+ it('\'Select\' tool should be visible and should be in unselected state by default', () => {
30
+ utilities.verifyElementVisibilityState(highlightImagePage.selectTool(), 'visible');
31
+ highlightImagePage.steps.verifyUnselectedStateOfSelectTool();
32
+ });
33
+
34
+ it('\'Undo\' tool should be visible and should be in unselected state by default', () => {
35
+ utilities.verifyElementVisibilityState(highlightImagePage.undoTool(), 'visible');
36
+ highlightImagePage.steps.verifyUnselectedStateOfUndoTool();
37
+ });
38
+
39
+ it('\'Redo\' tool should be visible and should be in unselected state by default', () => {
40
+ utilities.verifyElementVisibilityState(highlightImagePage.redoTool(), 'visible');
41
+ highlightImagePage.steps.verifyUnselectedStateOfRedoTool();
42
+ });
43
+
44
+ it('\'Item Eraser\' tool should be visible and should be in unselected state by default', () => {
45
+ utilities.verifyElementVisibilityState(highlightImagePage.itemEraserTool(), 'visible');
46
+ highlightImagePage.steps.verifyUnselectedStateOfItemEraserTool();
47
+ });
48
+
49
+ it('\'Clear All\' tool should be visible and should be in unselected state by default', () => {
50
+ utilities.verifyElementVisibilityState(highlightImagePage.clearAllTool(), 'visible');
51
+ highlightImagePage.steps.verifyUnselectedStateOfClearAllTool();
52
+ });
53
+
54
+ it('\'Highlight count\' label having value 0 should be displayed by default', () => {
55
+ utilities.verifyElementVisibilityState(highlightImagePage.highlightCount(), 'visible')
56
+ highlightImagePage.steps.verifyHighlightCountInHighlightImageSection(0);
57
+ });
58
+
59
+ it('\'Edit image\' and \'Delete image\' button should be visible', () => {
60
+ utilities.verifyInnerText(uploadImageSectionComponent.editImageButton(), 'Edit image');
61
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.editImageButton(), 'visible');
62
+ utilities.verifyInnerText(uploadImageSectionComponent.deleteImageButton(), 'Delete image');
63
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.deleteImageButton(), 'visible');
64
+ });
65
+
66
+ //TODO: Need to update script after https://redmine.zeuslearning.com/issues/518498 is resolved
67
+ it('When the user hovers overs the tools, tooltips with texts should be displayed and on moving the focus away from the tools, the tooltips should disappear', () => {
68
+ const tools = [highlightImagePage.selectTool, highlightImagePage.penTool, highlightImagePage.undoTool, highlightImagePage.redoTool, highlightImagePage.itemEraserTool, highlightImagePage.clearAllTool];
69
+ const tooltip = ['SelectSelect, move, rotate and re-size', 'PenDraw a polygon', 'UndoUndo last action', 'RedoRedo last action', 'Item EraserRemove the item hovered', 'Clear AllRemove all the highlights']
70
+ for (let index = 0; index < tools.length; index++) {
71
+ highlightImagePage.steps.verifyTooltip(tools[index](), tooltip[index])
72
+ }
73
+ });
74
+
75
+ //Failing due to https://redmine.zeuslearning.com/issues/543603
76
+ it('CSS of \'Highlight image\' section', { tags: 'css' }, () => {
77
+ utilities.verifyCSS(highlightImagePage.penTool(), {
78
+ 'background-color': css.color.liTextSelectedBg,
79
+ 'font-weight': css.fontWeight.regular
80
+ });
81
+ utilities.verifyCSS(highlightImagePage.selectTool(), {
82
+ 'background-color': css.color.secondaryBtnBg,
83
+ 'font-weight': css.fontWeight.regular
84
+ });
85
+ utilities.verifyCSS(uploadImageSectionComponent.editImageButton().find('span'), {
86
+ 'color': css.color.secondaryBtnActive,
87
+ 'font-size': css.fontSize.default,
88
+ 'font-weight': css.fontWeight.regular
89
+ });
90
+ cy.log('Verifying color of edit image icon')
91
+ uploadImageSectionComponent.editImageButton()
92
+ .verifyPseudoClassBeforeProperty('color', css.color.secondaryBtnActive);
93
+ utilities.verifyCSS(uploadImageSectionComponent.deleteImageButton().find('span'), {
94
+ 'color': css.color.errorText,
95
+ 'font-size': css.fontSize.default,
96
+ 'font-weight': css.fontWeight.regular
97
+ });
98
+ cy.log('Verifying color of delete image icon')
99
+ uploadImageSectionComponent.deleteImageButton()
100
+ .verifyPseudoClassBeforeProperty('color', css.color.deleteIcon);
101
+ utilities.verifyCSS(highlightImagePage.highlightCount(), {
102
+ 'color': css.color.labels,
103
+ 'font-size': css.fontSize.small,
104
+ 'font-weight': css.fontWeight.regular,
105
+ 'background-color': css.color.liTextBg
106
+ });
107
+ const tools = [highlightImagePage.selectTool, highlightImagePage.penTool, highlightImagePage.undoTool, highlightImagePage.redoTool, highlightImagePage.itemEraserTool, highlightImagePage.clearAllTool]
108
+ tools.forEach(tool => {
109
+ utilities.verifyCSS(tool().find('svg'), {
110
+ 'color': css.color.activeButtons,
111
+ });
112
+ });
113
+ });
114
+
115
+ it('Accessibility of upload image section', { tags: 'a11y' }, () => {
116
+ cy.checkAccessibility(highlightImagePage.highlightImageSectionWrapper());
117
+ });
118
+ });
119
+
120
+ describe('Edit image popup contents and functionality', () => {
121
+ abortEarlySetup();
122
+ before(() => {
123
+ cy.log('Navigating to highlight image question type');
124
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
125
+ cy.log('Uploading an image');
126
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
127
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
128
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
129
+ uploadImageSectionComponent.steps.clickOnEditImageButton();
130
+ });
131
+
132
+ uploadImageSectionComponent.tests.verifyUploadImagePopupImageTitle();
133
+
134
+ uploadImageSectionComponent.tests.uploadImagePopupContents(500, 500);
135
+
136
+ uploadImageSectionComponent.tests.verifyButtonReplaceInImagePopup();
137
+
138
+ uploadImageSectionComponent.tests.uploadImageHeightWidthAspectRatioAndResetDimensionsFunctionality(500, 500);
139
+
140
+ it('When user clicks on \'Cancel\' button the popup should close and image should not get edited', () => {
141
+ uploadImageSectionComponent.steps.clickOnImagePopupCancelButton();
142
+ highlightImagePage.steps.verifyEditTabWidthInputFieldValue(500);
143
+ cy.log('Post step: Clicking on edit image button')
144
+ uploadImageSectionComponent.steps.clickOnEditImageButton();
145
+ });
146
+
147
+ uploadImageSectionComponent.tests.uploadImageReplaceButtonFunctionality();
148
+
149
+ it('When user makes some edits and clicks on the \'Ok\' button the popup should close and the edited image should be uploaded', () => {
150
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
151
+ highlightImagePage.steps.verifyEditTabWidthInputFieldValue(225);
152
+ });
153
+ });
154
+
155
+ describe('Edit image pop up content - source URL', () => {
156
+ abortEarlySetup();
157
+ before(() => {
158
+ cy.log('Navigating to highlight image question type');
159
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
160
+ cy.log('Uploading an image using source url');
161
+ uploadImageSectionComponent.steps.clickOnSourceURL();
162
+ uploadImageSectionComponent.steps.uploadImageUsingSourceURL(constants.flowerImage);
163
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
164
+ uploadImageSectionComponent.steps.clickOnEditImageButton();
165
+ });
166
+
167
+ //Failing due to https://redmine.zeuslearning.com/issues/543833
168
+ it('When user selects source URL, a popup should be displayed with title \'Add source URL\'', () => {
169
+ utilities.verifyInnerText(uploadImageSectionComponent.imagePopupTitle(), 'Add source URL');
170
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.imagePopupTitle(), 'visible');
171
+ });
172
+
173
+ uploadImageSectionComponent.tests.verifyUploadImageSourceURLLabelAndInputFieldInEditSourceURLPopup();
174
+
175
+ uploadImageSectionComponent.tests.uploadImagePopupContents(650, 684);
176
+ });
177
+
178
+ describe('Delete image - Edit tab', () => {
179
+ abortEarlySetup();
180
+ before(() => {
181
+ cy.log('Navigating to highlight image question type');
182
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
183
+ cy.log('Uploading an image');
184
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
185
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
186
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
187
+ });
188
+
189
+ uploadImageSectionComponent.tests.verifyDeleteImagePopup();
190
+
191
+ it('When user clicks on \'Cancel\' button the popup should close and image should not get deleted', () => {
192
+ dialogBoxBase.steps.clickOnRejectButtonInDialogBox();
193
+ utilities.verifyElementVisibilityState(highlightImagePage.highlighImageCanvas(), 'visible');
194
+ });
195
+
196
+ it('When user clicks on \'Delete image\' button the popup should close and image should get deleted', () => {
197
+ uploadImageSectionComponent.steps.clickOnDeleteImageButton();
198
+ dialogBoxBase.steps.clickOnAcceptButtonInDialogBox();
199
+ utilities.verifyElementVisibilityState(highlightImagePage.highlighImageCanvas(), 'notExist')
200
+ });
201
+ });
202
+
203
+ describe('Width(px) and Image alternative text: contents and Set correct answer section', () => {
204
+ abortEarlySetup();
205
+ before(() => {
206
+ cy.log('Navigating to highlight image question type');
207
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
208
+ cy.barsPreLoaderWait();
209
+ });
210
+
211
+ it('When user has not uploaded an image then \'Width(px)\' and \'Image alternative text\' label and input field should not be displayed', () => {
212
+ utilities.verifyElementVisibilityState(highlightImagePage.widthLabel(), 'notExist');
213
+ utilities.verifyElementVisibilityState(highlightImagePage.widthInputField(), 'notExist');
214
+ utilities.verifyElementVisibilityState(highlightImagePage.imageAlternativeTextLabel(), 'notExist');
215
+ utilities.verifyElementVisibilityState(highlightImagePage.imageAlternativeTextInputField(), 'notExist');
216
+ });
217
+
218
+ it('When user uploads an image \'Width(px)\' label and input field should be displayed and by default the input field should be prefilled with the width of the uploaded image', () => {
219
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
220
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
221
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
222
+ highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
223
+ utilities.verifyInnerText(highlightImagePage.widthLabel(), 'Width (px)');
224
+ utilities.verifyElementVisibilityState(highlightImagePage.widthLabel(), 'visible');
225
+ highlightImagePage.steps.verifyEditTabWidthInputFieldValue(500);
226
+ utilities.verifyElementVisibilityState(highlightImagePage.widthInputField(), 'visible');
227
+ });
228
+
229
+ it('When user has uploaded an image \'Image alternative text\' label and input field should be displayed and by default the input field should be empty', () => {
230
+ utilities.verifyInnerText(highlightImagePage.imageAlternativeTextLabel(), 'Image alternative text');
231
+ utilities.verifyElementVisibilityState(highlightImagePage.imageAlternativeTextLabel(), 'visible');
232
+ highlightImagePage.steps.verifyImageAlternativeTextInputField('');
233
+ utilities.verifyElementVisibilityState(highlightImagePage.imageAlternativeTextInputField(), 'visible');
234
+ });
235
+
236
+ it('When the user enters a value in the \'Width\' input field then the width of the image in \'Highlight image\' section and \'Set correct answer\' section should be updated accordingly', () => {
237
+ highlightImagePage.steps.addInputToEditTabWidthInputField(250);
238
+ highlightImagePage.steps.verifyImageWidthInHighlightImageSection(250);
239
+ highlightImagePage.steps.verifyHeightAndWidthOfImageInSetCorrectAnswerSection(500, 250);
240
+ });
241
+
242
+ it('When user has edited the value of image in \'Highlight image\' section then the width of image should be edited in the \'Edit image\' popup', () => {
243
+ uploadImageSectionComponent.steps.clickOnEditImageButton();
244
+ uploadImageSectionComponent.steps.verifyWidthInputFieldValueInImagePopup(250);
245
+ uploadImageSectionComponent.steps.clickOnImagePopupCancelButton();
246
+ });
247
+
248
+ it('When user enters text in the \'Image alternative text\' input field the alternative text should be displayed in the \'Set correct answer\' section', () => {
249
+ highlightImagePage.steps.addInputToImageAlternativeTextInputField(constants.flowerImageAltText);
250
+ highlightImagePage.steps.verifyImageAlternativeTextOfImageInSetCorrectAnswerSection(constants.flowerImageAltText);
251
+ });
252
+
253
+ it('CSS of Width(px) and Image alternative text section', { tags: 'css' }, () => {
254
+ utilities.verifyCSS(highlightImagePage.widthLabel(), {
255
+ 'color': css.color.labels,
256
+ 'font-size': css.fontSize.normal,
257
+ 'font-weight': css.fontWeight.semibold
258
+ });
259
+ utilities.verifyCSS(highlightImagePage.widthInputField(), {
260
+ 'color': css.color.text,
261
+ 'font-size': css.fontSize.default,
262
+ 'font-weight': css.fontWeight.regular
263
+ });
264
+ utilities.verifyCSS(highlightImagePage.imageAlternativeTextLabel(), {
265
+ 'color': css.color.labels,
266
+ 'font-size': css.fontSize.normal,
267
+ 'font-weight': css.fontWeight.semibold
268
+ });
269
+ utilities.verifyCSS(highlightImagePage.imageAlternativeTextInputField(), {
270
+ 'color': css.color.text,
271
+ 'font-size': css.fontSize.default,
272
+ 'font-weight': css.fontWeight.regular
273
+ });
274
+ });
275
+
276
+ it('Accessibility of Width(px) and Image alternative text section', { tags: 'a11y' }, () => {
277
+ cy.checkAccessibility(highlightImagePage.imageAlternativeTextLabel().parents('.width-alternative-text-wrapper'));
278
+ });
279
+
280
+ it('When user clears the \'Image alternative text\' input field then the alternative text should not be displayed in the \'Set correct answer\' section', () => {
281
+ highlightImagePage.steps.clearImageAlternativeTextInputField();
282
+ highlightImagePage.steps.verifyImageAlternativeTextOfImageInSetCorrectAnswerSection('');
283
+ });
284
+ });
285
+
286
+ describe('Width(px) and Image alternative text: preview tab', () => {
287
+ abortEarlySetup();
288
+ before(() => {
289
+ cy.log('Navigating to highlight image question type');
290
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
291
+ cy.log('Uploading an image');
292
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
293
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
294
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
295
+ highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
296
+ });
297
+
298
+ it('When the user enters a value in the \'Width\' input field then the width of the image should be updated accordingly in the \'Preview tab\'', () => {
299
+ highlightImagePage.steps.addInputToEditTabWidthInputField(250);
300
+ highlightImagePage.steps.switchToPreviewTab();
301
+ highlightImagePage.steps.verifyHeightAndWidthOfImageInPreviewTab(500, 250);
302
+ });
303
+
304
+ it('When user enters text in the \'Image alternative text\' input field the alternative text should be displayed in the \'Preview tab\'', () => {
305
+ highlightImagePage.steps.switchToEditTab();
306
+ highlightImagePage.steps.addInputToImageAlternativeTextInputField(constants.flowerImageAltText);
307
+ highlightImagePage.steps.switchToPreviewTab();
308
+ highlightImagePage.steps.verifyImageAlternativeTextOfImageInPreviewTab(constants.flowerImageAltText);
309
+ });
310
+
311
+ it('When user clears the \'Image alternative text\' input field then the alternative text should not be displayed in the \'Preview tab\'', () => {
312
+ highlightImagePage.steps.switchToEditTab();
313
+ highlightImagePage.steps.clearImageAlternativeTextInputField();
314
+ highlightImagePage.steps.switchToPreviewTab();
315
+ highlightImagePage.steps.verifyImageAlternativeTextOfImageInPreviewTab('');
316
+ });
317
+ });
318
+ });