itemengine-cypress-automation 1.0.26 → 1.0.27
Sign up to get free protection for your applications and to get access to all the features.
- package/cypress/e2e/ILC/HighlightImage/highlightImageAdditionalSettings.js +1 -229
- package/cypress/e2e/ILC/HighlightImage/highlightImageAdditionalSettingsBasic.js +252 -0
- package/cypress/e2e/ILC/HighlightImage/highlightImageAllOrNothingScoring.js +0 -794
- package/cypress/e2e/ILC/HighlightImage/highlightImageAllOrNothingWithAlternateAnswer.js +810 -0
- package/cypress/e2e/ILC/HighlightImage/highlightImageCustomizeHighlightProperties.js +0 -341
- package/cypress/e2e/ILC/HighlightImage/highlightImageCustomizeHighlightPropertiesFunctionality.js +356 -0
- package/cypress/e2e/ILC/HighlightImage/highlightImageEditTabBasic.js +0 -75
- package/cypress/e2e/ILC/HighlightImage/highlightImagePartialDifferentWeightsScoring.js +0 -883
- package/cypress/e2e/ILC/HighlightImage/highlightImagePartialDifferentWeightsWithAlternateAnswer.js +898 -0
- package/cypress/e2e/ILC/HighlightImage/highlightImagePartialEqualWeightsScoring.js +0 -879
- package/cypress/e2e/ILC/HighlightImage/highlightImagePartialEqualWeightsWithAlternateAnswer.js +894 -0
- package/cypress/e2e/ILC/HighlightImage/highlightImageSupportedFileTypes.js +86 -0
- package/cypress/e2e/ILC/HighlightImage/{highlightImageToolsFunctionality.js → highlightImageToolsFunctionalityEditTab.js} +1 -150
- package/cypress/e2e/ILC/HighlightImage/highlightImageToolsFunctionalityPreviewTab.js +163 -0
- package/package.json +1 -1
@@ -0,0 +1,86 @@
|
|
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: Supported file types', () => {
|
8
|
+
before(() => {
|
9
|
+
cy.loginAs('admin');
|
10
|
+
});
|
11
|
+
|
12
|
+
describe('Supported file types functionality: device popup', () => {
|
13
|
+
abortEarlySetup();
|
14
|
+
before(() => {
|
15
|
+
cy.log('Navigating to highlight image question type');
|
16
|
+
highlightImagePage.steps.navigateToCreateQuestion('highlight image');
|
17
|
+
cy.barsPreLoaderWait();
|
18
|
+
});
|
19
|
+
|
20
|
+
const supportedFormatFiles = {
|
21
|
+
jpg: 'highlightImage.jpg',
|
22
|
+
jpeg: 'sample.jpeg',
|
23
|
+
png: 'image.png',
|
24
|
+
gif: 'sample.gif',
|
25
|
+
heic: 'sample.heic',
|
26
|
+
heif: 'sample.heif',
|
27
|
+
svg: 'sample.svg'
|
28
|
+
};
|
29
|
+
|
30
|
+
Object.keys(supportedFormatFiles).forEach((fileType) => {
|
31
|
+
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\'`, () => {
|
32
|
+
uploadImageSectionComponent.steps.uploadFile(supportedFormatFiles[fileType]);
|
33
|
+
uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
|
34
|
+
uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
|
35
|
+
utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
|
36
|
+
highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
|
37
|
+
highlightImagePage.steps.verifyImageUploadedInSetCorrectAnswerSection();
|
38
|
+
highlightImagePage.steps.verifyUploadedImageFormatInSetCorrectAnswerSection(fileType);
|
39
|
+
cy.log('Checking in preview tab')
|
40
|
+
highlightImagePage.steps.switchToPreviewTab();
|
41
|
+
highlightImagePage.steps.verifyUploadedImageFormatInPreviewTab(fileType);
|
42
|
+
highlightImagePage.steps.switchToEditTab();
|
43
|
+
cy.log('Post step: Delete the image')
|
44
|
+
uploadImageSectionComponent.steps.clickOnDeleteImageButton();
|
45
|
+
highlightImagePage.steps.clickOnAcceptButtonInDialogBox();
|
46
|
+
});
|
47
|
+
});
|
48
|
+
});
|
49
|
+
|
50
|
+
describe('Supported file types functionality: Source URL popup', () => {
|
51
|
+
abortEarlySetup();
|
52
|
+
before(() => {
|
53
|
+
cy.log('Navigating to highlight image question type');
|
54
|
+
highlightImagePage.steps.navigateToCreateQuestion('highlight image');
|
55
|
+
cy.barsPreLoaderWait();
|
56
|
+
});
|
57
|
+
|
58
|
+
const supportedFormatFiles = {
|
59
|
+
jpg: constants.foxImageLink,
|
60
|
+
jpeg: constants.sampleJPEGLink,
|
61
|
+
png: constants.samplePNGLink,
|
62
|
+
gif: constants.sampleGIFLink,
|
63
|
+
svg: constants.sampleSVGLink
|
64
|
+
};
|
65
|
+
|
66
|
+
Object.keys(supportedFormatFiles).forEach((fileType) => {
|
67
|
+
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\'`, () => {
|
68
|
+
uploadImageSectionComponent.steps.clickOnSourceURL();
|
69
|
+
uploadImageSectionComponent.steps.uploadImageUsingSourceURL(supportedFormatFiles[fileType]);
|
70
|
+
uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
|
71
|
+
uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
|
72
|
+
utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
|
73
|
+
highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
|
74
|
+
highlightImagePage.steps.verifyImageUploadedInSetCorrectAnswerSection();
|
75
|
+
highlightImagePage.steps.verifyUploadedImageFormatInSetCorrectAnswerSection(fileType);
|
76
|
+
cy.log('Checking in preview tab')
|
77
|
+
highlightImagePage.steps.switchToPreviewTab();
|
78
|
+
highlightImagePage.steps.verifyUploadedImageFormatInPreviewTab(fileType);
|
79
|
+
highlightImagePage.steps.switchToEditTab();
|
80
|
+
cy.log('Post step: Delete the image')
|
81
|
+
uploadImageSectionComponent.steps.clickOnDeleteImageButton();
|
82
|
+
highlightImagePage.steps.clickOnAcceptButtonInDialogBox();
|
83
|
+
});
|
84
|
+
});
|
85
|
+
});
|
86
|
+
});
|
@@ -7,7 +7,7 @@ const flowerHighlightRegion = [[24, 6], [24, 24], [56, 24], [56, 6]];
|
|
7
7
|
const leafHighlightRegion = [[54, 48], [54, 72], [82, 72], [82, 48]];
|
8
8
|
const overlapHighlightRegion = [[24, 24], [56, 24], [61, 9], [34, 8]]
|
9
9
|
|
10
|
-
describe('Create Item page - Highlight image: Tools functionality', () => {
|
10
|
+
describe('Create Item page - Highlight image: Tools functionality edit tab', () => {
|
11
11
|
before(() => {
|
12
12
|
cy.loginAs('admin');
|
13
13
|
});
|
@@ -51,49 +51,6 @@ describe('Create Item page - Highlight image: Tools functionality', () => {
|
|
51
51
|
});
|
52
52
|
});
|
53
53
|
|
54
|
-
describe('\'Pen\' tool functionality - Preview tab', () => {
|
55
|
-
abortEarlySetup();
|
56
|
-
before(() => {
|
57
|
-
cy.log('Navigating to Highlight image question type');
|
58
|
-
highlightImagePage.steps.navigateToCreateQuestion('highlight image');
|
59
|
-
cy.log('Uploading an image');
|
60
|
-
uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
|
61
|
-
uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
|
62
|
-
uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
|
63
|
-
utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
|
64
|
-
highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
|
65
|
-
highlightImagePage.steps.verifyImageUploadedInSetCorrectAnswerSection();
|
66
|
-
});
|
67
|
-
|
68
|
-
it('When the user highlights a region on the highlight image canvas, it should be visible in \'Preview\' tab', () => {
|
69
|
-
highlightImagePage.steps.highlightRegionInImage(flowerHighlightRegion);
|
70
|
-
cy.log('Switching to Preview Tab')
|
71
|
-
highlightImagePage.steps.switchToPreviewTab();
|
72
|
-
highlightImagePage.steps.verifyHighlightRegionsInPreviewTab(0, flowerHighlightRegion);
|
73
|
-
});
|
74
|
-
|
75
|
-
it('When the user highlights multiple regions on the highlight image canvas, a new highlight should be visible in \'Preview\' tab', () => {
|
76
|
-
cy.log('Switching to Edit Tab')
|
77
|
-
highlightImagePage.steps.switchToEditTab();
|
78
|
-
highlightImagePage.steps.highlightRegionInImage(leafHighlightRegion);
|
79
|
-
cy.log('Switching to Preview Tab')
|
80
|
-
highlightImagePage.steps.switchToPreviewTab();
|
81
|
-
highlightImagePage.steps.verifyHighlightRegionsInPreviewTab(1, leafHighlightRegion);
|
82
|
-
highlightImagePage.steps.verifyHighlightRegionCountInPreviewTab(2);
|
83
|
-
});
|
84
|
-
|
85
|
-
it('The user should not be able to draw overlapping highlights on the highlight image canvas', () => {
|
86
|
-
cy.log('Switching to Edit Tab')
|
87
|
-
highlightImagePage.steps.switchToEditTab();
|
88
|
-
highlightImagePage.steps.highlightRegionInImage(overlapHighlightRegion);
|
89
|
-
cy.log('Switching to Preview Tab')
|
90
|
-
highlightImagePage.steps.switchToPreviewTab();
|
91
|
-
highlightImagePage.steps.verifyHighlightRegionsInPreviewTab(0, flowerHighlightRegion);
|
92
|
-
highlightImagePage.steps.verifyHighlightRegionsInPreviewTab(1, leafHighlightRegion);
|
93
|
-
highlightImagePage.steps.verifyHighlightRegionCountInPreviewTab(2);
|
94
|
-
});
|
95
|
-
});
|
96
|
-
|
97
54
|
//TODO: Need to update script after https://redmine.zeuslearning.com/issues/544199 is answered
|
98
55
|
describe('\'Undo\' and \'Redo\' tool functionality - Edit tab, Set correct answer section', () => {
|
99
56
|
abortEarlySetup();
|
@@ -147,64 +104,6 @@ describe('Create Item page - Highlight image: Tools functionality', () => {
|
|
147
104
|
});
|
148
105
|
});
|
149
106
|
|
150
|
-
describe('\'Undo\' and \'Redo\' tool functionality - Preview tab', () => {
|
151
|
-
abortEarlySetup();
|
152
|
-
before(() => {
|
153
|
-
cy.log('Navigating to Highlight image question type');
|
154
|
-
highlightImagePage.steps.navigateToCreateQuestion('highlight image');
|
155
|
-
cy.log('Uploading an image');
|
156
|
-
uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
|
157
|
-
uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
|
158
|
-
uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
|
159
|
-
utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
|
160
|
-
highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
|
161
|
-
highlightImagePage.steps.verifyImageUploadedInSetCorrectAnswerSection();
|
162
|
-
highlightImagePage.steps.highlightRegionInImage(flowerHighlightRegion);
|
163
|
-
highlightImagePage.steps.highlightRegionInImage(leafHighlightRegion);
|
164
|
-
});
|
165
|
-
|
166
|
-
it('When the user performs the undo action, it should undo the latest action and it should be visible in \'Preview\' tab', () => {
|
167
|
-
highlightImagePage.steps.clickOnUndoTool();
|
168
|
-
cy.log('Switching to Preview Tab')
|
169
|
-
highlightImagePage.steps.switchToPreviewTab();
|
170
|
-
highlightImagePage.steps.verifyHighlightRegionCountInPreviewTab(1);
|
171
|
-
});
|
172
|
-
|
173
|
-
it('When the user clicks on the redo tool after performing an undo action, then the highlight region should be displayed again in the \'Preview\' tab', () => {
|
174
|
-
cy.log('Switching to Edit Tab')
|
175
|
-
highlightImagePage.steps.switchToEditTab();
|
176
|
-
highlightImagePage.steps.clickOnRedoTool();
|
177
|
-
cy.log('Switching to Preview Tab')
|
178
|
-
highlightImagePage.steps.switchToPreviewTab();
|
179
|
-
highlightImagePage.steps.verifyHighlightRegionsInPreviewTab(1, leafHighlightRegion);
|
180
|
-
highlightImagePage.steps.verifyHighlightRegionCountInPreviewTab(2);
|
181
|
-
});
|
182
|
-
|
183
|
-
it('User should be able to undo multiple highlight regions by using the \'Undo\' tool', () => {
|
184
|
-
cy.log('Switching to Edit Tab')
|
185
|
-
highlightImagePage.steps.switchToEditTab();
|
186
|
-
for (var i = 0; i < 11; i++) {
|
187
|
-
highlightImagePage.steps.clickOnUndoTool();
|
188
|
-
};
|
189
|
-
cy.log('Switching to Preview Tab')
|
190
|
-
highlightImagePage.steps.switchToPreviewTab();
|
191
|
-
utilities.verifyElementVisibilityState(highlightImagePage.previewTabHighlight(), 'notExist')
|
192
|
-
});
|
193
|
-
|
194
|
-
it('When the user clicks on the \'Redo\' tool multiple times after performing an undo action, then all the highlight region should be displayed again in the \'Preview\' tab', () => {
|
195
|
-
cy.log('Switching to Edit Tab')
|
196
|
-
highlightImagePage.steps.switchToEditTab();
|
197
|
-
for (var i = 0; i < 11; i++) {
|
198
|
-
highlightImagePage.steps.clickOnRedoTool();
|
199
|
-
};
|
200
|
-
cy.log('Switching to Preview Tab')
|
201
|
-
highlightImagePage.steps.switchToPreviewTab();
|
202
|
-
highlightImagePage.steps.verifyHighlightRegionsInPreviewTab(0, flowerHighlightRegion);
|
203
|
-
highlightImagePage.steps.verifyHighlightRegionsInPreviewTab(1, leafHighlightRegion);
|
204
|
-
highlightImagePage.steps.verifyHighlightRegionCountInPreviewTab(2);
|
205
|
-
});
|
206
|
-
});
|
207
|
-
|
208
107
|
describe('\'Item eraser\' tool functionality - Edit tab, Set correct answer section', () => {
|
209
108
|
abortEarlySetup();
|
210
109
|
before(() => {
|
@@ -232,30 +131,6 @@ describe('Create Item page - Highlight image: Tools functionality', () => {
|
|
232
131
|
});
|
233
132
|
});
|
234
133
|
|
235
|
-
describe('\'Item eraser\' tool functionality - Preview tab', () => {
|
236
|
-
abortEarlySetup();
|
237
|
-
before(() => {
|
238
|
-
cy.log('Navigating to Highlight image question type');
|
239
|
-
highlightImagePage.steps.navigateToCreateQuestion('highlight image');
|
240
|
-
cy.log('Uploading an image');
|
241
|
-
uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
|
242
|
-
uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
|
243
|
-
uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
|
244
|
-
utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
|
245
|
-
highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
|
246
|
-
highlightImagePage.steps.verifyImageUploadedInSetCorrectAnswerSection();
|
247
|
-
highlightImagePage.steps.highlightRegionInImage(flowerHighlightRegion);
|
248
|
-
highlightImagePage.steps.highlightRegionInImage(leafHighlightRegion);
|
249
|
-
});
|
250
|
-
|
251
|
-
it('When the user deletes the highlight using \'Item eraser\' tool, the deleted highlight should not be visible in \'Preview\' tab', () => {
|
252
|
-
highlightImagePage.steps.eraseAHighlightRegion([flowerHighlightRegion[0]]);
|
253
|
-
cy.log('Switching to Preview Tab')
|
254
|
-
highlightImagePage.steps.switchToPreviewTab();
|
255
|
-
highlightImagePage.steps.verifyHighlightRegionCountInPreviewTab(1);
|
256
|
-
});
|
257
|
-
});
|
258
|
-
|
259
134
|
describe('\'Clear all\' tool functionality - Edit tab, Set correct answer section', () => {
|
260
135
|
abortEarlySetup();
|
261
136
|
before(() => {
|
@@ -282,28 +157,4 @@ describe('Create Item page - Highlight image: Tools functionality', () => {
|
|
282
157
|
highlightImagePage.steps.verifyUnselectedStateOfClearAllTool();
|
283
158
|
});
|
284
159
|
});
|
285
|
-
|
286
|
-
describe('\'Clear all\' tool functionality - 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
|
-
utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
|
296
|
-
highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
|
297
|
-
highlightImagePage.steps.verifyImageUploadedInSetCorrectAnswerSection();
|
298
|
-
highlightImagePage.steps.highlightRegionInImage(flowerHighlightRegion);
|
299
|
-
highlightImagePage.steps.highlightRegionInImage(leafHighlightRegion);
|
300
|
-
});
|
301
|
-
|
302
|
-
it('When the user deletes all the highlights using \'Clear all\' tool, no highlights should be visible in \'Preview\' tab', () => {
|
303
|
-
highlightImagePage.steps.clickOnClearAllTool();
|
304
|
-
cy.log('Switching to Preview Tab')
|
305
|
-
highlightImagePage.steps.switchToPreviewTab();
|
306
|
-
utilities.verifyElementVisibilityState(highlightImagePage.previewTabHighlight(), 'notExist')
|
307
|
-
});
|
308
|
-
});
|
309
160
|
});
|
@@ -0,0 +1,163 @@
|
|
1
|
+
import { highlightImagePage } from "../../../pages";
|
2
|
+
import { uploadImageSectionComponent } from "../../../pages/components/uploadImageSectionComponent";
|
3
|
+
import abortEarlySetup from "../../../support/helpers/abortEarly";
|
4
|
+
import utilities from "../../../support/helpers/utilities";
|
5
|
+
|
6
|
+
const flowerHighlightRegion = [[24, 6], [24, 24], [56, 24], [56, 6]];
|
7
|
+
const leafHighlightRegion = [[54, 48], [54, 72], [82, 72], [82, 48]];
|
8
|
+
const overlapHighlightRegion = [[24, 24], [56, 24], [61, 9], [34, 8]]
|
9
|
+
|
10
|
+
describe('Create Item page - Highlight image: Tools functionality preview tab', () => {
|
11
|
+
before(() => {
|
12
|
+
cy.loginAs('admin');
|
13
|
+
});
|
14
|
+
|
15
|
+
describe('\'Pen\' tool functionality - Preview tab', () => {
|
16
|
+
abortEarlySetup();
|
17
|
+
before(() => {
|
18
|
+
cy.log('Navigating to Highlight image question type');
|
19
|
+
highlightImagePage.steps.navigateToCreateQuestion('highlight image');
|
20
|
+
cy.log('Uploading an image');
|
21
|
+
uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
|
22
|
+
uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
|
23
|
+
uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
|
24
|
+
utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
|
25
|
+
highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
|
26
|
+
highlightImagePage.steps.verifyImageUploadedInSetCorrectAnswerSection();
|
27
|
+
});
|
28
|
+
|
29
|
+
it('When the user highlights a region on the highlight image canvas, it should be visible in \'Preview\' tab', () => {
|
30
|
+
highlightImagePage.steps.highlightRegionInImage(flowerHighlightRegion);
|
31
|
+
cy.log('Switching to Preview Tab')
|
32
|
+
highlightImagePage.steps.switchToPreviewTab();
|
33
|
+
highlightImagePage.steps.verifyHighlightRegionsInPreviewTab(0, flowerHighlightRegion);
|
34
|
+
});
|
35
|
+
|
36
|
+
it('When the user highlights multiple regions on the highlight image canvas, a new highlight should be visible in \'Preview\' tab', () => {
|
37
|
+
cy.log('Switching to Edit Tab')
|
38
|
+
highlightImagePage.steps.switchToEditTab();
|
39
|
+
highlightImagePage.steps.highlightRegionInImage(leafHighlightRegion);
|
40
|
+
cy.log('Switching to Preview Tab')
|
41
|
+
highlightImagePage.steps.switchToPreviewTab();
|
42
|
+
highlightImagePage.steps.verifyHighlightRegionsInPreviewTab(1, leafHighlightRegion);
|
43
|
+
highlightImagePage.steps.verifyHighlightRegionCountInPreviewTab(2);
|
44
|
+
});
|
45
|
+
|
46
|
+
it('The user should not be able to draw overlapping highlights on the highlight image canvas', () => {
|
47
|
+
cy.log('Switching to Edit Tab')
|
48
|
+
highlightImagePage.steps.switchToEditTab();
|
49
|
+
highlightImagePage.steps.highlightRegionInImage(overlapHighlightRegion);
|
50
|
+
cy.log('Switching to Preview Tab')
|
51
|
+
highlightImagePage.steps.switchToPreviewTab();
|
52
|
+
highlightImagePage.steps.verifyHighlightRegionsInPreviewTab(0, flowerHighlightRegion);
|
53
|
+
highlightImagePage.steps.verifyHighlightRegionsInPreviewTab(1, leafHighlightRegion);
|
54
|
+
highlightImagePage.steps.verifyHighlightRegionCountInPreviewTab(2);
|
55
|
+
});
|
56
|
+
});
|
57
|
+
|
58
|
+
describe('\'Undo\' and \'Redo\' tool functionality - Preview tab', () => {
|
59
|
+
abortEarlySetup();
|
60
|
+
before(() => {
|
61
|
+
cy.log('Navigating to Highlight image question type');
|
62
|
+
highlightImagePage.steps.navigateToCreateQuestion('highlight image');
|
63
|
+
cy.log('Uploading an image');
|
64
|
+
uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
|
65
|
+
uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
|
66
|
+
uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
|
67
|
+
utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
|
68
|
+
highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
|
69
|
+
highlightImagePage.steps.verifyImageUploadedInSetCorrectAnswerSection();
|
70
|
+
highlightImagePage.steps.highlightRegionInImage(flowerHighlightRegion);
|
71
|
+
highlightImagePage.steps.highlightRegionInImage(leafHighlightRegion);
|
72
|
+
});
|
73
|
+
|
74
|
+
it('When the user performs the undo action, it should undo the latest action and it should be visible in \'Preview\' tab', () => {
|
75
|
+
highlightImagePage.steps.clickOnUndoTool();
|
76
|
+
cy.log('Switching to Preview Tab')
|
77
|
+
highlightImagePage.steps.switchToPreviewTab();
|
78
|
+
highlightImagePage.steps.verifyHighlightRegionCountInPreviewTab(1);
|
79
|
+
});
|
80
|
+
|
81
|
+
it('When the user clicks on the redo tool after performing an undo action, then the highlight region should be displayed again in the \'Preview\' tab', () => {
|
82
|
+
cy.log('Switching to Edit Tab')
|
83
|
+
highlightImagePage.steps.switchToEditTab();
|
84
|
+
highlightImagePage.steps.clickOnRedoTool();
|
85
|
+
cy.log('Switching to Preview Tab')
|
86
|
+
highlightImagePage.steps.switchToPreviewTab();
|
87
|
+
highlightImagePage.steps.verifyHighlightRegionsInPreviewTab(1, leafHighlightRegion);
|
88
|
+
highlightImagePage.steps.verifyHighlightRegionCountInPreviewTab(2);
|
89
|
+
});
|
90
|
+
|
91
|
+
it('User should be able to undo multiple highlight regions by using the \'Undo\' tool', () => {
|
92
|
+
cy.log('Switching to Edit Tab')
|
93
|
+
highlightImagePage.steps.switchToEditTab();
|
94
|
+
for (var i = 0; i < 11; i++) {
|
95
|
+
highlightImagePage.steps.clickOnUndoTool();
|
96
|
+
};
|
97
|
+
cy.log('Switching to Preview Tab')
|
98
|
+
highlightImagePage.steps.switchToPreviewTab();
|
99
|
+
utilities.verifyElementVisibilityState(highlightImagePage.previewTabHighlight(), 'notExist')
|
100
|
+
});
|
101
|
+
|
102
|
+
it('When the user clicks on the \'Redo\' tool multiple times after performing an undo action, then all the highlight region should be displayed again in the \'Preview\' tab', () => {
|
103
|
+
cy.log('Switching to Edit Tab')
|
104
|
+
highlightImagePage.steps.switchToEditTab();
|
105
|
+
for (var i = 0; i < 11; i++) {
|
106
|
+
highlightImagePage.steps.clickOnRedoTool();
|
107
|
+
};
|
108
|
+
cy.log('Switching to Preview Tab')
|
109
|
+
highlightImagePage.steps.switchToPreviewTab();
|
110
|
+
highlightImagePage.steps.verifyHighlightRegionsInPreviewTab(0, flowerHighlightRegion);
|
111
|
+
highlightImagePage.steps.verifyHighlightRegionsInPreviewTab(1, leafHighlightRegion);
|
112
|
+
highlightImagePage.steps.verifyHighlightRegionCountInPreviewTab(2);
|
113
|
+
});
|
114
|
+
});
|
115
|
+
|
116
|
+
describe('\'Item eraser\' tool functionality - Preview tab', () => {
|
117
|
+
abortEarlySetup();
|
118
|
+
before(() => {
|
119
|
+
cy.log('Navigating to Highlight image question type');
|
120
|
+
highlightImagePage.steps.navigateToCreateQuestion('highlight image');
|
121
|
+
cy.log('Uploading an image');
|
122
|
+
uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
|
123
|
+
uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
|
124
|
+
uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
|
125
|
+
utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
|
126
|
+
highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
|
127
|
+
highlightImagePage.steps.verifyImageUploadedInSetCorrectAnswerSection();
|
128
|
+
highlightImagePage.steps.highlightRegionInImage(flowerHighlightRegion);
|
129
|
+
highlightImagePage.steps.highlightRegionInImage(leafHighlightRegion);
|
130
|
+
});
|
131
|
+
|
132
|
+
it('When the user deletes the highlight using \'Item eraser\' tool, the deleted highlight should not be visible in \'Preview\' tab', () => {
|
133
|
+
highlightImagePage.steps.eraseAHighlightRegion([flowerHighlightRegion[0]]);
|
134
|
+
cy.log('Switching to Preview Tab')
|
135
|
+
highlightImagePage.steps.switchToPreviewTab();
|
136
|
+
highlightImagePage.steps.verifyHighlightRegionCountInPreviewTab(1);
|
137
|
+
});
|
138
|
+
});
|
139
|
+
|
140
|
+
describe('\'Clear all\' tool functionality - Preview tab', () => {
|
141
|
+
abortEarlySetup();
|
142
|
+
before(() => {
|
143
|
+
cy.log('Navigating to Highlight image question type');
|
144
|
+
highlightImagePage.steps.navigateToCreateQuestion('highlight image');
|
145
|
+
cy.log('Uploading an image');
|
146
|
+
uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
|
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.highlightRegionInImage(flowerHighlightRegion);
|
153
|
+
highlightImagePage.steps.highlightRegionInImage(leafHighlightRegion);
|
154
|
+
});
|
155
|
+
|
156
|
+
it('When the user deletes all the highlights using \'Clear all\' tool, no highlights should be visible in \'Preview\' tab', () => {
|
157
|
+
highlightImagePage.steps.clickOnClearAllTool();
|
158
|
+
cy.log('Switching to Preview Tab')
|
159
|
+
highlightImagePage.steps.switchToPreviewTab();
|
160
|
+
utilities.verifyElementVisibilityState(highlightImagePage.previewTabHighlight(), 'notExist')
|
161
|
+
});
|
162
|
+
});
|
163
|
+
});
|