itemengine-cypress-automation 1.0.585-IEI-7161-main-9d7019b.0 → 1.0.585-IEI-7055-cypress-9249eaa.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,12 +1,9 @@
1
1
  import abortEarlySetup from "../../../support/helpers/abortEarly";
2
- import { uploadResponsePage, itemPreviewPage } from "../../../pages";
2
+ import { uploadResponsePage } from "../../../pages";
3
3
  import utilities from "../../../support/helpers/utilities";
4
4
  const css = Cypress.env('css');
5
- let correctAnswerViews = ['Question preview', 'Item preview', 'Student view'];
6
- const views = utilities.getViews(correctAnswerViews);
7
- let itemReferenceID = "";
8
5
 
9
- const labels = [uploadResponsePage.allowStudentToAddFileDescriptionLabel, uploadResponsePage.allowStudentToEditFileNameLabel, uploadResponsePage.displayPerFileSizeLimitToStudentLabel];
6
+ const labels =[uploadResponsePage.allowStudentToAddFileDescriptionLabel, uploadResponsePage.allowStudentToEditFileNameLabel, uploadResponsePage.displayPerFileSizeLimitToStudentLabel];
10
7
 
11
8
  describe('Create question page - Upload Response: Additional Settings', () => {
12
9
  before(() => {
@@ -46,7 +43,7 @@ describe('Create question page - Upload Response: Additional Settings', () => {
46
43
  uploadResponsePage.steps.uncheckDisplayPerFileSizeLimitToStudentCheckbox();
47
44
  });
48
45
 
49
- it('\'Allow student to edit file name\' label and checkbox should be displayed and by default checkbox should be checked', () => {
46
+ /*it('\'Allow student to edit file name\' label and checkbox should be displayed and by default checkbox should be checked', () => {
50
47
  utilities.verifyInnerText(uploadResponsePage.allowStudentToEditFileNameLabel(), 'Allow student to edit file name');
51
48
  utilities.verifyElementVisibilityState(uploadResponsePage.allowStudentToEditFileNameLabel(), 'visible');
52
49
  utilities.verifyElementVisibilityState(uploadResponsePage.allowStudentToEditFileNameCheckbox(), 'exist');
@@ -90,7 +87,7 @@ describe('Create question page - Upload Response: Additional Settings', () => {
90
87
 
91
88
  it('Accessibility of \'Student view settings\' section', { tags: 'a11y' }, () => {
92
89
  cy.checkAccessibility(uploadResponsePage.uploadControlsLabel().parents('.student-view-settings-container'))
93
- });
90
+ });*/
94
91
  });
95
92
 
96
93
  describe('Upload controls - Preview tab', () => {
@@ -153,7 +150,7 @@ describe('Create question page - Upload Response: Additional Settings', () => {
153
150
  });
154
151
  });
155
152
 
156
- describe('Allow student to edit file name - Preview tab', () => {
153
+ /*describe('Allow student to edit file name - Preview tab', () => {
157
154
  abortEarlySetup();
158
155
  before(() => {
159
156
  uploadResponsePage.steps.navigateToCreateQuestion('upload response');
@@ -173,9 +170,9 @@ describe('Create question page - Upload Response: Additional Settings', () => {
173
170
  uploadResponsePage.steps.uncheckAllowStudentToEditFileNameCheckbox();
174
171
  uploadResponsePage.steps.switchToPreviewTab();
175
172
  uploadResponsePage.steps.uploadFile('uploads/highlightImage.jpg');
176
- utilities.verifyElementVisibilityState(uploadResponsePage.editDisplayTextIcon(), 'notExist');
173
+ utilities.verifyElementVisibilityState(uploadResponsePage.editDisplayTextIcon(), 'hidden');
177
174
  });
178
- });
175
+ });*/
179
176
 
180
177
  describe('Allow student to add file description - Preview tab', () => {
181
178
  abortEarlySetup();
@@ -183,9 +180,9 @@ describe('Create question page - Upload Response: Additional Settings', () => {
183
180
  uploadResponsePage.steps.navigateToCreateQuestion('upload response');
184
181
  cy.barsPreLoaderWait();
185
182
  });
186
-
183
+
187
184
  it('When the \'Allow student to add file description\' checkbox is checked then in the preview tab, then add description icon should be displayed', () => {
188
- uploadResponsePage.steps.verifyAllowStudentToAddFileDescriptionCheckboxChecked();
185
+ uploadResponsePage.steps.verifyAllowStudentToEditFileNameCheckboxChecked();
189
186
  uploadResponsePage.steps.switchToPreviewTab();
190
187
  uploadResponsePage.steps.uploadFile('uploads/highlightImage.jpg');
191
188
  utilities.verifyElementVisibilityState(uploadResponsePage.addFileDescriptionIcon(), 'visible');
@@ -200,174 +197,4 @@ describe('Create question page - Upload Response: Additional Settings', () => {
200
197
  utilities.verifyElementVisibilityState(uploadResponsePage.addFileDescriptionIcon(), 'notExist');
201
198
  });
202
199
  });
203
-
204
- views.forEach((view) => {
205
- describe(`${view}: Student view settings default state`, () => {
206
- abortEarlySetup();
207
- before(() => {
208
- switch (view) {
209
- case 'Question preview':
210
- uploadResponsePage.steps.navigateToCreateQuestion('upload response');
211
- cy.barsPreLoaderWait();
212
- uploadResponsePage.steps.addTextInQuestionInstructionsInputField('upload response instructions.');
213
- uploadResponsePage.steps.verifyAllowStudentToEditFileNameCheckboxChecked();
214
- uploadResponsePage.steps.verifyAllowStudentToAddFileDescriptionCheckboxChecked();
215
- uploadResponsePage.steps.verifyDisplayPerFileSizeLimitToStudentCheckboxChecked();
216
- uploadResponsePage.steps.switchToPreviewTab();
217
- break;
218
- case 'Item preview':
219
- cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
220
- itemPreviewPage.steps.switchToPreviewTab();
221
- break;
222
- case 'Student view':
223
- cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
224
- break;
225
- };
226
- });
227
-
228
- beforeEach(() => {
229
- switch (view) {
230
- case 'Question preview':
231
- break;
232
- case 'Item preview':
233
- break;
234
- case 'Student view':
235
- break;
236
- }
237
- });
238
-
239
- if (view === 'Question preview') {
240
- after(() => {
241
- uploadResponsePage.steps.clickOnSaveQuestionButton();
242
- utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
243
- itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
244
- });
245
- };
246
-
247
- it(`When the 'Allow student to edit file name' checkbox ,then edit icon should be displayed in the ${view}`, () => {
248
- uploadResponsePage.steps.uploadFile('uploads/highlightImage.jpg');
249
- utilities.verifyElementVisibilityState(utilities.getNthElement(uploadResponsePage.editDisplayTextIcon(), 0), 'visible');
250
- });
251
-
252
- it(`When the 'Allow student to add file description' checkbox is checked, then add description icon should be displayed in the ${view}`, () => {
253
- uploadResponsePage.steps.uploadFile('uploads/highlightImage.jpg');
254
- utilities.verifyElementVisibilityState(uploadResponsePage.addFileDescriptionIcon(), 'visible');
255
- });
256
-
257
- it(`When the 'Display per file size limit to student' checkbox is checked then, then 'Maximum file size: #MB' should be displayed in the ${view}`, () => {
258
- utilities.verifyElementVisibilityState(uploadResponsePage.maximumFileSize(), 'visible');
259
- uploadResponsePage.steps.verifyMaximumFileSizePreviewTab('20MB');
260
- });
261
-
262
- it('When the \'Capture photos\' option is selected then in the preview tab, the upload response area text should have \'Capture an image\' option', () => {
263
- uploadResponsePage.steps.verifyUploadOptionVisibleInUploadResponseArea('Capture photo');
264
- });
265
-
266
- it('When the \'Drag and drop files\' option is selected then in the preview tab, the upload response area text should be \'Drag and drop files here\'', () => {
267
- utilities.verifyElementVisibilityState(uploadResponsePage.uploadCloudIcon(), 'visible');
268
- utilities.verifyInnerText(uploadResponsePage.dragAndDropFilesText(), 'Drag & Drop files here');
269
- });
270
-
271
- it('When the user clicks on the link text \'capture an image\' a \'Capture image\' popup should open', () => {
272
- uploadResponsePage.steps.captureImage();
273
- utilities.verifyElementVisibilityState(uploadResponsePage.dialogBox(), 'visible');
274
- });
275
-
276
- it('On \'Capture image\' popup following should be displayed - \'Capture image\' title text, Camera preview, Capture and Cancel buttons', () => {
277
- uploadResponsePage.steps.verifyCaptureImagePopup();
278
- utilities.verifyElementVisibilityState(uploadResponsePage.acceptButton(), 'visible');
279
- utilities.verifyElementVisibilityState(uploadResponsePage.cancelButton(), 'visible');
280
- utilities.verifyInnerText(uploadResponsePage.cancelButton(), 'Cancel');
281
- utilities.verifyInnerText(uploadResponsePage.acceptButton(), 'Capture');
282
- });
283
-
284
- it('When the user clicks on \'Cancel\' button the \'Capture image\' popup should close', () => {
285
- uploadResponsePage.steps.clickCancelButtonInPopup();
286
- utilities.verifyElementVisibilityState(uploadResponsePage.dialogBox(), 'notExist');
287
- });
288
-
289
- it('When the user clicks on \'Capture\' button, then an image should get captured and a preview of the captured image should be displayed in place of the camera preview and also two buttons \'Retake\' and \'Save\' should be displayed in the popup and \'Cancel\' and \'Capture\' buttons should not be displayed in the popup', () => {
290
- uploadResponsePage.steps.captureImage();
291
- uploadResponsePage.steps.clickAcceptButtonInPopup();
292
- utilities.verifyInnerText(uploadResponsePage.cancelButton(), 'Retake');
293
- utilities.verifyInnerText(uploadResponsePage.acceptButton(), 'Save');
294
- });
295
-
296
- it('When the user clicks on \'Save\' button, it should upload the captured image in the response', () => {
297
- uploadResponsePage.steps.clickAcceptButtonInPopup();
298
- utilities.verifyElementVisibilityState(uploadResponsePage.uploadingProgressBar(), 'notExist');
299
- });
300
- });
301
- });
302
-
303
- views.forEach((view) => {
304
- describe.only(`${view}: Student view settings modified state`, () => {
305
- abortEarlySetup();
306
- before(() => {
307
- switch (view) {
308
- case 'Question preview':
309
- uploadResponsePage.steps.navigateToCreateQuestion('upload response');
310
- cy.barsPreLoaderWait();
311
- uploadResponsePage.steps.addTextInQuestionInstructionsInputField('upload response instructions.');
312
- uploadResponsePage.steps.uncheckAllowStudentToEditFileNameCheckbox();
313
- uploadResponsePage.steps.uncheckAllowStudentToAddFileDescriptionCheckbox();
314
- uploadResponsePage.steps.uncheckDisplayPerFileSizeLimitToStudentCheckbox();
315
- uploadResponsePage.steps.unselectUploadControlsOption(0);
316
- uploadResponsePage.steps.unselectUploadControlsOption(1);
317
- uploadResponsePage.steps.switchToPreviewTab();
318
- break;
319
- case 'Item preview':
320
- cy.visit(`/item-engine/demo/edit-item/${utilities.base64Encoding(itemReferenceID)}`);
321
- itemPreviewPage.steps.switchToPreviewTab();
322
- break;
323
- case 'Student view':
324
- cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
325
- break;
326
- };
327
- });
328
-
329
- beforeEach(() => {
330
- switch (view) {
331
- case 'Question preview':
332
- break;
333
- case 'Item preview':
334
- break;
335
- case 'Student view':
336
- cy.visit(`/item-engine/demo/render-item/student-view/${utilities.base64Encoding(itemReferenceID)}`);
337
- break;
338
- }
339
- });
340
-
341
- if (view === 'Question preview') {
342
- after(() => {
343
- uploadResponsePage.steps.clickOnSaveQuestionButton();
344
- utilities.verifyElementVisibilityState(itemPreviewPage.referenceID(), 'visible');
345
- itemReferenceID = itemPreviewPage.steps.getItemReferenceID();
346
- });
347
- };
348
-
349
- it(`When the user unchecks \'Allow student to edit file name\' checkbox, then edit icon should be not be displayed in the ${view}`, () => {
350
- uploadResponsePage.steps.uploadFile('uploads/highlightImage.jpg');
351
- utilities.verifyElementVisibilityState(uploadResponsePage.editDisplayTextIcon(), 'notExist');
352
- });
353
-
354
- it(`When the user unchecks 'Allow student to add file description' checkbox, then in the Preview tab add description icon should be not be displayed in the ${view}`, () => {
355
- uploadResponsePage.steps.uploadFile('uploads/highlightImage.jpg');
356
- utilities.verifyElementVisibilityState(uploadResponsePage.addFileDescriptionIcon(), 'notExist');
357
- });
358
-
359
- it(`When the user unchecks 'Display per file size limit to student' checkbox, then in the Preview tab Maximum file size: #MB should not be displayed in the ${view}`, () => {
360
- utilities.verifyElementVisibilityState(uploadResponsePage.maximumFileSize(), 'notExist');
361
- });
362
-
363
- it(`When the user unselects the 'Capture photos' option, then the upload response area text should not have 'capture an image' option in the ${view}`, () => {
364
- uploadResponsePage.steps.verifyUploadOptionNotVisibleInUploadResponseArea('Capture photo');
365
- });
366
-
367
- it(`When the user unselects the 'Drag and drop files' option, then the upload response area text should be 'Upload file here' in the ${view}`, () => {
368
- utilities.verifyElementVisibilityState(uploadResponsePage.uploadCloudIcon(), 'visible');
369
- utilities.verifyInnerText(uploadResponsePage.dragAndDropFilesText(), 'Upload file here');
370
- });
371
- });
372
- });
373
200
  });
@@ -22,7 +22,7 @@ describe('Create question page - Upload Response: Preview', () => {
22
22
  });
23
23
 
24
24
  it('CSS of uploaded file wrapper contents', { tags: 'css' }, () => {
25
- utilities.verifyCSS(uploadResponsePage.uploadedFileDownloadLinkText(), {
25
+ utilities.verifyCSS(uploadResponsePage.uploadedFileLink().children(), {
26
26
  'color': css.color.linkText,
27
27
  'font-size': css.fontSize.default,
28
28
  'font-weight': css.fontWeight.regular
@@ -105,7 +105,7 @@ describe('Create question page - Upload Response: Preview', () => {
105
105
 
106
106
  it('On clicking on the file name, user should be able to download the file', () => {
107
107
  uploadResponsePage.steps.uploadFile('uploads/image.png');
108
- uploadResponsePage.steps.verifyDownloadedFilename('image.png', 0);
108
+ cy.verifyUploadFilePreviewDownload('image.png');
109
109
  cy.wait(5000);
110
110
  });
111
111
  });
@@ -131,10 +131,6 @@ describe('Create question page - Upload Response: Preview', () => {
131
131
 
132
132
  it('On \'Capture image\' popup following should be displayed - \'Capture image\' title text, Camera preview, Capture and Cancel buttons', () => {
133
133
  uploadResponsePage.steps.verifyCaptureImagePopup();
134
- utilities.verifyElementVisibilityState(uploadResponsePage.acceptButton(), 'visible');
135
- utilities.verifyElementVisibilityState(uploadResponsePage.cancelButton(), 'visible');
136
- utilities.verifyInnerText(uploadResponsePage.cancelButton(), 'Cancel');
137
- utilities.verifyInnerText(uploadResponsePage.acceptButton(), 'Capture');
138
134
  });
139
135
 
140
136
  it('CSS of \'Capture image\' popup', { tags: 'css' }, () => {
@@ -67,10 +67,9 @@ describe('Create question page - Upload Response: Preview', () => {
67
67
  utilities.verifyInnerText(commonComponents.tooltipText(), 'Add file description');
68
68
  });
69
69
 
70
- it('When the user clicks on the \'Add file description\' icon button, an input area should be displayed along with a label text: \'Add file description\'', () => {
70
+ it('When the user clicks on the \'Add file description\' icon button, an input area should be displayed along with a placeholder text: \'Add file description\'', () => {
71
71
  uploadResponsePage.steps.clickOnAddFileDescriptionIcon();
72
- utilities.verifyInnerText(uploadResponsePage.addFileDescriptionLabel(), 'Add file description');
73
- utilities.verifyElementVisibilityState(uploadResponsePage.addFileDescriptionInput(), 'visible');
72
+ uploadResponsePage.steps.verifyAddFileDescriptionInputFieldPlaceholderText();
74
73
  });
75
74
 
76
75
  it('CSS of \'Add file description\' input field', { tags: 'css' }, () => {
@@ -82,7 +81,7 @@ describe('Create question page - Upload Response: Preview', () => {
82
81
  });
83
82
 
84
83
  it('Accessibility of \'Add file description\' input field', { tags: 'a11y' }, () => {
85
- cy.checkAccessibility(uploadResponsePage.addFileDescriptionInput());
84
+ cy.checkAccessibility(uploadResponsePage.addFileDescriptionInput().parents('.placeholder'));
86
85
  });
87
86
 
88
87
  it('User should be able to add description text for uploaded file', () => {
@@ -245,7 +244,7 @@ describe('Create question page - Upload Response: Preview', () => {
245
244
  });
246
245
 
247
246
  it('If the user tries to download file after renaming, the file should get downloaded with the original name', () => {
248
- uploadResponsePage.steps.verifyDownloadedFilename('imageEdited.png', 0);
247
+ cy.verifyUploadFilePreviewDownload('image.png');
249
248
  });
250
249
  });
251
250
  });
@@ -40,7 +40,7 @@ const selectors = {
40
40
  correctIncorrectStatusMessageText: () => cy.get('[class*="NumberLinestyles__CorrectIncorrectWrapper"]'),
41
41
 
42
42
  //Correct answer section
43
- numberLineCorrectAnswerSection: () => cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox svg').eq(2),
43
+ numberLineCorrectAnswerSection: (isAlternativeAnswerSVG = false) => cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox svg').eq(isAlternativeAnswerSVG ? 3 : 2),
44
44
  numberLinePointCorrectAnswerSection: () => cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').last().find('svg ellipse[display="inline"]')
45
45
  }
46
46
 
@@ -440,7 +440,7 @@ const steps = {
440
440
  clickAndDropLabelOnNumberLinePreviewTab: (label, orientation, range, coordinate) => {
441
441
  numberLineLabelPage.draggableLabelsPreviewTab()
442
442
  .contains(label)
443
- .click();
443
+ .click({ force: true });
444
444
  numberLineLabelPage.numberLinePreviewTab()
445
445
  .then(($graphElement) => {
446
446
  if (orientation === 'horizontal') {
@@ -462,7 +462,7 @@ const steps = {
462
462
  const originY = graphHeight / 2;
463
463
  const yPixel = originY - coordinate * (graphHeight / range);
464
464
  numberLineLabelPage.numberLinePreviewTab()
465
- .click(originX, yPixel, { force: true });
465
+ .dblclick(originX, yPixel, { force: true });
466
466
  });
467
467
  }
468
468
  });
@@ -612,16 +612,17 @@ const steps = {
612
612
  * @param {Object[]} coordinates - An array containing x and y coordinates along with their ranges
613
613
  * @param {number} range - range of x coordinate
614
614
  */
615
- verifyCorrectResponseOnNumberLineCorrectAnswerSection: (label, range, coordinate) => {
615
+ verifyCorrectResponseOnNumberLineCorrectAnswerSection: (label, range, coordinate, isAlternativeAnswer) => {
616
+ let index = isAlternativeAnswer ? 2 : 1;
616
617
  numberLineLabelPage.numberLineCorrectAnswerSection()
617
618
  .then(($graphElement) => {
618
619
  let graphWidth = $graphElement[0].clientWidth;
619
620
  const originX = graphWidth / 2 + tolerance / 2;
620
621
  const xPixel = originX + coordinate * ((graphWidth - tolerance) / range);
621
- cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(1).find(`svg ellipse[cx*="${Math.floor(xPixel)}"][display="inline"]:visible`)
622
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(index).find(`svg ellipse[cx*="${Math.floor(xPixel)}"][display="inline"]:visible`)
622
623
  .should('have.css', 'fill', css.color.correctAnswer);
623
624
  });
624
- numberLineLabelPage.numberLineCorrectAnswerSection()
625
+ numberLineLabelPage.numberLineCorrectAnswerSection(isAlternativeAnswer)
625
626
  .parents('.ngie-jxgbox')
626
627
  .within(() => {
627
628
  numberLineLabelPage.draggableLabelsSpecifyCorrectAnswer()
@@ -607,7 +607,8 @@ const steps = {
607
607
  * @param {number} coordinates[].x - x coordinate to be plotted on the graph
608
608
  * @param {number} coordinates[].xRange - range of x coordinate
609
609
  */
610
- verifyCorrectPointsOnNumberLineCorrectAnswerSection: (range, coordinates) => {
610
+ verifyCorrectPointsOnNumberLineCorrectAnswerSection: (range, coordinates, isAlternativeAnswer = false) => {
611
+ let index = isAlternativeAnswer ? 2 : 1;
611
612
  coordinates.forEach(x => {
612
613
  numberLinePage.numberLineCorrectAnswerSection()
613
614
  .then(($graphElement) => {
@@ -616,7 +617,7 @@ const steps = {
616
617
  const originX = graphWidth / 2 + tolerance / 2;
617
618
  const originY = graphHeight / 2;
618
619
  const xPixel = originX + x * ((graphWidth - tolerance) / range);
619
- cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(1).find(`svg ellipse[cx*="${Math.floor(xPixel)}"][cy*="${Math.floor(originY)}"][display="inline"]`)
620
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(index).find(`svg ellipse[cx*="${Math.floor(xPixel)}"][cy*="${Math.floor(originY)}"][display="inline"]`)
620
621
  .should('have.css', 'stroke', css.color.correctAnswer);
621
622
  });
622
623
  });
@@ -670,7 +671,8 @@ const steps = {
670
671
  * @param {number} range - The uniform range of coordinates.
671
672
  * @param {Object[]} coordinates - An array of objects, each with x1 and x2 properties representing the points of each line segment.
672
673
  */
673
- verifyCorrectLineSegmentOnNumberLineCorrectAnswerSection: (range, coordinates) => {
674
+ verifyCorrectLineSegmentOnNumberLineCorrectAnswerSection: (range, coordinates, isAlternativeAnswer = false) => {
675
+ let index = isAlternativeAnswer ? 2 : 1;
674
676
  coordinates.forEach(({ x1, x2 }) => {
675
677
  numberLinePage.numberLineCorrectAnswerSection()
676
678
  .then(($graphElement) => {
@@ -680,7 +682,7 @@ const steps = {
680
682
  const originY = graphHeight / 2;
681
683
  const x1Pixel = originX + x1 * ((graphWidth - tolerance) / range);
682
684
  const x2Pixel = originX + x2 * ((graphWidth - tolerance) / range);
683
- cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(1).find(`[stroke-linecap="butt"][x1*="${Math.floor(x1Pixel)}"][y1*="${Math.floor(originY)}"][x2*="${Math.floor(x2Pixel)}"][y2*="${Math.floor(originY)}"]`)
685
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(index).find(`[stroke-linecap="butt"][x1*="${Math.floor(x1Pixel)}"][y1*="${Math.floor(originY)}"][x2*="${Math.floor(x2Pixel)}"][y2*="${Math.floor(originY)}"]`)
684
686
  .should('have.css', 'stroke', css.color.correctAnswer);
685
687
  });
686
688
  });
@@ -692,7 +694,8 @@ const steps = {
692
694
  * @param {number} range - The range of the number line.
693
695
  * @param {number} startingPoint - It representing the starting point of the ray.
694
696
  */
695
- verifyCorrectRayOnNumberLineCorrectAnswerSection: (direction, range, startingPoint) => {
697
+ verifyCorrectRayOnNumberLineCorrectAnswerSection: (direction, range, startingPoint, isAlternativeAnswer = false) => {
698
+ let index = isAlternativeAnswer ? 2 : 1;
696
699
  numberLinePage.numberLineCorrectAnswerSection()
697
700
  .then(($graphElement) => {
698
701
  const graphWidth = $graphElement[0].clientWidth;
@@ -702,7 +705,7 @@ const steps = {
702
705
  const x1Pixel = originX + startingPoint * ((graphWidth - tolerance) / range);
703
706
  const rayArrowWidth = 18;
704
707
  const x2Pixel = direction === "left" ? rayArrowWidth : graphWidth - rayArrowWidth;
705
- cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(1).find(`[stroke-linecap="butt"][x1*="${Math.floor(x1Pixel)}"][y1*="${Math.floor(originY)}"][x2*="${Math.floor(x2Pixel)}"][y2*="${Math.floor(originY)}"]`)
708
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(index).find(`[stroke-linecap="butt"][x1*="${Math.floor(x1Pixel)}"][y1*="${Math.floor(originY)}"][x2*="${Math.floor(x2Pixel)}"][y2*="${Math.floor(originY)}"]`)
706
709
  .should('have.css', 'stroke', css.color.correctAnswer);
707
710
  });
708
711
  },
@@ -949,7 +952,8 @@ const steps = {
949
952
  * @param {number} range - The range of the number line.
950
953
  * @param {number[]} coordinates - The y-coordinates of the points.
951
954
  */
952
- verifyCorrectPointsOnVerticalNumberLineCorrectAnswerSection: (range, coordinates) => {
955
+ verifyCorrectPointsOnVerticalNumberLineCorrectAnswerSection: (range, coordinates, isAlternativeAnswer = false) => {
956
+ let index = isAlternativeAnswer ? 2 : 1;
953
957
  coordinates.forEach(y => {
954
958
  numberLinePage.numberLineCorrectAnswerSection()
955
959
  .then(($graphElement) => {
@@ -958,7 +962,7 @@ const steps = {
958
962
  const originX = graphWidth / 2;
959
963
  const originY = graphHeight / 2 - tolerance / 2;
960
964
  const yPixel = originY - y * ((graphHeight - tolerance) / range);
961
- cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(1).find(`svg ellipse[cx*="${Math.floor(originX)}"][cy*="${Math.floor(yPixel)}"][display="inline"]`)
965
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(index).find(`svg ellipse[cx*="${Math.floor(originX)}"][cy*="${Math.floor(yPixel)}"][display="inline"]`)
962
966
  .should('have.css', 'stroke', css.color.correctAnswer);
963
967
  });
964
968
  });
@@ -1109,7 +1113,8 @@ const steps = {
1109
1113
  * @param {number} coordinates[].y1 - The y-coordinate of the starting point.
1110
1114
  * @param {number} coordinates[].y2 - The y-coordinate of the ending point.
1111
1115
  */
1112
- verifyCorrectLineSegmentOnVerticalNumberLineCorrectAnswerSection: (range, coordinates) => {
1116
+ verifyCorrectLineSegmentOnVerticalNumberLineCorrectAnswerSection: (range, coordinates, isAlternativeAnswer = false) => {
1117
+ let index = isAlternativeAnswer ? 2 : 1;
1113
1118
  coordinates.forEach(({ y1, y2 }) => {
1114
1119
  numberLinePage.numberLineCorrectAnswerSection()
1115
1120
  .then(($graphElement) => {
@@ -1119,7 +1124,7 @@ const steps = {
1119
1124
  const originY = graphHeight / 2 - tolerance / 2;
1120
1125
  const y1Pixel = originY - y1 * ((graphHeight - tolerance) / range);
1121
1126
  const y2Pixel = originY - y2 * ((graphHeight - tolerance) / range);
1122
- cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(1).find(`[stroke-linecap="butt"][x1*="${Math.floor(originX)}"][y1*="${Math.floor(y1Pixel)}"][x2*="${Math.floor(originX)}"][y2*="${Math.floor(y2Pixel)}"]`)
1127
+ cy.get('[class*="question-preview-wrapper"] .ngie-jxgbox').eq(index).find(`[stroke-linecap="butt"][x1*="${Math.floor(originX)}"][y1*="${Math.floor(y1Pixel)}"][x2*="${Math.floor(originX)}"][y2*="${Math.floor(y2Pixel)}"]`)
1123
1128
  .should('have.css', 'stroke', css.color.correctAnswer);
1124
1129
  });
1125
1130
  });