itemengine-cypress-automation 1.0.564-IEI-6998-Add-coverage-for-image-hightlight-question-type-f372002.0 → 1.0.564-IEI-7011-195aab1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  import { singleSelectionPage } from "../../../pages/singleSelectionPage";
2
2
  import abortEarlySetup from "../../../support/helpers/abortEarly";
3
3
  const css = Cypress.env('css');
4
+ const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT');
4
5
 
5
6
  const options = ['Pollution caused by treating chemical waste', 'Pollution caused by cement production', 'Pollution caused by methane production', 'Pollution caused by cement and methane production'];
6
7
 
@@ -35,6 +36,20 @@ describe('Create item page - Single selection: All or nothing with alternative a
35
36
  singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
36
37
  //correct answer section
37
38
  singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(1);
39
+ //show alternative answers
40
+ if (alternativeAnswerCheck === 'true') {
41
+ singleSelectionPage.steps.verifyCorrectAnswersLabelAndPointVisible('(20 points)');
42
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleExists();
43
+ singleSelectionPage.steps.disableShowAlternativeAnswersToggle();
44
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
45
+ singleSelectionPage.steps.verifyAlternativeAnswersSectionNotExist();
46
+ singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
47
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleChecked();
48
+ singleSelectionPage.steps.verifyAlternativeAnswersLabelAndPointVisible(1, '(10 points)');
49
+ singleSelectionPage.steps.verifyAlternateAnswerOptionIconCorrectAnswerSection(2);
50
+ singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
51
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
52
+ }
38
53
  singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
39
54
  });
40
55
 
@@ -49,6 +64,9 @@ describe('Create item page - Single selection: All or nothing with alternative a
49
64
  singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
50
65
  singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
51
66
  singleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
67
+ if (alternativeAnswerCheck === 'true') {
68
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
69
+ }
52
70
  //singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
53
71
  /*cy.log('When the user has attempted the question with responses from the correct accordion and clicks on \'Check answer\' button, then correct icons should be displayed besides correct responses, correct answer border and a label should not be displayed below the question preview')
54
72
  singleSelectionPage.steps.checkAnswer();
@@ -74,6 +92,9 @@ describe('Create item page - Single selection: All or nothing with alternative a
74
92
  singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
75
93
  singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
76
94
  singleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
95
+ if (alternativeAnswerCheck === 'true') {
96
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
97
+ }
77
98
  singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
78
99
  /*cy.log('When the user has attempted the question with responses from the alternative accordion and clicks on \'Check answer\' button, then correct icons should only be displayed besides correct responses from the alternative accordion, correct answer border and a label should not be displayed below the question preview')
79
100
  singleSelectionPage.steps.checkAnswer();
@@ -98,6 +119,20 @@ describe('Create item page - Single selection: All or nothing with alternative a
98
119
  singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
99
120
  //correct answer section
100
121
  singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(1);
122
+ //show alternative answers
123
+ if (alternativeAnswerCheck === 'true') {
124
+ singleSelectionPage.steps.verifyCorrectAnswersLabelAndPointVisible('(20 points)');
125
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleExists();
126
+ singleSelectionPage.steps.disableShowAlternativeAnswersToggle();
127
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
128
+ singleSelectionPage.steps.verifyAlternativeAnswersSectionNotExist();
129
+ singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
130
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleChecked();
131
+ singleSelectionPage.steps.verifyAlternativeAnswersLabelAndPointVisible(1, '(10 points)');
132
+ singleSelectionPage.steps.verifyAlternateAnswerOptionIconCorrectAnswerSection(2);
133
+ singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
134
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
135
+ }
101
136
  //singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
102
137
  /*cy.log('When the user has attempted the question incorrectly and clicks on \'Check answer\' button, then incorrect icons should only be displayed besides incorrect responses, correct icons should not be displayed besides unattempted correct options, incorrect answer border and a label should not be displayed below the question preview')
103
138
  singleSelectionPage.steps.checkAnswer();
@@ -156,6 +191,20 @@ describe('Create item page - Single selection: All or nothing with alternative a
156
191
  singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
157
192
  //correct answer section
158
193
  singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(2);
194
+ // alternative answer section
195
+ if (alternativeAnswerCheck === 'true') {
196
+ singleSelectionPage.steps.verifyCorrectAnswersLabelAndPointVisible('(20 points)');
197
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleExists();
198
+ singleSelectionPage.steps.disableShowAlternativeAnswersToggle();
199
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
200
+ singleSelectionPage.steps.verifyAlternativeAnswersSectionNotExist();
201
+ singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
202
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleChecked();
203
+ singleSelectionPage.steps.verifyAlternativeAnswersLabelAndPointVisible(1, '(10 points)');
204
+ singleSelectionPage.steps.verifyAlternateAnswerOptionIconCorrectAnswerSection(1);
205
+ singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
206
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
207
+ }
159
208
  singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
160
209
  });
161
210
 
@@ -170,6 +219,9 @@ describe('Create item page - Single selection: All or nothing with alternative a
170
219
  singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
171
220
  singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
172
221
  singleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
222
+ if (alternativeAnswerCheck === 'true') {
223
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
224
+ }
173
225
  singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
174
226
  /*cy.log('When the user has attempted the question with responses from the correct accordion and clicks on \'Check answer\' button, then correct icons should be displayed besides correct responses, correct answer border and a label should not be displayed below the question preview')
175
227
  singleSelectionPage.steps.checkAnswer();
@@ -193,6 +245,9 @@ describe('Create item page - Single selection: All or nothing with alternative a
193
245
  singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
194
246
  singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
195
247
  singleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
248
+ if (alternativeAnswerCheck === 'true') {
249
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
250
+ }
196
251
  singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
197
252
  /*cy.log('When the user has attempted the question with responses from the alternative accordion and clicks on \'Check answer\' button, then correct icons should only be displayed besides correct responses from the alternative accordion, correct answer border and a label should not be displayed below the question preview')
198
253
  singleSelectionPage.steps.checkAnswer();
@@ -217,6 +272,20 @@ describe('Create item page - Single selection: All or nothing with alternative a
217
272
  singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
218
273
  //correct answer section
219
274
  singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(2);
275
+ // alternative answer section
276
+ if (alternativeAnswerCheck === 'true') {
277
+ singleSelectionPage.steps.verifyCorrectAnswersLabelAndPointVisible('(20 points)');
278
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleExists();
279
+ singleSelectionPage.steps.disableShowAlternativeAnswersToggle();
280
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
281
+ singleSelectionPage.steps.verifyAlternativeAnswersSectionNotExist();
282
+ singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
283
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleChecked();
284
+ singleSelectionPage.steps.verifyAlternativeAnswersLabelAndPointVisible(1, '(10 points)');
285
+ singleSelectionPage.steps.verifyAlternateAnswerOptionIconCorrectAnswerSection(1);
286
+ singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
287
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
288
+ }
220
289
  singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
221
290
  /*cy.log('When the user has attempted the question incorrectly and clicks on \'Check answer\' button, then incorrect icons should be displayed besides incorrect responses, correct icons should not be displayed besides unattempted correct options, incorrect answer border and a label should not be displayed below the question preview')
222
291
  singleSelectionPage.steps.checkAnswer();
@@ -255,6 +324,20 @@ describe('Create item page - Single selection: All or nothing with alternative a
255
324
  singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
256
325
  //correct answer section
257
326
  singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(1);
327
+ // alternative answer section
328
+ if (alternativeAnswerCheck === 'true') {
329
+ singleSelectionPage.steps.verifyCorrectAnswersLabelAndPointVisible('(20 points)');
330
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleExists();
331
+ singleSelectionPage.steps.disableShowAlternativeAnswersToggle();
332
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
333
+ singleSelectionPage.steps.verifyAlternativeAnswersSectionNotExist();
334
+ singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
335
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleChecked();
336
+ singleSelectionPage.steps.verifyAlternativeAnswersLabelAndPointVisible(1, '(20 points)');
337
+ singleSelectionPage.steps.verifyAlternateAnswerOptionIconCorrectAnswerSection(2);
338
+ singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
339
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
340
+ }
258
341
  singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
259
342
  });
260
343
 
@@ -269,6 +352,9 @@ describe('Create item page - Single selection: All or nothing with alternative a
269
352
  singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
270
353
  singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
271
354
  singleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
355
+ if (alternativeAnswerCheck === 'true') {
356
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
357
+ }
272
358
  singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
273
359
  /*cy.log('When the user has attempted the question with responses from the correct accordion and clicks on \'Check answer\' button, then correct icons should be displayed besides correct responses, correct answer border and a label should not be displayed below the question preview')
274
360
  singleSelectionPage.steps.checkAnswer();
@@ -292,6 +378,9 @@ describe('Create item page - Single selection: All or nothing with alternative a
292
378
  singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
293
379
  singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
294
380
  singleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
381
+ if (alternativeAnswerCheck === 'true') {
382
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
383
+ }
295
384
  singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
296
385
  /*cy.log('When the user has attempted the question with responses from the alternative accordion and clicks on \'Check answer\' button, then correct icons should only be displayed besides correct responses from the alternative accordion, correct answer border and a label should not be displayed below the question preview')
297
386
  singleSelectionPage.steps.checkAnswer();
@@ -316,6 +405,20 @@ describe('Create item page - Single selection: All or nothing with alternative a
316
405
  singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
317
406
  //correct answer section
318
407
  singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(1);
408
+ //show alternative answers
409
+ if (alternativeAnswerCheck === 'true') {
410
+ singleSelectionPage.steps.verifyCorrectAnswersLabelAndPointVisible('(20 points)');
411
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleExists();
412
+ singleSelectionPage.steps.disableShowAlternativeAnswersToggle();
413
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
414
+ singleSelectionPage.steps.verifyAlternativeAnswersSectionNotExist();
415
+ singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
416
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleChecked();
417
+ singleSelectionPage.steps.verifyAlternativeAnswersLabelAndPointVisible(1, '(20 points)');
418
+ singleSelectionPage.steps.verifyAlternateAnswerOptionIconCorrectAnswerSection(2);
419
+ singleSelectionPage.steps.clickShowAlternativeAnswersToggle();
420
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleUnchecked();
421
+ }
319
422
  singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
320
423
  /*cy.log('When the user has attempted the question incorrectly and clicks on \'Check answer\' button, then incorrect icons should only be displayed besides incorrect responses, correct icons should not be displayed besides unattempted correct options, incorrect answer border and a label should not be displayed below the question preview')
321
424
  singleSelectionPage.steps.checkAnswer();
@@ -3,6 +3,7 @@ export * from './commonComponents';
3
3
  export * from './additionalSettingsPanel';
4
4
  export * from './mcqAdditionalSettingsBase';
5
5
  export * from './questionInstructionsComponent';
6
+ export * from './showAlternativeAnswersComponent';
6
7
  export * from './ckEditorToolbar';
7
8
  export * from './essayResponseCommonComponents';
8
9
  export * from './optionsWrapperComponent';
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Show Alternative Answers Component
3
+ * Common functionality for managing and verifying alternative answers toggle and content
4
+ * across different question types (Single Selection, Multiple Selection, etc.)
5
+ */
6
+
7
+ const showAlternativeAnswersComponent = {
8
+ // Selectors for the alternative answers toggle
9
+ showAlternativeAnswersToggleWrapper: () => cy.get('[class*="ShowAlternativeAnswerSwitch"][class*="SwitchWrapper"]'),
10
+ showAlternativeAnswersToggleInput: () => cy.get('[class*="ShowAlternativeAnswerSwitch"][class*="SwitchWrapper"] input[type="checkbox"]'),
11
+ showAlternativeAnswersToggleLabel: () => cy.get('[class*="ShowAlternativeAnswerSwitch"][class*="SwitchWrapper"] [class*="SwitchLabelWrapper"]'),
12
+ showAlternativeAnswersToggleButton: () => cy.get('[class*="ShowAlternativeAnswerSwitch"][class*="SwitchWrapper"] .MuiButtonBase-root'),
13
+
14
+ // Selectors for the alternative answers content section
15
+ alternativeAnswersSection: () => cy.get('[class*="CorrectAnswerLabelWrapper"]').eq(1), // Alternative answer is typically the second wrapper
16
+ alternativeAnswerGridWrapper: () => cy.get('[class*="CorrectAnswerGridWrapper"]'),
17
+ alternativeAnswerSelectionGrid: () => cy.get('.correct-ans-selection-grid'),
18
+ correctAnswerLabelWrapper: () => cy.get('[class*="CorrectAnswerLabelWrapper"]').eq(0), // Correct answer is typically the first wrapper
19
+
20
+ steps: {
21
+ /**
22
+ * Verifies that the "Show alternative answers" toggle is present and visible
23
+ */
24
+ verifyShowAlternativeAnswersToggleExists: () => {
25
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper().should('be.visible');
26
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleLabel()
27
+ .should('contain.text', 'Show alternative answers');
28
+ },
29
+
30
+ /**
31
+ * Verifies that the "Show alternative answers" toggle does not exist
32
+ */
33
+ verifyShowAlternativeAnswersToggleNotExists: () => {
34
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
35
+ .should('not.exist');
36
+ },
37
+
38
+ /**
39
+ * Verifies that the "Show alternative answers" toggle is in the checked (enabled) state
40
+ */
41
+ verifyShowAlternativeAnswersToggleChecked: () => {
42
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
43
+ .should('be.checked')
44
+ .and('have.attr', 'aria-pressed', 'true');
45
+ // Verify the checked state visual indicator (tick icon)
46
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
47
+ .find('.icon-ILC-tick-icon')
48
+ .should('be.visible');
49
+ },
50
+
51
+ /**
52
+ * Verifies that the "Show alternative answers" toggle is in the unchecked (disabled) state
53
+ */
54
+ verifyShowAlternativeAnswersToggleUnchecked: () => {
55
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
56
+ .should('not.be.checked')
57
+ .and('have.attr', 'aria-pressed', 'false');
58
+ // Verify the unchecked state visual indicator (x-circle icon)
59
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
60
+ .find('.icon-x-circle')
61
+ .should('be.visible');
62
+ },
63
+
64
+ /**
65
+ * Clicks the "Show alternative answers" toggle to change its state
66
+ */
67
+ clickShowAlternativeAnswersToggle: () => {
68
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleButton()
69
+ .click();
70
+ },
71
+
72
+ /**
73
+ * Enables the "Show alternative answers" toggle (clicks it if it's currently unchecked)
74
+ */
75
+ enableShowAlternativeAnswersToggle: () => {
76
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
77
+ .then(($input) => {
78
+ if (!$input.prop('checked')) {
79
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
80
+ }
81
+ });
82
+ },
83
+
84
+ /**
85
+ * Disables the "Show alternative answers" toggle (clicks it if it's currently checked)
86
+ */
87
+ disableShowAlternativeAnswersToggle: () => {
88
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
89
+ .then(($input) => {
90
+ if ($input.prop('checked')) {
91
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
92
+ }
93
+ });
94
+ },
95
+
96
+ /**
97
+ * Verifies that the alternative answers section is visible
98
+ * @param {number} index - The index of the alternative answer (e.g., 1 for "Alternative answer 1")
99
+ * @param {string} points - The expected points for the alternative answer
100
+ */
101
+
102
+ verifyAlternativeAnswersLabelAndPointVisible: (index, points) => {
103
+ showAlternativeAnswersComponent.alternativeAnswersSection().should('be.visible');
104
+
105
+ if (points) {
106
+ showAlternativeAnswersComponent.alternativeAnswersSection()
107
+ .parent()
108
+ .find('p')
109
+ .invoke('text')
110
+ .then((text) => {
111
+ expect(text.trim()).to.equal(points);
112
+ });
113
+ }
114
+ },
115
+
116
+ /**
117
+ * Verifies that the correct answers section is visible
118
+ * @param {number} points - The expected points for the alternative answer
119
+ */
120
+
121
+ verifyCorrectAnswersLabelAndPointVisible: (points) => {
122
+ showAlternativeAnswersComponent.correctAnswerLabelWrapper()
123
+ .should('be.visible');
124
+
125
+ if (points) {
126
+ showAlternativeAnswersComponent.correctAnswerLabelWrapper()
127
+ .parent()
128
+ .find('p')
129
+ .invoke('text')
130
+ .then((text) => {
131
+ expect(text.trim()).to.equal(points);
132
+ });
133
+ }
134
+ },
135
+
136
+ /**
137
+ * Verifies that the alternative answers section does not exist
138
+ */
139
+ verifyAlternativeAnswersSectionNotExist: () => {
140
+ showAlternativeAnswersComponent.alternativeAnswersSection().should('not.exist');
141
+ },
142
+ },
143
+ };
144
+
145
+ export { showAlternativeAnswersComponent };
@@ -1,7 +1,6 @@
1
1
  import utilities from "../support/helpers/utilities";
2
2
  import { additionalSettingsAccessibilitySectionComponent, additionalSettingsPanel, autoScoredScoringPreviewTab, autoScoredScoringSectionMultiResponseType, autoScoredSpecifyCorrectAnswerSection, autoScoredStudentViewSettings, backgroundImageUploadComponent, commonComponents, createQuestionBasePage, enableOuterBorderComponent, gradingViewEnumerationComponent, imageActionsComponent, imageCanvasComponent, questionInstructionsComponent, scoringSectionBaseEditTab, showAvailableOptionsToStudents, showStudentMaximumNumberOfPossibleSelections, singleMultipleSelectionModeComponent, colorPopupComponent } from "./components";
3
3
  import { createItemPage } from "./createItemPage";
4
- import { itemPreviewPage } from "./itemPreviewPage";
5
4
  const css = Cypress.env('css');
6
5
  let imageWidth = 768;
7
6
  let imageHeight = 432;
@@ -19,7 +18,6 @@ const selectors = {
19
18
  ...imageActionsComponent,
20
19
  ...additionalSettingsPanel,
21
20
  ...gradingViewEnumerationComponent,
22
- ...itemPreviewPage,
23
21
 
24
22
  //Image selection style section.
25
23
  imageSelectionStyleLabel: () => cy.get('.options-label'),
@@ -112,12 +110,6 @@ const selectors = {
112
110
  saturationPointer: () => cy.get('.react-colorful__pointer.react-colorful__saturation-pointer'),
113
111
  huePointer: () => cy.get('.react-colorful__pointer.react-colorful__hue-pointer'),
114
112
  alphaPointer: () => cy.get('.react-colorful__pointer.react-colorful__alpha-pointer'),
115
- enumerationPlacementLabel: () => cy.get('[class*="options-container-cls dropzone-identifiers-wrapper"] .options-label').eq(1),
116
- enumerationToggleButtonContainer: () => cy.get('[aria-label="Enumeration placement"]'),
117
- enumerationPlacementTopToggleButton: () => cy.get('[data-ngie-testid="top-toggle-button"]'),
118
- enumerationPlacementCenterToggleButton: () => cy.get('[data-ngie-testid="center-toggle-button"]').eq(1),
119
- enumerationPlacementBottomToggleButton: () => cy.get('[data-ngie-testid="bottom-toggle-button"]'),
120
- enumerationForHighlightsPreviewTab: () => cy.get('[class*="highlight-svg-responseive"] circle'),
121
113
  }
122
114
 
123
115
  const steps = {
@@ -320,7 +312,7 @@ const steps = {
320
312
  * @description this function verifies height of canvas
321
313
  */
322
314
  verifyCanvasHeight: (height) => {
323
- const tolerance = 10
315
+ const tolerance = 2
324
316
  imageHighlightPage.specifyPossibleOptionsImageCanvas()
325
317
  .should('have.css', 'height')
326
318
  .then(($cssHeight) => {
@@ -667,20 +659,20 @@ const steps = {
667
659
 
668
660
  verifyCanvasImageTopLeftAlignedInPreviewTab: () => {
669
661
  imageHighlightPage.imagePreviewTab()
670
- .should('have.attr', 'x', '0')
671
- .and('have.attr', 'y', '0');
662
+ .should('have.css', 'top', '0px')
663
+ .and('have.css', 'left', '0px');
672
664
  },
673
665
 
674
666
  verifyCanvasImageCenterAlignedInPreviewTab: () => {
675
667
  imageHighlightPage.imagePreviewTab()
676
- .should('have.attr', 'x', '100')
677
- .and('have.attr', 'y', '100');
668
+ .should('not.have.css', 'top', '0px')
669
+ .and('not.have.css', 'left', '0px');
678
670
  },
679
671
 
680
672
  verifyCanvasImageTopRightAlignedInPreviewTab: () => {
681
673
  imageHighlightPage.imagePreviewTab()
682
- .should('have.attr', 'x', '100')
683
- .and('not.have.attr', 'y', '200');
674
+ .should('have.css', 'top', '0px')
675
+ .and('not.have.css', 'left', '0px');
684
676
  },
685
677
 
686
678
  /**
@@ -1152,20 +1144,6 @@ const steps = {
1152
1144
  });
1153
1145
  },
1154
1146
 
1155
- /**
1156
- * @param {number} index of highlight region
1157
- * @description this function verifies the outLineHighlight of selected highlight in item preview tab.
1158
- */
1159
- verifyOutlineHighlightRegionItemPreviewTabSection: (index) => {
1160
- imageHighlightPage.itemPreviewPageWrapper()
1161
- .within(() => {
1162
- utilities.verifyCSS(imageHighlightPage.specifyCorrectAnswerSectionHighlightPolygon().eq(index), {
1163
- 'stroke-width': '2px',
1164
- 'stroke': css.color.activeHighlightBorder
1165
- });
1166
- });
1167
- },
1168
-
1169
1147
  /**
1170
1148
  * @param {number} index of highlight region
1171
1149
  * @description this function verifies the patternHighlight of selected highlight in preview tab.
@@ -1727,161 +1705,6 @@ const steps = {
1727
1705
  Math.abs(ag - eg) <= tolerance &&
1728
1706
  Math.abs(ab - eb) <= tolerance
1729
1707
  );
1730
- },
1731
-
1732
- /**
1733
- * @param {number} width index for the border style.
1734
- * @param {number} height index for the border style.
1735
- * @description Verifies the height and width of image in preview tab.
1736
- */
1737
- verifyImageDimensionsPreviewTab: (width, height) => {
1738
- imageHighlightPage.imagePreviewTab()
1739
- .should('have.css', 'width', `${width}px`)
1740
- .and('have.css', 'height', `${height}px`);
1741
- },
1742
-
1743
- /**
1744
- * @description Clicks on the bottom enumeration placement button.
1745
- */
1746
- selectBottomEnumerationPlacementToggle: () => {
1747
- imageHighlightPage.enumerationPlacementBottomToggleButton()
1748
- .click();
1749
- },
1750
-
1751
- /**
1752
- * @description Clicks on the center enumeration placement button.
1753
- */
1754
- selectCenterEnumerationPlacementToggle: () => {
1755
- imageHighlightPage.enumerationPlacementCenterToggleButton()
1756
- .click();
1757
- },
1758
-
1759
- /**
1760
- * @param {string} enumerationPlacement placement of the enumeration.
1761
- * @param {number} index index of highlight region
1762
- * @description Verifies the enumeration placement for highlight regions in the preview tab.
1763
- */
1764
- verifyNumerationPlacementForHighlightRegionInPreviewTab: (enumerationPlacement, index) => {
1765
- const tolerance = 1
1766
- switch (enumerationPlacement) {
1767
- case 'Top':
1768
- switch (index) {
1769
- case 0:
1770
- imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
1771
- .invoke('attr', 'cx')
1772
- .then(actualCx => {
1773
- const roundedCx = Number(actualCx).toFixed(2); // keep two decimals
1774
- expect(roundedCx).to.equal('307.80');
1775
- });
1776
- imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
1777
- .invoke('attr', 'cy')
1778
- .then(actualCx => {
1779
- const roundedCx = Number(actualCx).toFixed(2); // keep two decimals
1780
- expect(roundedCx).to.equal('59.03');
1781
- });
1782
- imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
1783
- .should('have.attr', 'r', '12');
1784
- break;
1785
- case 1:
1786
- imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
1787
- .invoke('attr', 'cx')
1788
- .then(actualCx => {
1789
- const roundedCx = Number(actualCx).toFixed(2); // keep two decimals
1790
- expect(roundedCx).to.equal('200.52');
1791
- });
1792
- imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
1793
- .invoke('attr', 'cy')
1794
- .then(actualCx => {
1795
- const roundedCx = Number(actualCx).toFixed(2); // keep two decimals
1796
- expect(roundedCx).to.equal('213.11');
1797
- });
1798
- imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
1799
- .should('have.attr', 'r', '12');
1800
- break;
1801
- default:
1802
- throw new Error(`Unsupported index ${index} for placement 'Top'`);
1803
- }
1804
- break;
1805
- case 'Center':
1806
- switch (index) {
1807
- case 0:
1808
- // Match cx only up to 2 decimal places to allow minor rendering variance.
1809
- imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
1810
- .invoke('attr', 'cx')
1811
- .then(actualCx => {
1812
- const roundedCx = Number(actualCx).toFixed(2); // keep two decimals
1813
- expect(roundedCx).to.equal('365.45');
1814
- });
1815
- imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
1816
- .invoke('attr', 'cy')
1817
- .then(actualCy => {
1818
- const roundedCy = Number(actualCy).toFixed(2); // keep two decimals
1819
- expect(roundedCy).to.equal('100.06');
1820
- });
1821
- imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
1822
- .should('have.attr', 'r', '12');
1823
- break;
1824
- case 1:
1825
- imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
1826
- .invoke('attr', 'cx')
1827
- .then(actualCx => {
1828
- const roundedCx = Number(actualCx).toFixed(2); // keep two decimals
1829
- expect(roundedCx).to.equal('284.74');
1830
- });
1831
- imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
1832
- .invoke('attr', 'cy')
1833
- .then(actualCy => {
1834
- const roundedCy = Number(actualCy).toFixed(2); // keep two decimals
1835
- expect(roundedCy).to.equal('238.14');
1836
- });
1837
- imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
1838
- .should('have.attr', 'r', '12');
1839
- break;
1840
- default:
1841
- throw new Error(`Unsupported index ${index} for placement 'Center'`);
1842
- }
1843
- break;
1844
- case 'Bottom':
1845
- switch (index) {
1846
- case 0:
1847
- imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
1848
- .invoke('attr', 'cx')
1849
- .then(actualCx => {
1850
- const roundedCx = Number(actualCx).toFixed(2); // keep two decimals
1851
- expect(roundedCx).to.equal('307.80');
1852
- });
1853
- imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
1854
- .invoke('attr', 'cy')
1855
- .then(actualCy => {
1856
- const roundedCy = Number(actualCy).toFixed(2); // keep two decimals
1857
- expect(roundedCy).to.equal('167.09');
1858
- });
1859
- imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
1860
- .should('have.attr', 'r', '12');
1861
- break;
1862
- case 1:
1863
- imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
1864
- .invoke('attr', 'cx')
1865
- .then(actualCx => {
1866
- const roundedCx = Number(actualCx).toFixed(2); // keep two decimals
1867
- expect(roundedCx).to.equal('200.52');
1868
- });
1869
- imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
1870
- .invoke('attr', 'cy')
1871
- .then(actualCy => {
1872
- const roundedCy = Number(actualCy).toFixed(2); // keep two decimals
1873
- expect(roundedCy).to.equal('289.16');
1874
- });
1875
- imageHighlightPage.enumerationForHighlightsPreviewTab().eq(index)
1876
- .should('have.attr', 'r', '12');
1877
- break;
1878
- default:
1879
- throw new Error(`Unsupported index ${index} for placement 'Bottom'`);
1880
- }
1881
- break;
1882
- default:
1883
- throw new Error(`Invalid enumeration placement '${enumerationPlacement}'`);
1884
- }
1885
1708
  }
1886
1709
  }
1887
1710
 
@@ -2,7 +2,6 @@ import { createQuestionBasePage, autoScoredScoringPreviewTab } from "./component
2
2
 
3
3
  const selectors = {
4
4
  referenceID: () => cy.get('.edit-item-reference-id'),
5
- itemPreviewPageWrapper: () => cy.get('.item-layout-columns-wrapper-without-scroll'),
6
5
  }
7
6
 
8
7
  const steps = {