itemengine-cypress-automation 1.0.24 → 1.0.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAdditionalSettingsAdvanceSettingsForAllResponseAreas.js +511 -0
  2. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAdditionalSettingsBasic.js +263 -0
  3. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAdditionalSettingsResponseAccordions.js +734 -0
  4. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAdditionalSettingsStudentResponseAreaAndLayout.js +603 -0
  5. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAllOrNothingWithAlternateAnswer.js +54 -0
  6. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAutoScoredScoring.js +0 -46
  7. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextPartialDifferentWeights.js +47 -0
  8. package/cypress/e2e/ILC/FillInTheGapsText/{fillInTheGapsTextScoringPartialDifferentWeights.js → fillInTheGapsTextPartialDifferentWeightsWithAlternateAnswer.js} +1 -38
  9. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextPartialEqualWeights.js +45 -0
  10. package/cypress/e2e/ILC/FillInTheGapsText/{fillInTheGapsTextScoringPartialEqualWeights.js → fillInTheGapsTextPartialEqualWeightsWithAlternateAnswer.js} +0 -37
  11. package/cypress/e2e/ILC/HighlightImage/highlightImageAdditionalSettings.js +447 -0
  12. package/cypress/e2e/ILC/HighlightImage/highlightImageAllOrNothingScoring.js +1029 -0
  13. package/cypress/e2e/ILC/HighlightImage/highlightImageCustomizeHighlightProperties.js +1010 -0
  14. package/cypress/e2e/ILC/HighlightImage/highlightImageEditTabBasic.js +200 -0
  15. package/cypress/e2e/ILC/HighlightImage/highlightImageEditTabHighlightSectionContents.js +318 -0
  16. package/cypress/e2e/ILC/HighlightImage/highlightImageEditTabScoring.js +403 -0
  17. package/cypress/e2e/ILC/HighlightImage/highlightImageHeaderSection.js +86 -0
  18. package/cypress/e2e/ILC/HighlightImage/highlightImageManuallyAndNonScoredScoring.js +176 -0
  19. package/cypress/e2e/ILC/HighlightImage/highlightImagePartialDifferentWeightsScoring.js +1093 -0
  20. package/cypress/e2e/ILC/HighlightImage/highlightImagePartialEqualWeightsScoring.js +1087 -0
  21. package/cypress/e2e/ILC/HighlightImage/highlightImagePreviewTab.js +88 -0
  22. package/cypress/e2e/ILC/HighlightImage/highlightImageSetCorrectAnswerCheckboxes.js +244 -0
  23. package/cypress/e2e/ILC/HighlightImage/highlightImageSetCorrectAnswerSection.js +186 -0
  24. package/cypress/e2e/ILC/HighlightImage/highlightImageToolsFunctionality.js +309 -0
  25. package/package.json +1 -1
  26. package/cypress/e2e/ILC/FillInTheGapsText/fillInTheGapsTextAdditionalSettings.js +0 -2060
@@ -0,0 +1,88 @@
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
+ const css = Cypress.env('css');
6
+
7
+ const flowerHighlightRegion = [[24, 6], [24, 24], [56, 24], [56, 6]];
8
+ const branchesHighlightRegion = [[36, 36], [36, 46], [58, 46], [58, 36]];
9
+ const leafHighlightRegion = [[54, 48], [54, 72], [82, 72], [82, 48]];
10
+
11
+ describe('Create Item page - Highlight image: Preview tab', () => {
12
+ before(() => {
13
+ cy.loginAs('admin');
14
+ });
15
+
16
+ describe('Preview tab contents with uploading image', () => {
17
+ abortEarlySetup();
18
+ before(() => {
19
+ cy.log('Navigating to Highlight image question type');
20
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
21
+ cy.barsPreLoaderWait();
22
+ highlightImagePage.steps.addQuestionInstructions();
23
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
24
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
25
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
26
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
27
+ highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
28
+ highlightImagePage.steps.verifyImageUploadedInSetCorrectAnswerSection();
29
+ highlightImagePage.steps.highlightRegionInImage(flowerHighlightRegion);
30
+ highlightImagePage.steps.highlightRegionInImage(branchesHighlightRegion);
31
+ highlightImagePage.steps.highlightRegionInImage(leafHighlightRegion);
32
+ highlightImagePage.steps.checkMultipleSelectionCheckbox();
33
+ highlightImagePage.steps.switchToPreviewTab();
34
+ });
35
+
36
+ it('When user uploads an image in the \'Highlight image\' section then the uploaded image should be displayed with highlight regions, error message should not be displayed and in the preview tab', () => {
37
+ utilities.verifyElementVisibilityState(highlightImagePage.previewTabImage(), 'visible');
38
+ utilities.verifyElementVisibilityState(highlightImagePage.errorMessage(), 'notExist');
39
+ });
40
+
41
+ it('The highlighted regions should be displayed in the preview tab', () => {
42
+ highlightImagePage.steps.verifyHighlightRegionsInPreviewTab(0, flowerHighlightRegion);
43
+ highlightImagePage.steps.verifyHighlightRegionsInPreviewTab(1, branchesHighlightRegion);
44
+ highlightImagePage.steps.verifyHighlightRegionsInPreviewTab(2, leafHighlightRegion);
45
+ utilities.verifyElementCount(highlightImagePage.previewTabHighlight(), 3);
46
+ });
47
+
48
+ it('User should be able to select and de-select the highlight regions in preview tab', () => {
49
+ highlightImagePage.steps.highlightARegionInPreviewTab(0);
50
+ highlightImagePage.steps.highlightARegionInPreviewTab(1);
51
+ highlightImagePage.steps.verifySelectedHighlightRegionInPreviewTab(0);
52
+ highlightImagePage.steps.verifySelectedHighlightRegionInPreviewTab(1);
53
+ highlightImagePage.steps.verifyRegionIsNotHighlighted(2);
54
+ highlightImagePage.steps.removeHighlightOfARegionInPreviewTab(0);
55
+ highlightImagePage.steps.verifyRegionIsNotHighlighted(0);
56
+ highlightImagePage.steps.verifySelectedHighlightRegionInPreviewTab(1);
57
+ highlightImagePage.steps.verifyRegionIsNotHighlighted(2);
58
+ });
59
+
60
+ it('CSS of highlight region in preview tab in default, hover and active state', { tags: 'css' }, () => {
61
+ cy.log('Default state')
62
+ utilities.verifyCSS(highlightImagePage.previewTabHighlightPolygon().eq(2), {
63
+ 'stroke': css.color.activeButtons,
64
+ 'stroke-width': '2px'
65
+ });
66
+ cy.log('Active state')
67
+ utilities.verifyCSS(highlightImagePage.previewTabHighlightPolygon().eq(1), {
68
+ 'stroke': css.color.activeHighlightBorder,
69
+ 'stroke-width': '4px'
70
+ });
71
+ cy.log('Hover state')
72
+ utilities.hoverOverElement(highlightImagePage.previewTabHighlight().eq(0))
73
+ utilities.verifyCSS(highlightImagePage.previewTabHighlightPolygon().eq(0), {
74
+ 'stroke': css.color.hoverHighlightBorder,
75
+ 'stroke-width': '4px'
76
+ });
77
+ utilities.hoverAwayFromElement();
78
+ utilities.verifyCSS(highlightImagePage.previewTabHighlightPolygon().eq(2), {
79
+ 'stroke': css.color.activeButtons,
80
+ 'stroke-width': '2px'
81
+ });
82
+ });
83
+
84
+ it('Accessibility of preview tab highlight regions', { tags: 'a11y' }, () => {
85
+ cy.checkAccessibility(highlightImagePage.previewTabQuestionWrapper());
86
+ });
87
+ });
88
+ });
@@ -0,0 +1,244 @@
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
+ const css = Cypress.env('css');
6
+
7
+ const flowerHighlightRegion = [[24, 6], [24, 24], [56, 24], [56, 6]];
8
+ const branchesHighlightRegion = [[36, 36], [36, 46], [58, 46], [58, 36]];
9
+ const leafHighlightRegion = [[54, 48], [54, 72], [82, 72], [82, 48]];
10
+
11
+ describe('Highlight image: Set correct answer checkboxes', () => {
12
+ before(() => {
13
+ cy.loginAs('admin');
14
+ });
15
+
16
+ describe('Multiple selection: Set correct answer section', () => {
17
+ abortEarlySetup();
18
+ before(() => {
19
+ cy.log('Navigating to highlight image question type');
20
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
21
+ cy.barsPreLoaderWait();
22
+ highlightImagePage.steps.addQuestionInstructions();
23
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
24
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
25
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
26
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
27
+ highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
28
+ highlightImagePage.steps.verifyImageUploadedInSetCorrectAnswerSection();
29
+ highlightImagePage.steps.highlightRegionInImage(flowerHighlightRegion);
30
+ highlightImagePage.steps.highlightRegionInImage(branchesHighlightRegion);
31
+ highlightImagePage.steps.highlightRegionInImage(leafHighlightRegion);
32
+ });
33
+
34
+ it('\'Multiple selection\' label and checkbox should be displayed and by default it should be unchecked', () => {
35
+ utilities.verifyInnerText(highlightImagePage.multipleSelectionCheckboxLabel(), 'Multiple selection');
36
+ utilities.verifyElementVisibilityState(highlightImagePage.multipleSelectionCheckboxLabel(), 'exist');
37
+ utilities.verifyElementVisibilityState(highlightImagePage.multipleSelectionCheckbox(), 'exist');
38
+ highlightImagePage.steps.verifyMultipleSelectionCheckboxIsUnchecked();
39
+ });
40
+
41
+ it('When multiple selection checkbox is unchecked then the user should be able to highlight only one region in the set correct answer section', () => {
42
+ highlightImagePage.steps.highlightARegionInSetCorrectAnswerSection(0);
43
+ highlightImagePage.steps.highlightARegionInSetCorrectAnswerSection(2);
44
+ highlightImagePage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(0);
45
+ highlightImagePage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(1);
46
+ highlightImagePage.steps.verifySelectedHighlightRegionInSetCorrectAnswerSection(2);
47
+ });
48
+
49
+ it('When the user checks the multiple selection checkbox then the user should be able to highlight multiple regions in the set correct answer section', () => {
50
+ highlightImagePage.steps.checkMultipleSelectionCheckbox();
51
+ highlightImagePage.steps.highlightARegionInSetCorrectAnswerSection(1);
52
+ highlightImagePage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(0);
53
+ highlightImagePage.steps.verifySelectedHighlightRegionInSetCorrectAnswerSection(1);
54
+ highlightImagePage.steps.verifySelectedHighlightRegionInSetCorrectAnswerSection(2);
55
+ });
56
+
57
+ it('CSS of multiple selection checkbox', { tags: 'css' }, () => {
58
+ utilities.verifyCSS(highlightImagePage.multipleSelectionCheckboxLabel(), {
59
+ 'color': css.color.labelText,
60
+ 'font-size': css.fontSize.normal,
61
+ 'font-weight': css.fontWeight.regular
62
+ });
63
+ utilities.verifyCSS(highlightImagePage.multipleSelectionCheckbox().parents('[data-ngie-testid="multiple-selection-checkbox"]').find('svg g').eq(1), {
64
+ 'fill': css.color.primaryBtnBg
65
+ });
66
+ });
67
+
68
+ it('Accessibility of multiple selection checkbox', { tags: 'a11y' }, () => {
69
+ cy.checkAccessibility(highlightImagePage.multipleSelectionCheckboxLabel());
70
+ });
71
+ });
72
+
73
+ describe('Multiple selection: Preview tab', () => {
74
+ abortEarlySetup();
75
+ before(() => {
76
+ cy.log('Navigating to highlight image question type');
77
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
78
+ cy.barsPreLoaderWait();
79
+ highlightImagePage.steps.addQuestionInstructions();
80
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
81
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
82
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
83
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
84
+ highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
85
+ highlightImagePage.steps.verifyImageUploadedInSetCorrectAnswerSection();
86
+ highlightImagePage.steps.highlightRegionInImage(flowerHighlightRegion);
87
+ highlightImagePage.steps.highlightRegionInImage(branchesHighlightRegion);
88
+ highlightImagePage.steps.highlightRegionInImage(leafHighlightRegion);
89
+ });
90
+
91
+ it('When multiple selection checkbox is unchecked then the user should be able to highlight only one region in the preview tab', () => {
92
+ highlightImagePage.steps.verifyMultipleSelectionCheckboxIsUnchecked();
93
+ highlightImagePage.steps.switchToPreviewTab();
94
+ highlightImagePage.steps.highlightARegionInPreviewTab(0);
95
+ highlightImagePage.steps.highlightARegionInPreviewTab(2);
96
+ highlightImagePage.steps.verifyRegionIsNotHighlighted(0);
97
+ highlightImagePage.steps.verifyRegionIsNotHighlighted(1);
98
+ highlightImagePage.steps.verifySelectedHighlightRegionInPreviewTab(2);
99
+ });
100
+
101
+ it('When the user checks the multiple selection checkbox then the user should be able to highlight multiple regions in the preview tab', () => {
102
+ highlightImagePage.steps.switchToEditTab();
103
+ highlightImagePage.steps.checkMultipleSelectionCheckbox();
104
+ highlightImagePage.steps.switchToPreviewTab();
105
+ highlightImagePage.steps.highlightARegionInPreviewTab(1);
106
+ highlightImagePage.steps.highlightARegionInPreviewTab(2);
107
+ highlightImagePage.steps.verifyRegionIsNotHighlighted(0);
108
+ highlightImagePage.steps.verifySelectedHighlightRegionInPreviewTab(1);
109
+ highlightImagePage.steps.verifySelectedHighlightRegionInPreviewTab(2);
110
+ });
111
+ });
112
+
113
+ describe('Hide highlights: Set correct answer section', () => {
114
+ abortEarlySetup();
115
+ before(() => {
116
+ cy.log('Navigating to highlight image question type');
117
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
118
+ cy.barsPreLoaderWait();
119
+ highlightImagePage.steps.addQuestionInstructions();
120
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
121
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
122
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
123
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
124
+ highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
125
+ highlightImagePage.steps.verifyImageUploadedInSetCorrectAnswerSection();
126
+ highlightImagePage.steps.highlightRegionInImage(flowerHighlightRegion);
127
+ highlightImagePage.steps.highlightRegionInImage(branchesHighlightRegion);
128
+ highlightImagePage.steps.highlightRegionInImage(leafHighlightRegion);
129
+ });
130
+
131
+ it('\'Hide highlight\' label and checkbox should be displayed and by default it should be unchecked', () => {
132
+ utilities.verifyInnerText(highlightImagePage.hideHighlightsCheckboxLabel(), 'Hide highlights');
133
+ utilities.verifyElementVisibilityState(highlightImagePage.hideHighlightsCheckboxLabel(), 'exist');
134
+ utilities.verifyElementVisibilityState(highlightImagePage.hideHighlightsCheckbox(), 'exist');
135
+ highlightImagePage.steps.verifyHideHighlightsCheckboxIsUnchecked();
136
+ });
137
+
138
+ it('When \'Hide highlight\' checkbox is unchecked then the highlights should be displayed in the set correct answer section', () => {
139
+ highlightImagePage.steps.verifyHighlightRegionVisibleInSetCorrectAnswerSection(0);
140
+ highlightImagePage.steps.verifyHighlightRegionVisibleInSetCorrectAnswerSection(1);
141
+ highlightImagePage.steps.verifyHighlightRegionVisibleInSetCorrectAnswerSection(2);
142
+ });
143
+
144
+ it('When the user checks the \'Hide highlight\' checkbox then the highlights should not be displayed in the set correct answer section', () => {
145
+ highlightImagePage.steps.checkHideHighlightsCheckbox();
146
+ highlightImagePage.steps.verifyHighlightRegionHiddenInSetCorrectAnswerSection(0);
147
+ highlightImagePage.steps.verifyHighlightRegionHiddenInSetCorrectAnswerSection(1);
148
+ highlightImagePage.steps.verifyHighlightRegionHiddenInSetCorrectAnswerSection(2);
149
+ });
150
+
151
+ it('When the user hovers over the highlight regions the regions should be displayed in the set correct answer section', () => {
152
+ highlightImagePage.steps.hoverOverHighlightRegionInSetCorrectSection(0);
153
+ highlightImagePage.steps.verifyHighlightRegionVisibleInSetCorrectAnswerSection(0);
154
+ highlightImagePage.steps.verifyHighlightRegionHiddenInSetCorrectAnswerSection(1);
155
+ highlightImagePage.steps.verifyHighlightRegionHiddenInSetCorrectAnswerSection(2);
156
+ });
157
+
158
+ it('CSS of hide highlight checkbox and label', { tags: 'css' }, () => {
159
+ utilities.verifyCSS(highlightImagePage.hideHighlightsCheckboxLabel(), {
160
+ 'color': css.color.labelText,
161
+ 'font-size': css.fontSize.normal,
162
+ 'font-weight': css.fontWeight.regular
163
+ });
164
+ utilities.verifyCSS(highlightImagePage.hideHighlightsCheckbox().parents('[data-ngie-testid="hide-highlights-checkbox"]').find('svg g').eq(1), {
165
+ 'fill': css.color.primaryBtnBg
166
+ });
167
+ });
168
+
169
+ it('Accessibility of Set correct answer section', { tags: 'a11y' }, () => {
170
+ cy.checkAccessibility(highlightImagePage.hideHighlightsCheckboxLabel().parents('.highlight-image-set-correct-answer-wrapper'));
171
+ });
172
+
173
+ it('The user should be able to select and de-select highlight regions in the set correct answer section', () => {
174
+ highlightImagePage.steps.highlightARegionInSetCorrectAnswerSection(1);
175
+ highlightImagePage.steps.verifyHighlightRegionHiddenInSetCorrectAnswerSection(0);
176
+ highlightImagePage.steps.verifySelectedHighlightRegionVisibleInSetCorrectAnswerSection(1);
177
+ highlightImagePage.steps.verifyHighlightRegionHiddenInSetCorrectAnswerSection(2);
178
+ highlightImagePage.steps.removeHighlightOfARegionInSetCorrectAnswerSection(1);
179
+ utilities.hoverAwayFromElement();
180
+ highlightImagePage.steps.verifyHighlightRegionHiddenInSetCorrectAnswerSection(0);
181
+ highlightImagePage.steps.verifyHighlightRegionHiddenInSetCorrectAnswerSection(1);
182
+ highlightImagePage.steps.verifyHighlightRegionHiddenInSetCorrectAnswerSection(2);
183
+ });
184
+ });
185
+
186
+ describe('Hide highlights: Preview tab', () => {
187
+ abortEarlySetup();
188
+ before(() => {
189
+ cy.log('Navigating to highlight image question type');
190
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
191
+ cy.barsPreLoaderWait();
192
+ highlightImagePage.steps.addQuestionInstructions();
193
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
194
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
195
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
196
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
197
+ highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
198
+ highlightImagePage.steps.verifyImageUploadedInSetCorrectAnswerSection();
199
+ highlightImagePage.steps.highlightRegionInImage(flowerHighlightRegion);
200
+ highlightImagePage.steps.highlightRegionInImage(branchesHighlightRegion);
201
+ highlightImagePage.steps.highlightRegionInImage(leafHighlightRegion);
202
+ });
203
+
204
+ it('When \'Hide highlight\' checkbox is unchecked then the highlights should be displayed in the preview tab', () => {
205
+ highlightImagePage.steps.verifyHideHighlightsCheckboxIsUnchecked();
206
+ highlightImagePage.steps.switchToPreviewTab();
207
+ highlightImagePage.steps.verifyHighlightRegionVisibleInPreviewTab(0);
208
+ highlightImagePage.steps.verifyHighlightRegionVisibleInPreviewTab(1);
209
+ highlightImagePage.steps.verifyHighlightRegionVisibleInPreviewTab(2);
210
+ });
211
+
212
+ it('When the user checks the \'Hide highlight\' checkbox then the highlights should not be displayed in the preview tab', () => {
213
+ highlightImagePage.steps.switchToEditTab();
214
+ highlightImagePage.steps.checkHideHighlightsCheckbox();
215
+ highlightImagePage.steps.switchToPreviewTab();
216
+ highlightImagePage.steps.verifyHighlightRegionHiddenInPreviewTab(0);
217
+ highlightImagePage.steps.verifyHighlightRegionHiddenInPreviewTab(1);
218
+ highlightImagePage.steps.verifyHighlightRegionHiddenInPreviewTab(2);
219
+ });
220
+
221
+ it('When the user hovers over the highlight regions the regions should be displayed in the preview tab and the user should be able to select and de-select them', () => {
222
+ highlightImagePage.steps.hoverOverHighlightRegionInPreviewTab(0);
223
+ highlightImagePage.steps.verifyHighlightRegionVisibleInPreviewTab(0);
224
+ highlightImagePage.steps.verifyHighlightRegionHiddenInPreviewTab(1);
225
+ highlightImagePage.steps.verifyHighlightRegionHiddenInPreviewTab(2);
226
+ });
227
+
228
+ it('Accessibility of preview tab', { tags: 'a11y' }, () => {
229
+ cy.checkAccessibility(highlightImagePage.previewTabQuestionWrapper());
230
+ });
231
+
232
+ it('The user should be able to select and de-select highlight regions in the preview tab', () => {
233
+ highlightImagePage.steps.highlightARegionInSetCorrectAnswerSection(1);
234
+ highlightImagePage.steps.verifyHighlightRegionHiddenInPreviewTab(0);
235
+ highlightImagePage.steps.verifySelectedHighlightRegionVisibleInPreviewTab(1);
236
+ highlightImagePage.steps.verifyHighlightRegionHiddenInPreviewTab(2);
237
+ highlightImagePage.steps.removeHighlightOfARegionInPreviewTab(1);
238
+ utilities.hoverAwayFromElement();
239
+ highlightImagePage.steps.verifyHighlightRegionHiddenInPreviewTab(0);
240
+ highlightImagePage.steps.verifyHighlightRegionHiddenInPreviewTab(1);
241
+ highlightImagePage.steps.verifyHighlightRegionHiddenInPreviewTab(2);
242
+ });
243
+ });
244
+ });
@@ -0,0 +1,186 @@
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
+ const css = Cypress.env('css');
6
+
7
+ const flowerHighlightRegion = [[24, 6], [24, 24], [56, 24], [56, 6]];
8
+ const branchesHighlightRegion = [[36, 36], [36, 46], [58, 46], [58, 36]];
9
+ const leafHighlightRegion = [[54, 48], [54, 72], [82, 72], [82, 48]];
10
+
11
+ describe('Create Item page - Highlight image: Set correct answer, Alternate correct answer - Edit tab cases', () => {
12
+ before(() => {
13
+ cy.loginAs('admin');
14
+ });
15
+
16
+ describe('Set correct answer section', () => {
17
+ abortEarlySetup();
18
+ before(() => {
19
+ cy.log('Navigating to highlight image question type');
20
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
21
+ cy.barsPreLoaderWait();
22
+ highlightImagePage.steps.addQuestionInstructions();
23
+ });
24
+
25
+ it('When user has not uploaded any image then the \'Set correct answer\' section should not be displayed', () => {
26
+ utilities.verifyElementVisibilityState(highlightImagePage.setCorrectAnswerLabel(), 'notExist');
27
+ utilities.verifyElementVisibilityState(highlightImagePage.setCorrectAnswerHelpText(), 'notExist');
28
+ utilities.verifyElementVisibilityState(highlightImagePage.correctTab(), 'notExist');
29
+ utilities.verifyElementVisibilityState(highlightImagePage.alternateAnswerButton(), 'notExist');
30
+ });
31
+
32
+ it('When user uploads an image the \'Set correct answer\' section should be displayed along with the uploaded image', () => {
33
+ cy.log('Pre step: Switching to edit tab')
34
+ highlightImagePage.steps.switchToEditTab();
35
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
36
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
37
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
38
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
39
+ highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
40
+ utilities.verifyElementVisibilityState(highlightImagePage.setCorrectAnswerLabel(), 'visible');
41
+ utilities.verifyElementVisibilityState(highlightImagePage.setCorrectAnswerHelpText(), 'visible');
42
+ utilities.verifyElementVisibilityState(highlightImagePage.correctTab(), 'visible');
43
+ utilities.verifyElementVisibilityState(highlightImagePage.alternateAnswerButton(), 'visible');
44
+ highlightImagePage.steps.verifyImageUploadedInSetCorrectAnswerSection();
45
+ });
46
+
47
+ highlightImagePage.tests.verifyAutoScoredSetCorrectAnswerHeaderSectionContents('highlight image');
48
+
49
+ it('When user clicks on add alternate answer button without allotting points in the \'Set correct answer\' then a warning popup should be displayed', () => {
50
+ highlightImagePage.steps.clickOnAddAlternateAnswerButton();
51
+ utilities.verifyElementVisibilityState(highlightImagePage.dialogBox(), 'exist');
52
+ });
53
+
54
+ it('When user closes the warning popup \'Error: Please enter points\' and \'Error: Please set correct answer\' error message should be displayed', () => {
55
+ highlightImagePage.steps.closeWarningPopup();
56
+ highlightImagePage.steps.verifyPointsFieldErrorMessage()
57
+ highlightImagePage.steps.verifySetCorrectAnswerSectionErrorMessage()
58
+ highlightImagePage.steps.verifySetCorrectAnswerErrorIconIsDisplayed();
59
+ });
60
+
61
+ it('When user allots points and sets correct answer then the error messages and error icon should disappear', () => {
62
+ highlightImagePage.steps.allotPoints(10);
63
+ highlightImagePage.steps.highlightRegionInImage(flowerHighlightRegion);
64
+ highlightImagePage.steps.highlightRegionInImage(branchesHighlightRegion);
65
+ highlightImagePage.steps.highlightRegionInImage(leafHighlightRegion);
66
+ highlightImagePage.steps.highlightARegionInSetCorrectAnswerSection(0);
67
+ highlightImagePage.steps.highlightARegionInSetCorrectAnswerSection(1);
68
+ highlightImagePage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
69
+ highlightImagePage.steps.verifyErrorMessageIsNotDisplayed();
70
+ cy.log('Post step: Clear points field')
71
+ highlightImagePage.steps.clearPointsField();
72
+ });
73
+
74
+ highlightImagePage.tests.verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty('Correct tab');
75
+ });
76
+
77
+ describe('Alternate correct answer', () => {
78
+ abortEarlySetup();
79
+ before(() => {
80
+ cy.log('Navigating to highlight image question type');
81
+ highlightImagePage.steps.navigateToCreateQuestion('highlight image');
82
+ cy.barsPreLoaderWait();
83
+ highlightImagePage.steps.addQuestionInstructions();
84
+ uploadImageSectionComponent.steps.uploadFile('highlightImage.jpg');
85
+ uploadImageSectionComponent.steps.verifyUploadedImageInImagePopup();
86
+ uploadImageSectionComponent.steps.clickOnImagePopupOkButton();
87
+ utilities.verifyElementVisibilityState(uploadImageSectionComponent.uploadImagePopup(), 'notExist');
88
+ highlightImagePage.steps.verifyImageUploadedInHighlightRegion();
89
+ highlightImagePage.steps.verifyImageUploadedInSetCorrectAnswerSection();
90
+ highlightImagePage.steps.highlightRegionInImage(flowerHighlightRegion);
91
+ highlightImagePage.steps.highlightRegionInImage(branchesHighlightRegion);
92
+ highlightImagePage.steps.highlightRegionInImage(leafHighlightRegion);
93
+ });
94
+
95
+ highlightImagePage.tests.verifyAutoScoredAlternateAnswer('highlight image');
96
+
97
+ it('When the user allots points to the \'Correct tab\' and highlights region in the \'Set correct answer\' section then on clicking the \'Alternate tab\' button an alternate tab should be added', () => {
98
+ highlightImagePage.steps.allotPoints(10);
99
+ highlightImagePage.steps.highlightARegionInSetCorrectAnswerSection(0);
100
+ highlightImagePage.steps.verifyErrorMessageIsNotDisplayed();
101
+ highlightImagePage.steps.verifySetCorrectAnswerErrorIconIsNotDisplayed();
102
+ highlightImagePage.steps.addAlternateTab(1);
103
+ });
104
+
105
+ it('When user adds an alternate tab all the highlight regions should be displayed and they should not be selected', () => {
106
+ highlightImagePage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(0);
107
+ highlightImagePage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(1);
108
+ highlightImagePage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(2);
109
+ });
110
+
111
+ it('User should be able set correct answer section in the \'Alternate tab\' by ordering the options in the \'Alternate tab\'', () => {
112
+ highlightImagePage.steps.highlightARegionInSetCorrectAnswerSection(1);
113
+ });
114
+
115
+ highlightImagePage.tests.verifyAutoScoredPointsErrorMessageWhenPointsFieldIsEmpty('Alternate tab');
116
+
117
+ //Failing due to https://redmine.zeuslearning.com/issues/544273
118
+ it('CSS of active state of Alternate answer tab', { tags: 'css' }, () => {
119
+ utilities.verifyCSS(highlightImagePage.alternateAnswerTab(1), {
120
+ 'color': css.color.secondaryBtnActive,
121
+ 'font-size': css.fontSize.default,
122
+ 'font-weight': css.fontWeight.bold
123
+ });
124
+ cy.log('CSS of inactive Correct answer tab')
125
+ utilities.verifyCSS(highlightImagePage.correctTab(), {
126
+ 'color': css.color.labels,
127
+ 'font-size': css.fontSize.default,
128
+ 'font-weight': css.fontWeight.bold
129
+ });
130
+ });
131
+
132
+ highlightImagePage.tests.verifyA11yOfAlternateAnswerTab();
133
+
134
+ it('When user switches to the \'Correct tab\' from the \'Alternate tab\' the selected options in the \'Correct tab\' should remain the same', () => {
135
+ highlightImagePage.steps.navigateToCorrectTab();
136
+ highlightImagePage.steps.verifySelectedHighlightRegionInSetCorrectAnswerSection(0);
137
+ highlightImagePage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(1);
138
+ highlightImagePage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(2);
139
+ });
140
+
141
+ it('When user clicks on \'Add Alternate Answer\' button a new tab should be added with the name \'Alternate 2\' and appropriate options should be displayed in the set correct answer section', () => {
142
+ highlightImagePage.steps.addAlternateTab(2);
143
+ highlightImagePage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(0);
144
+ highlightImagePage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(1);
145
+ highlightImagePage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(2);
146
+ });
147
+
148
+ highlightImagePage.tests.verifyWarningPopupAndTabNavigationWhenNoPointsAddedInAlternateTab();
149
+
150
+ it('When the user clicks on the \'Close\' button alongside alternate answer tab, alternate answer tab should get removed and the name of the alternate answer tabs should get updated and correct answers should be displayed accordingly', () => {
151
+ cy.log('Set correct answer and points in alternate 2 tab, then switch to Alternate 1 tab and click delete icon button');
152
+ highlightImagePage.steps.allotPoints(2);
153
+ highlightImagePage.steps.highlightARegionInSetCorrectAnswerSection(2);
154
+ highlightImagePage.steps.navigateToAlternateTab(1);
155
+ highlightImagePage.steps.deleteAlternateTab();
156
+ utilities.verifyElementVisibilityState(highlightImagePage.alternateAnswerTab(2), 'notExist');
157
+ utilities.verifyInnerText(highlightImagePage.alternateAnswerTab(1), 'Alternate 1')
158
+ highlightImagePage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(0);
159
+ highlightImagePage.steps.verifyRegionIsNotHighlightedInSetCorrectAnswerSection(1);
160
+ highlightImagePage.steps.verifySelectedHighlightRegionInSetCorrectAnswerSection(2);
161
+ });
162
+
163
+ it('When the user is on \'Alternate 1\' tab then on deleting a highlight region set as correct answer in Correct answer tab, tab should be switched from \'Alternate 1\' tab to \'Correct\' tab and \'Error: Please set a correct answer.\' validation error message should be thrown along with an error icon besides the \'Correct\' tab', () => {
164
+ highlightImagePage.steps.eraseAHighlightRegion([flowerHighlightRegion[0]]);
165
+ highlightImagePage.steps.verifyActiveStateOfCorrectTab();
166
+ utilities.verifyTextContent(highlightImagePage.errorMessage(), 'Error: Please set a correct answer.');
167
+ utilities.verifyElementVisibilityState(highlightImagePage.errorMessage(), 'visible');
168
+ highlightImagePage.steps.verifySetCorrectAnswerErrorIconIsDisplayed();
169
+ });
170
+
171
+ //Failing due to https://redmine.zeuslearning.com/issues/544273
172
+ it('CSS of active state of Correct answer tab', { tags: 'css' }, () => {
173
+ utilities.verifyCSS(highlightImagePage.correctTab(), {
174
+ 'color': css.color.secondaryBtnActive,
175
+ 'font-size': css.fontSize.default,
176
+ 'font-weight': css.fontWeight.bold
177
+ });
178
+ cy.log('CSS of inactive Alternate answer tab')
179
+ utilities.verifyCSS(highlightImagePage.alternateAnswerTab(1), {
180
+ 'color': css.color.labels,
181
+ 'font-size': css.fontSize.default,
182
+ 'font-weight': css.fontWeight.bold
183
+ });
184
+ });
185
+ });
186
+ });