itemengine-cypress-automation 1.0.563-IEI-6998-Add-coverage-for-image-hightlight-question-type-238d7b4.0 → 1.0.564-IEI-7011-cf323ce.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.
Files changed (24) hide show
  1. package/cypress/config-files/ilprod.json +2 -1
  2. package/cypress/config-files/ilqa.json +2 -1
  3. package/cypress/config-files/ilstage.json +2 -1
  4. package/cypress/e2e/ILC/ImageHighlight/additionalSettings.js +0 -87
  5. package/cypress/e2e/ILC/ImageHighlight/backgroundImageAndCanvasProperties.js +11 -62
  6. package/cypress/e2e/ILC/ImageHighlight/customiseHighlightStyle.js +12 -14
  7. package/cypress/e2e/ILC/ImageHighlight/imageHighlightStyle.js +3 -12
  8. package/cypress/e2e/ILC/ImageHighlight/minimumScoringPenaltyPointsAndRoundingDropdown.js +3 -66
  9. package/cypress/e2e/ILC/ImageHighlight/studentViewSettings.js +2 -16
  10. package/cypress/e2e/ILC/MultipleSelection/allOrNothingBasicForAllViews.smoke.js +168 -1
  11. package/cypress/e2e/ILC/MultipleSelection/allOrNothingWithAlternativeAnswer.js +86 -0
  12. package/cypress/e2e/ILC/MultipleSelection/partialDifferentWeightsWithAlternativeAnswer.js +91 -0
  13. package/cypress/e2e/ILC/MultipleSelection/partialEqualWeightsWithAlternativeAnswer.js +79 -0
  14. package/cypress/e2e/ILC/SingleSelection/allOrNothingBasicForAllViews.smoke.js +130 -0
  15. package/cypress/e2e/ILC/SingleSelection/allOrNothingWithAlternativeAnswer.js +16 -0
  16. package/cypress/pages/components/index.js +1 -0
  17. package/cypress/pages/components/showAlternativeAnswersComponent.js +169 -0
  18. package/cypress/pages/imageHighlightPage.js +7 -184
  19. package/cypress/pages/itemPreviewPage.js +0 -1
  20. package/cypress/pages/multipleSelectionPage.js +3 -1
  21. package/cypress/pages/singleSelectionPage.js +5 -1
  22. package/cypress/support/helpers/utilities.js +0 -16
  23. package/package.json +1 -1
  24. package/service.yaml +9 -1
@@ -3,6 +3,7 @@ import abortEarlySetup from "../../../support/helpers/abortEarly";
3
3
  import { dialogBoxBase, gradingViewPage, itemPreviewPage, studentViewPage } from "../../../pages";
4
4
  import utilities from "../../../support/helpers/utilities";
5
5
  const grepTags = Cypress.env('grepTags');
6
+ const alternativeAnswerCheck = Cypress.env('ENABLE_ALTERNATIVE_ANSWER_ENHANCEMENT');
6
7
  let correctAnswerViews = ['Question preview', 'Item preview', 'Grading view'];
7
8
  const views = utilities.getViews(correctAnswerViews);
8
9
  var itemReferenceID = "";
@@ -168,6 +169,135 @@ describe('Create Item page - Single Selection: Scoring cases', () => {
168
169
  });
169
170
  });
170
171
 
172
+ views.forEach((view) => {
173
+ describe(`Single selection: all or nothing with alternative answer - ${view}`, { tags: 'smoke' }, () => {
174
+ abortEarlySetup();
175
+ before(() => {
176
+ switch (view) {
177
+ case 'Question preview':
178
+ singleSelectionPage.steps.navigateToCreateQuestion('single selection');
179
+ cy.barsPreLoaderWait();
180
+ singleSelectionPage.steps.addTextInQuestionInstructionsInputField('Which of the following is the major contributor to increased carbon dioxide levels because of urbanization? Select your answer from the options below.');
181
+ singleSelectionPage.steps.allotPoints(20);
182
+ singleSelectionPage.steps.addInputToOptionsInputField(options);
183
+ singleSelectionPage.steps.checkOptionInSpecifyCorrectAnswerSection(1);
184
+ singleSelectionPage.steps.clickOnAddAlternativeAnswerButton();
185
+ singleSelectionPage.steps.allotPoints(10);
186
+ singleSelectionPage.steps.checkOptionInSpecifyCorrectAnswerSection(0);
187
+ singleSelectionPage.steps.switchToPreviewTab();
188
+ break;
189
+ case 'Item preview':
190
+ cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
191
+ itemPreviewPage.steps.switchToPreviewTab();
192
+ break;
193
+ case 'Grading view':
194
+ cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
195
+ break;
196
+ }
197
+ });
198
+
199
+ beforeEach(() => {
200
+ switch (view) {
201
+ case 'Question preview':
202
+ singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
203
+ singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
204
+ singleSelectionPage.steps.resetQuestionPreview();
205
+ break;
206
+ case 'Item preview':
207
+ itemPreviewPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
208
+ singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
209
+ itemPreviewPage.steps.resetQuestionPreview();
210
+ break;
211
+ case 'Grading view':
212
+ cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
213
+ break;
214
+ }
215
+ });
216
+
217
+ if (view === 'Question preview') {
218
+ after(() => {
219
+ singleSelectionPage.steps.clickOnSaveQuestionButton();
220
+ utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
221
+ itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
222
+ });
223
+ };
224
+
225
+ it('When the user selects \'Grading\' view without attempting the question, no icons should be displayed besides responses, correct answer label and border should not be displayed and correct answer should be displayed in correct answer section', () => {
226
+ if (view === 'Grading view') {
227
+ studentViewPage.steps.submitResponse();
228
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
229
+ studentViewPage.steps.clickOnGoToGradingViewButton();
230
+ gradingViewPage.steps.verifyGradingViewScore(0, 20);
231
+ }
232
+ if (view === 'Question preview' || view === 'Item preview') {
233
+ singleSelectionPage.steps.switchToGradingView();
234
+ singleSelectionPage.steps.verifyPreviewScore(0, 20);
235
+ }
236
+ singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(0);
237
+ singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(1);
238
+ singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(2);
239
+ singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(3);
240
+ singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabelNotExist();
241
+ singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
242
+ //correct answer section
243
+ singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(1);
244
+ if (alternativeAnswerCheck === 'true') {
245
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 10);
246
+ }
247
+ });
248
+
249
+ it('When the user attempts the question incorrectly, then the user should be awarded 0 points and on switching to \'Grading\' view, incorrect icons should be displayed besides incorrect responses, no icons should be displayed besides unattempted responses, incorrect answer border and label should not be displayed below the question preview and correct answer should be displayed in correct answer section', () => {
250
+ singleSelectionPage.steps.checkOptionInPreviewTab(2);
251
+ if (view === 'Grading view') {
252
+ studentViewPage.steps.submitResponse();
253
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
254
+ studentViewPage.steps.clickOnGoToGradingViewButton();
255
+ gradingViewPage.steps.verifyGradingViewScore(0, 20);
256
+ }
257
+ if (view === 'Question preview' || view === 'Item preview') {
258
+ singleSelectionPage.steps.switchToGradingView();
259
+ singleSelectionPage.steps.verifyPreviewScore(0, 20);
260
+ }
261
+ singleSelectionPage.steps.verifyIncorrectOptionIconStudentView(2);
262
+ singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(0);
263
+ singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(1);
264
+ singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(3);
265
+ singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
266
+ singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
267
+ //correct answer section
268
+ singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(1);
269
+ if (alternativeAnswerCheck === 'true') {
270
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 10);
271
+ }
272
+ });
273
+
274
+ it(`Single selection ${view} - When user attempts the question correctly, the user should be awarded full points and on switching to 'Grading' view, then correct icons should be displayed beside all the correct responses, correct answer border and a label should not be displayed below the question preview and correct answer section should not be displayed`, () => {
275
+ singleSelectionPage.steps.checkOptionInPreviewTab(1);
276
+ if (view === 'Grading view') {
277
+ studentViewPage.steps.submitResponse();
278
+ utilities.verifyElementVisibilityState(dialogBoxBase.dialogBox(), 'visible');
279
+ studentViewPage.steps.clickOnGoToGradingViewButton();
280
+ gradingViewPage.steps.verifyGradingViewScore(20, 20);
281
+ }
282
+ if (view === 'Question preview' || view === 'Item preview') {
283
+ singleSelectionPage.steps.verifyPreviewScore(20, 20);
284
+ singleSelectionPage.steps.switchToGradingView();
285
+ }
286
+ singleSelectionPage.steps.verifyCorrectOptionIconStudentView(1);
287
+ singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(0);
288
+ singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(2);
289
+ singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(3);
290
+ singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
291
+ singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
292
+ singleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
293
+ if (alternativeAnswerCheck === 'true') {
294
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
295
+ }
296
+ cy.eyesCheckWindow(`Single selection ${view} - Correct attempt`);
297
+ });
298
+ });
299
+ });
300
+
171
301
  views.forEach((view) => {
172
302
  describe(`Single selection - Manually scored: ${view}`, { tags: 'smoke' }, () => {
173
303
  abortEarlySetup();
@@ -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
 
@@ -49,6 +50,9 @@ describe('Create item page - Single selection: All or nothing with alternative a
49
50
  singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('correct');
50
51
  singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
51
52
  singleSelectionPage.steps.verifyCorrectAnswerSectionNotExist();
53
+ if (alternativeAnswerCheck === 'true') {
54
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleNotExists();
55
+ }
52
56
  //singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
53
57
  /*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
58
  singleSelectionPage.steps.checkAnswer();
@@ -96,6 +100,10 @@ describe('Create item page - Single selection: All or nothing with alternative a
96
100
  singleSelectionPage.steps.verifyIncorrectOptionIconStudentView(3);
97
101
  singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
98
102
  singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
103
+ //show alternative answers
104
+ if (alternativeAnswerCheck === 'true') {
105
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 10);
106
+ }
99
107
  //correct answer section
100
108
  singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(1);
101
109
  //singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
@@ -215,6 +223,10 @@ describe('Create item page - Single selection: All or nothing with alternative a
215
223
  singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(3);
216
224
  singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
217
225
  singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
226
+ //show alternative answers
227
+ if (alternativeAnswerCheck === 'true') {
228
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 10);
229
+ }
218
230
  //correct answer section
219
231
  singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(2);
220
232
  singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
@@ -314,6 +326,10 @@ describe('Create item page - Single selection: All or nothing with alternative a
314
326
  singleSelectionPage.steps.verifyCorrectIncorrectIconNotVisibleStudentView(3);
315
327
  singleSelectionPage.steps.verifyCorrectIncorrectAnswerLabel('incorrect');
316
328
  singleSelectionPage.steps.verifyCorrectIncorrectBorderNotExists();
329
+ //show alternative answers
330
+ if (alternativeAnswerCheck === 'true') {
331
+ singleSelectionPage.steps.verifyShowAlternativeAnswersToggleFunctionality(1, 20);
332
+ }
317
333
  //correct answer section
318
334
  singleSelectionPage.steps.verifyCorrectOptionIconCorrectAnswerSection(1);
319
335
  singleSelectionPage.steps.verifyQuestionPreviewStateWhenSwitchingBackToStudentView();
@@ -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,169 @@
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"]').contains('Alternative answer'),
16
+ alternativeAnswerLabelWrapper: () => cy.get('[class*="CorrectAnswerLabelWrapper"]:contains("Alternative answer")'),
17
+ alternativeAnswerGridWrapper: () => cy.get('[class*="CorrectAnswerGridWrapper"]'),
18
+ alternativeAnswerSelectionGrid: () => cy.get('.correct-ans-selection-grid'),
19
+
20
+ steps: {
21
+ /**
22
+ * Verifies that the "Show alternative answers" toggle is present and visible
23
+ */
24
+ verifyShowAlternativeAnswersToggleExists: () => {
25
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
26
+ .should('be.visible');
27
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleLabel()
28
+ .should('contain.text', 'Show alternative answers');
29
+ },
30
+
31
+ /**
32
+ * Verifies that the "Show alternative answers" toggle does not exist
33
+ */
34
+ verifyShowAlternativeAnswersToggleNotExists: () => {
35
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
36
+ .should('not.exist');
37
+ },
38
+
39
+ /**
40
+ * Verifies that the "Show alternative answers" toggle is in the checked (enabled) state
41
+ */
42
+ verifyShowAlternativeAnswersToggleChecked: () => {
43
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
44
+ .should('be.checked')
45
+ .and('have.attr', 'aria-pressed', 'true');
46
+ // Verify the checked state visual indicator (tick icon)
47
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
48
+ .find('.icon-ILC-tick-icon')
49
+ .should('be.visible');
50
+ },
51
+
52
+ /**
53
+ * Verifies that the "Show alternative answers" toggle is in the unchecked (disabled) state
54
+ */
55
+ verifyShowAlternativeAnswersToggleUnchecked: () => {
56
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
57
+ .should('not.be.checked')
58
+ .and('have.attr', 'aria-pressed', 'false');
59
+ // Verify the unchecked state visual indicator (x-circle icon)
60
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleWrapper()
61
+ .find('.icon-x-circle')
62
+ .should('be.visible');
63
+ },
64
+
65
+ /**
66
+ * Clicks the "Show alternative answers" toggle to change its state
67
+ */
68
+ clickShowAlternativeAnswersToggle: () => {
69
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleButton()
70
+ .click();
71
+ },
72
+
73
+ /**
74
+ * Enables the "Show alternative answers" toggle (clicks it if it's currently unchecked)
75
+ */
76
+ enableShowAlternativeAnswersToggle: () => {
77
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
78
+ .then(($input) => {
79
+ if (!$input.prop('checked')) {
80
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
81
+ }
82
+ });
83
+ },
84
+
85
+ /**
86
+ * Disables the "Show alternative answers" toggle (clicks it if it's currently checked)
87
+ */
88
+ disableShowAlternativeAnswersToggle: () => {
89
+ showAlternativeAnswersComponent.showAlternativeAnswersToggleInput()
90
+ .then(($input) => {
91
+ if ($input.prop('checked')) {
92
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
93
+ }
94
+ });
95
+ },
96
+
97
+ /**
98
+ * Verifies that the alternative answers section is visible
99
+ * @param {number} index - The index of the alternative answer (e.g., 1 for "Alternative answer 1")
100
+ * @param {number} points - The expected points for the alternative answer
101
+ */
102
+ verifyAlternativeAnswersSectionVisible: (index, points) => {
103
+ cy.get('[class*="CorrectAnswerLabelWrapper"]')
104
+ .contains(`Alternative answer ${index}`)
105
+ .should('be.visible');
106
+
107
+ if (points) {
108
+ cy.get('[class*="CorrectAnswerLabelWrapper"]')
109
+ .contains(`Alternative answer ${index}`)
110
+ .parent()
111
+ .find('p')
112
+ .should('contain.text', `(${points} points)`);
113
+ }
114
+ },
115
+
116
+ /**
117
+ * Verifies that the alternative answers section does not exist
118
+ */
119
+ verifyAlternativeAnswersSectionNotExist: () => {
120
+ cy.get('[class*="CorrectAnswerLabelWrapper"]')
121
+ .contains('Alternative answer')
122
+ .should('not.exist');
123
+ },
124
+
125
+ /**
126
+ * Verifies the complete alternative answers section including content and grid
127
+ * @param {number} index - The index of the alternative answer (e.g., 1 for "Alternative answer 1")
128
+ * @param {number} points - The expected points for the alternative answer
129
+ */
130
+ verifyAlternativeAnswersSectionComplete: (index = 1, points) => {
131
+ // Verify the alternative answer label is visible
132
+ showAlternativeAnswersComponent.steps.verifyAlternativeAnswersSectionVisible(index, points);
133
+
134
+ // Verify the selection grid is visible
135
+ showAlternativeAnswersComponent.alternativeAnswerSelectionGrid()
136
+ .should('be.visible');
137
+ },
138
+
139
+ /**
140
+ * Comprehensive test that verifies the complete toggle functionality
141
+ * @param {number} index - The index of the alternative answer to verify
142
+ * @param {number} points - The expected points for the alternative answer
143
+ */
144
+ verifyShowAlternativeAnswersToggleFunctionality: (index, points) => {
145
+ // Start with ensuring toggle exists
146
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleExists();
147
+
148
+ // Test unchecked state
149
+ showAlternativeAnswersComponent.steps.disableShowAlternativeAnswersToggle();
150
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
151
+
152
+ // Verify the alternative answers section does not exist
153
+ showAlternativeAnswersComponent.steps.verifyAlternativeAnswersSectionNotExist();
154
+
155
+ // Test checked state
156
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
157
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleChecked();
158
+
159
+ // Verify the alternative answers section is visible
160
+ showAlternativeAnswersComponent.steps.verifyAlternativeAnswersSectionVisible(index, points);
161
+
162
+ // Test toggle back to unchecked
163
+ showAlternativeAnswersComponent.steps.clickShowAlternativeAnswersToggle();
164
+ showAlternativeAnswersComponent.steps.verifyShowAlternativeAnswersToggleUnchecked();
165
+ }
166
+ },
167
+ };
168
+
169
+ 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 = {
@@ -1,6 +1,6 @@
1
1
  import constants from "../fixtures/constants";
2
2
  import utilities from "../support/helpers/utilities"
3
- import { autoScoredScoringSectionMultiResponseType, autoScoredSpecifyCorrectAnswerSection, commonComponents, createQuestionBasePage, optionsWrapperComponent, questionInstructionsComponent, scoringSectionBaseEditTab, autoScoredScoringPreviewTab, autoScoredStudentViewSettings, additionalSettingsPanel, ckEditorToolbar, equationEditorFlyout, mcqAdditionalSettingsBase, randomizeOptionsComponent, lockUnlockOptionComponent, additionalSettingsAccessibilitySectionComponent } from "./components"
3
+ import { autoScoredScoringSectionMultiResponseType, autoScoredSpecifyCorrectAnswerSection, commonComponents, createQuestionBasePage, optionsWrapperComponent, questionInstructionsComponent, scoringSectionBaseEditTab, autoScoredScoringPreviewTab, autoScoredStudentViewSettings, additionalSettingsPanel, ckEditorToolbar, equationEditorFlyout, mcqAdditionalSettingsBase, randomizeOptionsComponent, lockUnlockOptionComponent, additionalSettingsAccessibilitySectionComponent, showAlternativeAnswersComponent } from "./components"
4
4
  import { ckEditorAudioPlayerComponent } from "../pages/components/ckEditorAudioPlayerComponent"
5
5
  import { ckEditorEquationEditorComponent } from "../pages/components/ckEditorEquationEditorComponent"
6
6
  import { ckEditorInsertTableComponent } from "../pages/components/ckEditorInsertTableComponent"
@@ -35,6 +35,7 @@ const selectors = {
35
35
  ...ckEditorLinkComponent,
36
36
  ...createItemPage,
37
37
  ...audioPlayerPage,
38
+ ...showAlternativeAnswersComponent,
38
39
  //Specify correct answer section
39
40
  optionWrapperSpecifyCorrectAnswerSection: () => cy.get('.mcq-option-wrapper'),
40
41
  optionsText: () => cy.get('.mcq-label'),
@@ -111,6 +112,7 @@ const steps = {
111
112
  ...ckEditorAudioPlayerComponent.steps,
112
113
  ...ckEditorEquationEditorComponent.steps,
113
114
  ...ckEditorInsertTableComponent.steps,
115
+ ...showAlternativeAnswersComponent.steps,
114
116
  ...ckEditorInsertImageComponent.steps,
115
117
  ...ckEditorLinkComponent.steps,
116
118
  ...createItemPage.steps,